/* ═══════════════════════════════════════════════════════════════════════
   Flexzo Medical CV Manager – Complete Stylesheet
   Modern dark dashboard theme with sidebar navigation
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --bg-base:     #06090f;
  --bg-surface:  #0c1220;
  --bg-elevated: #131c2e;
  --bg-card:     #172033;
  --bg-hover:    #1c2840;
  --bg-input:    #0f1829;
  --border:      #1e2d45;
  --border-focus:#3b82f6;
  --text-primary:#edf2fc;
  --text-secondary:#8b9dc3;
  --text-muted:  #5a6f8f;
  --accent:      #3b82f6;
  --accent-hover:#2563eb;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --success:     #10b981;
  --success-glow:rgba(16, 185, 129, 0.15);
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --purple:      #8b5cf6;
  --sidebar-w:   240px;
  --topbar-h:    56px;
  --font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius:      12px;
  --radius-sm:   8px;
  --radius-xs:   6px;
  --shadow:      0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg:   0 12px 48px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════════════════════ */

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  z-index: 10000;
}

.login-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
}
.glow-1 { width: 500px; height: 500px; background: var(--accent); top: -10%; left: -10%; }
.glow-2 { width: 400px; height: 400px; background: var(--purple); bottom: -10%; right: -10%; }
.glow-3 { width: 300px; height: 300px; background: var(--success); top: 50%; left: 50%; transform: translate(-50%,-50%); opacity: 0.15; }

.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 48px 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.5s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 16px;
  color: white;
  margin-bottom: 16px;
}

.login-logo h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-wrapper svg { color: var(--text-muted); flex-shrink: 0; }

.input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
}

.input-wrapper input::placeholder { color: var(--text-muted); }

.login-error {
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-xs);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}

.login-footer {
  text-align: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.login-footer p {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════════════════════
   APP SHELL — Sidebar + Main Content
   ═══════════════════════════════════════════════════════════════════════ */

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  z-index: 100;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.3px;
}

.sidebar-logo svg {
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

.nav-item.active svg { color: var(--accent); }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: white;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-muted); }

.nav-logout {
  color: var(--text-muted) !important;
}
.nav-logout:hover {
  background: rgba(239, 68, 68, 0.1) !important;
  color: var(--danger) !important;
}

/* ─── Main Content ─── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ─── Top Bar ─── */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-icon-sm {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--success-glow);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s ease infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── Pages ─── */
.page {
  display: none;
  flex: 1;
  overflow: hidden;
}
.page.active { display: flex; flex-direction: column; flex: 1; }

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════════════════════════ */

.welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px;
  background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(59,130,246,0.08) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 28px;
  overflow: hidden;
}

.welcome-text h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}

.welcome-text h2 span { color: var(--accent); }

.welcome-text p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 500px;
}

.welcome-art { flex-shrink: 0; }

/* ─── Action Cards ─── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.action-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.action-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.action-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.format-icon { background: rgba(59, 130, 246, 0.12); color: var(--accent); }
.screen-icon { background: rgba(139, 92, 246, 0.12); color: var(--purple); }
.chat-icon   { background: rgba(16, 185, 129, 0.12); color: var(--success); }

.action-body { flex: 1; }
.action-body h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.action-body p  { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

.action-arrow {
  color: var(--text-muted);
  transition: transform 0.2s;
}
.action-card:hover .action-arrow { transform: translateX(4px); color: var(--accent); }

/* ─── Stats Row ─── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  padding: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.stat-value.status-live { color: var(--success); }

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════════════════════════════════════
   FORMAT CV PAGE
   ═══════════════════════════════════════════════════════════════════════ */

.format-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  min-height: 0;
}

.format-upload-panel, .format-result-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-card {
  padding: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.panel-card-title svg { color: var(--text-muted); }

.optional-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ─── Drop Zone ─── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-input);
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.drop-zone-content { color: var(--text-secondary); }
.drop-zone-icon { margin-bottom: 12px; opacity: 0.4; }
.drop-zone-content p { font-size: 14px; font-weight: 500; margin-bottom: 4px; }

.file-label {
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
}

.drop-hint { font-size: 13px; color: var(--text-secondary); }
.drop-formats { display: block; font-size: 11px; color: var(--text-muted); margin-top: 6px; }

.file-info {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.file-info .file-name {
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Format Result Panel ─── */
.format-result-wrapper {
  height: 100%;
  min-height: 400px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.format-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

.format-placeholder h3 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 16px;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.format-placeholder p {
  font-size: 13px;
}

.format-output {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.format-output-header { margin-bottom: -4px; }

.format-success-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--success-glow);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--success);
}

/* ─── Result Card ─── */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
}

.result-name {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 2px;
}

.result-title {
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
}

.result-reg {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: 'SF Mono', 'Fira Code', monospace;
  margin-bottom: 4px;
}

.result-specialty {
  font-size: 12px;
  color: var(--warning);
  font-weight: 600;
  margin-bottom: 12px;
}

.result-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.result-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-xs);
  min-width: 60px;
}

.stat-num { font-size: 20px; font-weight: 800; color: var(--accent); }
.stat-lbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.result-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── Download Section ─── */
.download-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.download-buttons {
  display: flex;
  gap: 12px;
}

.download-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.download-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.download-pdf:hover { border-color: var(--danger); background: rgba(239, 68, 68, 0.06); }
.download-docx:hover { border-color: var(--accent); background: var(--accent-glow); }

.download-btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pdf-icon  { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.docx-icon { background: rgba(59, 130, 246, 0.12); color: var(--accent); }

.download-btn-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1px;
}

.download-btn-text span {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Format Mode Toggle ─── */
.format-mode-toggle {
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.mode-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.mode-switch-group {
  display: flex;
  gap: 6px;
  background: var(--bg-card);
  border-radius: var(--radius-xs);
  padding: 3px;
}

.mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.mode-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.mode-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.mode-btn.active svg { stroke: #fff; }

.format-error-msg {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  color: var(--danger);
}
.format-error-msg strong { display: block; margin-bottom: 4px; }
.format-error-msg p { font-size: 13px; color: var(--text-secondary); margin: 0; }

/* ═══════════════════════════════════════════════════════════════════════
   SCREEN CV PAGE
   ═══════════════════════════════════════════════════════════════════════ */

.screen-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 24px;
  height: calc(100vh - var(--topbar-h) - 120px);
}

.screen-upload-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.screen-chat-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.chat-panel-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════════
   CHAT (shared between screen results + full chat page)
   ═══════════════════════════════════════════════════════════════════════ */

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.chat-header-actions { display: flex; gap: 8px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 90%;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-user { align-self: flex-end; flex-direction: row-reverse; }

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: var(--bg-card);
  color: var(--accent);
}

.message-user .message-avatar { background: var(--accent); color: white; }

.message-content {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-primary);
}

.message-assistant .message-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.message-user .message-content { background: var(--accent); color: white; }

.message-content p { margin-bottom: 8px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content ul { margin: 8px 0; padding-left: 20px; }
.message-content li { margin-bottom: 4px; }
.message-content strong { font-weight: 700; }
.message-content code { background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

.verdict-suitable { color: var(--success); font-weight: 700; }
.verdict-clarification { color: var(--warning); font-weight: 700; }
.verdict-unsuitable { color: var(--danger); font-weight: 700; }

/* ─── Chat Input ─── */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  resize: none;
  outline: none;
  max-height: 120px;
  transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--text-muted); }

/* ─── Full Chat Page ─── */
.page-chat-content {
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}

.chat-full-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ═══════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  outline: none;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 4px 16px rgba(59,130,246,0.3); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-full { width: 100%; }

.btn-send {
  padding: 10px 14px;
  border-radius: 10px;
  min-width: 40px;
}

.btn-mic {
  padding: 10px 14px;
  border-radius: 10px;
  min-width: 40px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
}
.btn-mic:hover { background: var(--bg-hover); color: var(--danger); border-color: var(--danger); }
.btn-mic.recording { background: var(--danger); color: white; border-color: var(--danger); animation: pulse-mic 1.5s ease infinite; }

@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* ═══════════════════════════════════════════════════════════════════════
   TEXTAREA
   ═══════════════════════════════════════════════════════════════════════ */

.textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}
.textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.textarea::placeholder { color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════
   SPINNER & LOADING
   ═══════════════════════════════════════════════════════════════════════ */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.btn-loading { display: inline-flex; align-items: center; gap: 8px; }

/* ═══════════════════════════════════════════════════════════════════════
   VOICE OVERLAY & BADGE
   ═══════════════════════════════════════════════════════════════════════ */

.voice-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 15, 0.92);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 20px;
}

.voice-indicator {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--accent);
  border-radius: 50%;
  animation: voiceRing 2s ease-in-out infinite;
  opacity: 0.3;
}
.ring-2 { animation-delay: 0.4s; }
.ring-3 { animation-delay: 0.8s; }

@keyframes voiceRing {
  0% { transform: scale(0.8); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 0; }
  100% { transform: scale(0.8); opacity: 0; }
}

.voice-icon { font-size: 48px; z-index: 1; }
.voice-overlay-text { font-size: 16px; font-weight: 600; color: var(--text-secondary); }

.voice-badge {
  position: fixed;
  bottom: 16px;
  right: 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--bg-elevated);
  color: var(--success);
  border: 1px solid var(--success);
  z-index: 50;
}
.voice-badge.listening { color: var(--accent); border-color: var(--accent); }
.voice-badge.processing { color: var(--warning); border-color: var(--warning); }
.voice-badge.speaking { color: var(--purple); border-color: var(--purple); }

/* ═══════════════════════════════════════════════════════════════════════
   TYPING INDICATOR
   ═══════════════════════════════════════════════════════════════════════ */

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px;
}
.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ═══════════════════════════════════════════════════════════════════════
   MARKDOWN IN MESSAGES
   ═══════════════════════════════════════════════════════════════════════ */

.message-content h1, .message-content h2, .message-content h3 {
  margin: 12px 0 6px;
  font-weight: 700;
}
.message-content h1 { font-size: 16px; }
.message-content h2 { font-size: 15px; }
.message-content h3 { font-size: 14px; color: var(--accent); }

.message-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 12px;
}
.message-content th, .message-content td {
  padding: 6px 10px;
  border: 1px solid var(--border);
  text-align: left;
}
.message-content th {
  background: var(--bg-elevated);
  font-weight: 600;
  color: var(--text-secondary);
}
.message-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  margin: 8px 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════════ */

.hidden { display: none !important; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 1100px) {
  .format-layout {
    grid-template-columns: 1fr;
  }
  .screen-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .screen-chat-panel {
    min-height: 400px;
  }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }

  .btn-icon-sm { display: flex; }

  .main-content { width: 100%; }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-content { padding: 20px; }

  .welcome-banner {
    padding: 24px;
  }
  .welcome-art { display: none; }
}

@media (max-width: 600px) {
  .login-card {
    padding: 32px 24px;
    margin: 16px;
  }

  .download-buttons {
    flex-direction: column;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
}

