/* MEDIXAI — Advanced Medical Intelligence System Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --primary: #7c3aed;
  --primary-dark: #5b21b6;
  --primary-light: #a855f7;
  --accent: #f97316;
  --accent-dark: #ea580c;
  --accent-light: #fb923c;
  --bg-dark: #0f0a1e;
  --bg-card: #1a1035;
  --bg-sidebar: #140d2a;
  --bg-input: #221540;
  --text-primary: #f3f0ff;
  --text-secondary: #a89cc8;
  --text-muted: #6b5f85;
  --border: #2d1f4e;
  --border-light: #3d2d5e;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --gradient-main: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #f97316 100%);
  --gradient-card: linear-gradient(135deg, rgba(124,58,237,0.15) 0%, rgba(248,113,22,0.05) 100%);
  --gradient-btn: linear-gradient(135deg, #7c3aed, #f97316);
  --shadow-glow: 0 0 30px rgba(124,58,237,0.3);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  overflow: hidden;
}

#app { height: 100vh; display: flex; flex-direction: column; }

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }

/* ── Top Navigation Bar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 60px; flex-shrink: 0;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
}
.topbar-brand .logo-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--gradient-main);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; box-shadow: var(--shadow-glow);
}
.topbar-brand .brand-text { font-size: 16px; font-weight: 800; }
.topbar-brand .brand-text span { background: var(--gradient-main); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-badge {
  display: flex; align-items: center; gap: 6px; padding: 5px 12px;
  background: rgba(124,58,237,0.2); border: 1px solid rgba(124,58,237,0.4);
  border-radius: 20px; font-size: 12px; color: var(--primary-light);
}
.topbar-badge .dot { width: 6px; height: 6px; background: var(--success); border-radius: 50%; animation: pulse 2s infinite; }

/* ── Main Layout ── */
.main-layout {
  display: flex; flex: 1; overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  transition: width 0.3s ease;
}
.sidebar.collapsed { width: 60px; }

.sidebar-section { padding: 12px 8px 4px; }
.sidebar-section-title {
  font-size: 10px; font-weight: 600; letter-spacing: 1px;
  color: var(--text-muted); text-transform: uppercase;
  padding: 0 8px; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden;
}
.sidebar.collapsed .sidebar-section-title { opacity: 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px; cursor: pointer;
  transition: all 0.2s; color: var(--text-secondary);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  border: 1px solid transparent; margin-bottom: 2px;
  text-decoration: none; position: relative;
}
.nav-item:hover {
  background: rgba(124,58,237,0.15); color: var(--text-primary);
  border-color: rgba(124,58,237,0.3);
}
.nav-item.active {
  background: rgba(124,58,237,0.25); color: var(--primary-light);
  border-color: rgba(124,58,237,0.5);
}
.nav-item .nav-icon { width: 18px; font-size: 15px; flex-shrink: 0; text-align: center; }
.nav-item .nav-label { flex: 1; }
.sidebar.collapsed .nav-label { display: none; }
.nav-item .nav-badge {
  font-size: 10px; background: var(--accent); color: white;
  padding: 1px 6px; border-radius: 10px; font-weight: 700;
}
.sidebar.collapsed .nav-badge { display: none; }

.nav-dropdown { overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
.nav-dropdown.open { max-height: 500px; }
.nav-dropdown .nav-item { padding-left: 36px; font-size: 12px; }

.nav-item .dropdown-arrow {
  font-size: 10px; transition: transform 0.3s;
  color: var(--text-muted);
}
.nav-item.dropdown-open .dropdown-arrow { transform: rotate(180deg); }

/* ── Content Area ── */
.content-area {
  flex: 1; display: flex; overflow: hidden;
}

/* ── Chat Panel ── */
.chat-panel {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-width: 0;
}

.agent-selector {
  display: flex; gap: 8px; padding: 12px 16px;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  overflow-x: auto; flex-shrink: 0;
}
.agent-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px; cursor: pointer;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--border-light); color: var(--text-secondary);
  background: transparent; transition: all 0.2s;
}
.agent-btn:hover { border-color: var(--primary); color: var(--primary-light); }
.agent-btn.active {
  background: var(--gradient-btn); color: white; border-color: transparent;
  box-shadow: 0 2px 12px rgba(124,58,237,0.4);
}

/* ── Chat Messages ── */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
}

.message {
  display: flex; gap: 12px; max-width: 100%;
  animation: fadeInUp 0.3s ease;
}
.message.user { flex-direction: row-reverse; }

.message-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.message.user .message-avatar {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}
.message.assistant .message-avatar {
  background: var(--gradient-main); box-shadow: 0 0 16px rgba(124,58,237,0.4);
}

.message-content {
  flex: 1; min-width: 0;
}
.message.user .message-content { display: flex; flex-direction: column; align-items: flex-end; }

.message-bubble {
  max-width: 85%; padding: 14px 18px; border-radius: 16px;
  line-height: 1.6; font-size: 14px;
  box-shadow: var(--shadow-card);
}
.message.user .message-bubble {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 16px 4px 16px 16px; color: white;
}
.message.assistant .message-bubble {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 4px 16px 16px 16px;
  background: var(--gradient-card);
  border-color: rgba(124,58,237,0.2);
}

.message-meta {
  font-size: 11px; color: var(--text-muted);
  margin-top: 6px; display: flex; align-items: center; gap: 8px;
}
.message-meta .provider-badge {
  padding: 2px 8px; background: rgba(124,58,237,0.2);
  border-radius: 10px; color: var(--primary-light);
}

/* Markdown rendering */
.message-bubble h1, .message-bubble h2, .message-bubble h3 {
  color: var(--primary-light); margin: 12px 0 6px; font-weight: 700;
}
.message-bubble h1 { font-size: 18px; }
.message-bubble h2 { font-size: 16px; }
.message-bubble h3 { font-size: 14px; }
.message-bubble p { margin-bottom: 8px; }
.message-bubble ul, .message-bubble ol { margin: 8px 0 8px 20px; }
.message-bubble li { margin-bottom: 4px; }
.message-bubble strong { color: var(--accent-light); }
.message-bubble em { color: var(--primary-light); }
.message-bubble code {
  background: rgba(0,0,0,0.3); padding: 2px 6px; border-radius: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #a8ff78;
}
.message-bubble pre {
  background: rgba(0,0,0,0.4); padding: 12px; border-radius: 8px;
  overflow-x: auto; margin: 8px 0;
}
.message-bubble pre code { background: none; padding: 0; }
.message-bubble table {
  width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px;
}
.message-bubble th {
  background: rgba(124,58,237,0.3); padding: 8px 12px;
  text-align: left; color: var(--primary-light);
}
.message-bubble td { padding: 7px 12px; border-bottom: 1px solid var(--border); }
.message-bubble tr:hover td { background: rgba(124,58,237,0.1); }
.message-bubble blockquote {
  border-left: 3px solid var(--accent); padding: 8px 12px;
  background: rgba(249,115,22,0.1); border-radius: 0 8px 8px 0; margin: 8px 0;
  color: var(--accent-light);
}
.message-bubble hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ── Chat Input ── */
.chat-input-area {
  padding: 16px; background: var(--bg-card);
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.chat-input-wrapper {
  display: flex; gap: 10px; align-items: flex-end;
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: 14px; padding: 10px 14px;
  transition: border-color 0.2s;
}
.chat-input-wrapper:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }
.chat-textarea {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-primary); font-size: 14px; resize: none;
  min-height: 24px; max-height: 150px; line-height: 1.5;
  font-family: 'Inter', sans-serif;
}
.chat-textarea::placeholder { color: var(--text-muted); }
.chat-send-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--gradient-btn); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 15px; flex-shrink: 0;
  transition: all 0.2s; box-shadow: 0 2px 12px rgba(124,58,237,0.4);
}
.chat-send-btn:hover { transform: scale(1.05); box-shadow: 0 4px 20px rgba(124,58,237,0.6); }
.chat-send-btn:disabled { opacity: 0.5; transform: none; cursor: not-allowed; }

.quick-prompts {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px;
}
.quick-prompt {
  padding: 5px 12px; border-radius: 15px; font-size: 11px; cursor: pointer;
  border: 1px solid var(--border-light); color: var(--text-secondary);
  background: transparent; transition: all 0.2s; font-weight: 500;
}
.quick-prompt:hover {
  border-color: var(--primary); color: var(--primary-light);
  background: rgba(124,58,237,0.1);
}

/* ── Right Panel ── */
.right-panel {
  width: 320px; flex-shrink: 0;
  background: var(--bg-sidebar); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.right-panel-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.right-panel-header h3 { font-size: 14px; font-weight: 700; color: var(--primary-light); }
.right-panel-content { flex: 1; overflow-y: auto; padding: 12px; }

.info-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
  transition: border-color 0.2s; cursor: pointer;
}
.info-card:hover { border-color: var(--primary); }
.info-card-title {
  font-size: 12px; font-weight: 700; color: var(--primary-light);
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.info-card-content { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }

/* ── Forms & Inputs ── */
.form-section {
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px; overflow-y: auto;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.form-control {
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: 10px; padding: 10px 14px; color: var(--text-primary);
  font-size: 13px; outline: none; transition: border-color 0.2s;
  font-family: 'Inter', sans-serif;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.1); }
.form-control::placeholder { color: var(--text-muted); }
.form-control option { background: var(--bg-card); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.tag-input-container {
  display: flex; flex-wrap: wrap; gap: 6px;
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: 10px; padding: 8px 12px; min-height: 44px;
  cursor: text; transition: border-color 0.2s;
}
.tag-input-container:focus-within { border-color: var(--primary); }
.tag {
  display: flex; align-items: center; gap: 4px;
  background: rgba(124,58,237,0.3); color: var(--primary-light);
  padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 500;
}
.tag-remove {
  cursor: pointer; color: var(--text-muted); font-size: 12px;
  padding: 0 2px; transition: color 0.2s;
}
.tag-remove:hover { color: var(--danger); }
.tag-input {
  border: none; outline: none; background: transparent;
  color: var(--text-primary); font-size: 13px; min-width: 100px;
  font-family: 'Inter', sans-serif;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: 10px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s; text-decoration: none;
}
.btn-primary {
  background: var(--gradient-btn); color: white;
  box-shadow: 0 2px 12px rgba(124,58,237,0.4);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(124,58,237,0.6); }
.btn-secondary {
  background: var(--bg-card); border: 1px solid var(--border-light); color: var(--text-secondary);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--text-primary); }
.btn-outline {
  background: transparent; border: 1px solid var(--primary); color: var(--primary-light);
}
.btn-outline:hover { background: rgba(124,58,237,0.1); }
.btn-danger { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #ef4444; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn-full { width: 100%; }

/* ── Cards ── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14px; font-weight: 700; color: var(--primary-light); }

/* ── Stat Cards ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat-card {
  background: var(--gradient-card); border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius); padding: 16px; text-align: center;
}
.stat-card .stat-value { font-size: 28px; font-weight: 800; color: var(--primary-light); }
.stat-card .stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.stat-card .stat-icon { font-size: 24px; margin-bottom: 8px; }

/* ── Loading ── */
.loading-spinner {
  display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px;
}
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-light); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
.typing-dots { display: flex; gap: 4px; align-items: center; }
.typing-dots span {
  width: 6px; height: 6px; background: var(--primary-light);
  border-radius: 50%; animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ── Welcome Screen ── */
.welcome-screen {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 40px; text-align: center;
}
.welcome-logo {
  width: 80px; height: 80px; border-radius: 20px;
  background: var(--gradient-main); display: flex; align-items: center;
  justify-content: center; font-size: 40px; margin-bottom: 24px;
  box-shadow: var(--shadow-glow); animation: float 3s ease-in-out infinite;
}
.welcome-title {
  font-size: 28px; font-weight: 800; margin-bottom: 8px;
  background: var(--gradient-main); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.welcome-subtitle { font-size: 14px; color: var(--text-secondary); max-width: 500px; line-height: 1.7; margin-bottom: 32px; }
.welcome-features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; max-width: 700px; width: 100%;
}
.feature-chip {
  background: var(--gradient-card); border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius); padding: 14px;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  transition: all 0.2s; text-align: left;
}
.feature-chip:hover {
  border-color: var(--primary); transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(124,58,237,0.2);
}
.feature-chip .feature-icon { font-size: 22px; }
.feature-chip .feature-text { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.feature-chip .feature-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Modals ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 28px; max-width: 560px; width: 90%;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-glow);
  animation: slideUp 0.3s ease;
}
.modal-title {
  font-size: 18px; font-weight: 800; margin-bottom: 20px;
  background: var(--gradient-main); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
  padding: 10px 18px; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--text-secondary); border-bottom: 2px solid transparent;
  transition: all 0.2s; white-space: nowrap;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary-light); border-bottom-color: var(--primary); }

/* ── Alert Boxes ── */
.alert {
  padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 12px;
  display: flex; align-items: flex-start; gap: 10px; line-height: 1.5;
}
.alert-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: #93c5fd; }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }
.alert-danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }

/* ── Drug Card ── */
.drug-card {
  background: var(--gradient-card); border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius); padding: 16px; cursor: pointer;
  transition: all 0.2s; margin-bottom: 10px;
}
.drug-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.drug-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.drug-badge {
  padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700;
}
.badge-induction { background: rgba(124,58,237,0.3); color: var(--primary-light); }
.badge-opioid { background: rgba(239,68,68,0.2); color: #f87171; }
.badge-nmb { background: rgba(249,115,22,0.2); color: var(--accent-light); }
.badge-inhalation { background: rgba(16,185,129,0.2); color: #6ee7b7; }
.badge-local { background: rgba(59,130,246,0.2); color: #93c5fd; }
.badge-reversal { background: rgba(245,158,11,0.2); color: #fcd34d; }
.badge-benzo { background: rgba(168,85,247,0.2); color: #d8b4fe; }

/* ── BMI Meter ── */
.bmi-meter {
  height: 14px; border-radius: 7px; margin: 12px 0;
  background: linear-gradient(to right, #3b82f6 0%, #10b981 18.5%, #f59e0b 25%, #ef4444 100%);
  position: relative;
}
.bmi-indicator {
  position: absolute; top: -4px; width: 22px; height: 22px;
  background: white; border-radius: 50%; border: 3px solid var(--primary);
  transform: translateX(-50%); transition: left 0.5s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* ── Result Display ── */
.result-container {
  background: var(--bg-card); border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius-lg); padding: 20px; margin-top: 16px;
}
.result-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}

/* ── Specialty Grid ── */
.specialty-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px;
}
.specialty-card {
  background: var(--gradient-card); border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius); padding: 16px; text-align: center; cursor: pointer;
  transition: all 0.2s;
}
.specialty-card:hover {
  border-color: var(--primary); transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(124,58,237,0.2);
}
.specialty-card .spec-icon { font-size: 28px; margin-bottom: 8px; }
.specialty-card .spec-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.specialty-card .spec-count { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ── Progress / Range ── */
.range-slider {
  width: 100%; height: 6px; border-radius: 3px;
  background: var(--border-light); outline: none; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: var(--gradient-btn);
  cursor: pointer; box-shadow: 0 0 0 3px rgba(124,58,237,0.2);
}

/* ── Animations ── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(124,58,237,0.3); }
  50% { box-shadow: 0 0 40px rgba(124,58,237,0.6); }
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── Disclaimer Banner ── */
.disclaimer-banner {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  background: rgba(245,158,11,0.1); border-top: 1px solid rgba(245,158,11,0.2);
  font-size: 11px; color: #fcd34d; flex-shrink: 0;
}

/* ── Toast ── */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 18px; border-radius: 10px; font-size: 13px; font-weight: 500;
  animation: slideUp 0.3s ease; min-width: 260px; max-width: 360px;
  box-shadow: var(--shadow-card); display: flex; align-items: center; gap: 10px;
}
.toast-success { background: rgba(16,185,129,0.9); color: white; }
.toast-error { background: rgba(239,68,68,0.9); color: white; }
.toast-info { background: rgba(59,130,246,0.9); color: white; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .right-panel { display: none; }
}
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .nav-label, .sidebar .sidebar-section-title, .sidebar .nav-badge { display: none; }
}
@media (max-width: 480px) {
  .sidebar { display: none; }
  .topbar-badge { display: none; }
}

/* ── Scrollable containers ── */
.scrollable { overflow-y: auto; }
.section-page {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; padding: 0;
}
.section-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg-card); flex-shrink: 0;
}
.section-header h2 {
  font-size: 18px; font-weight: 800; color: var(--primary-light);
  display: flex; align-items: center; gap: 10px;
}
.section-body { flex: 1; overflow-y: auto; padding: 20px; }

/* ── Settings ── */
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-key-input {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  background: var(--bg-input); border: 1px solid var(--border-light);
  color: var(--text-primary); border-radius: 8px; padding: 8px 12px;
  width: 280px; outline: none;
}
.settings-key-input:focus { border-color: var(--primary); }
.key-masked { -webkit-text-security: disc; text-security: disc; }
.toggle-eye {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 14px; transition: color 0.2s;
}
.toggle-eye:hover { color: var(--text-primary); }

/* ── Ebook styles ── */
.ebook-chapter-list { display: flex; flex-direction: column; gap: 6px; }
.chapter-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: var(--gradient-card); border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius); cursor: pointer; transition: all 0.2s;
}
.chapter-item:hover { border-color: var(--primary); transform: translateX(4px); }
.chapter-num {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(124,58,237,0.3); color: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.chapter-info .chapter-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.chapter-info .chapter-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
