/* ═══════════════════════════════════════════════════════════════════════
   DeepDive — Aurora Design System (Emil Kowalski Philosophy)
   ═══════════════════════════════════════════════════════════════════════

   Design Principles:
   • Taste is trained, not innate — every detail compounds
   • Beauty is leverage — people select tools by experience
   • Unseen details — no one notices individually, everyone feels it together
   
   Color: Aurora Purple (#7c5cff) + Mint (#16d99a) dual accent
   Layout: Sidebar (Desktop) / Bottom Nav (Mobile)
   ═══════════════════════════════════════════════════════════════════════ */

/* ═══ Custom Easing Curves ═══════════════════════════════════════════ */
:root {
  --accent: #7c5cff;
  --accent-2: #16d99a;
  --accent-grad: linear-gradient(135deg, #7c5cff 0%, #16d99a 100%);
  --accent-grad-2: linear-gradient(135deg, #9333ea 0%, #06b6d4 100%);
  
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  
  --bg: #070b14;
  --bg-alt: #0c1225;
  --surface: rgba(20, 26, 43, 0.85);
  --surface-solid: #141a2b;
  --surface-hover: rgba(30, 38, 60, 0.9);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --nav-w: 232px;
  --bottomnav-h: 60px;
  --topbar-h: 56px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
}

/* ═══ Light Theme ════════════════════════════════════════════════════ */
[data-theme="light"] {
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --surface: rgba(255, 255, 255, 0.85);
  --surface-solid: #ffffff;
  --surface-hover: rgba(241, 245, 249, 0.9);
  --border: rgba(0, 0, 0, 0.06);
  --border-hover: rgba(0, 0, 0, 0.12);
  --text: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: 'Lexend', 'Inter', sans-serif;
  font-weight: 600;
  line-height: 1.3;
}

/* ═══ Ambient Background ═════════════════════════════════════════════ */
body::before {
  content: '';
  position: fixed;
  top: -40%;
  left: -20%;
  width: 80%;
  height: 80%;
  background: radial-gradient(ellipse at center, rgba(124, 92, 255, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -30%;
  right: -20%;
  width: 70%;
  height: 70%;
  background: radial-gradient(ellipse at center, rgba(22, 217, 154, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ═══ Sidebar Layout ═════════════════════════════════════════════════ */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--nav-w);
  height: 100vh;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.sidebar-brand-text {
  font-family: 'Lexend', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 150ms var(--ease-out);
  position: relative;
}

.sidebar-link:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.sidebar-link.active {
  color: #a78bfa;
  background: rgba(124, 92, 255, 0.1);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent-grad);
  border-radius: 0 3px 3px 0;
}

.sidebar-link-icon {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-footer-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  background: none;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 150ms var(--ease-out);
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.sidebar-footer-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}

/* ── Main Content Area ── */
.app-content {
  flex: 1;
  margin-left: var(--nav-w);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.content-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 32px 80px;
}

/* ── Top Bar (Mobile) ── */
.topbar {
  display: none;
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 40;
}

.topbar-brand {
  font-family: 'Lexend', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar-spacer {
  flex: 1;
}

/* ── Bottom Nav (Mobile) ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottomnav-h);
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 50;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
}

.bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  transition: all 150ms var(--ease-out);
  min-width: 60px;
}

.bottom-nav-link:hover {
  color: var(--text);
}

.bottom-nav-link.active {
  color: #a78bfa;
}

.bottom-nav-icon {
  font-size: 1.2rem;
}

/* ═══ Glass Card System ══════════════════════════════════════════════ */
.glass-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform 200ms var(--ease-out),
              box-shadow 200ms var(--ease-out),
              border-color 200ms var(--ease-out);
  will-change: transform;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(124, 92, 255, 0.06);
  border-color: rgba(124, 92, 255, 0.15);
}

.glass-card-static {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ═══ Buttons — Press Feedback ══════════════════════════════════════ */
button, .btn, a[class*="btn"], a[class*="button"],
input[type="submit"], input[type="button"] {
  transition: transform 120ms var(--ease-out),
              background-color 200ms var(--ease-out),
              box-shadow 200ms var(--ease-out);
  will-change: transform;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  border: none;
  font-family: inherit;
}

button:active:not(:disabled):not(.no-press),
.btn:active:not(:disabled):not(.no-press) {
  transform: scale(0.97);
}

button:disabled, .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--accent-grad);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(124, 92, 255, 0.3);
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.9rem;
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.08);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
}

.btn-icon:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* ═══ Form Elements ══════════════════════════════════════════════════ */
.input-field {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 200ms var(--ease-out),
              box-shadow 200ms var(--ease-out);
  outline: none;
}

.input-field:focus {
  border-color: rgba(124, 92, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.1);
}

.input-field::placeholder {
  color: var(--text-dim);
}

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

/* ═══ Nav Link Underline Reveal ══════════════════════════════════════ */
.nav-underline {
  position: relative;
  text-decoration: none;
  transition: color 200ms var(--ease-out);
}

.nav-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-grad);
  transition: width 200ms var(--ease-out);
  border-radius: 1px;
}

.nav-underline:hover::after {
  width: 100%;
}

/* ═══ Gradient Text ══════════════════════════════════════════════════ */
.gradient-text {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ═══ Hero Section ═══════════════════════════════════════════════════ */
.hero-section {
  text-align: center;
  padding: 48px 0 32px;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

/* ═══ Stats Bar ══════════════════════════════════════════════════════ */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 20px 0;
  margin-bottom: 32px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-family: 'Lexend', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ═══ Input Group (URL + Format + Button) ═══════════════════════════ */
.input-group {
  display: flex;
  gap: 8px;
  max-width: 700px;
  margin: 0 auto;
}

.input-group .input-field {
  flex: 1;
}

.format-select {
  width: 140px;
  flex-shrink: 0;
}

/* ═══ Recent Videos Grid ═════════════════════════════════════════════ */
.section-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

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

/* ═══ History Card Grid ══════════════════════════════════════════════ */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.history-card {
  cursor: pointer;
  overflow: hidden;
}

.history-card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.history-card-body {
  padding: 14px;
}

.history-card-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

/* ═══ Format Badges ══════════════════════════════════════════════════ */
.format-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.format-badge.standard { background: rgba(99,102,241,0.12); color: #818cf8; }
.format-badge.blinkist { background: rgba(59,130,246,0.12); color: #60a5fa; }
.format-badge.tutorial { background: rgba(249,115,22,0.12); color: #fb923c; }
.format-badge.finanzen { background: rgba(16,185,129,0.12); color: #34d399; }
.format-badge.news     { background: rgba(239,68,68,0.12); color: #f87171; }
.format-badge.newsletter { background: rgba(168,85,247,0.12); color: #c084fc; }
.format-badge.rezept   { background: rgba(34,197,94,0.12); color: #4ade80; }

/* ═══ Status Badges ══════════════════════════════════════════════════ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.completed {
  background: rgba(22, 217, 154, 0.1);
  color: #34d399;
  border: 1px solid rgba(22, 217, 154, 0.2);
}

.status-badge.processing {
  background: rgba(124, 92, 255, 0.1);
  color: #a78bfa;
  border: 1px solid rgba(124, 92, 255, 0.2);
  animation: pulse-dot 1.5s var(--ease-in-out) infinite;
}

.status-badge.error {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ═══ Action Cards Grid ═══════════════════════════════════════════════ */
.action-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.action-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out), border-color 200ms var(--ease-out);
}

.action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(124, 92, 255, 0.06);
  border-color: rgba(124, 92, 255, 0.15);
}

.action-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.action-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ═══ Audio Player ═══════════════════════════════════════════════════ */
.audio-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.audio-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c5cff, #16d99a);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: transform 120ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.audio-btn:hover {
  box-shadow: 0 4px 20px rgba(124, 92, 255, 0.3);
}

.audio-btn:active {
  transform: scale(0.93);
}

.audio-progress {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  transition: height 150ms var(--ease-out);
}

.audio-progress:hover {
  height: 8px;
}

.audio-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c5cff, #16d99a);
  border-radius: 3px;
  transition: width 100ms linear;
  position: relative;
}

.audio-progress-fill::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #16d99a;
  opacity: 0;
  transition: opacity 150ms var(--ease-out);
  box-shadow: 0 0 8px rgba(22, 217, 154, 0.4);
}

.audio-progress:hover .audio-progress-fill::after {
  opacity: 1;
}

.audio-time {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-variant-numeric: tabular-nums;
  min-width: 80px;
  text-align: right;
  flex-shrink: 0;
}

/* ═══ Download Grid ══════════════════════════════════════════════════ */
.downloads-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.download-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 150ms var(--ease-out);
}

.download-btn.pdf { background: rgba(239,68,68,0.1); color: #f87171; }
.download-btn.pdf:hover { background: rgba(239,68,68,0.2); }
.download-btn.html { background: rgba(249,115,22,0.1); color: #fb923c; }
.download-btn.html:hover { background: rgba(249,115,22,0.2); }
.download-btn.preview { background: var(--surface-hover); color: var(--text-muted); }
.download-btn.preview:hover { color: var(--text); background: rgba(255,255,255,0.08); }

/* ═══ Mindmap Container ══════════════════════════════════════════════ */
.mindmap-container {
  max-height: 280px;
  overflow: auto;
  border-radius: var(--radius-sm);
}

.mindmap-container svg {
  max-width: 100%;
  height: auto;
}

/* ═══ Tools Grid ═════════════════════════════════════════════════════ */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 150ms var(--ease-out);
}

.tool-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

/* ═══ Bento Grid (Result) ════════════════════════════════════════════ */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.bento-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  animation: card-enter 300ms var(--ease-out);
}

.bento-card.span-2 {
  grid-column: span 2;
}

.bento-card-header {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: var(--text);
}

.bento-card-body {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.bento-card-body p {
  margin-bottom: 8px;
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══ Stats Card (Video Header) ══════════════════════════════════════ */
.video-header-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}

/* ═══ Chat Panel (Floating) ══════════════════════════════════════════ */
#chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c5cff, #16d99a);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: 90;
  box-shadow: 0 4px 24px rgba(124, 92, 255, 0.3);
  cursor: pointer;
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

#chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(124, 92, 255, 0.4);
}

#chat-fab:active {
  transform: scale(0.95);
}

#chat-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid var(--bg);
  animation: pulse-dot 2s ease-in-out infinite;
}

#chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 91;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms var(--ease-out);
}

#chat-overlay.open {
  opacity: 1;
  pointer-events: all;
}

#chat-panel {
  position: fixed;
  bottom: 0;
  right: 24px;
  width: 380px;
  max-height: 580px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 92;
  display: flex;
  flex-direction: column;
  transform: translateY(calc(100% + 40px));
  transition: transform 350ms var(--ease-drawer);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.3);
}

#chat-panel.open {
  transform: translateY(0);
}

.chat-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
}

.chat-panel-header .spacer { flex: 1; }

.chat-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
  max-height: 350px;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 85%;
  font-size: 0.85rem;
  line-height: 1.5;
  animation: chat-enter 200ms var(--ease-out);
}

@keyframes chat-enter {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-bubble.user {
  background: linear-gradient(135deg, #7c5cff, #6d4aff);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.chat-bubble.ai {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-panel-footer {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
  transition: border-color 200ms var(--ease-out);
}

.chat-input:focus {
  border-color: rgba(124, 92, 255, 0.4);
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-thinking {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chat-thinking span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: thinking-bounce 1.2s ease-in-out infinite;
}

.chat-thinking span:nth-child(2) { animation-delay: 0.2s; }
.chat-thinking span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinking-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ═══ Pipeline Progress ══════════════════════════════════════════════ */
.pipeline-progress-fill {
  transition: width 500ms var(--ease-out);
}

/* ═══ Sort/Filter Pills ══════════════════════════════════════════════ */
.pill-group {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 4px;
  border: 1px solid var(--border);
}

.pill {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: all 150ms var(--ease-out);
  text-decoration: none;
  border: none;
  font-family: inherit;
}

.pill:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.pill.active {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.15), rgba(22, 217, 154, 0.1));
  color: #a78bfa;
}

/* ═══ Toast Container ════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: toast-in 250ms var(--ease-spring);
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 360px;
}

.toast.removing {
  animation: toast-out 200ms var(--ease-out) forwards;
}

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

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

/* ═══ Skeleton Loading ═══════════════════════════════════════════════ */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* ═══ Modal / ELI5 ═══════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 200ms var(--ease-out);
}

.modal-content {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 520px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: scale-in 250ms var(--ease-spring);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ═══ Spinner ════════════════════════════════════════════════════════ */
@keyframes spin-smooth {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-spin-smooth {
  animation: spin-smooth 1s linear infinite;
}

/* ═══ Empty State ════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.empty-state-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ═══ Settings Page ══════════════════════════════════════════════════ */
.settings-section {
  margin-bottom: 28px;
}

.settings-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.settings-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ═══ Back Link ══════════════════════════════════════════════════════ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 16px;
  transition: color 150ms var(--ease-out);
}

.back-link:hover {
  color: #a78bfa;
}

/* ═══ Scrollbar ══════════════════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* ═══ Print Styles ═══════════════════════════════════════════════════ */
@media print {
  .sidebar, .bottom-nav, .topbar, #chat-fab, #chat-panel, #chat-overlay,
  button, .btn, .download-btn, .tool-btn, #toast-container { display: none !important; }
  .app-content { margin-left: 0 !important; }
  .glass-card, .action-card, .bento-card, .video-header-card { 
    background: white !important; 
    color: black !important; 
    border-color: #ddd !important;
  }
}

/* ═══ Reduced Motion ═════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══ Responsive ═════════════════════════════════════════════════════ */

/* Tablet: Sidebar shrinks */
@media (max-width: 1024px) {
  .action-cards-grid { grid-template-columns: repeat(2, 1fr); }
  .bento-grid { grid-template-columns: 1fr; }
  .bento-card.span-2 { grid-column: span 1; }
}

/* Mobile: Sidebar → Bottom Nav */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .topbar { display: flex; }
  .bottom-nav { display: flex; }
  .app-content { margin-left: 0; }
  .content-inner { 
    padding: 16px 16px calc(var(--bottomnav-h) + 16px); 
  }
  
  .hero-title { font-size: 1.8rem; }
  .hero-subtitle { font-size: 0.95rem; }
  
  .input-group { flex-direction: column; }
  .format-select { width: 100%; }
  
  .action-cards-grid { grid-template-columns: 1fr; }
  .stats-bar { gap: 16px; flex-wrap: wrap; }
  
  .history-grid { grid-template-columns: 1fr; }
  
  .settings-grid { grid-template-columns: 1fr; }
  
  #chat-panel {
    right: 0;
    width: 100%;
    max-height: 80vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  
  #chat-fab {
    bottom: calc(var(--bottomnav-h) + 16px);
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .content-inner { padding: 12px 12px calc(var(--bottomnav-h) + 12px); }
  .hero-title { font-size: 1.5rem; }
  .hero-section { padding: 24px 0; }
  .recent-grid { grid-template-columns: 1fr; }
}
