/* ================================================================
   ARRETADOS ACADEMY — Design System v2.0
   "Aprender é divertido. O futuro é agora."
   ================================================================ */

/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
  /* Primary — Azul Bebê Arretados */
  --color-primary-50: #F0F9FF;
  --color-primary-100: #E0F3FE;
  --color-primary-200: #BAE5FD;
  --color-primary-300: #89CFF0;
  --color-primary-400: #5BB8E0;
  --color-primary-500: #3A9FD0;
  --color-primary-600: #1E85B8;
  --color-primary-700: #156B96;
  --color-primary: #89CFF0;

  /* Surface */
  --color-bg: #FAFBFC;
  --color-surface: #FFFFFF;
  --color-surface-hover: #F5F8FA;
  --color-surface-raised: #FFFFFF;

  /* Text */
  --color-text: #1A1D26;
  --color-text-secondary: #6B7280;
  --color-text-muted: #9CA3AF;

  /* Accents */
  --color-success: #10B981;
  --color-success-50: #ECFDF5;
  --color-warning: #F59E0B;
  --color-warning-50: #FFFBEB;
  --color-purple: #8B5CF6;
  --color-purple-50: #F5F3FF;
  --color-rose: #F43F5E;
  --color-rose-50: #FFF1F2;
  --color-amber: #F59E0B;

  /* Borders */
  --color-border: #E5E7EB;
  --color-border-light: #F0F1F3;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 30px rgba(137, 207, 240, 0.15), 0 4px 10px rgba(0,0,0,0.04);
  --shadow-xl: 0 16px 48px rgba(137, 207, 240, 0.2), 0 8px 16px rgba(0,0,0,0.04);
  --shadow-button: 0 4px 14px rgba(58, 159, 208, 0.3);
  --shadow-card-hover: 0 12px 40px rgba(137, 207, 240, 0.25);

  /* Border Radius */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-14: 56px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* Layout */
  --sidebar-width: 272px;
  --sidebar-collapsed: 0px;
  --topbar-height: 64px;
  --content-max: 1280px;

  /* Typography */
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

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

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

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1 { font-size: 2.75rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

::selection {
  background: var(--color-primary-200);
  color: var(--color-primary-700);
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* ── App Layout: Sidebar + Main ───────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border-light);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--duration-normal) var(--ease-out);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: var(--space-6) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-logo img {
  height: 90px;
  width: auto;
}

.sidebar-logo .logo-text {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--color-text);
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
}

.sidebar-nav a:hover {
  background: var(--color-primary-50);
  color: var(--color-primary-600);
}

.sidebar-nav a.active {
  background: var(--color-primary-50);
  color: var(--color-primary-600);
  font-weight: 600;
}

.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--color-primary-400);
  border-radius: var(--radius-full);
}

.sidebar-nav a .nav-icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-nav .nav-badge {
  margin-left: auto;
  background: var(--color-rose);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

.sidebar-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: var(--space-2) var(--space-4);
}

/* Sidebar User Mini-Profile */
.sidebar-user {
  padding: var(--space-4);
  margin: var(--space-2) var(--space-3) var(--space-4);
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-user .user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary-400), var(--color-primary-600));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-user .user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user .user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-level {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.sidebar-user .user-stats {
  display: flex;
  gap: var(--space-2);
  margin-top: 2px;
}

.sidebar-user .user-stat {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 2px;
}

.sidebar-user .user-stat.xp { color: var(--color-warning); }
.sidebar-user .user-stat.streak { color: var(--color-rose); }

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: var(--space-4);
  left: var(--space-4);
  z-index: 200;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--color-text);
  box-shadow: var(--shadow-md);
}

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

/* ── Main Content Area ────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top Bar ──────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 251, 252, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-light);
  padding: 0 var(--space-8);
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.topbar .breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.topbar .breadcrumb a {
  color: var(--color-text-secondary);
  transition: color var(--duration-fast);
}

.topbar .breadcrumb a:hover {
  color: var(--color-primary-600);
}

.topbar .breadcrumb span {
  color: var(--color-text);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  transition: all var(--duration-fast) var(--ease-out);
}

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

/* ── Page Content ─────────────────────────────────────────────── */
.page-content {
  padding: var(--space-8);
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

.page-content-wide {
  padding: var(--space-8);
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Welcome Hero ─────────────────────────────────────────────── */
.welcome-hero {
  margin-bottom: var(--space-8);
}

.welcome-hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: var(--space-1);
}

.welcome-hero .welcome-subtitle {
  color: var(--color-text-secondary);
  font-size: 1.05rem;
  margin-bottom: var(--space-6);
}

/* ── Stats Row ────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  border: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: var(--shadow-xs);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary-100);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-card .stat-icon.fire { background: var(--color-rose-50); color: var(--color-rose); }
.stat-card .stat-icon.xp { background: var(--color-warning-50); color: var(--color-warning); }
.stat-card .stat-icon.level { background: var(--color-purple-50); color: var(--color-purple); }
.stat-card .stat-icon.completed { background: var(--color-success-50); color: var(--color-success); }

.stat-card .stat-info { flex: 1; min-width: 0; }

.stat-card .stat-value {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1;
}

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

/* ── Section Headers ──────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.section-header .see-all {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-primary-600);
  transition: color var(--duration-fast);
}

.section-header .see-all:hover {
  color: var(--color-primary-700);
}

/* ── Continue Learning Card ───────────────────────────────────── */
.continue-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  border: 1px solid var(--color-border-light);
  margin-bottom: var(--space-8);
  display: flex;
  align-items: center;
  gap: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
}

.continue-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-primary-200);
}

.continue-card .continue-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary-200), var(--color-primary-400));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}

.continue-card .continue-info { flex: 1; }

.continue-card .continue-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.continue-card .continue-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.continue-card .continue-progress {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.continue-card .continue-progress .progress-label {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.continue-card .continue-arrow {
  font-size: 1.5rem;
  color: var(--color-primary-400);
  flex-shrink: 0;
}

/* ── Module Grid ──────────────────────────────────────────────── */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

.module-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  border: 1px solid var(--color-border-light);
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}

.module-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-primary-200);
}

/* Module locked state */
.module-card.locked {
  opacity: 0.55;
  filter: grayscale(0.5);
  pointer-events: none;
  position: relative;
}

.module-card.locked::after {
  content: '🔒';
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  font-size: 1.4rem;
  z-index: 2;
}

.module-card.locked .btn-access {
  background: var(--color-text-muted);
  cursor: not-allowed;
}

.module-card.locked:hover {
  transform: none;
  box-shadow: var(--shadow-xs);
  border-color: var(--color-border-light);
}

.module-card .module-emoji {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: var(--color-primary-50);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: var(--space-4);
}

.module-card .module-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.module-card .module-desc {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.module-card .module-progress {
  margin-bottom: var(--space-5);
}

.module-card .module-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.module-card .module-lesson-count {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.module-card .module-progress-percent {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary-600);
}

.module-card .module-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.module-card .btn-access {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  background: var(--color-primary-500);
  color: white;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--duration-fast) var(--ease-out);
  border: none;
  font-family: var(--font-body);
}

.module-card .btn-access:hover {
  background: var(--color-primary-600);
  transform: scale(1.05);
  box-shadow: var(--shadow-button);
}

.module-card .module-eta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Card accent bar at top */
.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--space-6);
  right: var(--space-6);
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary-400), var(--color-primary-200));
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transform: scaleX(0);
  transition: transform var(--duration-slow) var(--ease-out);
}

.module-card:hover::before {
  transform: scaleX(1);
}

/* ── Progress Bars ────────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary-300), var(--color-primary-500));
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 1s var(--ease-out);
}

.progress-bar.fill-success .progress-fill {
  background: linear-gradient(90deg, #34D399, var(--color-success));
}

.progress-bar.fill-warning .progress-fill {
  background: linear-gradient(90deg, #FBBF24, var(--color-warning));
}

/* Circular progress */
.circular-progress {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.circular-progress svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.circular-progress .bg-circle {
  fill: none;
  stroke: var(--color-border-light);
  stroke-width: 4;
}

.circular-progress .fg-circle {
  fill: none;
  stroke: var(--color-primary-400);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s var(--ease-out);
}

.circular-progress .circular-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-primary-600);
}

/* ── Achievements ─────────────────────────────────────────────── */
.achievements-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.achievement-badge {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 2px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  position: relative;
  transition: all var(--duration-normal) var(--ease-out);
  cursor: default;
}

.achievement-badge.unlocked {
  border-color: var(--color-warning);
  background: var(--color-warning-50);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.1);
}

.achievement-badge.unlocked::after {
  content: '✨';
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 0.7rem;
}

.achievement-badge.locked {
  filter: grayscale(1);
  opacity: 0.5;
}

.achievement-badge:hover {
  transform: scale(1.15);
}

.achievement-badge .badge-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text);
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast);
}

.achievement-badge:hover .badge-tooltip {
  opacity: 1;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-weight: 600;
  font-size: 0.925rem;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  font-family: var(--font-body);
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--color-primary-500);
  color: white;
  box-shadow: var(--shadow-button);
}

.btn-primary:hover {
  background: var(--color-primary-600);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(30, 133, 184, 0.4);
}

.btn-secondary {
  background: var(--color-primary-50);
  color: var(--color-primary-600);
}

.btn-secondary:hover {
  background: var(--color-primary-100);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--color-success);
  color: white;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

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

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: 1.05rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-block { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Forms & Inputs ───────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.95rem;
  font-family: var(--font-body);
  transition: all var(--duration-fast) var(--ease-out);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 4px var(--color-primary-100);
  background: var(--color-surface);
}

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

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* Floating label form */
.floating-field {
  position: relative;
  margin-bottom: var(--space-5);
}

.floating-field .form-input {
  padding: var(--space-5) var(--space-4) var(--space-2);
  border-radius: var(--radius-md);
}

.floating-field .floating-label {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  color: var(--color-text-muted);
  pointer-events: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.floating-field .form-input:focus ~ .floating-label,
.floating-field .form-input:not(:placeholder-shown) ~ .floating-label {
  top: var(--space-3);
  font-size: 0.7rem;
  color: var(--color-primary-600);
  font-weight: 600;
  transform: none;
}

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-xs);
}

.card-elevated {
  box-shadow: var(--shadow-md);
  border-color: transparent;
}

.card-padded {
  padding: var(--space-6);
}

/* ── Timeline (module lesson view) ────────────────────────────── */
.timeline {
  position: relative;
  padding-left: var(--space-10);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border-light);
}

.timeline-node {
  position: relative;
  padding: var(--space-4) 0 var(--space-6);
}

.timeline-node .node-marker {
  position: absolute;
  left: calc(-1 * var(--space-10) + 7px);
  top: var(--space-4);
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  border: 3px solid var(--color-border);
  background: var(--color-surface);
  z-index: 2;
  transition: all var(--duration-normal) var(--ease-out);
}

.timeline-node.completed .node-marker {
  background: var(--color-success);
  border-color: var(--color-success);
  box-shadow: 0 0 0 4px var(--color-success-50);
}

.timeline-node.completed .node-marker::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 4px;
  width: 4px;
  height: 7px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.timeline-node.current .node-marker {
  background: var(--color-primary-400);
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 4px var(--color-primary-100);
  animation: node-pulse 2s infinite;
}

.timeline-node.locked .node-marker {
  background: var(--color-bg);
  border-color: var(--color-border);
}

.timeline-node .node-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}

.timeline-node.current .node-content {
  border-color: var(--color-primary-200);
  box-shadow: var(--shadow-lg);
  background: var(--color-primary-50);
}

.timeline-node.completed .node-content:hover,
.timeline-node.current .node-content:hover {
  transform: translateX(4px);
}

.timeline-node.locked .node-content {
  opacity: 0.6;
  cursor: not-allowed;
}

.timeline-node .node-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.timeline-node .node-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-full);
}

.node-badge.done {
  background: var(--color-success-50);
  color: var(--color-success);
}

.node-badge.current {
  background: var(--color-primary-100);
  color: var(--color-primary-600);
}

.node-badge.locked {
  background: var(--color-bg);
  color: var(--color-text-muted);
}

/* ── Video Player Wrapper ─────────────────────────────────────── */
.video-wrapper {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin-bottom: var(--space-6);
}

.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  background: #000;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ── Lesson Action Bar ────────────────────────────────────────── */
.lesson-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

/* ── Comments ─────────────────────────────────────────────────── */
.comments-section {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
}

.comments-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
}

.comments-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.comments-list {
  padding: var(--space-4) var(--space-6);
  max-height: 500px;
  overflow-y: auto;
}

.comment-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-primary-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-primary-600);
  flex-shrink: 0;
}

.comment-body {
  flex: 1;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.comment-author {
  font-weight: 600;
  font-size: 0.875rem;
}

.comment-time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.comment-text {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.comments-form {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
}

.comments-form textarea {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  padding: var(--space-3);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  resize: none;
  transition: border-color var(--duration-fast);
}

.comments-form textarea:focus {
  outline: none;
  border-color: var(--color-primary-400);
}

/* Comment Reply Button */
.comment-reply-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
  transition: all var(--duration-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.comment-reply-btn:hover {
  color: var(--color-primary-600);
  background: var(--color-primary-50);
}

/* Comment Reply (nested) */
.comment-reply {
  margin-left: 48px;
  padding-left: var(--space-4);
  border-left: 3px solid var(--color-primary-200);
  background: var(--color-bg);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* Reply Form */
.reply-form-container {
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
}
.reply-textarea {
  width: 100%;
  min-height: 38px;
  max-height: 100px;
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.875rem;
  resize: none;
  transition: border-color var(--duration-fast);
  margin-bottom: var(--space-2);
}
.reply-textarea:focus {
  outline: none;
  border-color: var(--color-primary-400);
}
.reply-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* ── Quiz ─────────────────────────────────────────────────────── */
.quiz-container {
  max-width: 800px;
  margin: 0 auto;
}

.quiz-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.quiz-question-count {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.quiz-question-text {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: var(--space-6);
  line-height: 1.4;
  text-align: center;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
  text-align: left;
}

.quiz-option:hover {
  border-color: var(--color-primary-200);
  background: var(--color-primary-50);
  transform: translateX(2px);
}

.quiz-option .option-letter {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  transition: all var(--duration-fast);
}

.quiz-option.selected {
  border-color: var(--color-primary-400);
  background: var(--color-primary-50);
  box-shadow: 0 0 0 4px var(--color-primary-100);
}

.quiz-option.selected .option-letter {
  background: var(--color-primary-400);
  color: white;
}

.quiz-option.correct {
  border-color: var(--color-success) !important;
  background: var(--color-success-50) !important;
}

.quiz-option.correct .option-letter {
  background: var(--color-success) !important;
  color: white !important;
}

.quiz-option.incorrect {
  border-color: var(--color-rose) !important;
  background: var(--color-rose-50) !important;
}

.quiz-option.incorrect .option-letter {
  background: var(--color-rose) !important;
  color: white !important;
}

.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}

/* Quiz Results */
.quiz-result {
  text-align: center;
  padding: var(--space-12) var(--space-6);
}

.quiz-result .result-emoji {
  font-size: 5rem;
  margin-bottom: var(--space-6);
  animation: result-bounce 0.6s var(--ease-spring);
}

.quiz-result .result-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: var(--space-3);
}

.quiz-result .result-score {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-8);
}

.quiz-result.pass .result-emoji { color: var(--color-warning); }
.quiz-result.pass .result-title { color: var(--color-success); }
.quiz-result.fail .result-title { color: var(--color-text-secondary); }

/* ── Chat (Professor GonzaguinhIA) ──────────────────────────────────── */
.chat-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-height) - var(--space-6));
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.chat-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.chat-header .coruja-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #3A1C71, #D76D77, #FFAF7B);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.chat-header .coruja-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.chat-header .coruja-info span {
  font-size: 0.8rem;
  color: var(--color-success);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: var(--color-bg);
}

.chat-bubble {
  max-width: 80%;
  padding: var(--space-3) var(--space-4);
  font-size: 0.925rem;
  line-height: 1.6;
  animation: msg-slide-in 0.3s var(--ease-out);
}

.chat-bubble.bot {
  align-self: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
  box-shadow: var(--shadow-xs);
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--color-primary-500);
  color: white;
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
}

.chat-bubble.typing {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
  padding: var(--space-4);
}

.chat-bubble.typing .typing-dots {
  display: flex;
  gap: 4px;
}

.chat-bubble.typing .typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-text-muted);
  animation: typing-bounce 1.4s infinite;
}

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

.chat-input-bar {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-light);
  background: var(--color-surface);
}

.chat-input-bar input {
  flex: 1;
  padding: var(--space-3) var(--space-5);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-full);
  font-size: 0.925rem;
  font-family: var(--font-body);
  transition: border-color var(--duration-fast);
}

.chat-input-bar input:focus {
  outline: none;
  border-color: var(--color-primary-300);
  box-shadow: 0 0 0 4px var(--color-primary-50);
}

.chat-input-bar button {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--color-primary-500);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--duration-fast) var(--ease-out);
}

.chat-input-bar button:hover {
  background: var(--color-primary-600);
  transform: scale(1.08);
  box-shadow: var(--shadow-button);
}

.chat-suggestions {
  padding: var(--space-4) var(--space-6);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  border-top: 1px solid var(--color-border-light);
}

.chip {
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary-50);
  color: var(--color-primary-600);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--color-primary-100);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.chip:hover {
  background: var(--color-primary-100);
  transform: translateY(-1px);
}

/* ── Chat Header Layout ─────────────────────────────────────────── */
.chat-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex: 1;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: 0.825rem;
}

/* ── Token Counter Header ───────────────────────────────────────── */
.token-counter-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--color-primary-50);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary-600);
  border: 1px solid var(--color-primary-100);
  white-space: nowrap;
}
.token-counter-header.warning {
  background: #FEF3C7;
  color: #B45309;
  border-color: #FCD34D;
}
.token-counter-header.danger {
  background: var(--color-rose-50);
  color: var(--color-rose);
  border-color: var(--color-rose-200);
}

/* ── Instagram Follow Popup ────────────────────────────────────── */
.ig-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.3s ease-out;
}

.ig-popup-card {
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  max-width: 440px;
  width: 90%;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-xl);
  animation: popup-scale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ig-popup-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--duration-fast);
  line-height: 1;
}
.ig-popup-close:hover {
  color: var(--color-text);
}

.ig-popup-icon {
  font-size: 3.5rem;
  margin-bottom: var(--space-4);
}

.ig-popup-card h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 var(--space-3);
  font-family: var(--font-heading);
}

.ig-popup-card p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
  font-size: 0.95rem;
  line-height: 1.5;
}

.ig-follow-btn {
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888) !important;
  color: white !important;
  border: none !important;
  font-size: 1rem;
  padding: var(--space-3) var(--space-6);
  transition: all var(--duration-fast);
}
.ig-follow-btn:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

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

/* ── Auth Pages (Login / Register) ────────────────────────────── */
.auth-wrapper {
  display: flex;
  min-height: 100vh;
}

.auth-hero {
  flex: 1;
  background: linear-gradient(135deg, var(--color-primary-100) 0%, var(--color-primary-200) 30%, var(--color-primary-300) 70%, var(--color-primary-400) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  position: relative;
  overflow: hidden;
}

/* Animated particles / floating shapes */
.auth-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.2) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.15) 0%, transparent 60%);
  animation: auth-float 8s ease-in-out infinite alternate;
}

.auth-hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--color-primary-700);
}

.auth-hero-content .auth-logo {
  height: 80px;
  margin-bottom: var(--space-8);
  filter: brightness(0);
}

.auth-hero-content h1 {
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

.auth-hero-content p {
  font-size: 1.15rem;
  opacity: 0.8;
  max-width: 440px;
  color: var(--color-primary-700);
}

.auth-hero-illustration {
  margin-top: var(--space-8);
  font-size: 8rem;
  animation: auth-icon-bounce 2s ease-in-out infinite;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,0.1));
}

/* Floating decorative elements */
.floating-elements {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.floating-el {
  position: absolute;
  background: rgba(255,255,255,0.4);
  border-radius: var(--radius-lg);
  animation: float-around 20s linear infinite;
}

.floating-el:nth-child(1) {
  width: 80px; height: 80px;
  top: 10%; left: 10%;
  animation-duration: 18s;
  background: rgba(255,255,255,0.3);
}

.floating-el:nth-child(2) {
  width: 50px; height: 50px;
  top: 60%; left: 80%;
  animation-duration: 24s;
  animation-delay: -5s;
  border-radius: var(--radius-full);
}

.floating-el:nth-child(3) {
  width: 60px; height: 60px;
  top: 75%; left: 25%;
  animation-duration: 22s;
  animation-delay: -10s;
}

.floating-el:nth-child(4) {
  width: 40px; height: 40px;
  top: 20%; left: 70%;
  animation-duration: 20s;
  animation-delay: -3s;
  border-radius: var(--radius-full);
}

.floating-el:nth-child(5) {
  width: 70px; height: 70px;
  top: 45%; left: 40%;
  animation-duration: 26s;
  animation-delay: -8s;
}

.auth-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10);
  background: var(--color-bg);
}

.auth-form-card {
  width: 100%;
  max-width: 460px;
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border-light);
}

.auth-form-card h2 {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: var(--space-2);
}

.auth-form-card .auth-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: var(--space-8);
}

.auth-form-card .auth-footer {
  text-align: center;
  margin-top: var(--space-6);
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

.auth-form-card .auth-footer a {
  color: var(--color-primary-600);
  font-weight: 600;
  transition: color var(--duration-fast);
}

.auth-form-card .auth-footer a:hover {
  color: var(--color-primary-700);
}

.auth-error {
  background: var(--color-rose-50);
  color: var(--color-rose);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--space-5);
  text-align: center;
}

.auth-success {
  background: var(--color-success-50);
  color: var(--color-success);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--space-5);
  text-align: center;
}

/* ── Preloader ────────────────────────────────────────────────── */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--color-surface);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}

#preloader .preloader-logo {
  width: 120px;
  margin-bottom: var(--space-6);
  animation: preloader-bounce 1s infinite alternate var(--ease-in-out);
}

.preloader-spinner {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  border: 3px solid var(--color-border-light);
  border-top-color: var(--color-primary-400);
  animation: spin 0.8s linear infinite;
  margin-bottom: var(--space-5);
}

.preloader-text {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text-secondary);
}

/* ── Confetti Canvas ──────────────────────────────────────────── */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9998;
}

/* ── Toast / Notification ─────────────────────────────────────── */
.toast {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  z-index: 9997;
  animation: toast-in 0.4s var(--ease-spring);
  font-size: 0.925rem;
  font-weight: 600;
}

.toast.success { border-left: 4px solid var(--color-success); }
.toast.error { border-left: 4px solid var(--color-rose); }
.toast.info { border-left: 4px solid var(--color-primary-400); }

/* ── Badges ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 0.775rem;
  font-weight: 600;
  font-family: var(--font-body);
}

.badge-xp {
  background: var(--color-warning-50);
  color: #B45309;
}

.badge-streak {
  background: var(--color-rose-50);
  color: var(--color-rose);
}

.badge-success {
  background: var(--color-success-50);
  color: #065F46;
}

.badge-info {
  background: var(--color-primary-50);
  color: var(--color-primary-600);
}

/* ── Empty State ──────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--color-text-muted);
}

.empty-state .empty-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 1.25rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: 0.95rem;
}

/* ── Alert / Banner ───────────────────────────────────────────── */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: 0.925rem;
  font-weight: 500;
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.alert-success {
  background: var(--color-success-50);
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.alert-warning {
  background: var(--color-warning-50);
  color: #92400E;
  border: 1px solid #FDE68A;
}

.alert-info {
  background: var(--color-primary-50);
  color: var(--color-primary-700);
  border: 1px solid var(--color-primary-200);
}

/* ── Admin Layout ─────────────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 240px;
  background: var(--color-text);
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.admin-sidebar a {
  color: rgba(255,255,255,0.7);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--duration-fast);
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
  background: rgba(255,255,255,0.1);
  color: white;
}

.admin-main {
  flex: 1;
  margin-left: 240px;
  padding: var(--space-8);
}

/* ── Certificate ─────────────────────────────────────────────── */
.certificate-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-8);
}

.certificate-card {
  background: linear-gradient(135deg, #fffef5 0%, #ffffff 30%, #fffef5 60%, #ffffff 100%);
  border: 12px double #C9A84C;
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-10);
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

.certificate-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(201, 168, 76, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(201, 168, 76, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(137, 207, 240, 0.05) 0%, transparent 60%);
  pointer-events: none;
}

.certificate-header {
  position: relative;
  z-index: 1;
  margin-bottom: var(--space-8);
}

.certificate-header .cert-logo {
  height: 60px;
  margin-bottom: var(--space-4);
}

.certificate-header .cert-badge {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #C9A84C;
  margin-bottom: var(--space-2);
}

.certificate-header h1 {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 2.75rem;
  font-weight: 700;
  color: #1A1D26;
  margin-bottom: var(--space-2);
  letter-spacing: 0.03em;
}

.certificate-body {
  position: relative;
  z-index: 1;
  margin: var(--space-8) 0;
}

.certificate-body .cert-presented {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
  font-family: 'Georgia', 'Times New Roman', serif;
}

.certificate-body .cert-name {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: #C9A84C;
  margin-bottom: var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 2px solid #C9A84C;
  display: inline-block;
  min-width: 300px;
}

.certificate-body .cert-description {
  font-size: 1rem;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto var(--space-6);
  line-height: 1.6;
  font-family: 'Georgia', 'Times New Roman', serif;
}

.certificate-body .cert-details {
  display: flex;
  justify-content: center;
  gap: var(--space-10);
  flex-wrap: wrap;
  margin-top: var(--space-6);
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

.certificate-body .cert-detail-item {
  text-align: center;
}

.certificate-body .cert-detail-item strong {
  display: block;
  color: var(--color-text);
  font-size: 1.05rem;
  margin-top: var(--space-1);
}

.certificate-footer {
  position: relative;
  z-index: 1;
  margin-top: var(--space-8);
  display: flex;
  justify-content: center;
  gap: var(--space-10);
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  border-top: 1px solid #E5E0D0;
  padding-top: var(--space-6);
}

.certificate-footer .cert-seal {
  font-size: 3rem;
  opacity: 0.6;
}

.certificate-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-6);
  flex-wrap: wrap;
}

.certificate-actions .btn {
  min-width: 180px;
}

@media print {
  body * {
    visibility: hidden;
  }
  .certificate-wrapper,
  .certificate-wrapper * {
    visibility: visible;
  }
  .certificate-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px;
  }
  .certificate-actions,
  .sidebar,
  .topbar,
  .sidebar-toggle,
  .sidebar-overlay {
    display: none !important;
  }
  .main-content {
    margin-left: 0 !important;
  }
}

/* ── School Type Selector (Register) ──────────────────────────── */
.school-type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.school-type-option {
  cursor: pointer;
}

.school-type-option input[type="radio"] {
  display: none;
}

.school-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  transition: all var(--duration-fast) var(--ease-out);
  text-align: center;
}

.school-type-card:hover {
  border-color: var(--color-primary-200);
  background: var(--color-primary-50);
  transform: translateY(-2px);
}

.school-type-option input[type="radio"]:checked + .school-type-card {
  border-color: var(--color-primary-400);
  background: var(--color-primary-50);
  box-shadow: 0 0 0 4px var(--color-primary-100);
}

.school-type-icon {
  font-size: 2rem;
}

.school-type-text {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
}

/* ── Streak Lost Popup ────────────────────────────────────────── */
.streak-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.3s ease-out;
}

.streak-popup-card {
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  max-width: 460px;
  width: 90%;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-xl);
  animation: popup-scale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.streak-popup-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
}

.streak-popup-card h3 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 var(--space-3);
  font-family: var(--font-heading);
}

.streak-popup-card p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
  font-size: 0.95rem;
  line-height: 1.5;
}

.streak-popup-card .restore-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: var(--space-3);
  font-style: italic;
}

.streak-popup-card .restore-unavailable {
  background: var(--color-warning-50);
  color: #92400E;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: var(--space-4);
}

.btn-restore-streak {
  background: linear-gradient(135deg, var(--color-rose), #E11D48);
  color: white;
  font-size: 1rem;
  padding: var(--space-3) var(--space-6);
  border: none;
  transition: all var(--duration-fast);
}
.btn-restore-streak:hover {
  opacity: 0.9;
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.4);
}

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

/* ── Utility Classes ──────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-success { color: var(--color-success); }
.text-primary { color: var(--color-primary-600); }
.font-heading { font-family: var(--font-heading); }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.w-full { width: 100%; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

/* Margin */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-10 { margin-top: var(--space-10); }
.mt-12 { margin-top: var(--space-12); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-10 { margin-bottom: var(--space-10); }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

/* Padding */
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* ── Keyframes ────────────────────────────────────────────────── */
@keyframes node-pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--color-primary-100); }
  50% { box-shadow: 0 0 0 10px rgba(137, 207, 240, 0.2); }
}

@keyframes msg-slide-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

@keyframes preloader-bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-16px); }
}

@keyframes result-bounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ── Reveal Animations ───────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes auth-float {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.05) translate(10px, -10px); }
}

@keyframes auth-icon-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

@keyframes float-around {
  0% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(30px, -40px) rotate(5deg); }
  50% { transform: translate(-20px, -20px) rotate(-3deg); }
  75% { transform: translate(-30px, 30px) rotate(2deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--color-border-light) 25%, var(--color-bg) 50%, var(--color-border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* Staggered entrance for child elements */
.stagger-in > * {
  opacity: 0;
  transform: translateY(20px);
  animation: fade-in-up 0.5s var(--ease-out) forwards;
}

.stagger-in > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-in > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-in > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-in > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-in > *:nth-child(10) { animation-delay: 0.5s; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    width: 280px;
  }

  .sidebar-toggle {
    display: flex;
  }

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

  .main-content {
    margin-left: 0;
  }

  .topbar {
    padding-left: var(--space-16);
    padding-right: var(--space-4);
  }

  .page-content {
    padding: var(--space-5);
  }

  .modules-grid {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .auth-wrapper {
    flex-direction: column;
  }

  .auth-hero {
    padding: var(--space-8) var(--space-6);
    min-height: 300px;
  }

  .auth-hero-content h1 {
    font-size: 2rem;
  }

  .auth-hero-illustration {
    font-size: 4rem;
    margin-top: var(--space-4);
  }

  .auth-form-card {
    padding: var(--space-6);
  }

  .quiz-container {
    max-width: 100%;
  }

  .admin-sidebar {
    width: 0;
    padding: 0;
    overflow: hidden;
  }

  .admin-main {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .stats-row {
    grid-template-columns: 1fr;
  }

  .welcome-hero h1 {
    font-size: 1.75rem;
  }

  .lesson-actions {
    flex-direction: column;
  }

  .lesson-actions .btn {
    width: 100%;
  }

  .continue-card {
    flex-direction: column;
    text-align: center;
  }

  .chat-bubble {
    max-width: 90%;
  }

  .auth-hero-content h1 {
    font-size: 1.75rem;
  }

  .auth-form-card {
    padding: var(--space-5);
  }

  .auth-form-card h2 {
    font-size: 1.5rem;
  }

  .module-card .module-footer {
    flex-direction: column;
    gap: var(--space-3);
    align-items: stretch;
  }

  .topbar {
    padding: 0 var(--space-4);
  }

  .topbar .breadcrumb {
    font-size: 0.8rem;
  }
}
