/* ============================================
   NotebookLM Web Chat UI — Premium Dark Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- Design Tokens --- */
:root {
  --bg-primary: #06080f;
  --bg-secondary: #0d1117;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-glass-hover: rgba(255, 255, 255, 0.07);
  --bg-input: rgba(255, 255, 255, 0.06);

  --accent-purple: #7c3aed;
  --accent-purple-soft: rgba(124, 58, 237, 0.15);
  --accent-teal: #06b6d4;
  --accent-teal-soft: rgba(6, 182, 212, 0.12);
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(124,58,237,0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* --- App Layout --- */
.app {
  display: flex;
  height: 100vh;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(124,58,237,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(6,182,212,0.06) 0%, transparent 60%),
    var(--bg-primary);
}

/* --- Sidebar --- */
.sidebar {
  width: 280px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  transition: transform var(--transition-slow);
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-header .logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-teal));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-header h1 {
  font-size: 16px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.nav-item:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-purple-soft);
  color: var(--accent-purple);
  font-weight: 500;
}

.nav-item .icon { font-size: 18px; width: 22px; text-align: center; }

/* Sidebar footer */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-red);
  transition: background var(--transition);
}

.status-dot.online { background: var(--accent-green); box-shadow: 0 0 8px rgba(34,197,94,0.4); }

/* --- Main Content --- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* --- Top Bar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-height: 56px;
}

.topbar-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
}

.topbar-actions { display: flex; gap: 8px; align-items: center; }

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-icon:hover { background: var(--bg-glass-hover); color: var(--text-primary); border-color: var(--border-hover); }

.menu-toggle { display: none; }

/* --- Page Containers --- */
.page {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.page.active { display: flex; }

/* ===== CHAT PAGE ===== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}

/* Custom scrollbar */
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
.chat-messages::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Welcome */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  gap: 16px;
  opacity: 0;
  animation: fadeSlideUp 0.6s ease forwards;
}

.welcome .welcome-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.welcome h2 {
  font-size: 24px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome p { color: var(--text-muted); font-size: 14px; max-width: 400px; line-height: 1.6; }

/* Chat Bubbles */
.message {
  display: flex;
  gap: 12px;
  max-width: 80%;
  animation: fadeSlideUp 0.35s ease forwards;
  opacity: 0;
}

.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message.bot  { align-self: flex-start; }

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.message.user .message-avatar { background: var(--accent-purple-soft); }
.message.bot  .message-avatar { background: var(--accent-teal-soft); }

.message-content {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.7;
  position: relative;
}

.message.user .message-content {
  background: linear-gradient(135deg, var(--accent-purple), #6d28d9);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.bot .message-content {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}

.message.bot .message-content p { margin-bottom: 10px; }
.message.bot .message-content p:last-child { margin-bottom: 0; }
.message.bot .message-content code {
  background: rgba(255,255,255,0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
}
.message.bot .message-content pre {
  background: rgba(0,0,0,0.4);
  padding: 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 10px 0;
}
.message.bot .message-content pre code { background: none; padding: 0; }
.message.bot .message-content ul,
.message.bot .message-content ol { padding-left: 20px; margin: 8px 0; }
.message.bot .message-content li { margin-bottom: 4px; }
.message.bot .message-content strong { color: var(--accent-teal); font-weight: 600; }

.message-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity var(--transition);
}

.message:hover .message-actions { opacity: 1; }

.btn-tiny {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-tiny:hover { background: var(--bg-glass-hover); color: var(--text-primary); }
.btn-tiny.copied { border-color: var(--accent-green); color: var(--accent-green); }

/* Typing Indicator */
.typing-indicator {
  display: none;
  align-self: flex-start;
  gap: 12px;
  opacity: 0;
  animation: fadeSlideUp 0.3s ease forwards;
}

.typing-indicator.visible { display: flex; }

.typing-dots {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: 4px;
  backdrop-filter: blur(8px);
}

.typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

/* Error message */
.message.error .message-content {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  color: var(--accent-red);
}

/* --- Chat Input --- */
.chat-input-area {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  background: rgba(13,17,23,0.6);
  backdrop-filter: blur(12px);
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 860px;
  margin: 0 auto;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.chat-input-wrapper:focus-within {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-soft);
}

.chat-input-wrapper textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  min-height: 24px;
  max-height: 120px;
  line-height: 1.5;
  padding: 4px 0;
}

.chat-input-wrapper textarea::placeholder { color: var(--text-muted); }

.btn-send {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent-purple);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-send:hover { background: #6d28d9; transform: scale(1.05); }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.input-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ===== STUDIO PAGE ===== */
.studio-page {
  padding: 32px;
  overflow-y: auto;
}

.studio-page h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}

.studio-page .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.studio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.studio-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.studio-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-glass-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.studio-card .card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.studio-card .card-icon.purple { background: var(--accent-purple-soft); }
.studio-card .card-icon.teal   { background: var(--accent-teal-soft); }
.studio-card .card-icon.amber  { background: rgba(245,158,11,0.12); }
.studio-card .card-icon.green  { background: rgba(34,197,94,0.12); }

.studio-card h3 { font-size: 15px; font-weight: 600; }
.studio-card p  { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.studio-card .card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  padding: 4px 8px;
  border-radius: var(--radius-full);
  width: fit-content;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  transition: opacity var(--transition);
}

.modal-overlay.visible { display: flex; opacity: 1; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  animation: scaleIn 0.25s ease;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-body { padding: 24px; }

/* ===== LOGIN OVERLAY ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity var(--transition);
}

.login-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
  animation: scaleIn 0.3s ease;
  display: flex;
  flex-direction: column;
}

.login-logo {
  font-size: 40px;
  text-align: center;
  margin-bottom: 16px;
}

.login-card h2 {
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Form elements */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent-purple);
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-group select option { background: var(--bg-secondary); color: var(--text-primary); }

/* Buttons */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
}

.btn-primary {
  background: var(--accent-purple);
  color: #fff;
}
.btn-primary:hover { background: #6d28d9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-glass-hover); color: var(--text-primary); }

/* ===== SETTINGS PAGE ===== */
.settings-page {
  padding: 32px;
  overflow-y: auto;
  max-width: 640px;
}

.settings-page h2 { font-size: 22px; font-weight: 600; margin-bottom: 24px; }

.settings-section {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.settings-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== DOWNLOADS LIST ===== */
.downloads-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.download-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.download-item:hover { border-color: var(--border-hover); }

.download-item .dl-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.download-item .dl-info { flex: 1; min-width: 0; }
.download-item .dl-info h4 { font-size: 14px; font-weight: 500; }
.download-item .dl-info p  { font-size: 12px; color: var(--text-muted); }

.download-item .btn { flex-shrink: 0; }

/* ===== Toast Notification ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 3.7s forwards;
  box-shadow: var(--shadow-md);
}

.toast.success { background: rgba(34,197,94,0.15); color: var(--accent-green); border: 1px solid rgba(34,197,94,0.2); }
.toast.error   { background: rgba(239,68,68,0.15); color: var(--accent-red);   border: 1px solid rgba(239,68,68,0.2); }
.toast.info    { background: rgba(6,182,212,0.15);  color: var(--accent-teal);  border: 1px solid rgba(6,182,212,0.2); }

/* ===== Loading Spinner ===== */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ===== Animations ===== */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateY(8px); }
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: flex; }
  .message { max-width: 92%; }
  .studio-grid { grid-template-columns: 1fr; }
  .studio-page, .settings-page { padding: 20px; }
}

@media (max-width: 480px) {
  .chat-input-area { padding: 12px 16px 16px; }
  .chat-messages { padding: 16px; }
  .topbar { padding: 10px 16px; }
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

.sidebar-overlay.visible { display: block; }

/* ===== Button Sizes ===== */
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon.btn-sm { width: 28px; height: 28px; font-size: 13px; }

/* ===== Notebook Switcher (Topbar) ===== */
.notebook-switcher { position: relative; }

.btn-switcher {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-glass);
  color: var(--text-secondary); font-size: 13px; font-family: inherit;
  cursor: pointer; transition: all var(--transition); max-width: 200px;
}
.btn-switcher:hover { background: var(--bg-glass-hover); color: var(--text-primary); border-color: var(--border-hover); }
.switcher-icon { font-size: 14px; }
.switcher-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-arrow { font-size: 10px; color: var(--text-muted); }

.switcher-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  width: 280px; max-height: 360px; overflow-y: auto;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  z-index: 150; animation: scaleIn 0.2s ease;
}
.switcher-dropdown.visible { display: block; }

.switcher-dropdown-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--text-muted);
}

.switcher-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%;
  padding: 10px 14px; border: none; background: none;
  text-align: left; font-family: inherit; cursor: pointer;
  transition: background var(--transition); color: var(--text-secondary);
}
.switcher-item:hover { background: var(--bg-glass-hover); color: var(--text-primary); }
.switcher-item.active { background: var(--accent-purple-soft); color: var(--accent-purple); }
.switcher-item-name { font-size: 13px; font-weight: 500; }
.switcher-item-meta { font-size: 11px; color: var(--text-muted); }
.switcher-empty, .switcher-loading { padding: 20px; text-align: center; font-size: 13px; color: var(--text-muted); }
.switcher-loading { display: flex; justify-content: center; }

/* ===== Notebook Badge (Chat Welcome) ===== */
.notebook-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: var(--radius-full);
  background: var(--accent-purple-soft); font-size: 12px;
  color: var(--accent-purple); margin-top: 8px;
}
.notebook-badge .badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-purple); animation: pulse 2s infinite;
}

/* ===== Studio Section ===== */
.studio-section {
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; margin-bottom: 4px;
}
.studio-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.studio-section-header h3 { font-size: 15px; font-weight: 600; margin: 0; }
.studio-section-actions { display: flex; gap: 8px; }

/* Source List */
.source-list { display: flex; flex-direction: column; gap: 8px; }
.source-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: rgba(255,255,255,0.02);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.source-item:hover { border-color: var(--border-hover); background: var(--bg-glass-hover); }
.source-item-icon { font-size: 18px; width: 28px; text-align: center; flex-shrink: 0; }
.source-item-info { flex: 1; min-width: 0; }
.source-item-info h4 { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-item-info p { font-size: 11px; color: var(--text-muted); }
.source-empty { padding: 32px 16px; text-align: center; }
.source-empty-icon { font-size: 32px; margin-bottom: 8px; }
.source-empty p { font-size: 13px; color: var(--text-muted); }
.source-loading { display: flex; align-items: center; gap: 10px; padding: 20px; justify-content: center; font-size: 13px; color: var(--text-muted); }

/* ===== Downloads — Grouped List ===== */
.downloads-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}
.downloads-header h2 { margin-bottom: 4px; }
.downloads-loading { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 40px; font-size: 13px; color: var(--text-muted); }

.download-group {
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden; margin-bottom: 12px;
}
.download-group-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.download-group-header h4 { flex: 1; font-size: 14px; font-weight: 500; }
.dl-format {
  font-size: 11px; padding: 2px 8px; border-radius: var(--radius-full);
  background: rgba(255,255,255,0.06); color: var(--text-muted);
}
.download-group-items { padding: 4px 0; }
.download-file-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; gap: 12px;
}
.download-file-item:hover { background: rgba(255,255,255,0.02); }
.file-name { font-size: 13px; color: var(--text-secondary); }
.download-empty-item {
  padding: 16px 18px; font-size: 13px; color: var(--text-muted);
  font-style: italic;
}

/* ===== Responsive additions ===== */
@media (max-width: 768px) {
  .notebook-switcher { display: none; }
  .downloads-header { flex-direction: column; }
  .studio-section-header { flex-direction: column; align-items: flex-start; }
}
