/* ============================================================
   AutoTest IA 2026 — Estilos principales
   Diseño moderno, mobile-first, modo oscuro incluido
   ============================================================ */

/* ── Variables CSS ──────────────────────────────────────── */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #10b981;
  --secondary-dark: #059669;
  --accent: #f59e0b;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f97316;
  --warning-light: #ffedd5;
  --success: #22c55e;
  --success-light: #dcfce7;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #1e293b;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-focus: #2563eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: all 0.2s ease;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Modo oscuro ─────────────────────────────────────────── */
.dark {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-sidebar: #0f172a;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border: #334155;
  --primary-light: #1e3a5f;
  --success-light: #052e16;
  --danger-light: #450a0a;
  --warning-light: #431407;
  --purple-light: #2e1065;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
}

/* ── Reset y Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Layout Principal ─────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }

/* ── Pantallas (vistas) ──────────────────────────────────── */
.screen { display: none; width: 100%; }
.screen.active { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--bg-sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform 0.3s ease, var(--transition);
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo h1 { font-size: 1.2rem; font-weight: 700; color: #fff; }
.sidebar-logo span { font-size: 0.75rem; color: #94a3b8; }

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name { font-weight: 600; font-size: 0.9rem; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-level { font-size: 0.75rem; color: #94a3b8; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section { padding: 8px 20px 4px; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: #64748b; font-weight: 600; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 0.875rem;
  color: #94a3b8;
  transition: var(--transition);
  cursor: pointer;
  border-left: 3px solid transparent;
}
.nav-item:hover { color: #f1f5f9; background: rgba(255,255,255,0.05); }
.nav-item.active { color: #fff; background: rgba(37,99,235,0.2); border-left-color: var(--primary); }
.nav-item .nav-icon { width: 20px; text-align: center; font-size: 1rem; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 20px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn-sidebar-action {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 0.8rem; color: #94a3b8;
  background: transparent; border: none;
  cursor: pointer; transition: var(--transition);
  text-align: left; width: 100%;
}
.btn-sidebar-action:hover { color: #f1f5f9; background: rgba(255,255,255,0.05); }

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top Bar ─────────────────────────────────────────────── */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.topbar-title { font-weight: 700; font-size: 1.1rem; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.btn-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--bg); color: var(--text); }

#hamburger { display: none; }

/* ── Page Content ─────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ── Botones ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover:not(:disabled) { background: var(--secondary-dark); transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-warning { background: var(--accent); color: #fff; }
.btn-warning:hover:not(:disabled) { background: #d97706; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-xl { padding: 16px 36px; font-size: 1.1rem; border-radius: var(--radius); }
.btn-block { width: 100%; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header { margin-bottom: 16px; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.card-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* ── Grid ────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 600; }
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-sub { font-size: 0.8rem; color: var(--text-muted); }
.stat-icon { font-size: 1.5rem; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: #16a34a; }
.badge-danger { background: var(--danger-light); color: #dc2626; }
.badge-warning { background: var(--warning-light); color: #c2410c; }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-gray { background: var(--border); color: var(--text-muted); }

/* ── Barra de progreso ────────────────────────────────────── */
.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 20px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 20px;
  transition: width 0.6s ease;
  background: var(--primary);
}
.progress-fill.success { background: var(--secondary); }
.progress-fill.danger { background: var(--danger); }
.progress-fill.warning { background: var(--accent); }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.form-input {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: var(--bg-card);
  color: var(--text);
  transition: var(--transition);
  outline: none;
}
.form-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.form-error { font-size: 0.8rem; color: var(--danger); }
.form-hint { font-size: 0.78rem; color: var(--text-muted); }

/* ── Modales ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; visibility: hidden;
  transition: all 0.25s ease;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.96);
  transition: all 0.25s ease;
  box-shadow: var(--shadow-xl);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 6px; }
.modal-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 24px; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); }

/* ── Toast/Notificaciones ─────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--text);
  color: var(--bg-card);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  display: flex; align-items: center; gap: 10px;
  min-width: 240px; max-width: 360px;
}
.toast.success { background: var(--secondary); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--primary); }
@keyframes toastIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ═══════════════════════════════════════════════════════════
   LANDING PAGE
══════════════════════════════════════════════════════════ */
#screen-landing {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  min-height: 100vh;
  color: #fff;
  display: flex !important;
  flex-direction: column;
}
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 40px;
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.landing-logo { font-size: 1.4rem; font-weight: 800; }
.landing-logo span { color: var(--accent); }
.landing-nav-links { display: flex; gap: 12px; align-items: center; }

.landing-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(37,99,235,0.3);
  border: 1px solid rgba(37,99,235,0.5);
  padding: 6px 16px; border-radius: 20px;
  font-size: 0.8rem; font-weight: 600; color: #93c5fd;
  margin-bottom: 24px; letter-spacing: 0.05em;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900; line-height: 1.1;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #fff 30%, #93c5fd 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: #94a3b8; max-width: 600px;
  margin: 0 auto 36px;
  line-height: 1.7;
}
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-bottom: 48px; }
.btn-hero-primary {
  background: var(--primary);
  color: #fff; padding: 16px 36px;
  border-radius: 12px; font-size: 1.05rem;
  font-weight: 700; border: none; cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 0 30px rgba(37,99,235,0.4);
}
.btn-hero-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 0 40px rgba(37,99,235,0.6); }
.btn-hero-secondary {
  background: rgba(255,255,255,0.1);
  color: #fff; padding: 16px 32px;
  border-radius: 12px; font-size: 1.05rem;
  font-weight: 600; border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer; transition: all 0.3s;
  backdrop-filter: blur(10px);
}
.btn-hero-secondary:hover { background: rgba(255,255,255,0.15); transform: translateY(-2px); }

.hero-stats {
  display: flex; gap: 32px; flex-wrap: wrap; justify-content: center;
  padding: 24px; background: rgba(255,255,255,0.05);
  border-radius: var(--radius-lg); border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  margin-bottom: 60px;
}
.hero-stat { text-align: center; }
.hero-stat-value { font-size: 1.8rem; font-weight: 900; color: #fff; }
.hero-stat-label { font-size: 0.8rem; color: #94a3b8; }

.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px; padding: 0 40px 60px; max-width: 1100px; margin: 0 auto; width: 100%;
}
.feature-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius); padding: 24px;
  text-align: center; transition: all 0.3s;
}
.feature-card:hover { background: rgba(255,255,255,0.08); transform: translateY(-4px); }
.feature-icon { font-size: 2.5rem; margin-bottom: 12px; }
.feature-title { font-size: 1rem; font-weight: 700; margin-bottom: 8px; color: #f1f5f9; }
.feature-desc { font-size: 0.85rem; color: #94a3b8; line-height: 1.6; }

.landing-disclaimer {
  text-align: center; padding: 20px 40px;
  background: rgba(245,158,11,0.1);
  border-top: 1px solid rgba(245,158,11,0.2);
  font-size: 0.8rem; color: #fcd34d;
}

/* ═══════════════════════════════════════════════════════════
   AUTH (Login/Registro)
══════════════════════════════════════════════════════════ */
#screen-auth {
  background: var(--bg);
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow-xl);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo h1 { font-size: 1.5rem; font-weight: 900; }
.auth-logo span { color: var(--primary); }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 28px; background: var(--bg); padding: 4px; border-radius: var(--radius-sm); }
.auth-tab {
  flex: 1; padding: 8px; text-align: center;
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer; border-radius: 6px;
  transition: var(--transition);
  background: none; border: none;
  color: var(--text-muted);
}
.auth-tab.active { background: var(--bg-card); color: var(--text); box-shadow: var(--shadow); }
.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-divider { text-align: center; margin: 16px 0; color: var(--text-muted); font-size: 0.8rem; position: relative; }
.auth-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.auth-divider span { background: var(--bg-card); padding: 0 12px; position: relative; }

/* ═══════════════════════════════════════════════════════════
   DASHBOARD
══════════════════════════════════════════════════════════ */
.dashboard-greeting { margin-bottom: 24px; }
.dashboard-greeting h2 { font-size: 1.5rem; font-weight: 800; }
.dashboard-greeting p { color: var(--text-muted); font-size: 0.9rem; }

.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
.quick-action-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-radius: var(--radius);
  font-weight: 700; font-size: 0.9rem;
  border: none; cursor: pointer; transition: var(--transition);
  text-decoration: none;
}
.qa-primary { background: var(--primary); color: #fff; }
.qa-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.qa-success { background: var(--secondary); color: #fff; }
.qa-success:hover { background: var(--secondary-dark); transform: translateY(-2px); }
.qa-warning { background: var(--accent); color: #fff; }
.qa-warning:hover { background: #d97706; transform: translateY(-2px); }
.qa-purple { background: var(--purple); color: #fff; }
.qa-purple:hover { background: #7c3aed; transform: translateY(-2px); }

.xp-bar-container { margin-bottom: 24px; }
.xp-bar-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.xp-label { font-size: 0.85rem; font-weight: 700; }
.xp-value { font-size: 0.8rem; color: var(--text-muted); }

/* ─ Racha ─────────────────────────────── */
.streak-widget {
  background: linear-gradient(135deg, #f97316, #ef4444);
  border-radius: var(--radius); padding: 20px;
  color: #fff; display: flex; align-items: center; gap: 16px;
}
.streak-icon { font-size: 2.5rem; }
.streak-info h3 { font-size: 1.8rem; font-weight: 900; }
.streak-info p { font-size: 0.85rem; opacity: 0.9; }

/* ─ Probabilidad de aprobar ────────────── */
.prob-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  text-align: center;
}
.prob-circle {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 0%, var(--border) 0%);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  position: relative;
}
.prob-circle::after {
  content: '';
  width: 70px; height: 70px;
  background: var(--bg-card);
  border-radius: 50%;
  position: absolute;
}
.prob-percent {
  position: relative; z-index: 1;
  font-size: 1.2rem; font-weight: 900; color: var(--primary);
}

/* ─ Temas ─────────────────────────────── */
.tema-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.tema-item:last-child { border-bottom: none; }
.tema-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.tema-info { flex: 1; min-width: 0; }
.tema-name { font-size: 0.85rem; font-weight: 600; }
.tema-stats { font-size: 0.75rem; color: var(--text-muted); }
.tema-pct { font-size: 0.9rem; font-weight: 700; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════
   TESTS / EXAMEN / APRENDIZAJE
══════════════════════════════════════════════════════════ */
.test-container { max-width: 800px; margin: 0 auto; }

.test-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap;
}
.test-progress-info { flex: 1; min-width: 0; }
.test-progress-text { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.test-timer {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border);
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 1.1rem; font-weight: 800; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.test-timer.warning { color: var(--warning); }
.test-timer.danger { color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}
.question-meta {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.question-num { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.question-text {
  font-size: 1.05rem; font-weight: 600; color: var(--text);
  line-height: 1.55; margin-bottom: 24px;
}
.question-image {
  width: 100%; max-height: 220px;
  object-fit: contain; border-radius: var(--radius-sm);
  margin-bottom: 20px; background: var(--bg);
  padding: 8px;
}

.answers-grid { display: flex; flex-direction: column; gap: 10px; }
.answer-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem; font-weight: 500;
  cursor: pointer; transition: var(--transition);
  text-align: left; width: 100%;
}
.answer-btn:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-light); }
.answer-btn:disabled { cursor: default; }
.answer-btn.correct { border-color: var(--secondary); background: var(--success-light); color: #15803d; }
.answer-btn.incorrect { border-color: var(--danger); background: var(--danger-light); color: #dc2626; }
.answer-btn.selected:not(.correct):not(.incorrect) { border-color: var(--primary); background: var(--primary-light); }

.answer-letter {
  width: 32px; height: 32px;
  border-radius: 50%; background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 800; flex-shrink: 0;
  transition: var(--transition);
}
.answer-btn:hover:not(:disabled) .answer-letter { background: var(--primary); color: #fff; }
.answer-btn.correct .answer-letter { background: var(--secondary); color: #fff; }
.answer-btn.incorrect .answer-letter { background: var(--danger); color: #fff; }

/* ─ Feedback de respuesta ──────────────── */
.feedback-box {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 12px;
  display: none;
}
.feedback-box.show { display: block; animation: fadeIn 0.3s ease; }
.feedback-box.correct { background: var(--success-light); border: 1px solid #86efac; }
.feedback-box.incorrect { background: var(--danger-light); border: 1px solid #fca5a5; }
.feedback-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; }
.feedback-text { font-size: 0.85rem; line-height: 1.6; }
.feedback-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ─ Resultado final ────────────────────── */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.result-emoji { font-size: 4rem; margin-bottom: 12px; }
.result-title { font-size: 1.8rem; font-weight: 900; margin-bottom: 8px; }
.result-subtitle { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 28px; }
.result-stats { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.result-stat { text-align: center; }
.result-stat-value { font-size: 2rem; font-weight: 900; }
.result-stat-label { font-size: 0.78rem; color: var(--text-muted); }

/* ─ Selección de tema ─────────────────── */
.tema-selector { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.tema-btn {
  padding: 16px; border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg-card);
  cursor: pointer; transition: var(--transition);
  text-align: center;
}
.tema-btn:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tema-btn.selected { border-color: var(--primary); background: var(--primary-light); }
.tema-btn-icon { font-size: 1.8rem; margin-bottom: 8px; }
.tema-btn-name { font-size: 0.82rem; font-weight: 600; }

/* ═══════════════════════════════════════════════════════════
   FLASHCARDS
══════════════════════════════════════════════════════════ */
.flashcard-container {
  perspective: 1000px;
  max-width: 500px; margin: 0 auto 20px;
}
.flashcard {
  width: 100%; min-height: 220px;
  position: relative; cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.flashcard-front {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}
.flashcard-back {
  background: var(--bg-card);
  border: 2px solid var(--secondary);
  transform: rotateY(180deg);
}
.flashcard-hint { font-size: 0.8rem; opacity: 0.7; margin-top: 16px; }
.flashcard-q { font-size: 1.1rem; font-weight: 700; line-height: 1.5; }
.flashcard-a { font-size: 1rem; font-weight: 600; color: var(--secondary); line-height: 1.5; }
.flashcard-truco { font-size: 0.85rem; color: var(--text-muted); margin-top: 12px; font-style: italic; }

/* ═══════════════════════════════════════════════════════════
   TUTOR IA
══════════════════════════════════════════════════════════ */
.tutor-chat {
  display: flex; flex-direction: column; gap: 16px;
  max-height: 500px; overflow-y: auto;
  padding: 20px;
}
.chat-msg {
  display: flex; gap: 12px; align-items: flex-start;
  animation: fadeIn 0.3s ease;
}
.chat-msg.user { flex-direction: row-reverse; }
.chat-avatar {
  width: 36px; height: 36px;
  border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700;
}
.chat-avatar.ia { background: var(--primary); color: #fff; }
.chat-avatar.user-av { background: var(--secondary); color: #fff; }
.chat-bubble {
  max-width: 75%; padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.875rem; line-height: 1.6;
}
.chat-msg.ia .chat-bubble { background: var(--bg); border: 1px solid var(--border); border-radius: 4px 16px 16px 16px; }
.chat-msg.user .chat-bubble { background: var(--primary); color: #fff; border-radius: 16px 4px 16px 16px; }
.tutor-suggestions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 20px; }
.tutor-suggestion {
  padding: 8px 14px; border-radius: 20px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 0.8rem; font-weight: 500; cursor: pointer;
  transition: var(--transition); color: var(--text);
}
.tutor-suggestion:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* ═══════════════════════════════════════════════════════════
   ESTADÍSTICAS
══════════════════════════════════════════════════════════ */
.chart-container { position: relative; width: 100%; height: 280px; }

/* ─ Logros ────────────────────────────── */
.logros-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.logro-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  text-align: center; transition: var(--transition);
}
.logro-card.obtenido { border-color: var(--accent); background: linear-gradient(135deg, #fefce8, #fef3c7); }
.dark .logro-card.obtenido { background: linear-gradient(135deg, #422006, #292524); }
.logro-emoji { font-size: 2rem; margin-bottom: 8px; }
.logro-titulo { font-size: 0.8rem; font-weight: 700; margin-bottom: 4px; }
.logro-desc { font-size: 0.72rem; color: var(--text-muted); }
.logro-locked { opacity: 0.4; filter: grayscale(1); }

/* ═══════════════════════════════════════════════════════════
   TEORÍA POR TEMAS
══════════════════════════════════════════════════════════ */
.teoria-hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-lg); padding: 32px; color: #fff; margin-bottom: 24px;
}
.teoria-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.teoria-nav-btn {
  padding: 8px 16px; border-radius: 20px;
  background: var(--bg-card); border: 1.5px solid var(--border);
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  transition: var(--transition); color: var(--text);
}
.teoria-nav-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.teoria-content { display: none; }
.teoria-content.active { display: block; animation: fadeIn 0.3s ease; }
.teoria-section-title { font-size: 1.2rem; font-weight: 800; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.teoria-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.info-list { list-style: none; }
.info-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; display: flex; align-items: flex-start; gap: 10px; }
.info-list li:last-child { border-bottom: none; }
.info-list li::before { content: '→'; color: var(--primary); font-weight: 700; flex-shrink: 0; }
.highlight-box {
  background: var(--primary-light); border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 16px; margin: 12px 0; font-size: 0.875rem;
}
.warning-box {
  background: var(--warning-light); border-left: 4px solid var(--warning);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 16px; margin: 12px 0; font-size: 0.875rem;
}
.success-box {
  background: var(--success-light); border-left: 4px solid var(--secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 16px; margin: 12px 0; font-size: 0.875rem;
}
.velocidad-table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.velocidad-table th {
  background: var(--bg); padding: 10px 12px;
  text-align: left; font-weight: 700;
  border: 1px solid var(--border); font-size: 0.8rem;
}
.velocidad-table td { padding: 10px 12px; border: 1px solid var(--border); }
.velocidad-table tr:nth-child(even) td { background: var(--bg); }

/* ═══════════════════════════════════════════════════════════
   INTENSIVO
══════════════════════════════════════════════════════════ */
.intensivo-hero {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border-radius: var(--radius-xl); padding: 36px; color: #fff; margin-bottom: 24px;
  text-align: center;
}
.intensivo-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 28px; }
.intensivo-card {
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; cursor: pointer;
  transition: var(--transition); text-align: center;
}
.intensivo-card:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.intensivo-card.selected { border-color: var(--primary); background: var(--primary-light); }
.intensivo-icon { font-size: 3rem; margin-bottom: 12px; }
.intensivo-title { font-size: 1.2rem; font-weight: 800; margin-bottom: 8px; }
.intensivo-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; }
.intensivo-features { list-style: none; margin-top: 16px; text-align: left; }
.intensivo-features li { padding: 6px 0; font-size: 0.82rem; display: flex; gap: 8px; align-items: flex-start; }
.intensivo-features li::before { content: '✓'; color: var(--secondary); font-weight: 700; flex-shrink: 0; }

/* ─ Plan del día ───────────────────────── */
.plan-day {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 12px;
  display: flex; gap: 16px; align-items: flex-start;
}
.plan-day-num {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1rem; flex-shrink: 0;
}
.plan-day.completed .plan-day-num { background: var(--secondary); }
.plan-day-info { flex: 1; }
.plan-day-title { font-weight: 700; margin-bottom: 4px; }
.plan-day-desc { font-size: 0.82rem; color: var(--text-muted); }
.plan-day-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ═══════════════════════════════════════════════════════════
   MIS FALLOS
══════════════════════════════════════════════════════════ */
.fallo-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 10px;
}
.fallo-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.fallo-q { font-size: 0.9rem; font-weight: 600; flex: 1; }
.fallo-veces { color: var(--danger); font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.fallo-respuesta { font-size: 0.82rem; color: var(--text-muted); }
.fallo-correct { font-size: 0.82rem; color: var(--secondary); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════
   UTILIDADES Y ANIMACIONES
══════════════════════════════════════════════════════════ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { transform: translateX(-20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes bounceIn { 0% { transform: scale(0.8); opacity: 0; } 70% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }

.fade-in { animation: fadeIn 0.4s ease; }
.slide-in { animation: slideIn 0.4s ease; }
.bounce-in { animation: bounceIn 0.5s ease; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.font-bold { font-weight: 700; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--secondary); }
.text-danger { color: var(--danger); }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.emoji-lg { font-size: 2rem; }
.rounded { border-radius: var(--radius); }

/* ─ Spinner ───────────────────────────── */
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─ Empty state ───────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3.5rem; margin-bottom: 16px; }
.empty-state-title { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state-text { font-size: 0.875rem; line-height: 1.6; }

/* ══════════════════════════════════════
   RESPONSIVE — Mobile First
══════════════════════════════════════ */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  #hamburger { display: flex; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .features-grid { padding: 0 20px 40px; }
  .landing-nav { padding: 16px 20px; }
}

@media (max-width: 640px) {
  .page-content { padding: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero-title { font-size: 1.9rem; }
  .hero-stats { gap: 16px; }
  .quick-actions { gap: 8px; }
  .quick-action-btn { padding: 10px 14px; font-size: 0.82rem; }
  .result-card { padding: 24px 16px; }
  .question-card { padding: 20px 16px; }
  .auth-card { padding: 24px 20px; }
  .landing-hero { padding: 40px 16px; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .modal { padding: 24px; }
  .topbar { padding: 10px 16px; }
  .tutor-chat { max-height: 350px; }
  .intensivo-options { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
}

/* ── Sidebar overlay para móvil ──────────────────────────── */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  display: none;
}
.sidebar-overlay.show { display: block; }

/* ── Tabs ─────────────────────────────── */
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: var(--radius-sm); margin-bottom: 20px; overflow-x: auto; }
.tab-btn {
  flex: 1; min-width: max-content; padding: 8px 16px;
  border-radius: 6px; border: none;
  background: transparent; cursor: pointer;
  font-size: 0.85rem; font-weight: 600; color: var(--text-muted);
  transition: var(--transition); white-space: nowrap;
}
.tab-btn.active { background: var(--bg-card); color: var(--text); box-shadow: var(--shadow); }

/* ── Slider de opciones de test ──────────── */
.num-selector {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.num-btn {
  padding: 8px 18px; border-radius: 20px;
  border: 2px solid var(--border); background: var(--bg-card);
  font-size: 0.85rem; font-weight: 700; cursor: pointer;
  transition: var(--transition); color: var(--text);
}
.num-btn.selected, .num-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* Scrollbar personalizada */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }
