/* ═══════════════════════════════════════════════════════════
   VIDMIND — DEEP SPACE TERMINAL
   A mission-control aesthetic for AI video intelligence
═══════════════════════════════════════════════════════════ */

/* ── Custom Properties ── */
:root {
  /* Backgrounds */
  --bg-void:      #060a0f;
  --bg-deep:      #0a0f18;
  --bg-base:      #0d1420;
  --bg-raised:    #111929;
  --bg-overlay:   #16202e;
  --bg-surface:   #1a2638;
  --bg-hover:     #1f2e42;
  --bg-glass:     rgba(13, 20, 32, 0.7);

  /* Accents */
  --accent-cyan:  #00d4ff;
  --accent-teal:  #00b8d9;
  --accent-blue:  #3b82f6;
  --accent-glow:  rgba(0, 212, 255, 0.15);
  --accent-glow-strong: rgba(0, 212, 255, 0.3);

  /* Text */
  --text-primary:   #e8f4f8;
  --text-secondary: #7a9bb5;
  --text-muted:     #4a6580;
  --text-accent:    #00d4ff;

  /* Borders */
  --border-subtle:  rgba(0, 212, 255, 0.08);
  --border-soft:    rgba(0, 212, 255, 0.15);
  --border-active:  rgba(0, 212, 255, 0.4);

  /* Danger */
  --danger:         #ff4d6d;
  --danger-bg:      rgba(255, 77, 109, 0.1);

  /* Success */
  --success:        #00e5a0;
  --success-bg:     rgba(0, 229, 160, 0.1);

  /* Warning */
  --warning:        #ffb830;

  /* Fonts */
  --font-display:   'Syne', sans-serif;
  --font-body:      'DM Sans', sans-serif;
  --font-mono:      'DM Mono', monospace;

  /* Radii */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  22px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md:  0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg:  0 8px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px var(--accent-glow-strong);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Sidebar */
  --sidebar-width: 280px;
  --sidebar-collapsed: 0px;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-void);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow: hidden;
}

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Selection ── */
::selection { background: var(--accent-glow-strong); color: var(--accent-cyan); }

/* ════════════════════════════════════════════
   AMBIENT BACKGROUND
════════════════════════════════════════════ */
.bg-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  animation: orbFloat 20s ease-in-out infinite;
}

.orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #00d4ff, transparent 70%);
  top: -200px; left: -100px;
  animation-delay: 0s;
}
.orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #3b82f6, transparent 70%);
  bottom: -100px; right: -100px;
  animation-delay: -8s;
}
.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #00e5a0, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
  opacity: 0.06;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -40px) scale(1.05); }
  66%       { transform: translate(-20px, 30px) scale(0.95); }
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
}

/* ════════════════════════════════════════════
   APP SHELL
════════════════════════════════════════════ */
.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ════════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: width var(--transition-base), min-width var(--transition-base);
  overflow: hidden;
  position: relative;
  z-index: 10;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
}

.sidebar-inner {
  width: var(--sidebar-width);
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.logo-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: var(--bg-void);
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--accent-glow);
}

.logo-text { flex: 1; min-width: 0; }
.logo-name {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.logo-tagline {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
  flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--accent-cyan); background: var(--accent-glow); }

/* Sections */
.sidebar-section {
  padding: 16px 14px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.section-label i { font-size: 11px; color: var(--accent-cyan); }

/* Session Controls */
.session-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.btn-sidebar {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-sidebar i { font-size: 11px; }

.btn-sidebar.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: var(--bg-void);
}
.btn-sidebar.btn-primary:hover {
  box-shadow: 0 0 20px var(--accent-glow-strong);
  transform: translateY(-1px);
}

.btn-sidebar.btn-ghost {
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.btn-sidebar.btn-ghost:hover {
  border-color: var(--border-soft);
  color: var(--text-primary);
  background: var(--bg-overlay);
}

/* Session Select */
.session-select-wrap {
  position: relative;
}
.session-select {
  width: 100%;
  appearance: none;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 30px 8px 12px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--transition-fast);
  outline: none;
}
.session-select:hover, .session-select:focus {
  border-color: var(--border-soft);
  color: var(--text-primary);
}
.select-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

/* URL Input */
.url-input-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
}
.url-input {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.url-input::placeholder { color: var(--text-muted); }
.url-input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.url-add-btn {
  width: 34px; height: 34px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent-cyan);
  color: var(--bg-void);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
.url-add-btn:hover {
  background: var(--accent-blue);
  box-shadow: 0 0 15px var(--accent-glow-strong);
}
.url-add-btn.loading { animation: spin 0.8s linear infinite; }

/* Loading Bar */
.loading-bar {
  height: 2px;
  background: var(--bg-raised);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 10px;
}
.loading-bar.hidden { display: none; }
.loading-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
  border-radius: var(--radius-full);
  animation: loadingSlide 1.5s ease-in-out infinite;
}
@keyframes loadingSlide {
  0%   { width: 0%; margin-left: 0%; }
  50%  { width: 60%; margin-left: 20%; }
  100% { width: 0%; margin-left: 100%; }
}

/* Video List */
.video-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  max-height: 200px;
  overflow-y: auto;
}

.video-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  animation: slideInLeft 0.25s ease;
}
.video-item:hover { border-color: var(--border-soft); background: var(--bg-overlay); }
.video-item.active { border-color: var(--border-active); background: var(--accent-glow); }

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

.video-thumb {
  width: 34px; height: 24px;
  border-radius: 4px;
  background: var(--bg-surface);
  flex-shrink: 0;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}
.video-thumb img { width: 100%; height: 100%; object-fit: cover; }

.video-info { flex: 1; min-width: 0; }
.video-title {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.video-meta {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
}

.video-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  padding: 3px;
  border-radius: 4px;
  transition: color var(--transition-fast), background var(--transition-fast);
  flex-shrink: 0;
}
.video-remove-btn:hover { color: var(--danger); background: var(--danger-bg); }

/* Chat Target */
.chat-target-wrap { }
.chat-target-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 6px;
}
.chat-target-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.target-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 0.72rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--bg-raised);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-body);
}
.target-btn i { font-size: 10px; flex-shrink: 0; }
.target-btn:hover { border-color: var(--border-soft); color: var(--text-primary); }
.target-btn.active {
  border-color: var(--accent-cyan);
  background: var(--accent-glow);
  color: var(--accent-cyan);
}

/* Export Buttons */
.export-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.btn-export {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-export i { font-size: 13px; width: 16px; text-align: center; }
.btn-export:hover {
  border-color: var(--border-soft);
  color: var(--accent-cyan);
  background: var(--bg-overlay);
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: statusPulse 2s ease-in-out infinite;
}
.status-dot.loading { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.status-dot.error   { background: var(--danger);  box-shadow: 0 0 8px var(--danger); }
@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}
.status-text {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ════════════════════════════════════════════
   MAIN CONTENT
════════════════════════════════════════════ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Top Nav ── */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex-shrink: 0;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  height: 100%;
  align-items: center;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
}
.nav-tab i { font-size: 13px; }
.nav-tab:hover { color: var(--text-primary); background: var(--bg-raised); }
.nav-tab.active {
  color: var(--accent-cyan);
  background: var(--accent-glow);
}
.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -13px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 2px;
  background: var(--accent-cyan);
  border-radius: var(--radius-full);
  box-shadow: 0 0 8px var(--accent-cyan);
}

.tab-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent-cyan);
  color: var(--bg-void);
  border-radius: var(--radius-full);
  font-size: 0.6rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
}
.tab-badge:empty, .tab-badge[data-count="0"] { display: none; }

.nav-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.active-session-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.pulse-dot {
  color: var(--success);
  font-size: 8px;
  animation: statusPulse 2s ease-in-out infinite;
}

/* ── Views ── */
.view {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  animation: fadeIn 0.2s ease;
}
.view.active { display: flex; flex-direction: column; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view-header {
  margin-bottom: 24px;
}
.view-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.view-title i { color: var(--accent-cyan); font-size: 1.1rem; }
.view-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ════════════════════════════════════════════
   CHAT VIEW
════════════════════════════════════════════ */
#viewChat {
  padding: 0;
  overflow: hidden;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Welcome State */
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  flex: 1;
  animation: fadeIn 0.4s ease;
}
.welcome-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  color: var(--accent-cyan);
  margin-bottom: 20px;
  box-shadow: 0 0 40px var(--accent-glow-strong);
  animation: iconGlow 3s ease-in-out infinite;
}
@keyframes iconGlow {
  0%, 100% { box-shadow: 0 0 40px var(--accent-glow-strong); }
  50%       { box-shadow: 0 0 60px var(--accent-glow-strong), 0 0 100px var(--accent-glow); }
}
.welcome-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.welcome-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 380px;
  line-height: 1.7;
  margin-bottom: 28px;
}
.welcome-suggestions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.suggestion-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.suggestion-chip i { font-size: 11px; color: var(--accent-cyan); }
.suggestion-chip:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: var(--accent-glow);
  transform: translateY(-2px);
}

/* Messages */
.message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: messageAppear 0.3s ease;
  max-width: 860px;
}
@keyframes messageAppear {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

.message-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}
.user-message .message-avatar {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  color: var(--bg-void);
}
.ai-message .message-avatar {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  color: var(--accent-cyan);
}

.message-body { flex: 1; min-width: 0; }

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.user-message .message-meta { flex-direction: row-reverse; }
.message-sender {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.message-time {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
}
.message-video-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 2px 7px;
  background: var(--accent-glow);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-full);
  color: var(--accent-cyan);
}

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.88rem;
  line-height: 1.7;
  max-width: 680px;
}
.user-message .message-bubble {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(0, 212, 255, 0.15));
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
  color: var(--text-primary);
  margin-left: auto;
}
.ai-message .message-bubble {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
  color: var(--text-primary);
}

.message-bubble p { margin-bottom: 10px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble strong { color: var(--accent-cyan); font-weight: 600; }
.message-bubble code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--bg-deep);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-cyan);
}

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

.msg-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  font-size: 0.68rem;
  font-family: var(--font-body);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.msg-action-btn i { font-size: 10px; }
.msg-action-btn:hover { color: var(--accent-cyan); border-color: var(--border-soft); background: var(--accent-glow); }
.msg-action-btn.bookmarked { color: var(--warning); border-color: var(--warning); background: rgba(255, 184, 48, 0.1); }

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 28px 10px;
}
.typing-indicator.hidden { display: none; }
.typing-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: var(--accent-cyan);
}
.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-raised);
  padding: 10px 14px;
  border-radius: 18px 18px 18px 4px;
  border: 1px solid var(--border-subtle);
}
.typing-dots span {
  width: 6px; height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* Chat Input */
.chat-input-area {
  border-top: 1px solid var(--border-subtle);
  padding: 16px 28px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  flex-shrink: 0;
}

.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: 8px 8px 8px 14px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.chat-input-wrap:focus-within {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-context-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--accent-glow);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition-fast);
  align-self: center;
}
.input-context-pill i { font-size: 9px; }
.input-context-pill:hover { background: rgba(0, 212, 255, 0.2); }

.chat-textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--text-primary);
  resize: none;
  min-height: 22px;
  max-height: 160px;
  line-height: 1.6;
  padding: 3px 0;
  overflow-y: auto;
}
.chat-textarea::placeholder { color: var(--text-muted); }

.input-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.btn-send {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border: none;
  color: var(--bg-void);
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.btn-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px var(--accent-glow-strong);
}
.btn-send:active { transform: translateY(0); }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.input-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 6px;
}
.input-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.input-hint kbd {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-mono);
}

/* ════════════════════════════════════════════
   BOOKMARKS VIEW
════════════════════════════════════════════ */
#viewBookmarks { gap: 20px; }

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition-fast);
}
.card:hover { border-color: var(--border-soft); }

.add-bookmark-card { flex-shrink: 0; }
.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.card-header i { color: var(--accent-cyan); font-size: 14px; }

.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 6px;
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: none; cursor: pointer; }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-primary-full {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border: none;
  border-radius: var(--radius-md);
  color: var(--bg-void);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary-full:hover {
  box-shadow: 0 0 25px var(--accent-glow-strong);
  transform: translateY(-1px);
}

.bookmarks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  overflow-y: auto;
}

.bookmark-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all var(--transition-fast);
  animation: fadeIn 0.25s ease;
  position: relative;
  overflow: hidden;
}
.bookmark-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.bookmark-card:hover { border-color: var(--border-soft); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.bookmark-card:hover::before { opacity: 1; }

.bookmark-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.bookmark-card-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.bookmark-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.bookmark-delete-btn:hover { color: var(--danger); background: var(--danger-bg); }

.bookmark-note {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  -webkit-line-clamp: 3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bookmark-video-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  padding: 3px 9px;
  background: var(--accent-glow);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-full);
  color: var(--accent-cyan);
}

.bookmark-time {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: auto;
}

.bookmarks-empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.bookmarks-empty i { font-size: 32px; display: block; margin-bottom: 12px; opacity: 0.3; }

/* ════════════════════════════════════════════
   NOTES VIEW
════════════════════════════════════════════ */
#viewNotes { padding: 0; overflow: hidden; }
.notes-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.notes-list-panel {
  width: 220px;
  min-width: 220px;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 0;
}
.notes-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}
.btn-icon-sm {
  width: 26px; height: 26px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.btn-icon-sm:hover { color: var(--accent-cyan); border-color: var(--border-soft); background: var(--accent-glow); }
.btn-icon-sm.btn-danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }

.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.note-list-item {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}
.note-list-item:hover { background: var(--bg-raised); }
.note-list-item.active {
  background: var(--accent-glow);
  border-color: var(--border-soft);
}
.note-list-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.note-list-meta {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
}

.note-editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 28px;
}
.note-editor-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.note-title-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-fast);
}
.note-title-input::placeholder { color: var(--text-muted); }
.note-title-input:focus { border-bottom-color: var(--border-soft); }
.note-editor-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.note-video-select {
  width: 180px;
  font-size: 0.75rem;
  padding: 6px 10px;
}

.note-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
  flex-shrink: 0;
}
.toolbar-btn {
  width: 30px; height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.toolbar-btn:hover { background: var(--bg-raised); color: var(--text-primary); }
.toolbar-btn.active { background: var(--accent-glow); color: var(--accent-cyan); }
.toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border-subtle);
  margin: 0 4px;
}

.note-editor-body {
  flex: 1;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text-primary);
  outline: none;
  padding: 4px 0;
  min-height: 100px;
}
.note-editor-body:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}
.note-editor-body h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin: 16px 0 8px;
}
.note-editor-body strong { color: var(--accent-cyan); }
.note-editor-body ul, .note-editor-body ol {
  padding-left: 20px;
  margin: 8px 0;
}
.note-editor-body li { margin: 4px 0; }

/* Notes view header */
#viewNotes .view-header {
  padding: 28px 28px 0;
}

/* ════════════════════════════════════════════
   HISTORY VIEW
════════════════════════════════════════════ */
.history-search-wrap {
  position: relative;
  margin-bottom: 24px;
  flex-shrink: 0;
}
.history-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}
.history-search {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 11px 16px 11px 38px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.history-search::placeholder { color: var(--text-muted); }
.history-search:focus { border-color: var(--border-active); box-shadow: 0 0 0 3px var(--accent-glow); }

.history-layout {
  display: flex;
  gap: 20px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.history-sessions-panel {
  width: 260px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 10px;
}
.history-sessions-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-session-item {
  padding: 12px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.history-session-item:hover { border-color: var(--border-soft); background: var(--bg-overlay); }
.history-session-item.active { border-color: var(--border-active); background: var(--accent-glow); }
.history-session-name {
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.history-session-meta {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
}

.history-detail-panel {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-muted);
  text-align: center;
  gap: 12px;
}
.history-empty i { font-size: 32px; opacity: 0.2; }
.history-empty p { font-size: 0.82rem; }

.history-message {
  padding: 12px 14px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border-left: 2px solid var(--border-subtle);
  transition: border-color var(--transition-fast);
}
.history-message.user-msg { border-left-color: var(--accent-blue); }
.history-message.ai-msg   { border-left-color: var(--accent-cyan); }
.history-msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.history-msg-sender {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.history-msg-sender.user { color: var(--accent-blue); }
.history-msg-sender.ai   { color: var(--accent-cyan); }
.history-msg-time {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
}
.history-msg-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ════════════════════════════════════════════
   TOAST NOTIFICATIONS
════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-overlay);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  font-size: 0.82rem;
  color: var(--text-primary);
  pointer-events: all;
  animation: toastIn 0.3s ease;
  min-width: 240px;
  max-width: 360px;
}
.toast.exit { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { to   { opacity: 0; transform: translateY(20px) scale(0.95); } }

.toast-icon { font-size: 15px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.info    .toast-icon { color: var(--accent-cyan); }
.toast.warning .toast-icon { color: var(--warning); }

/* ════════════════════════════════════════════
   MODAL
════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 15, 0.8);
  backdrop-filter: blur(8px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--bg-overlay);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 380px;
  text-align: center;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0,0,0,0.5);
  animation: modalPop 0.25s ease;
}
@keyframes modalPop {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.modal-icon {
  font-size: 28px;
  color: var(--warning);
  margin-bottom: 16px;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.modal-body {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.btn-ghost-modal {
  padding: 9px 24px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-ghost-modal:hover { border-color: var(--border-soft); color: var(--text-primary); }
.btn-danger-modal {
  padding: 9px 24px;
  background: var(--danger);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-danger-modal:hover { background: #ff1f47; box-shadow: 0 0 20px rgba(255,77,109,0.4); }

/* ════════════════════════════════════════════
   UTILITY
════════════════════════════════════════════ */
.hidden { display: none !important; }

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

/* ════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════ */
@media (max-width: 900px) {
  :root { --sidebar-width: 240px; }
}

@media (max-width: 700px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    width: 260px !important;
    min-width: 260px !important;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { width: 100%; }

  .nav-tab span { display: none; }
  .nav-tab { padding: 7px 10px; }

  .chat-messages { padding: 16px; }
  .chat-input-area { padding: 12px 16px; }
  .view { padding: 16px; }

  .history-layout { flex-direction: column; }
  .history-sessions-panel { width: 100%; min-width: unset; max-height: 200px; }

  .notes-layout { flex-direction: column; }
  .notes-list-panel { width: 100%; min-width: unset; max-height: 160px; border-right: none; border-bottom: 1px solid var(--border-subtle); }
}
