/* ============================================================
   OSINT ACADEMY - STYLES
   Clean, modern, light theme. No emojis — SVG icons only.
   ============================================================ */

/* ── CSS Variables ───────────────────────────────── */
:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface-alt: #f8f9fa;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --code-comment: #64748b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --sidebar-w: 280px;
  --header-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', Consolas, 'Courier New', monospace;
  --transition: 0.2s ease;
}

/* Dark mode */
[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-alt: #334155;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #1e3a5f;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --border: #334155;
  --border-strong: #475569;
  --success: #10b981;
  --success-light: #064e3b;
  --warning: #f59e0b;
  --warning-light: #451a03;
  --danger: #ef4444;
  --danger-light: #450a0a;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --code-comment: #64748b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.3);
}

/* ── Reset & Base ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img, svg { display: block; max-width: 100%; }

/* ── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ── Header ──────────────────────────────────────── */
.header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-logo { display: flex; align-items: center; gap: 8px; }
.header-logo svg { width: 28px; height: 28px; }
.header-title { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.header-subtitle { font-size: 12px; color: var(--text-tertiary); font-weight: 400; }
.header-right { display: flex; align-items: center; gap: 16px; }

.header-progress { display: flex; align-items: center; gap: 10px; }
.progress-ring { width: 36px; height: 36px; position: relative; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring .bg-circle { fill: none; stroke: var(--border); stroke-width: 3; }
.progress-ring .fg-circle { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }
.progress-ring .progress-text {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 11px; font-weight: 700; color: var(--text);
}

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: all var(--transition);
}
.icon-btn:hover { background: var(--surface-alt); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  position: fixed; top: var(--header-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto; padding: 12px 0;
  z-index: 50;
}
.sidebar-section { margin-bottom: 4px; }
.sidebar-level-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; cursor: pointer;
  font-weight: 600; font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px;
  transition: all var(--transition);
}
.sidebar-level-header:hover { background: var(--surface-alt); color: var(--text); }
.sidebar-level-header .level-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sidebar-level-header .chevron { margin-left: auto; transition: transform var(--transition); }
.sidebar-level-header .chevron.collapsed { transform: rotate(-90deg); }
.sidebar-level-header .level-progress-mini {
  width: 40px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden;
}
.sidebar-level-header .level-progress-mini-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }

.sidebar-items { overflow: hidden; }
.sidebar-items.collapsed { max-height: 0; }
.sidebar-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px 8px 32px; cursor: pointer;
  font-size: 13.5px; color: var(--text-secondary);
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-item:hover { background: var(--surface-alt); color: var(--text); }
.sidebar-item.active {
  background: var(--primary-light); color: var(--primary);
  border-left-color: var(--primary); font-weight: 600;
}
.sidebar-item .item-number {
  font-size: 11px; color: var(--text-tertiary);
  font-weight: 600; min-width: 28px;
}
.sidebar-item.completed .item-check {
  width: 16px; height: 16px; flex-shrink: 0;
}
.sidebar-item .item-check { width: 16px; height: 16px; flex-shrink: 0; opacity: 0; transition: opacity var(--transition); }
.sidebar-item.completed .item-check { opacity: 1; }
.sidebar-item.completed .item-number { text-decoration: line-through; opacity: 0.5; }

.sidebar-sep { height: 1px; background: var(--border); margin: 8px 16px; }
.sidebar-link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; font-size: 13.5px; color: var(--text-secondary);
  cursor: pointer; transition: all var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-link:hover { background: var(--surface-alt); color: var(--text); }
.sidebar-link.active { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.sidebar-link svg { width: 18px; height: 18px; opacity: 0.6; }

/* ── Main Content ────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  padding: 32px 40px 80px;
  min-height: calc(100vh - var(--header-h));
  max-width: 960px;
}

/* ── Site Footer ─────────────────────────────────── */
.site-footer {
  margin-left: var(--sidebar-w);
  margin-top: 48px;
  background: #e9eef6;
  border-top: 1px solid var(--border-strong);
  padding: 30px 40px 40px;
}
[data-theme="dark"] .site-footer { background: #0b1220; border-top-color: #1e293b; }
.footer-inner { display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 30px; }
.footer-brand { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 10px; letter-spacing: -0.2px; }
.footer-line { font-size: 12.5px; color: #475569; line-height: 1.7; margin-bottom: 9px; }
[data-theme="dark"] .footer-line { color: #94a3b8; }
.footer-line.footer-strong { color: #1e293b; font-weight: 700; }
[data-theme="dark"] .footer-line.footer-strong { color: #e2e8f0; }
.footer-col a { color: var(--primary); }
.footer-bottom {
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border-strong);
  font-size: 12px; color: #64748b;
}
@media (max-width: 760px) { .footer-inner { grid-template-columns: 1fr; gap: 22px; } }

/* ── Breadcrumb ──────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-tertiary); margin-bottom: 16px; }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb .sep { color: var(--text-tertiary); }
.breadcrumb .current { color: var(--text); font-weight: 500; }

/* ── Section Header ──────────────────────────────── */
.section-header { margin-bottom: 24px; }
.section-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.section-number {
  font-size: 12px; font-weight: 700; padding: 3px 8px;
  border-radius: 4px; background: var(--primary-light); color: var(--primary);
}
.section-title { font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; margin-bottom: 8px; }
.section-info { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text-secondary); }
.section-info-item { display: flex; align-items: center; gap: 5px; }
.section-info svg { width: 15px; height: 15px; }

/* ── Content Blocks ──────────────────────────────── */
.content-block { margin-bottom: 16px; }
.content-p { font-size: 15px; color: var(--text); line-height: 1.7; margin-bottom: 14px; }

.callout {
  padding: 14px 16px; border-radius: var(--radius); margin-bottom: 16px;
  border-left: 4px solid; display: flex; gap: 12px; align-items: flex-start;
}
.callout-info { background: var(--primary-light); border-color: var(--primary); }
.callout-warning { background: var(--warning-light); border-color: var(--warning); }
.callout-danger { background: var(--danger-light); border-color: var(--danger); }
.callout svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.callout-info svg { color: var(--primary); }
.callout-warning svg { color: var(--warning); }
.callout-danger svg { color: var(--danger); }
.callout-text { font-size: 14px; color: var(--text); line-height: 1.6; }

.code-block {
  background: var(--code-bg); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 16px;
}
.code-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.code-lang { font-size: 12px; color: var(--code-comment); font-family: var(--font-mono); font-weight: 600; }
.copy-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 4px;
  font-size: 12px; color: var(--code-text); transition: all var(--transition);
  background: rgba(255,255,255,0.05);
}
.copy-btn:hover { background: rgba(255,255,255,0.15); }
.copy-btn svg { width: 14px; height: 14px; }
.copy-btn.copied { color: var(--success); }
.copy-btn.copied svg { color: var(--success); }
.code-block pre {
  padding: 16px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13.5px;
  color: var(--code-text); line-height: 1.6;
}

/* ── Video Cards ─────────────────────────────────── */
.videos-grid { display: grid; gap: 12px; margin-bottom: 24px; }
.video-card {
  display: flex; gap: 12px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); transition: all var(--transition);
}
.video-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.video-thumb {
  width: 80px; height: 80px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: var(--surface-alt); display: flex; align-items: center; justify-content: center;
}
.video-thumb svg { width: 32px; height: 32px; color: var(--danger); }
.video-info { flex: 1; min-width: 0; }
.video-channel { font-size: 13px; font-weight: 600; color: var(--primary); margin-bottom: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.video-badge { font-size: 10.5px; font-weight: 600; color: var(--text-secondary); border: 1px solid var(--border); padding: 1px 7px; border-radius: 999px; letter-spacing: 0.2px; }
.video-title { font-size: 14px; color: var(--text); margin-bottom: 4px; font-weight: 500; }
.video-note { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.video-link { font-size: 12px; color: var(--primary); display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; }
.video-link svg { width: 13px; height: 13px; }

/* ── Shortcuts ───────────────────────────────────── */
.shortcuts-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 24px; }
@media (min-width: 700px) { .shortcuts-grid { grid-template-columns: 1fr 1fr; } }

.shortcut-card {
  padding: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: all var(--transition);
  display: flex; gap: 12px; align-items: flex-start;
}
.shortcut-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); transform: translateY(-1px); }
.shortcut-icon { width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.shortcut-icon svg { width: 18px; height: 18px; }
.shortcut-icon.link { background: var(--primary-light); }
.shortcut-icon.link svg { color: var(--primary); }
.shortcut-icon.install { background: var(--success-light); }
.shortcut-icon.install svg { color: var(--success); }
.shortcut-icon.uninstall { background: var(--danger-light); }
.shortcut-icon.uninstall svg { color: var(--danger); }
.shortcut-icon.copy { background: var(--warning-light); }
.shortcut-icon.copy svg { color: var(--warning); }
.shortcut-body { flex: 1; min-width: 0; }
.shortcut-label { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.shortcut-desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }

.shortcut-code {
  margin-top: 10px; display: none;
}
.shortcut-code.show { display: block; }
.shortcut-code .code-block { margin-bottom: 0; }

/* ── Tools Table ─────────────────────────────────── */
.tools-section { margin-bottom: 24px; }
.tools-section-title {
  font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.tools-section-title svg { width: 18px; height: 18px; color: var(--text-secondary); }

.tool-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 6px; transition: all var(--transition);
}
.tool-row:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.tool-name { font-weight: 600; font-size: 14px; color: var(--text); min-width: 120px; }
.tool-name a { color: var(--text); }
.tool-name a:hover { color: var(--primary); }
.tool-desc { font-size: 13px; color: var(--text-secondary); flex: 1; }
.tool-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tool-type { font-size: 11px; color: var(--text-tertiary); padding: 2px 8px; background: var(--surface-alt); border-radius: 4px; }
.badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px; white-space: nowrap;
}
.badge-free { background: var(--success-light); color: var(--success); }
.badge-freemium { background: var(--warning-light); color: var(--warning); }
.badge-paid { background: var(--danger-light); color: var(--danger); }
.tool-stars { font-size: 12px; color: var(--text-tertiary); font-family: var(--font-mono); }

/* ── Section Divider ──────────────────────────────── */
.section-divider {
  height: 1px; background: var(--border); margin: 32px 0;
}

/* ── Complete Button ──────────────────────────────── */
.complete-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 32px; padding: 16px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); gap: 16px;
}
.complete-bar.completed { background: var(--success-light); border-color: var(--success); }
.complete-info { flex: 1; }
.complete-status { font-size: 14px; font-weight: 600; color: var(--text); }
.complete-bar.completed .complete-status { color: var(--success); }
.complete-hint { font-size: 12.5px; color: var(--text-secondary); }

.btn {
  padding: 8px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  transition: all var(--transition); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.1); }
.btn-outline { border: 1px solid var(--border-strong); color: var(--text); background: var(--surface); }
.btn-outline:hover { background: var(--surface-alt); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

/* ── Dashboard ───────────────────────────────────── */
.dashboard-hero {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.dashboard-hero::before {
  content: ''; position: absolute; top: 0; right: 0; width: 200px; height: 200px;
  background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
  opacity: 0.5; pointer-events: none;
}
.dashboard-title { font-size: 32px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; margin-bottom: 8px; }
.dashboard-subtitle { font-size: 16px; color: var(--text-secondary); margin-bottom: 24px; max-width: 500px; }
.dashboard-stats { display: flex; gap: 24px; flex-wrap: wrap; }
.stat-card {
  flex: 1; min-width: 140px; padding: 16px;
  background: var(--surface-alt); border-radius: var(--radius);
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.dashboard-levels { display: grid; gap: 16px; }
@media (min-width: 800px) { .dashboard-levels { grid-template-columns: 1fr 1fr 1fr; } }
.level-card {
  padding: 20px; border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--surface); transition: all var(--transition); cursor: pointer;
}
.level-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.level-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.level-card-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.level-card-icon svg { width: 22px; height: 22px; color: #fff; }
.level-card-title { font-size: 18px; font-weight: 700; color: var(--text); }
.level-card-subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.level-card-progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.level-card-progress-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.level-card-stats { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); }
.level-card-stats .completed-count { font-weight: 600; color: var(--text); }

/* ── Tools Directory Page ────────────────────────── */
.tools-dir-header { margin-bottom: 24px; }
.tools-dir-title { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.tools-dir-subtitle { font-size: 15px; color: var(--text-secondary); }
.tools-filter {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px;
}
.filter-chip {
  padding: 6px 14px; border-radius: 20px; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer; transition: all var(--transition);
}
.filter-chip:hover { border-color: var(--border-strong); color: var(--text); }
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.tools-dir-category { margin-bottom: 28px; }
.tools-dir-cat-title {
  font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 2px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}

/* ── YouTube Channels Page ───────────────────────── */
.channels-grid { display: grid; gap: 12px; }
@media (min-width: 600px) { .channels-grid { grid-template-columns: 1fr 1fr; } }
.channel-card {
  padding: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); transition: all var(--transition);
}
.channel-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.channel-name { font-size: 14px; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.channel-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; line-height: 1.5; }
.channel-level { font-size: 11px; color: var(--text-tertiary); }

/* ── Settings Page ───────────────────────────────── */
.settings-section {
  padding: 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px;
}
.settings-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.settings-label { font-size: 14px; color: var(--text); }
.settings-desc { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }

.toggle { position: relative; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border-strong); border-radius: 24px; transition: var(--transition);
}
.toggle-slider::before {
  content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Toast ───────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px; z-index: 1000;
  font-size: 14px; color: var(--text); opacity: 0;
  transform: translateY(10px); transition: all 0.3s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast svg { width: 18px; height: 18px; }
.toast-success svg { color: var(--success); }

/* ── Resources Grid ──────────────────────────────── */
.resources-grid { display: grid; gap: 12px; }
@media (min-width: 600px) { .resources-grid { grid-template-columns: 1fr 1fr; } }
.resource-card {
  padding: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); transition: all var(--transition);
}
.resource-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.resource-name { font-size: 14px; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.resource-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; width: 280px; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 20px; }
  .site-footer { padding: 26px 20px 36px; }
  .mobile-menu-btn { display: flex !important; }
}
.mobile-menu-btn { display: none; }

/* ── Animations ──────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease; }

@keyframes slideDown { from { max-height: 0; opacity: 0; } to { max-height: 2000px; opacity: 1; } }
.slide-down { animation: slideDown 0.3s ease; overflow: hidden; }

/* ════════════════════════════════════════════════════
   AI ASSISTANT
   ════════════════════════════════════════════════════ */
.ai-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 20px;
}
.ai-title { font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; }
.ai-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 4px; max-width: 480px; }

.ai-settings {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: none;
}
.ai-settings.open { display: block; }
.ai-foot-note { font-size: 12.5px; color: var(--text-tertiary); margin-top: 10px; text-align: center; }

/* ════════════════════════════════════════════════════
   FLOATING AI ASSISTANT (FAB)
   ════════════════════════════════════════════════════ */
.fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 200;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff; border: none; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(37, 99, 235, .42);
  transition: transform .18s ease, box-shadow .18s ease;
}
.fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 30px rgba(37, 99, 235, .55); }
.fab svg { width: 26px; height: 26px; }
.fab-panel {
  position: fixed; right: 22px; bottom: 90px; z-index: 200;
  width: 400px; max-width: calc(100vw - 32px);
  height: min(620px, calc(100vh - 120px));
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
  display: flex; flex-direction: column; overflow: hidden;
}
.fab-panel[hidden] { display: none; }
.fab-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-alt);
}
.fab-title { font-size: 14px; font-weight: 700; color: var(--text); }
.fab-head-actions { display: flex; gap: 6px; }
.fab-icon {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-secondary); cursor: pointer;
  display: grid; place-items: center;
}
.fab-icon:hover { color: var(--primary); border-color: var(--primary); }
.fab-icon svg { width: 16px; height: 16px; }
.fab-body { flex: 1; overflow-y: auto; padding: 14px; }
.fab-body .ai-settings { margin-bottom: 14px; }
.fab-subhead { margin-bottom: 10px; }
.fab-back { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; color: var(--primary); font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; }
.fab-back svg { width: 15px; height: 15px; }
.fab-empty { text-align: center; padding: 16px 8px 20px; display: grid; gap: 12px; justify-items: center; }
.fab-empty-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--primary-light); display: grid; place-items: center; color: var(--primary); }
.fab-empty-icon svg { width: 26px; height: 26px; }
.fab-empty p { font-size: 13.5px; color: var(--text-secondary); }
.fab-body .ai-chat { border-radius: var(--radius); padding: 14px; min-height: 240px; max-height: none; margin-bottom: 12px; }
.fab-body .ai-msg { max-width: 100%; }
.fab-body .ai-bubble { font-size: 13.5px; }
.fab-body .ai-input-area textarea { font-size: 15px; }

/* ════════════════════════════════════════════════════
   MOBILE (semua halaman)
   ════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .main { padding: 16px 14px 64px; }
  .header { padding: 0 14px; }
  .header-title { font-size: 16px; }
  .header-subtitle { display: none; }
  .dashboard-title { font-size: 26px !important; }
  .dashboard-subtitle { font-size: 14px !important; }
  .section-title, .page-title { font-size: 22px; }
  .dashboard-levels, .shortcuts-grid, .videos-grid, .channels-grid, .resources-grid, .videos-grid { grid-template-columns: 1fr !important; }
  .tool-row, .video-card, .shortcut-card, .channel-card, .resource-card { flex-direction: column; align-items: flex-start; }
  .tool-row > * { width: 100%; }
  .code-block, pre, .post-body pre { overflow-x: auto; max-width: 100%; }
  .content-code, .ai-code { overflow-x: auto; }
  table, .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .fab { right: 14px; bottom: 14px; width: 52px; height: 52px; }
  .fab-panel {
    right: 0; left: 0; bottom: 0; width: 100%; max-width: 100%;
    height: 90vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .ai-header { flex-direction: column; align-items: stretch; }
  .ai-title { font-size: 22px; }
  .ai-chat { padding: 14px; min-height: 300px; max-height: 52vh; }
  .ai-msg { max-width: 100%; }
  .ai-settings { padding: 14px; }
  .ai-config-row input, .ai-config-row select, .ai-config-row textarea { font-size: 16px; }
  .ai-help-steps { margin-left: 18px; font-size: 12.5px; }
  .footer-inner { gap: 18px; }
}
.ai-settings-inner { display: grid; gap: 20px; }

/* ── AI Help: panduan mendapatkan API key ────────── */
.ai-help { background: var(--primary-light); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 16px; }
.ai-help summary { cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--primary-hover); list-style: none; display: flex; align-items: center; gap: 9px; }
.ai-help summary::-webkit-details-marker { display: none; }
.ai-help summary::before { content: '?'; display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.ai-help[open] summary { margin-bottom: 12px; }
.ai-help-steps { margin: 0 0 10px 22px; font-size: 13px; color: var(--text); line-height: 1.75; }
.ai-help-steps li { margin-bottom: 6px; }
.ai-help-steps code { background: var(--surface); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; font-family: var(--font-mono); }
.ai-help-note { font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; }
.ai-config-section {
  padding: 16px; background: var(--surface-alt); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.ai-config-section-title {
  font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.ai-config-section-title svg { width: 18px; height: 18px; color: var(--primary); }
.ai-config-row { margin-bottom: 12px; }
.ai-config-row:last-child { margin-bottom: 0; }
.ai-config-row label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.ai-config-row input, .ai-config-row select, .ai-config-row textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font-size: 14px; font-family: var(--font); transition: border-color var(--transition);
  resize: vertical;
}
.ai-config-row input:focus, .ai-config-row select:focus, .ai-config-row textarea:focus {
  outline: none; border-color: var(--primary);
}
.ai-hint { display: block; font-size: 11.5px; color: var(--text-tertiary); margin-top: 4px; line-height: 1.4; }

.ai-settings-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ai-test-result { margin-top: 10px; }
.ai-test-msg { font-size: 13px; padding: 8px 12px; border-radius: var(--radius-sm); }
.ai-test-ok { background: var(--success-light); color: var(--success); }
.ai-test-error { background: var(--danger-light); color: var(--danger); }

.ai-chat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  min-height: 400px; max-height: 60vh; overflow-y: auto;
  margin-bottom: 16px; display: flex; flex-direction: column; gap: 16px;
}
.ai-msg { display: flex; gap: 10px; max-width: 92%; }
.ai-msg-user { align-self: flex-end; flex-direction: row-reverse; }
.ai-msg-ai { align-self: flex-start; }
.ai-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary-light); display: flex; align-items: center; justify-content: center;
}
.ai-avatar svg { width: 18px; height: 18px; color: var(--primary); }
.ai-bubble {
  padding: 12px 16px; border-radius: 14px; font-size: 14.5px; line-height: 1.65;
  color: var(--text); word-wrap: break-word; overflow-wrap: anywhere;
}
.ai-msg-ai .ai-bubble { background: var(--surface-alt); border: 1px solid var(--border); border-top-left-radius: 4px; }
.ai-msg-user .ai-bubble { background: var(--primary); color: #fff; border-top-right-radius: 4px; }
.ai-msg-user .ai-bubble code, .ai-msg-user .ai-bubble pre { color: #fff; }
.ai-code {
  background: var(--code-bg); color: var(--code-text); padding: 12px;
  border-radius: var(--radius-sm); overflow-x: auto; font-family: var(--font-mono);
  font-size: 13px; margin: 8px 0; line-height: 1.5;
}
.ai-inline-code {
  background: var(--surface-alt); color: var(--primary); padding: 1px 6px;
  border-radius: 4px; font-family: var(--font-mono); font-size: 13px;
}
.ai-msg-user .ai-bubble .ai-inline-code { background: rgba(255,255,255,0.2); color: #fff; }

.ai-typing { display: inline-flex; gap: 4px; align-items: center; }
.ai-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-tertiary);
  animation: typingBounce 1.2s infinite ease-in-out;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

.ai-input-area {
  display: flex; gap: 10px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px; box-shadow: var(--shadow-sm);
}
.ai-input-area textarea {
  flex: 1; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 14.5px; font-family: var(--font); color: var(--text);
  resize: none; max-height: 120px; min-height: 42px; line-height: 1.5;
  background: var(--surface);
}
.ai-input-area textarea:focus { outline: none; border-color: var(--primary); }
.ai-send { flex-shrink: 0; height: 42px; padding: 0 16px; }
.ai-send:disabled { cursor: not-allowed; }
