:root {
  --bg-deep: #050507;
  --bg-panel: #0c0c10;
  --bg-elevated: #121218;
  --chrome: #c0c8d4;
  --chrome-dim: #6b7280;
  --ice: #7dd3fc;
  --ice-glow: rgba(125, 211, 252, 0.25);
  --text: #e5e7eb;
  --text-dim: #9ca3af;
  --border: rgba(192, 200, 212, 0.15);
  --danger: #f87171;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Rajdhani', sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(125, 211, 252, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(125, 211, 252, 0.02) 0%, transparent 50%);
}

.hidden {
  display: none !important;
}

.screen {
  width: 100%;
  height: 100%;
}

/* ========== LOGIN ========== */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: 
    linear-gradient(135deg, #050507 0%, #0a0a12 50%, #050507 100%);
}

.login-panel {
  width: 420px;
  padding: 48px 40px;
  background: linear-gradient(180deg, rgba(18, 18, 24, 0.95) 0%, rgba(12, 12, 16, 0.98) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 
    0 0 0 1px rgba(192, 200, 212, 0.05),
    0 25px 50px -12px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  position: relative;
}

.login-panel::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 17px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(192, 200, 212, 0.3), transparent 40%, transparent 60%, rgba(125, 211, 252, 0.2));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.logo-area {
  text-align: center;
  margin-bottom: 40px;
}

.logo-icon {
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--ice);
  text-shadow: 0 0 20px var(--ice-glow);
  margin-bottom: 12px;
}

.logo-area h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 4px;
  color: var(--text);
}

.subtitle {
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--chrome-dim);
  margin-top: 8px;
}

.form-group {
  margin-bottom: 22px;
}

.form-group label {
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--chrome-dim);
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 15px 18px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 17px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  border-color: var(--ice);
  box-shadow: 0 0 0 3px var(--ice-glow);
}

.btn-primary {
  width: 100%;
  padding: 16px;
  margin-top: 10px;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
  border: none;
  border-radius: 8px;
  color: #0a0a0b;
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px -5px rgba(14, 165, 233, 0.5);
}

.login-footer {
  margin-top: 32px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--chrome-dim);
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* ========== APP LAYOUT ========== */
#app-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-small {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--ice);
  letter-spacing: 2px;
}

.app-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.model-selector select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 6px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  outline: none;
  cursor: pointer;
  min-width: 220px;
}

.model-selector select:focus {
  border-color: var(--ice);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: 6px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ghost:hover {
  border-color: var(--ice);
  color: var(--ice);
}

.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: 280px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 12px;
}

.sidebar-header h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--chrome-dim);
}

.btn-icon {
  width: 28px;
  height: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ice);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: rgba(125, 211, 252, 0.1);
  border-color: var(--ice);
}

.projects-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
}

.project-item {
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.project-item:hover {
  background: var(--bg-elevated);
}

.project-item.active {
  background: rgba(125, 211, 252, 0.08);
  border-color: rgba(125, 211, 252, 0.25);
}

.project-item .name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.project-item .meta {
  font-size: 15px;
  color: var(--text-dim);
  margin-top: 3px;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--chrome-dim);
}

.status-dot {
  width: 7px;
  height: 7px;
  background: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 8px #34d399;
}

/* CHAT AREA */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.chat-header h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 17px;
  letter-spacing: 1px;
  color: var(--text);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome-message {
  text-align: center;
  margin-top: 80px;
  color: var(--text-dim);
}

.welcome-message h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  letter-spacing: 2px;
  margin-bottom: 10px;
  color: var(--chrome);
}

.message {
  max-width: 860px;
  padding: 18px 22px;
  border-radius: 12px;
  line-height: 1.65;
  font-size: 20px;
}

.message.user {
  align-self: flex-end;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.25);
}

.message.assistant {
  align-self: flex-start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.message .role {
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--chrome-dim);
  margin-bottom: 8px;
  font-family: 'Orbitron', sans-serif;
}

.input-area {
  padding: 16px 24px 24px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.btn-attach {
  width: 48px;
  height: 48px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--ice);
  font-size: 26px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-attach:hover {
  border-color: var(--ice);
  background: rgba(125, 211, 252, 0.1);
}

.image-preview {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.btn-remove-img {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  background: rgba(0,0,0,0.75);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#user-input {
  flex: 1;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 19px;
  resize: none;
  outline: none;
  max-height: 200px;
  transition: border-color 0.2s;
}

#user-input:focus {
  border-color: var(--ice);
}

.btn-send {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  border: none;
  border-radius: 12px;
  color: #0a0a0b;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-send:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(14, 165, 233, 0.5);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(192, 200, 212, 0.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(192, 200, 212, 0.35);
}
