/* ============================================================
   AgilePoint Hub — Design System
   Enterprise Dark | AgilePoint Blue | Poppins
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- View Transitions (cross-page nav animation) ---------- */
@view-transition {
  navigation: auto;
}

/* Navbar morphs as a named element — active pill slides between pages.
   contain:layout style prevents the browser from re-snapshotting layout
   children, which is what makes the active indicator appear to slide. */
.navbar {
  view-transition-name: main-nav;
  contain: layout style;
}

/* Keep the navbar transition crisp — default cross-fade is too slow */
::view-transition-old(main-nav),
::view-transition-new(main-nav) {
  animation-duration: 200ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  mix-blend-mode: normal;
}

/* Page body: subtle fade + upward drift */
::view-transition-old(root) {
  animation: 160ms ease-out both fade-out-vt;
}
::view-transition-new(root) {
  animation: 200ms ease-in both fade-in-vt;
}

@keyframes fade-out-vt {
  to { opacity: 0; }
}
@keyframes fade-in-vt {
  from { opacity: 0; transform: translateY(6px); }
}

/* ---------- Design Tokens ---------- */
:root {
  /* Colors — AgilePoint brand palette */
  --color-primary: #0077D9;
  --color-primary-light: #1A8FE8;
  --color-primary-glow: rgba(0, 119, 217, 0.35);
  --color-accent: #00C2E0;
  --color-accent-glow: rgba(0, 194, 224, 0.25);
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-danger: #EF4444;

  /* Backgrounds — deep navy, AgilePoint-style */
  --bg-base: #060D1A;
  --bg-surface: #0D1829;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --bg-glass-strong: rgba(255, 255, 255, 0.09);
  --bg-input: rgba(255, 255, 255, 0.06);

  /* Text */
  --text-primary: #F0F6FF;
  --text-secondary: #B8C9E0;
  --text-muted: #5A7A9E;
  --text-disabled: #2D4060;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-card: rgba(0, 119, 217, 0.15);
  --border-accent: rgba(0, 119, 217, 0.40);
  --border-focus: rgba(0, 119, 217, 0.70);

  /* Sizing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Spacing */
  --nav-height: 68px;
  --sidebar-width: 280px;
  --content-max: 1200px;

  /* Shadows */
  --shadow-sm: 0 1px 8px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.6);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.7);
  --shadow-primary: 0 4px 32px rgba(0, 119, 217, 0.30);
  --shadow-accent: 0 4px 24px rgba(0, 194, 224, 0.20);

  /* Transitions */
  --ease-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --ease-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --ease-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Hex grid background texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100'%3E%3Cpath d='M28 66L0 50V16L28 0l28 16v34L28 66zm0-6l22-12.7V22.7L28 10 6 22.7v24.6L28 60z' fill='none' stroke='rgba(0%2C119%2C217%2C0.05)' stroke-width='1'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 1;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
ul { list-style: none; }

::selection { background: var(--color-primary-glow); color: var(--text-primary); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--border-card); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-primary); }

/* ---------- Background Gradient Orbs ---------- */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.bg-orbs::before {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  top: -200px; left: -150px;
  background: radial-gradient(circle, rgba(0,119,217,0.14) 0%, transparent 70%);
  animation: orbFloat 20s ease-in-out infinite;
}
.bg-orbs::after {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  bottom: -100px; right: -100px;
  background: radial-gradient(circle, rgba(0,194,224,0.09) 0%, transparent 70%);
  animation: orbFloat 25s ease-in-out infinite reverse;
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ---------- Layout Wrappers ---------- */
.page-wrapper { position: relative; z-index: 1; }
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 24px; }
.container-wide { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

/* ---------- Navigation — Tubelight Pill ---------- */
.navbar {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  min-width: 480px;
  max-width: calc(100% - 48px);
  height: var(--nav-height);
  background: rgba(6, 13, 26, 0.75);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(0, 119, 217, 0.18);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 20px;
  z-index: 1000;
  box-shadow: 0 4px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.03), inset 0 1px 0 rgba(255,255,255,0.06);
  transition: background var(--ease-normal), box-shadow var(--ease-normal);
  gap: 8px;
}
.navbar.scrolled {
  background: rgba(6, 13, 26, 0.92);
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}
/* Used in footer logo + login page header */
.nav-logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-primary);
  flex-shrink: 0;
}
.nav-logo-icon svg { width: 18px; height: 18px; fill: white; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  padding: 4px;
}

/* Icon-only nav links that expand on hover */
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  font-size: 0.855rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  z-index: 1;
  overflow: hidden;
  /* Width driven by icon only; label expands in */
  transition: color var(--ease-fast), padding var(--ease-fast);
}
.nav-link svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-link .nav-label {
  display: inline-block;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-width 220ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity   160ms ease,
    margin    220ms cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: 0;
}
.nav-link:hover .nav-label,
.nav-link.active .nav-label {
  max-width: 80px;
  opacity: 1;
  margin-left: 6px;
}
.nav-link:hover svg,
.nav-link.active svg {
  transform: translateX(-1px);
}
.nav-link:hover { color: var(--text-secondary); }
.nav-link.active { color: var(--text-primary); }

/* Tubelight active indicator */
.nav-link.active::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: rgba(0, 119, 217, 0.18);
  z-index: -1;
}
/* The glow lamp above the active link */
.nav-link.active::after {
  content: '';
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 0 0 var(--radius-full) var(--radius-full);
  box-shadow:
    0 0 8px 2px rgba(0, 119, 217, 0.7),
    0 0 20px 4px rgba(0, 119, 217, 0.35),
    0 0 40px 8px rgba(0, 119, 217, 0.15);
  z-index: 2;
}

.nav-cta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Logout button — icon-only, sits left of hamburger */
.nav-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--ease-fast), color var(--ease-fast);
  flex-shrink: 0;
}
.nav-logout:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}
.nav-logout svg {
  width: 18px;
  height: 18px;
}

/* Mobile menu sign-out button */
.nav-mobile-logout {
  width: 100%;
  margin-top: 8px;
  padding: 12px 16px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--ease-fast);
  text-align: center;
}
.nav-mobile-logout:hover {
  background: rgba(239, 68, 68, 0.15);
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border-radius: var(--radius-full);
  transition: background var(--ease-fast);
}
.nav-hamburger:hover { background: var(--bg-glass); }
.nav-hamburger span {
  display: block;
  width: 20px; height: 2px;
  background: var(--text-secondary);
  border-radius: var(--radius-full);
  transition: transform var(--ease-normal), opacity var(--ease-normal);
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-mobile-menu {
  display: none;
  position: fixed;
  top: calc(var(--nav-height) + 20px);
  left: 24px; right: 24px;
  background: rgba(17, 24, 39, 0.96);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  z-index: 999;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-lg);
  animation: slideDown var(--ease-spring) forwards;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
.nav-mobile-menu.open { display: flex; }
.nav-mobile-menu .nav-link { padding: 12px 16px; font-size: 0.95rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--ease-normal);
  cursor: pointer;
  border: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity var(--ease-fast);
}
.btn:hover::after { opacity: 0.06; }
.btn:active::after { opacity: 0.12; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover { box-shadow: 0 6px 40px rgba(0, 119, 217, 0.45); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

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

.btn-accent {
  background: linear-gradient(135deg, var(--color-accent), #0097B2);
  color: white;
  box-shadow: var(--shadow-accent);
}
.btn-accent:hover { box-shadow: 0 6px 32px rgba(0, 194, 224, 0.35); transform: translateY(-1px); }

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

.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-icon { padding: 10px; }

/* ---------- Cards — Spotlight + Glow ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background var(--ease-normal), border-color var(--ease-normal), transform var(--ease-normal), box-shadow var(--ease-normal);
  position: relative;
  overflow: hidden;
}

/* Spotlight mouse-tracking glow border */
.card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(
    400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(0, 119, 217, 0.25),
    transparent 60%
  );
  opacity: 0;
  transition: opacity var(--ease-normal);
  pointer-events: none;
  z-index: 0;
}
.card:hover::before { opacity: 1; }

/* Inner surface stays above spotlight */
.card > * { position: relative; z-index: 1; }

.card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(0, 119, 217, 0.22);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(0,119,217,0.08);
}
.card-interactive { cursor: pointer; }
.card-interactive:hover { transform: translateY(-3px); }
.card-glow:hover {
  box-shadow:
    var(--shadow-md),
    0 0 0 1px rgba(0, 119, 217, 0.25),
    0 4px 32px rgba(0, 119, 217, 0.18);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-primary { background: rgba(0,119,217,0.15); color: var(--color-primary-light); border: 1px solid rgba(0,119,217,0.25); }
.badge-accent { background: rgba(6,182,212,0.12); color: #22D3EE; border: 1px solid rgba(0,194,224,0.2); }
.badge-success { background: rgba(16,185,129,0.12); color: #34D399; border: 1px solid rgba(16,185,129,0.2); }
.badge-warning { background: rgba(245,158,11,0.12); color: #FCD34D; border: 1px solid rgba(245,158,11,0.2); }
.badge-neutral { background: var(--bg-glass); color: var(--text-muted); border: 1px solid var(--border-subtle); }

/* ---------- Inputs ---------- */
.input-wrapper { position: relative; }
.input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 11px 16px;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast), background var(--ease-fast);
  outline: none;
}
.input::placeholder { color: var(--text-muted); }
.input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0,119,217,0.12);
  background: rgba(255,255,255,0.07);
}
.input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.input-icon ~ .input { padding-left: 42px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; background: var(--bg-glass); border-radius: var(--radius-lg); padding: 4px; border: 1px solid var(--border-subtle); }
.tab-btn {
  flex: 1;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--ease-fast);
  background: transparent;
  text-align: center;
}
.tab-btn:hover { color: var(--text-secondary); background: var(--bg-glass); }
.tab-btn.active { background: var(--bg-glass-strong); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* ---------- Sidebar Layout ---------- */
.sidebar-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: calc(100vh - var(--nav-height) - 24px);
  padding-top: calc(var(--nav-height) + 24px);
  gap: 0;
}

.sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 24px);
  height: calc(100vh - var(--nav-height) - 24px);
  overflow-y: auto;
  padding: 24px 16px;
  border-right: 1px solid var(--border-subtle);
}
.sidebar::-webkit-scrollbar { width: 4px; }

.sidebar-section { margin-bottom: 32px; }
.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--ease-fast);
  border: 1px solid transparent;
}
.sidebar-item:hover { color: var(--text-secondary); background: var(--bg-glass); }
.sidebar-item.active {
  color: var(--text-primary);
  background: rgba(0,119,217,0.12);
  border-color: var(--border-accent);
}
.sidebar-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.sidebar-item-badge { margin-left: auto; }

.main-content { padding: 32px 40px; overflow-y: auto; }

/* ---------- Hero Section ---------- */
.hero {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  padding: calc(var(--nav-height) + 48px) 0 80px;
  position: relative;
}
.hero-content { max-width: 680px; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(0,119,217,0.12);
  border: 1px solid rgba(0,119,217,0.25);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary-light);
  margin-bottom: 28px;
  animation: fadeInUp 0.6s var(--ease-slow) both;
}
.hero-eyebrow-dot { width: 6px; height: 6px; background: var(--color-primary); border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.hero-title {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  animation: fadeInUp 0.6s var(--ease-slow) 0.1s both;
}
.hero-title-gradient {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 40px;
  animation: fadeInUp 0.6s var(--ease-slow) 0.2s both;
}
.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  animation: fadeInUp 0.6s var(--ease-slow) 0.3s both;
}

/* ---------- Section Headers ---------- */
.section { padding: 80px 0; }
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 16px;
}
.section-label::before {
  content: '';
  display: block;
  width: 20px; height: 2px;
  background: var(--color-accent);
  border-radius: var(--radius-full);
}
.section-title {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 16px;
}
.section-subtitle { font-size: 1.05rem; color: var(--text-secondary); max-width: 560px; line-height: 1.7; }

/* ---------- Stats Bar ---------- */
.stats-bar {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.stat-item {
  flex: 1;
  padding: 24px;
  text-align: center;
  border-right: 1px solid var(--border-subtle);
  transition: background var(--ease-fast);
}
.stat-item:last-child { border-right: none; }
.stat-item:hover { background: var(--bg-card-hover); }
.stat-number {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; margin-top: 4px; }

/* ---------- Feature Grid ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.feature-card {
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
  opacity: 0;
  transition: opacity var(--ease-normal);
}
.feature-card:hover::before { opacity: 1; }
.feature-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  transition: all var(--ease-normal);
}
.feature-icon.indigo { background: rgba(0,119,217,0.12); border-color: rgba(0,119,217,0.2); }
.feature-icon.cyan { background: rgba(6,182,212,0.10); border-color: rgba(6,182,212,0.18); }
.feature-icon.emerald { background: rgba(16,185,129,0.10); border-color: rgba(16,185,129,0.18); }
.feature-card:hover .feature-icon { transform: scale(1.05); }
.feature-icon svg { width: 22px; height: 22px; }
.feature-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; }
.feature-desc { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.65; }

/* ---------- Learning Path Timeline ---------- */
.phase-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  position: relative;
}
.phase-grid::before {
  content: '';
  position: absolute;
  top: 32px; left: calc(16.67% + 20px); right: calc(16.67% + 20px);
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  z-index: 0;
}
.phase-card {
  padding: 28px 24px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.phase-number {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 auto 16px;
  border: 2px solid;
  transition: all var(--ease-normal);
}
.phase-number.beginner { background: rgba(0,119,217,0.15); border-color: var(--color-primary); color: var(--color-primary-light); }
.phase-number.intermediate { background: rgba(6,182,212,0.12); border-color: var(--color-accent); color: #22D3EE; }
.phase-number.advanced { background: rgba(16,185,129,0.10); border-color: var(--color-success); color: #34D399; }
.phase-card:hover .phase-number { transform: scale(1.1); }
.phase-title { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.phase-desc { font-size: 0.825rem; color: var(--text-secondary); line-height: 1.6; }
.phase-topics { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

/* ---------- Code Blocks ---------- */
.code-block {
  position: relative;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border-subtle);
}
.code-dots { display: flex; gap: 6px; }
.code-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.code-dot:nth-child(1) { background: #FF5F57; }
.code-dot:nth-child(2) { background: #FFBD2E; }
.code-dot:nth-child(3) { background: #28CA41; }
.code-lang { font-size: 0.75rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.code-copy-btn {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  transition: all var(--ease-fast);
}
.code-copy-btn:hover { color: var(--text-primary); background: var(--bg-glass-strong); }
.code-copy-btn.copied { color: var(--color-success); border-color: rgba(16,185,129,0.3); }
pre {
  padding: 20px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #E2E8F0;
}

/* ---------- Progress ---------- */
.progress-bar {
  height: 4px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-slow);
}

/* ---------- Chat UI ---------- */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-height) - 24px);
  padding-top: calc(var(--nav-height) + 24px);
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.chat-messages::-webkit-scrollbar { width: 4px; }

.message {
  display: flex;
  gap: 12px;
  max-width: 80%;
  animation: fadeInUp 0.3s var(--ease-normal) both;
}
.message.user { align-self: flex-end; flex-direction: row-reverse; }

.message-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.message-avatar.ai { background: linear-gradient(135deg, var(--color-primary), var(--color-accent)); }
.message-avatar.user { background: var(--bg-glass-strong); border: 1px solid var(--border-card); color: var(--text-muted); }

.message-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.65;
  max-width: 100%;
}
.message.ai .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-top-left-radius: 4px;
  color: var(--text-primary);
}
.message.user .message-bubble {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  border: none;
  border-top-right-radius: 4px;
  color: white;
}

.typing-indicator {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  border-top-left-radius: 4px;
  width: fit-content;
}
.typing-dot {
  width: 7px; height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%,80%,100% { transform: translateY(0); } 40% { transform: translateY(-8px); } }

.chat-input-area {
  padding: 20px 32px 28px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(10, 15, 30, 0.8);
  backdrop-filter: blur(12px);
}
.chat-input-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.chat-textarea {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  color: var(--text-primary);
  font-size: 0.9rem;
  resize: none;
  min-height: 52px;
  max-height: 160px;
  outline: none;
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
  line-height: 1.5;
}
.chat-textarea::placeholder { color: var(--text-muted); }
.chat-textarea:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(0,119,217,0.12); }

.chat-send-btn {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  color: white;
  box-shadow: var(--shadow-primary);
  transition: all var(--ease-normal);
  flex-shrink: 0;
}
.chat-send-btn:hover { transform: scale(1.05); box-shadow: 0 6px 32px rgba(0,119,217,0.4); }
.chat-send-btn:disabled { opacity: 0.4; transform: none; cursor: not-allowed; }
.chat-send-btn svg { width: 20px; height: 20px; }

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.suggestion-chip {
  padding: 7px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--ease-fast);
}
.suggestion-chip:hover { background: rgba(0,119,217,0.12); border-color: var(--border-accent); color: var(--color-primary-light); }

/* ---------- Resource Cards ---------- */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.resource-card {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.resource-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.resource-title { font-size: 0.95rem; font-weight: 600; line-height: 1.4; }
.resource-desc { font-size: 0.825rem; color: var(--text-secondary); line-height: 1.6; flex: 1; }
.resource-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.resource-meta { font-size: 0.75rem; color: var(--text-muted); }

/* ---------- Lesson Items ---------- */
.module-group { margin-bottom: 28px; }
.module-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--ease-fast);
  user-select: none;
}
.module-header:hover { background: var(--bg-glass); }
.module-title { font-size: 0.95rem; font-weight: 600; flex: 1; }
.module-chevron {
  width: 18px; height: 18px;
  color: var(--text-muted);
  transition: transform var(--ease-normal);
}
.module-group.open .module-chevron { transform: rotate(180deg); }
.module-lessons {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 0 8px 8px;
}
.module-group.open .module-lessons { display: flex; }

.lesson-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--ease-fast);
  border: 1px solid transparent;
}
.lesson-item:hover { background: var(--bg-glass); border-color: var(--border-subtle); }
.lesson-item.active { background: rgba(0,119,217,0.10); border-color: var(--border-accent); }
.lesson-item.completed { opacity: 0.6; }
.lesson-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-card);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--ease-fast);
}
.lesson-item.completed .lesson-check { background: var(--color-success); border-color: var(--color-success); }
.lesson-check svg { width: 11px; height: 11px; color: white; display: none; }
.lesson-item.completed .lesson-check svg { display: block; }
.lesson-title { font-size: 0.875rem; font-weight: 500; flex: 1; }
.lesson-duration { font-size: 0.75rem; color: var(--text-muted); }

/* ---------- Walkthrough Steps ---------- */
.step-card {
  display: flex;
  gap: 20px;
  padding: 28px;
  position: relative;
}
.step-card::before {
  content: '';
  position: absolute;
  left: 54px;
  top: 72px;
  bottom: -20px;
  width: 2px;
  background: linear-gradient(180deg, var(--border-accent), transparent);
}
.step-card:last-child::before { display: none; }
.step-number {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0,119,217,0.12);
  border: 2px solid var(--border-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary-light);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.step-content { flex: 1; }
.step-title { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.step-desc { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.65; }

/* ---------- Search Bar ---------- */
.search-bar {
  position: relative;
  max-width: 520px;
}
.search-bar svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--text-muted);
}
.search-bar .input { padding-left: 48px; }

/* ---------- Filter Chips ---------- */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filter-chip {
  padding: 7px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--ease-fast);
}
.filter-chip:hover { color: var(--text-secondary); background: var(--bg-glass-strong); }
.filter-chip.active { background: rgba(0,119,217,0.15); border-color: var(--border-accent); color: var(--color-primary-light); }

/* ---------- Divider ---------- */
.divider {
  height: 1px;
  background: var(--border-subtle);
  border: none;
  margin: 40px 0;
}
.divider-text {
  text-align: center;
  position: relative;
  margin: 32px 0;
}
.divider-text::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 1px;
  background: var(--border-subtle);
}
.divider-text span {
  position: relative;
  background: var(--bg-base);
  padding: 0 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---------- Footer ---------- */
.footer {
  padding: 48px 0;
  border-top: 1px solid var(--border-subtle);
  margin-top: 80px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
}
.footer-brand-desc { font-size: 0.875rem; color: var(--text-muted); line-height: 1.7; margin-top: 12px; max-width: 280px; }
.footer-heading { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 16px; }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-link { font-size: 0.875rem; color: var(--text-muted); transition: color var(--ease-fast); }
.footer-link:hover { color: var(--text-primary); }
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---------- Scroll Animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-slow), transform 0.6s var(--ease-slow);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  from { background-position: -200% center; }
  to { background-position: 200% center; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* ---------- Toast Notifications ---------- */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  animation: slideInRight 0.3s var(--ease-spring) both;
  max-width: 360px;
}
.toast.success { border-color: rgba(16,185,129,0.3); }
.toast.error { border-color: rgba(239,68,68,0.3); }
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .sidebar-layout { grid-template-columns: 240px 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .phase-grid { grid-template-columns: 1fr; }
  .phase-grid::before { display: none; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 100%; }
  .navbar { top: 8px; width: calc(100% - 32px); min-width: unset; border-radius: var(--radius-xl); padding: 0 10px 0 14px; }
  .nav-links { display: none; }
  .nav-cta .btn { display: none; }
  .nav-hamburger { display: flex; }
  .sidebar-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border-subtle); }
  .main-content { padding: 24px 20px; }
  .hero { padding-top: calc(var(--nav-height) + 80px); padding-bottom: 60px; }
  .hero-decoration { display: none !important; }
  .stats-bar { flex-direction: column; }
  .stat-item { border-right: none; border-bottom: 1px solid var(--border-subtle); }
  .stat-item:last-child { border-bottom: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .feature-card { padding: 18px; }
  .feature-icon { width: 38px; height: 38px; margin-bottom: 12px; }
  .feature-title { font-size: 0.95rem; }
  .feature-desc { font-size: 0.82rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
  .chat-messages { padding: 20px 16px; }
  .chat-input-area { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   PAGE HEADER (shared inner-page hero)
   ============================================================ */
.page-header {
  padding: calc(var(--nav-height) + 60px) 0 48px;
  position: relative;
}
.page-header .section-label { margin-bottom: 12px; }
.page-header .section-title { font-size: clamp(1.8rem, 3.5vw, 2.8rem); }

/* ============================================================
   FILTER TABS (used in reference.html and build.html)
   ============================================================ */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-tab {
  padding: 8px 18px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--ease-fast);
}
.filter-tab:hover { color: var(--text-secondary); background: var(--bg-glass-strong); border-color: var(--border-card); }
.filter-tab.active { background: rgba(0,119,217,0.15); border-color: var(--border-accent); color: var(--color-primary-light); }

/* ============================================================
   REFERENCE PAGE — search & card extras
   ============================================================ */
.reference-search-bar {
  position: relative;
  max-width: 480px;
}
.reference-search-bar svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.reference-search-bar input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 11px 16px 11px 44px;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
}
.reference-search-bar input::placeholder { color: var(--text-muted); }
.reference-search-bar input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(0,119,217,0.12); }

.ref-card-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ref-card-icon.indigo { background: rgba(0,119,217,0.12); color: var(--color-primary-light); }
.ref-card-icon.cyan   { background: rgba(6,182,212,0.10); color: #22D3EE; }
.ref-card-icon.emerald{ background: rgba(16,185,129,0.10); color: #34D399; }
.ref-card-icon.amber  { background: rgba(245,158,11,0.10); color: #FCD34D; }
.ref-card-icon.rose   { background: rgba(239,68,68,0.10); color: #F87171; }
.ref-card-icon svg { width: 20px; height: 20px; }

.resource-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* ============================================================
   CHAT PAGE — SHELL LAYOUT
   ============================================================ */
.chat-page { display: flex; flex-direction: column; }

.chat-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
  padding-top: calc(var(--nav-height) + 24px);
}

/* Sidebar */
.chat-sidebar {
  padding: 24px 16px;
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: rgba(10,15,30,0.6);
}
.chat-sidebar::-webkit-scrollbar { width: 3px; }
.chat-sidebar-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 6px; }
.chat-sidebar-desc  { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }
.chat-sidebar-section {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 12px 0 6px;
}
.chat-divider { height: 1px; background: var(--border-subtle); margin: 14px 0; }
.chat-suggestion {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 0.815rem;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--ease-fast);
  margin-bottom: 2px;
  line-height: 1.4;
}
.chat-suggestion:hover { background: var(--bg-glass); border-color: var(--border-subtle); color: var(--text-primary); }
.chat-clear-btn {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 0.815rem;
  color: var(--text-muted);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  text-align: center;
  transition: all var(--ease-fast);
}
.chat-clear-btn:hover { color: var(--color-danger); border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.06); }

/* API key section */
.api-key-section { padding-top: 16px; }
.api-key-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
  transition: border-color var(--ease-fast);
}
.api-key-input::placeholder { color: var(--text-muted); }
.api-key-input:focus { border-color: var(--border-focus); }

/* Chat main */
.chat-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.chat-messages::-webkit-scrollbar { width: 5px; }

/* Welcome state */
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  padding: 48px 20px;
  flex: 1;
  max-width: 540px;
  margin: 0 auto;
}
.chat-welcome-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0,119,217,0.2), rgba(0,194,224,0.2));
  border: 1px solid var(--border-accent);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-primary-light);
}
.chat-welcome h2 { font-size: 1.4rem; font-weight: 700; }
.chat-welcome p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.65; }
.chat-welcome-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.chip {
  padding: 8px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--ease-fast);
}
.chip:hover { background: rgba(0,119,217,0.12); border-color: var(--border-accent); color: var(--color-primary-light); }

/* Messages */
.message {
  display: flex;
  gap: 12px;
  max-width: 84%;
  animation: fadeInUp 0.3s var(--ease-normal) both;
}
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.message-avatar.ai   { background: linear-gradient(135deg, var(--color-primary), var(--color-accent)); color: white; }
.message-avatar.user { background: var(--bg-glass-strong); border: 1px solid var(--border-card); color: var(--text-muted); }
.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.88rem;
  line-height: 1.65;
}
.message.ai .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-top-left-radius: 4px;
  color: var(--text-primary);
}
.message.user .message-bubble {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  border-top-right-radius: 4px;
  color: white;
}
/* Markdown inside AI bubble */
.message-bubble h1,.message-bubble h2,.message-bubble h3 { font-weight: 700; margin: 12px 0 6px; }
.message-bubble h1 { font-size: 1.05rem; }
.message-bubble h2 { font-size: 0.97rem; }
.message-bubble h3 { font-size: 0.9rem; }
.message-bubble p  { margin-bottom: 8px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul,.message-bubble ol { padding-left: 18px; margin: 6px 0; }
.message-bubble li { margin-bottom: 4px; }
.message-bubble code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82em;
  background: rgba(0,0,0,0.35);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}
.message-bubble pre {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 0.82rem;
}
.message-bubble pre code { background: none; border: none; padding: 0; }
.message-bubble strong { color: var(--text-primary); font-weight: 600; }
.message-bubble a { color: var(--color-primary-light); text-decoration: underline; text-underline-offset: 2px; }

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  border-top-left-radius: 4px;
  width: fit-content;
}
.typing-dot {
  width: 7px; height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%,80%,100% { transform: translateY(0); } 40% { transform: translateY(-7px); } }

/* Chat input */
.chat-input-area {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(10,15,30,0.8);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}
.chat-input-status { font-size: 0.75rem; color: var(--color-accent); min-height: 18px; margin-bottom: 8px; }
.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-textarea {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 0.9rem;
  resize: none;
  min-height: 48px;
  max-height: 150px;
  outline: none;
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
  line-height: 1.5;
  overflow-y: auto;
}
.chat-textarea::placeholder { color: var(--text-muted); }
.chat-textarea:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(0,119,217,0.12); }
.chat-send-btn {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  color: white;
  box-shadow: var(--shadow-primary);
  transition: all var(--ease-normal);
  flex-shrink: 0;
}
.chat-send-btn:hover { transform: scale(1.05); box-shadow: 0 6px 32px rgba(0,119,217,0.4); }
.chat-send-btn:disabled { opacity: 0.4; transform: none; cursor: not-allowed; }
.chat-disclaimer { font-size: 0.72rem; color: var(--text-muted); margin-top: 8px; text-align: center; }
.chat-disclaimer a { color: var(--text-muted); text-decoration: underline; }

/* Primary muted color variable */
:root { --primary-muted: var(--color-primary-light); --font-mono: 'JetBrains Mono', monospace; }

/* ============================================================
   BUILD PAGE
   ============================================================ */
.build-panel { display: none; }
.build-panel.active { display: block; }

.build-two-col {
  display: grid;
  grid-template-columns: 5fr 12fr;
  gap: 28px;
  align-items: start;
}
.build-panel-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; }
.build-panel-desc  { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.65; margin-bottom: 24px; }

/* Example chips */
.example-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.example-chip {
  padding: 5px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--ease-fast), color var(--ease-fast), border-color var(--ease-fast);
  white-space: nowrap;
}
.example-chip:hover {
  background: rgba(124,58,237,0.12);
  border-color: var(--color-primary-light);
  color: var(--text-primary);
}

/* Form controls */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.form-group:last-of-type { margin-bottom: 0; }
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.form-input,.form-textarea,.form-select {
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
  width: 100%;
}
.form-input::placeholder,.form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus,.form-textarea:focus,.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0,119,217,0.12);
}
.form-textarea { resize: vertical; min-height: 100px; line-height: 1.55; }
.form-select { cursor: pointer; }
.form-select option { background: var(--bg-surface); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Result panel */
.build-result {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky;
  top: calc(var(--nav-height) + 32px);
}
.build-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}
.build-result-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }

/* Output tabs (Text / Diagram) */
.output-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.25);
  border-radius: var(--radius-md);
  padding: 3px;
}
.output-tab {
  padding: 5px 14px;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--ease-fast), color var(--ease-fast);
}
.output-tab.active {
  background: var(--color-primary);
  color: #fff;
}
.output-tab:not(.active):hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
}
.build-result-body {
  padding: 20px;
  min-height: 320px;
  height: calc(100vh - var(--nav-height) - 200px);
  max-height: calc(100vh - var(--nav-height) - 200px);
  overflow-y: auto;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text-secondary);
}
.build-result-body::-webkit-scrollbar { width: 4px; }

/* Markdown rendered output */
.markdown-output { padding: 4px 0; }
.markdown-output h1 { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); margin: 20px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border-subtle); }
.markdown-output h2 { font-size: 1rem; font-weight: 700; color: var(--color-primary-light); margin: 18px 0 6px; }
.markdown-output h3 { font-size: 0.92rem; font-weight: 600; color: var(--text-primary); margin: 14px 0 4px; }
.markdown-output h4 { font-size: 0.88rem; font-weight: 600; color: var(--text-secondary); margin: 10px 0 4px; }
.markdown-output p { margin-bottom: 8px; line-height: 1.7; font-size: 0.88rem; }
.markdown-output ul, .markdown-output ol { padding-left: 20px; margin: 6px 0 12px; }
.markdown-output li { margin-bottom: 5px; font-size: 0.88rem; line-height: 1.6; }
.markdown-output strong { color: var(--text-primary); font-weight: 600; }
.markdown-output em { color: var(--text-secondary); font-style: italic; }
.markdown-output hr { border: none; border-top: 1px solid var(--border-subtle); margin: 16px 0; }
.markdown-output code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: rgba(124,58,237,0.15);
  color: #c4b5fd;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(124,58,237,0.25);
}
.markdown-output pre {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 10px 0;
}
.markdown-output pre code { background: none; border: none; padding: 0; font-size: 0.83rem; color: #e2e8f0; }

/* Mermaid diagram */
.mermaid-wrapper {
  display: none; /* kept for legacy — bpmn replaces this */
}
.bpmn-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 540px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: #1a1f2e;
  overflow: hidden;
  margin: 8px 0;
}
.bpmn-canvas {
  width: 100%;
  height: 100%;
}
/* bpmn-js internal canvas — force dark background and visible elements */
.bpmn-canvas .djs-container {
  background: #1a1f2e !important;
}
.bpmn-canvas .djs-shape .djs-visual rect,
.bpmn-canvas .djs-shape .djs-visual polygon,
.bpmn-canvas .djs-shape .djs-visual circle,
.bpmn-canvas .djs-shape .djs-visual ellipse {
  fill: #2a3147 !important;
  stroke: #4a9eff !important;
  stroke-width: 1.5px !important;
}
.bpmn-canvas .djs-shape .djs-visual text {
  fill: #e2e8f0 !important;
  font-family: var(--font-sans) !important;
  font-size: 11px !important;
}
.bpmn-canvas .djs-connection .djs-visual path {
  stroke: #64748b !important;
  stroke-width: 1.5px !important;
}
.bpmn-canvas .djs-label text {
  fill: #94a3b8 !important;
  font-size: 10px !important;
}
/* Start event green, end event red */
.bpmn-canvas [data-element-id$="StartEvent"] .djs-visual circle,
.bpmn-canvas [data-element-id*="Start"] .djs-visual circle {
  fill: #064e3b !important;
  stroke: #10b981 !important;
}
.bpmn-canvas [data-element-id$="EndEvent"] .djs-visual circle,
.bpmn-canvas [data-element-id*="End"] .djs-visual circle {
  fill: #450a0a !important;
  stroke: #ef4444 !important;
}
.bpmn-diagram-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.875rem;
  gap: 10px;
}
.bpmn-diagram-loading::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.bpmn-zoom-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
  z-index: 10;
}
/* Hide bpmn.io watermark */
.bpmn-canvas .bjs-powered-by {
  display: none !important;
}
.bpmn-zoom-controls button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-subtle);
  background: rgba(15,23,42,0.85);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.bpmn-zoom-controls button:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}
.mermaid-block svg {
  min-width: 600px;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}
.markdown-output table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  margin: 12px 0 16px;
  table-layout: auto;
}
.markdown-output th {
  background: rgba(124,58,237,0.15);
  color: var(--text-primary);
  font-weight: 600;
  padding: 8px 10px;
  text-align: left;
  border: 1px solid var(--border-subtle);
}
.markdown-output td {
  padding: 7px 10px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: top;
  line-height: 1.5;
  overflow-wrap: break-word;
}
.markdown-output tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
.markdown-output tr:hover td { background: rgba(124,58,237,0.06); }

/* Legacy selectors kept for compatibility */
.build-result-body h2,.build-result-body h3 { color: var(--text-primary); font-weight: 700; margin: 14px 0 6px; font-size: 0.95rem; }
.build-result-body p { margin-bottom: 8px; }
.build-result-body ul,.build-result-body ol { padding-left: 18px; margin: 6px 0 12px; }
.build-result-body li { margin-bottom: 4px; }
.build-result-body code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: rgba(0,0,0,0.35);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}
.build-result-body pre {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 10px 0;
}
.build-result-body pre code { background: none; border: none; padding: 0; font-size: 0.83rem; }
.build-result-body strong { color: var(--text-primary); }
.build-result-body .build-generating { color: var(--color-accent); font-style: italic; }

.build-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  height: 100%;
  min-height: 280px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   LEARN PAGE extras (accordion modules)
   ============================================================ */
.learn-hero { padding: calc(var(--nav-height) + 56px) 0 48px; }
.phase-selector { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 40px; }
.phase-btn {
  padding: 9px 20px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--ease-fast);
}
.phase-btn:hover { color: var(--text-secondary); background: var(--bg-glass-strong); }
.phase-btn.active.beginner { background: rgba(0,119,217,0.15); border-color: var(--border-accent); color: var(--color-primary-light); }
.phase-btn.active.intermediate { background: rgba(6,182,212,0.12); border-color: rgba(6,182,212,0.35); color: #22D3EE; }
.phase-btn.active.advanced { background: rgba(16,185,129,0.10); border-color: rgba(16,185,129,0.3); color: #34D399; }

.module-group {
  margin-bottom: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--ease-fast);
}
.module-group:hover { border-color: var(--border-card); }
.module-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  background: var(--bg-glass);
  transition: background var(--ease-fast);
}
.module-header:hover { background: var(--bg-glass-strong); }
.module-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(0,119,217,0.12);
  border: 1px solid rgba(0,119,217,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary-light);
  flex-shrink: 0;
}
.module-title  { font-size: 0.9rem; font-weight: 600; flex: 1; }
.module-count  { font-size: 0.75rem; color: var(--text-muted); }
.module-chevron { width: 16px; height: 16px; color: var(--text-muted); transition: transform var(--ease-normal); flex-shrink: 0; }
.module-group.open .module-chevron { transform: rotate(180deg); }
.module-lessons { display: none; padding: 8px; border-top: 1px solid var(--border-subtle); }
.module-group.open .module-lessons { display: block; }

.lesson-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--ease-fast);
  font-size: 0.875rem;
}
.lesson-item:hover { background: var(--bg-glass); }
.lesson-type-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-video   { background: var(--color-primary-light); }
.dot-reading { background: var(--color-accent); }
.dot-lab     { background: var(--color-success); }
.dot-quiz    { background: var(--color-warning); }
.lesson-name { flex: 1; color: var(--text-secondary); }
.lesson-dur  { font-size: 0.75rem; color: var(--text-muted); }
.lesson-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(0,119,217,0.12);
  color: var(--color-primary-light);
  border: 1px solid rgba(0,119,217,0.2);
}

/* ============================================================
   RESPONSIVE — NEW ADDITIONS
   ============================================================ */
@media (max-width: 1024px) {
  .build-two-col { grid-template-columns: 1fr; }
  .build-result  { position: static; }
  .chat-shell    { grid-template-columns: 220px 1fr; }
}

@media (max-width: 768px) {
  .chat-shell { grid-template-columns: 1fr; grid-template-rows: 260px 1fr; }
  .chat-sidebar { height: 260px; border-right: none; border-bottom: 1px solid var(--border-subtle); }
  .chat-main { min-height: 0; }
  .chat-messages { padding: 16px; }
  .chat-welcome { padding: 20px 16px; gap: 10px; }
  .chat-welcome-icon { width: 48px; height: 48px; }
  .chat-welcome h2 { font-size: 1.1rem; }
  .chat-welcome p { font-size: 0.82rem; }
  .chat-input-area { padding: 12px 16px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .build-two-col { gap: 20px; }
  .api-key-section { margin-top: 16px; }
}

/* ============================================================
   REFERENCE PAGE — Search + Filters + Resource Cards
   ============================================================ */
.page-header {
  padding: 56px 0 36px;
}

/* Search bar */
.search-container {
  position: relative;
  max-width: 540px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  height: 48px;
  padding: 0 20px 0 48px;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.filter-tab {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.filter-tab:hover {
  border-color: var(--border-accent);
  color: var(--text-primary);
}

.filter-tab.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* Resource grid */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 8px;
}

/* Resource card parts */
.resource-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.resource-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.resource-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.resource-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
  line-height: 1.4;
}

.resource-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
}

.resource-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.resource-source {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.resource-arrow {
  font-size: 1rem;
  color: var(--text-muted);
  transition: transform 0.2s, color 0.2s;
}

.resource-card:hover .resource-arrow {
  transform: translateX(4px);
  color: var(--color-primary-light);
}

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

.empty-state.hidden { display: none; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 20px 40px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 48px 40px;
  text-align: center;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.login-logo svg { width: 28px; height: 28px; }

.login-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 36px;
  line-height: 1.6;
}

.login-field {
  margin-bottom: 16px;
  text-align: left;
}

.login-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.login-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input::placeholder { color: var(--text-muted); }

.login-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.login-input.error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.login-btn {
  width: 100%;
  height: 50px;
  margin-top: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.login-error {
  margin-top: 14px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  color: #FCA5A5;
  font-size: 0.88rem;
  display: none;
}

.login-error.visible { display: block; }

.login-hint {
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============================================================
   Login Page
   ============================================================ */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 48px 40px;
  text-align: center;
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 24px 64px rgba(0,0,0,0.4),
              0 0 0 1px rgba(255,255,255,0.04) inset;
}

.login-logo {
  width: 56px;
  height: 56px;
  background: var(--color-primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 8px 24px var(--color-primary-glow);
}

.login-logo svg {
  width: 28px;
  height: 28px;
}

.login-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0 0 32px;
  line-height: 1.6;
}

.login-field {
  text-align: left;
  margin-bottom: 16px;
}

.login-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.login-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.login-input::placeholder {
  color: var(--text-muted);
}

.login-input:focus {
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.login-input.error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.2);
}

.login-error {
  display: none;
  font-size: 0.82rem;
  color: var(--color-danger);
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  text-align: center;
}

.login-error.visible {
  display: block;
}

.login-btn {
  width: 100%;
  padding: 13px;
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 8px;
  border-radius: 10px;
}

.login-hint {
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Login tabs ─────────────────────────────────────────── */
.login-tabs {
  display: flex;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 28px;
  gap: 4px;
}

.login-tab {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}

.login-tab:hover {
  color: var(--text-secondary);
}

.login-tab.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--color-primary-glow);
}

/* ── Code input (large centred digits) ──────────────────── */
.login-input--code {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  padding: 14px 16px;
}

.login-input--code::placeholder {
  letter-spacing: 0.2em;
  font-size: 1.2rem;
  font-weight: 400;
  opacity: 0.4;
}

/* ── Success message ────────────────────────────────────── */
.login-success {
  display: none;
  font-size: 0.82rem;
  color: #6ee7b7;
  background: rgba(52,211,153,0.1);
  border: 1px solid rgba(52,211,153,0.25);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  text-align: center;
}

.login-success.visible {
  display: block;
}

/* ── Inline link buttons (inside hint text) ─────────────── */
.login-link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: inherit;
  color: var(--color-primary-light);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-link-btn:hover {
  color: var(--text-primary);
}


/* ============================================================
   FLOATING AI ASSISTANT
   ============================================================ */

/* Trigger button */
.ai-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 2000;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, #0055A0 100%);
  border: 2px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    0 0 0 0 rgba(0, 119, 217, 0.5),
    0 8px 32px rgba(0, 119, 217, 0.45),
    0 4px 16px rgba(0,0,0,0.4);
  transition: transform var(--ease-spring), box-shadow var(--ease-normal);
  animation: fabPulse 3s ease-in-out infinite;
}
.ai-fab:hover {
  transform: scale(1.1);
  box-shadow:
    0 0 0 8px rgba(0, 119, 217, 0.15),
    0 12px 40px rgba(0, 119, 217, 0.6),
    0 4px 16px rgba(0,0,0,0.4);
  animation: none;
}
.ai-fab.open {
  transform: rotate(90deg) scale(1.05);
  background: linear-gradient(135deg, #1A3A5C 0%, #0D1829 100%);
  animation: none;
}
.ai-fab svg {
  width: 28px;
  height: 28px;
  fill: white;
  transition: transform var(--ease-spring);
  pointer-events: none;
}

@keyframes fabPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,119,217,0.4), 0 8px 32px rgba(0,119,217,0.4); }
  50% { box-shadow: 0 0 0 10px rgba(0,119,217,0.0), 0 8px 32px rgba(0,119,217,0.5); }
}

/* Panel */
.ai-panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 1999;
  width: 380px;
  max-width: calc(100vw - 40px);
  background: rgba(6, 13, 26, 0.94);
  border: 1px solid rgba(0, 119, 217, 0.25);
  border-radius: var(--radius-xl);
  box-shadow:
    0 24px 80px rgba(0,0,0,0.7),
    0 0 0 1px rgba(255,255,255,0.04),
    inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  overflow: hidden;
  display: none;
  flex-direction: column;
  max-height: 520px;
  transform-origin: bottom right;
}
.ai-panel.open {
  display: flex;
  animation: panelPopIn 0.28s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}
@keyframes panelPopIn {
  from { opacity: 0; transform: scale(0.88) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Panel header */
.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(0,119,217,0.12);
  background: rgba(0,119,217,0.06);
  flex-shrink: 0;
}
.ai-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}
.ai-panel-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,0.6);
  flex-shrink: 0;
}
.ai-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-panel-link {
  font-size: 0.75rem;
  color: var(--color-primary-light);
  padding: 4px 10px;
  border: 1px solid rgba(0,119,217,0.3);
  border-radius: var(--radius-full);
  transition: background var(--ease-fast), color var(--ease-fast);
  white-space: nowrap;
}
.ai-panel-link:hover { background: rgba(0,119,217,0.15); color: white; }
.ai-panel-close {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background var(--ease-fast), color var(--ease-fast);
  flex-shrink: 0;
}
.ai-panel-close:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }

/* Messages area */
.ai-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
}
.ai-panel-messages::-webkit-scrollbar { width: 3px; }
.ai-panel-messages::-webkit-scrollbar-thumb { background: rgba(0,119,217,0.3); border-radius: 3px; }

.ai-msg {
  display: flex;
  gap: 8px;
  max-width: 100%;
}
.ai-msg.user { flex-direction: row-reverse; }
.ai-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
}
.ai-msg.user .ai-msg-avatar { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.1); }
.ai-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.55;
  max-width: calc(100% - 44px);
}
.ai-msg.bot .ai-msg-bubble {
  background: rgba(0,119,217,0.10);
  border: 1px solid rgba(0,119,217,0.15);
  border-bottom-left-radius: 4px;
  color: var(--text-secondary);
}
.ai-msg.user .ai-msg-bubble {
  background: rgba(0,119,217,0.22);
  border: 1px solid rgba(0,119,217,0.30);
  border-bottom-right-radius: 4px;
  color: var(--text-primary);
  text-align: right;
}

/* Typing indicator */
.ai-typing .ai-msg-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}
.ai-typing-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  animation: typingBounce 1.2s ease-in-out infinite;
}
.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Input area */
.ai-panel-input-area {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(0,119,217,0.10);
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}
.ai-panel-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 8px 8px 8px 14px;
  transition: border-color var(--ease-fast);
}
.ai-panel-input-row:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0,119,217,0.10);
}
.ai-panel-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.855rem;
  line-height: 1.5;
  resize: none;
  max-height: 100px;
  min-height: 22px;
  padding: 0;
}
.ai-panel-textarea::placeholder { color: var(--text-muted); }
.ai-panel-send {
  width: 34px; height: 34px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--ease-fast), transform var(--ease-fast);
  margin-bottom: 1px;
}
.ai-panel-send:hover { background: var(--color-primary-light); transform: scale(1.05); }
.ai-panel-send:disabled { background: rgba(0,119,217,0.3); cursor: not-allowed; transform: none; }
.ai-panel-send svg { width: 16px; height: 16px; fill: white; }
.ai-panel-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}
.ai-panel-hint a { color: var(--color-primary-light); }

/* === LESSON MODAL === */

/* Overlay backdrop */
/* ═══════════════════════════════════════════════════════
   LESSON MODAL — Tabbed layout
   ═══════════════════════════════════════════════════════ */

#lesson-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(4, 9, 20, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
#lesson-modal.is-open {
  display: flex;
  animation: lm-backdrop-in 220ms ease forwards;
}
@keyframes lm-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lesson-modal-panel {
  position: relative;
  width: 100%;
  max-width: 700px;
  margin: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
  overflow: hidden;
  animation: lm-panel-in 280ms var(--ease-spring) forwards;
}
@keyframes lm-panel-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ────────────────────────────────────────────── */
.lesson-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.lesson-modal-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.lesson-modal-badge {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0,119,217,0.18), rgba(6,182,212,0.12));
  border: 1px solid rgba(6,182,212,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-accent);
}
.lesson-modal-badge svg { width: 16px; height: 16px; }
#lesson-modal-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#lesson-close-header {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--ease-fast), color var(--ease-fast), border-color var(--ease-fast);
}
#lesson-close-header:hover {
  background: var(--bg-glass-strong);
  color: var(--text-primary);
  border-color: var(--border-accent);
}
#lesson-close-header svg { width: 16px; height: 16px; }

/* ── Tab bar ────────────────────────────────────────────── */
.lesson-tab-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--bg-surface);
}
.lesson-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 10px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  transition: color var(--ease-fast), border-color var(--ease-fast), background var(--ease-fast);
  position: relative;
  bottom: -1px;
  white-space: nowrap;
}
.lesson-tab-btn svg { width: 13px; height: 13px; opacity: 0.7; }
.lesson-tab-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-glass);
}
.lesson-tab-btn.is-active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}
.lesson-tab-btn.is-active svg { opacity: 1; }
/* Completed tab indicator */
.lesson-tab-btn.is-done::after {
  content: '✓';
  font-size: 0.65rem;
  margin-left: 2px;
  color: var(--color-success);
}

/* Progress dots — pushed to the right */
.lesson-tab-progress {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 10px;
}
.lesson-tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-card);
  transition: background var(--ease-normal), transform var(--ease-normal);
}
.lesson-tab-dot.is-active {
  background: var(--color-accent);
  transform: scale(1.3);
}
.lesson-tab-dot.is-done {
  background: var(--color-success);
}

/* ── Tab panes ──────────────────────────────────────────── */
.lesson-tab-pane {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px 24px;
  animation: lm-pane-in 200ms ease forwards;
}
.lesson-tab-pane.is-active { display: flex; }
@keyframes lm-pane-in {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Read pane ──────────────────────────────────────────── */
#lesson-content-body {
  color: var(--text-secondary);
  font-size: 0.925rem;
  line-height: 1.8;
  flex: 1;
}
#lesson-content-body p { margin-bottom: 16px; }
#lesson-content-body p:first-child {
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 400;
  line-height: 1.75;
}
#lesson-content-body strong { color: var(--text-primary); font-weight: 600; }

/* ── Key Concepts pane ──────────────────────────────────── */
.lesson-concepts-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.lesson-concepts-icon { font-size: 1.6rem; line-height: 1; }
.lesson-concepts-intro {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

#lesson-key-points {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}
#lesson-key-points li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.55;
  transition: border-color var(--ease-fast), background var(--ease-fast);
}
#lesson-key-points li:hover {
  background: var(--bg-glass-strong);
  border-color: var(--border-accent);
}
#lesson-key-points li .kp-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: 'Poppins', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Shared footer CTA ──────────────────────────────────── */
.lesson-read-footer {
  margin-top: 4px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.lesson-tab-next-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-primary);
  transition: box-shadow var(--ease-normal), transform var(--ease-normal);
  border: none;
  cursor: pointer;
}
.lesson-tab-next-btn:hover {
  box-shadow: 0 6px 40px rgba(0, 119, 217, 0.45);
  transform: translateY(-1px);
}
.lesson-tab-next-btn svg { width: 15px; height: 15px; }
/* #lesson-start-quiz is now .lesson-tab-next-btn — no separate rules needed */
#lesson-start-quiz { /* alias — handled by .lesson-tab-next-btn */ }

/* ── Quiz pane ──────────────────────────────────────────── */
#lesson-quiz-section { display: block; }

.lesson-quiz-label {
  font-family: 'Poppins', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary-light);
  margin-bottom: 14px;
}
.lesson-question-counter {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
#lesson-question-text {
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 20px;
}

#lesson-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.lesson-option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 13px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  transition: background var(--ease-fast), border-color var(--ease-fast), color var(--ease-fast);
  cursor: pointer;
}
.lesson-option-btn:hover:not(:disabled) {
  background: var(--bg-glass-strong);
  border-color: var(--border-accent);
  color: var(--text-primary);
}
.lesson-option-btn.is-selected {
  background: rgba(0, 119, 217, 0.12);
  border-color: var(--color-primary);
  color: var(--text-primary);
}
.lesson-option-btn.is-correct {
  background: rgba(16, 185, 129, 0.12);
  border-color: var(--color-success);
  color: var(--text-primary);
}
.lesson-option-btn.is-wrong {
  background: rgba(239, 68, 68, 0.10);
  border-color: var(--color-danger);
  color: var(--text-primary);
}
.lesson-option-btn:disabled { cursor: not-allowed; }
.lesson-option-letter {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  font-family: 'Poppins', sans-serif;
  transition: background var(--ease-fast), border-color var(--ease-fast);
}
.lesson-option-btn.is-selected .lesson-option-letter {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}
.lesson-option-btn.is-correct .lesson-option-letter {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}
.lesson-option-btn.is-wrong .lesson-option-letter {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: white;
}

#lesson-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-primary);
  transition: box-shadow var(--ease-normal), transform var(--ease-normal), opacity var(--ease-fast);
  border: none;
  cursor: pointer;
}
#lesson-submit-btn:hover:not(:disabled) {
  box-shadow: 0 6px 40px rgba(0, 119, 217, 0.45);
  transform: translateY(-1px);
}
#lesson-submit-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

#lesson-feedback {
  display: none;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.55;
}
#lesson-feedback.is-visible { display: block; }
#lesson-feedback.feedback-correct {
  background: rgba(16, 185, 129, 0.10);
  border: 1px solid rgba(16, 185, 129, 0.30);
  color: var(--text-secondary);
}
#lesson-feedback.feedback-wrong {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--text-secondary);
}
.feedback-verdict {
  font-weight: 700;
  margin-bottom: 4px;
}
.feedback-correct .feedback-verdict { color: var(--color-success); }
.feedback-wrong .feedback-verdict { color: var(--color-danger); }

#lesson-next-btn {
  display: none;
  margin-top: 14px;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-accent);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background var(--ease-fast), box-shadow var(--ease-fast);
  cursor: pointer;
}
#lesson-next-btn.is-visible { display: inline-flex; }
#lesson-next-btn:hover {
  background: var(--bg-glass-strong);
  box-shadow: 0 0 0 1px var(--color-primary);
}
#lesson-next-btn svg { width: 15px; height: 15px; }

/* ── Results ────────────────────────────────────────────── */
#lesson-results {
  display: none;
  text-align: center;
  padding: 12px 0 8px;
}
#lesson-results.is-visible { display: block; }
.lesson-results-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  line-height: 1;
}
#lesson-score {
  font-family: 'Poppins', sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 10px;
}
.lesson-results-message {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.lesson-results-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.lesson-results-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
#lesson-try-again {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-accent);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background var(--ease-fast), box-shadow var(--ease-fast);
  cursor: pointer;
}
#lesson-try-again:hover {
  background: var(--bg-glass-strong);
  box-shadow: 0 0 0 1px var(--color-primary);
}
#lesson-try-again svg { width: 15px; height: 15px; }
#lesson-close-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-primary);
  border: none;
  transition: box-shadow var(--ease-normal), transform var(--ease-normal);
  cursor: pointer;
}
#lesson-close-btn:hover {
  box-shadow: 0 6px 40px rgba(0, 119, 217, 0.45);
  transform: translateY(-1px);
}

/* ── No-quiz fallback ────────────────────────────────────── */
.lesson-no-quiz {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  #lesson-modal { padding: 0; align-items: flex-end; }
  .lesson-modal-panel {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh;
    animation: lm-panel-mobile-in 280ms var(--ease-spring) forwards;
  }
  @keyframes lm-panel-mobile-in {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .lesson-tab-btn { padding: 8px 10px 10px; font-size: 0.77rem; }
  .lesson-tab-btn svg { display: none; }
}

/* === END LESSON MODAL === */
