﻿/* ─── VARIABLES CORPORATIVAS b[ai]resoft ─── */
:root {
  --bai-blue: #0940E5;
  --bai-dark: #0A0A0A;
  --bai-blue-mid: #0052B3;
  --bai-white: #FFFFFF;
  --bai-purple: #6831CF;
  --bai-blue-10: rgba(9,64,229,0.10);
  --bai-blue-20: rgba(9,64,229,0.20);
  --bai-purple-10: rgba(104,49,207,0.10);
  --bai-purple-20: rgba(104,49,207,0.20);
  --bai-success: #34d399;
  --bai-success-bg: rgba(52,211,153,0.95);

  /* Superficies */
  --surface-1: #0A0A0A;
  --surface-2: #111116;
  --surface-3: #17171F;
  --surface-4: #1E1E28;

  /* Texto */
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255,255,255,0.65);
  --text-muted: rgba(255,255,255,0.35);

  /* Bordes */
  --border-subtle: rgba(255,255,255,0.07);
  --border-active: rgba(9,64,229,0.40);

  /* Tipografía */
  --font-ui: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-scale: 1; /* Escala de tipografía controlada por JS */

  /* Layout */
  --sidebar-width: 240px;
  --header-height: 52px;

  /* Transiciones */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;

  /* Radios */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

/* ─── COLORES CURSO (GitHub Dark + Devin Desktop inspiration) ─── */
:root {
  /* Colores adicionales del curso */
  --curso-bg:          #0D1117;   /* fondo base — GitHub dark */
  --curso-surface:     #161B22;   /* cards, panels */
  --curso-surface-2:   #21262D;   /* hover states, inputs */
  --curso-border:      #30363D;   /* bordes sutiles */
  --curso-accent:      #58A6FF;   /* azul Devin — acción principal */
  --curso-accent-2:    #3FB950;   /* verde progreso / completado */
  --curso-accent-3:    #F78166;   /* naranja / advertencia */
  --curso-text:        #E6EDF3;   /* texto principal */
  --curso-text-muted:  #7D8590;   /* texto secundario */
  --curso-text-subtle: #484F58;   /* texto terciario, placeholders */

  /* Gradiente signature del curso */
  --curso-gradient: linear-gradient(135deg, #58A6FF 0%, #BC8CFF 100%);
}
/* ─── TEMA CLARO ────────────────────────────────────────────────── */
[data-theme="light"] {
  /* Texto — más oscuro para mejor contraste */
  --text-primary:   #0A0A0F;
  --text-secondary: rgba(10,10,15,0.75);   /* era 0.65 — subir */
  --text-muted:     rgba(10,10,15,0.55);   /* era 0.40 — subir */

  /* Superficies — más diferenciadas entre sí */
  --surface-1: #EEEEF4;
  --surface-2: #F8F8FC;
  --surface-3: #FFFFFF;
  --surface-4: #EBEBF2;

  /* Bordes — más visibles */
  --border-subtle:  rgba(0,0,0,0.12);   /* era 0.08 — subir */
  --border-active:  rgba(9,64,229,0.50);

  /* Colores corporativos — sin cambios en ambos temas */
  --bai-blue: #0940E5;
  --bai-blue-mid: #0052B3;
  --bai-purple: #6831CF;
  --bai-dark: #0A0A0A;
  --bai-white: #FFFFFF;
  --bai-blue-10: rgba(9,64,229,0.08);
  --bai-blue-20: rgba(9,64,229,0.16);
  --bai-purple-10: rgba(104,49,207,0.08);
  --bai-purple-20: rgba(104,49,207,0.16);
}

/* ─── Ajustes tema claro ───────────────────────────────────────── */
[data-theme="light"] .sidebar {
  border-right-color: rgba(0,0,0,0.08);
  box-shadow: 2px 0 8px rgba(0,0,0,0.06);
}

[data-theme="light"] .app-header {
  background: rgba(244,244,248,0.92);
  border-bottom-color: rgba(0,0,0,0.08);
}

[data-theme="light"] .lesson-card {
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

[data-theme="light"] .module-hero {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

[data-theme="light"] .code-block {
  background: #F8F8FC;
  border-color: rgba(0,0,0,0.10);
}
[data-theme="light"] .code-block code {
  color: #1a1a2e;
}

[data-theme="light"] .tip-box {
  background: rgba(9,64,229,0.05);
}
[data-theme="light"] .tip-box--bai {
  background: rgba(104,49,207,0.05);
}

[data-theme="light"] .sidebar__logo-text .accent {
  color: var(--bai-blue);
}

[data-theme="light"] .btn-sidebar-logout {
  color: var(--text-muted);
}

/* Elementos específicos con bajo contraste en tema claro */
[data-theme="light"] .tag {
  background: rgba(9,64,229,0.07);
  color: #0035A0;
  border-color: rgba(9,64,229,0.20);
}

.module-number {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--curso-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

[data-theme="light"] .sidebar__module-title {
  color: #0A0A0F;
}

[data-theme="light"] .sidebar__lesson-title {
  color: rgba(10,10,15,0.75);
}

[data-theme="light"] .sidebar__progress-text {
  color: rgba(10,10,15,0.55);
}

[data-theme="light"] .module-hero__eyebrow {
  color: rgba(10,10,15,0.55);
}

[data-theme="light"] .lesson-section-title {
  color: rgba(10,10,15,0.55);
}

[data-theme="light"] .lesson-card__desc {
  color: rgba(10,10,15,0.70);
}

[data-theme="light"] .checklist__item {
  color: rgba(10,10,15,0.75);
}

[data-theme="light"] .tip-box__text {
  color: rgba(10,10,15,0.75);
}

[data-theme="light"] .app-header__breadcrumb {
  color: rgba(10,10,15,0.55);
}

[data-theme="light"] .app-header__breadcrumb strong {
  color: #0A0A0F;
}

[data-theme="light"] .badge--starter {
  background: rgba(63, 185, 80, 0.12);
  color: #1A7F37;
  border-color: rgba(63, 185, 80, 0.25);
}

[data-theme="light"] .badge--starter:hover {
  background: rgba(63, 185, 80, 0.18);
  border-color: rgba(63, 185, 80, 0.40);
}

[data-theme="light"] .badge--core {
  background: rgba(88, 166, 255, 0.12);
  color: #0969DA;
  border-color: rgba(88, 166, 255, 0.25);
}

[data-theme="light"] .badge--core:hover {
  background: rgba(88, 166, 255, 0.18);
  border-color: rgba(88, 166, 255, 0.40);
}

[data-theme="light"] .badge--avanzado,
[data-theme="light"] .badge--advanced,
[data-theme="light"] .badge--avançado {
  background: rgba(188, 140, 255, 0.12);
  color: #8A2BE2;
  border-color: rgba(188, 140, 255, 0.25);
}

[data-theme="light"] .badge--avanzado:hover,
[data-theme="light"] .badge--advanced:hover,
[data-theme="light"] .badge--avançado:hover {
  background: rgba(188, 140, 255, 0.18);
  border-color: rgba(188, 140, 255, 0.40);
}

[data-theme="light"] .badge--experto,
[data-theme="light"] .badge--expert,
[data-theme="light"] .badge--especialista {
  background: rgba(188, 140, 255, 0.15);
  color: #7C3AED;
  border-color: rgba(188, 140, 255, 0.30);
}

[data-theme="light"] .badge--experto:hover,
[data-theme="light"] .badge--expert:hover,
[data-theme="light"] .badge--especialista:hover {
  background: rgba(188, 140, 255, 0.22);
  border-color: rgba(188, 140, 255, 0.50);
}


[data-theme="light"] .badge--nuevo {
  background: rgba(248, 81, 73, 0.12);
  color: #CF222E;
  border-color: rgba(248, 81, 73, 0.25);
}

[data-theme="light"] .badge--nuevo:hover {
  background: rgba(248, 81, 73, 0.18);
  border-color: rgba(248, 81, 73, 0.40);
}

[data-theme="dark"] .badge--avanzado,
[data-theme="dark"] .badge--advanced,
[data-theme="dark"] .badge--avançado {
  background: rgba(188, 140, 255, 0.15);
  color: #BC8CFF;
  border-color: rgba(188, 140, 255, 0.30);
}

[data-theme="dark"] .badge--avanzado:hover,
[data-theme="dark"] .badge--advanced:hover,
[data-theme="dark"] .badge--avançado:hover {
  background: rgba(188, 140, 255, 0.25);
  border-color: rgba(188, 140, 255, 0.50);
}

[data-theme="dark"] .badge--experto,
[data-theme="dark"] .badge--expert,
[data-theme="dark"] .badge--especialista {
  background: rgba(188, 140, 255, 0.20);
  color: #BC8CFF;
  border-color: rgba(188, 140, 255, 0.40);
}

[data-theme="dark"] .badge--experto:hover,
[data-theme="dark"] .badge--expert:hover,
[data-theme="dark"] .badge--especialista:hover {
  background: rgba(188, 140, 255, 0.30);
  border-color: rgba(188, 140, 255, 0.60);
}


[data-theme="light"] .update-badge {
  background: rgba(0,0,0,0.06);
  color: rgba(10,10,15,0.65);
  border-color: rgba(0,0,0,0.12);
}

[data-theme="light"] .update-badge--changelog {
  background: rgba(9,64,229,0.08);
  color: #0035A0;
  border-color: rgba(9,64,229,0.20);
}


[data-theme="light"] .update-badge--twitter {
  background: rgba(104,49,207,0.08);
  color: #4A1FA0;
  border-color: rgba(104,49,207,0.20);
}


[data-theme="light"] .update-badge--blog {
  background: rgba(6,95,70,0.08);
  color: #065F46;
  border-color: rgba(6,95,70,0.20);
}


[data-theme="light"] .update-badge--docs {
  background: rgba(120,53,15,0.08);
  color: #92400E;
  border-color: rgba(120,53,15,0.20);
}

[data-theme="light"] .update-entry__resumen {
  color: rgba(10,10,15,0.75);
}

[data-theme="light"] .continue-banner__lesson {
  color: rgba(10,10,15,0.70);
}

[data-theme="light"] .continue-banner__time {
  color: rgba(10,10,15,0.50);
}

[data-theme="light"] .app-footer {
  color: rgba(10,10,15,0.45);
  border-top-color: rgba(0,0,0,0.10);
}

[data-theme="light"] .code-block code {
  color: #1a1a2e;
}

[data-theme="light"] .btn-next-lesson {
  color: rgba(10,10,15,0.65);
  border-color: rgba(0,0,0,0.15);
}

[data-theme="light"] .btn-next-lesson:hover {
  color: #0A0A0F;
  border-color: var(--bai-blue);
}

[data-theme="light"] .module-overview-card__num {
  color: rgba(10,10,15,0.50);
}

[data-theme="light"] .module-overview-card__count {
  color: rgba(10,10,15,0.50);
}

[data-theme="light"] .sidebar__subtitle {
  color: rgba(10,10,15,0.50);
}

[data-theme="light"] .btn-sidebar-logout {
  color: rgba(10,10,15,0.50);
  border-color: rgba(0,0,0,0.12);
}

[data-theme="light"] .btn-sidebar-logout:hover {
  color: #0A0A0F;
  border-color: var(--bai-blue);
}

[data-theme="light"] .vs-card__item {
  color: rgba(10,10,15,0.70);
}

[data-theme="light"] .concept-card__desc {
  color: rgba(10,10,15,0.70);
}

[data-theme="light"] .alert-info__text {
  color: rgba(10,10,15,0.75);
}

[data-theme="light"] .alert-warning__text {
  color: rgba(10,10,15,0.75);
}

/* ─── TRANSICIONES ─────────────────────────────────────────────── */
*, *::before, *::after {
  transition: background-color 0.25s ease, border-color 0.25s ease,
              color 0.15s ease;
}

/* Excepciones — elementos que NO deben transicionar */
.lesson-card,
.module-overview-card,
.lesson-card__body.open {
  transition: border-color 0.2s ease, transform 0.2s ease,
              background-color 0.25s ease !important;
}

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

/* ─── SELECTOR DE TEMA ─────────────────────────────────────────── */
.theme-selector {
  display: flex;
  gap: 2px;
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.btn-tema {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--text-muted);
}

.btn-tema:hover {
  background: var(--surface-4);
  color: var(--text-primary);
}

/* ─── RESET Y BASE ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

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

body {
  font-family: var(--font-ui), system-ui, -apple-system, sans-serif;
  color: var(--text-primary);
  background: var(--surface-1);
  line-height: 1.5;
}

a {
  color: var(--bai-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--bai-blue-mid);
}

button {
  font-family: inherit;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--bai-blue);
  outline-offset: 2px;
}

/* ─── LAYOUT PRINCIPAL ─────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ──────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--surface-2);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
}

.sidebar__brand {
  padding: 20px;
  border-bottom: 1px solid var(--curso-border);
  display: flex;
}

.sidebar__logo-text {
  font-family: var(--font-ui), sans-serif;
  font-weight: 700;
  font-size: 20px;
  line-height: 1;
}

.sidebar__logo-text .accent {
  color: var(--bai-blue);
}

.sidebar__subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Barra de progreso global */
.sidebar__progress-wrap {
  padding: 12px 20px 4px;
}

.sidebar__progress-bar {
  height: 6px;
  background: var(--curso-surface-2);
  border-radius: 3px;
  overflow: hidden;
}

.sidebar__progress-fill {
  height: 100%;
  background: var(--curso-gradient);
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  animation: progressFill 1s ease-out;
}

.sidebar__progress-text {
  font-family: var(--font-mono), monospace;
  color: var(--curso-accent);
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
}

/* Contraste sidebar en tema oscuro */
[data-theme="dark"] .sidebar__progress-text,
:root .sidebar__progress-text {
  color: var(--curso-accent);
}

/* Contraste sidebar en tema claro */
[data-theme="light"] .sidebar__progress-text {
  color: rgba(10,10,15,0.60);
}

/* Navegación de módulos */
.sidebar__nav {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
}

.sidebar__module {
  margin-bottom: 4px;
}

.sidebar__module-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  width: 100%;
  background: transparent;
  border: none;
  text-align: left;
}

.sidebar__module-header:hover {
  background: var(--surface-4);
}

.sidebar__module-header.active {
  background: var(--bai-blue-10);
}

.sidebar__module-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

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

.sidebar__module-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Contraste sidebar en tema oscuro */
[data-theme="dark"] .sidebar__module-title,
:root .sidebar__module-title {
  color: rgba(255,255,255,0.90) !important;
}

/* Contraste sidebar en tema claro */
[data-theme="light"] .sidebar__module-title {
  color: rgba(10,10,15,0.90) !important;
}

.sidebar__module-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
}

.sidebar__module-count {
  font-size: 11px;
  color: var(--text-muted);
}

/* Contraste sidebar en tema oscuro */
[data-theme="dark"] .sidebar__module-count,
:root .sidebar__module-count {
  color: rgba(255,255,255,0.60) !important;
}

/* Contraste sidebar en tema claro */
[data-theme="light"] .sidebar__module-count {
  color: rgba(10,10,15,0.60) !important;
}


/* Barra de progreso individual por módulo en sidebar */
.sidebar__module-progress {
  height: 2px;
  background: var(--curso-surface-2);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.sidebar__module-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

.sidebar__module-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.sidebar__module-arrow.open {
  transform: rotate(90deg);
}

.sidebar__lessons {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.sidebar__lessons.open {
  max-height: 800px;
}

.sidebar__lesson {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px 7px 26px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  margin: 1px 0;
  background: transparent;
  border-left: 3px solid var(--curso-border);
  border-top: none;
  border-right: none;
  border-bottom: none;
  
  opacity: 0.6;
  text-align: left;
  width: 100%;
  animation: slideInUp 0.25s ease both;
}

.sidebar__lesson:nth-child(1) { animation-delay: 0.02s; }
.sidebar__lesson:nth-child(2) { animation-delay: 0.04s; }
.sidebar__lesson:nth-child(3) { animation-delay: 0.06s; }
.sidebar__lesson:nth-child(4) { animation-delay: 0.08s; }
.sidebar__lesson:nth-child(5) { animation-delay: 0.10s; }

.sidebar__lesson:hover {
  background: var(--surface-4);
}

.sidebar__lesson.active,
.sidebar__lesson.reading {
  border-left-color: var(--curso-accent);
  background: rgba(88, 166, 255, 0.06);
  box-shadow: inset 0 0 0 0.5px rgba(88, 166, 255, 0.2);
}

.sidebar__lesson.active .sidebar__lesson-title,
.sidebar__lesson.reading .sidebar__lesson-title {
  color: var(--bai-blue);
}

.sidebar__lesson-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  background: transparent;
  color: transparent;
}

.sidebar__lesson-check.done {
  background: var(--curso-accent-2);
  border-color: var(--curso-accent-2);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  color: #000;
  font-size: 12px;
}

.sidebar__lesson-title {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* Contraste sidebar en tema oscuro */
[data-theme="dark"] .sidebar__lesson-title,
:root .sidebar__lesson-title {
  color: rgba(255,255,255,0.65) !important;
}

/* Contraste sidebar en tema claro */
[data-theme="light"] .sidebar__lesson-title {
  color: rgba(10,10,15,0.70) !important;
}

/* Punto de última lectura */
.sidebar__last-read-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bai-blue);
  flex-shrink: 0;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}
/* Botón logout en sidebar */
.sidebar__footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.btn-sidebar-logout {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 12px;
  background: transparent;
  transition: all var(--transition-fast);
}

.btn-sidebar-logout:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
}

/* Selector de temas en sidebar (móvil) */
.sidebar__theme-selector {
  padding: 12px 20px 8px;
  border-top: 1px solid var(--border-subtle);
}

.theme-selector-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btn-tema-sidebar {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  font-family: var(--font-ui);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.btn-tema-sidebar.activo {
  background: var(--bai-blue-10);
  color: var(--bai-blue);
  border-color: rgba(9,64,229,0.20);
}

/* En desktop el selector del sidebar está oculto */
@media (min-width: 769px) {
  .sidebar__theme-selector { display: none; }
  .theme-selector { display: flex; } /* asegurar visible en desktop */
}

/* ─── BADGES DE NIVEL MEJORADOS (FRONTEND DESIGN SKILL) ───────────── */

/* Badge base mejorado */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-mono), monospace;
  border: 1px solid;
  transition: all 0.2s ease;
}

/* Básico/Starter — verde */
.badge--starter {
  background: rgba(63, 185, 80, 0.15);
  color: #3FB950;
  border-color: rgba(63, 185, 80, 0.30);
}

.badge--starter:hover {
  background: rgba(63, 185, 80, 0.25);
  border-color: rgba(63, 185, 80, 0.50);
}

/* Intermedio/Core — azul Devin */
.badge--core {
  background: rgba(88, 166, 255, 0.15);
  color: #58A6FF;
  border-color: rgba(88, 166, 255, 0.30);
}

.badge--core:hover {
  background: rgba(88, 166, 255, 0.25);
  border-color: rgba(88, 166, 255, 0.50);
}

/* Avanzado/Advanced/Avançado — morado */
.badge--avanzado,
.badge--advanced,
.badge--avançado {
  background: rgba(188, 140, 255, 0.15);
  color: #BC8CFF;
  border-color: rgba(188, 140, 255, 0.30);
}

.badge--avanzado:hover,
.badge--advanced:hover,
.badge--avançado:hover {
  background: rgba(188, 140, 255, 0.25);
  border-color: rgba(188, 140, 255, 0.50);
}

/* Experto/Expert/Especialista — morado más intenso */
.badge--experto,
.badge--expert,
.badge--especialista {
  background: rgba(188, 140, 255, 0.20);
  color: #BC8CFF;
  border-color: rgba(188, 140, 255, 0.40);
}

.badge--experto:hover,
.badge--expert:hover,
.badge--especialista:hover {
  background: rgba(188, 140, 255, 0.30);
  border-color: rgba(188, 140, 255, 0.60);
}

/* Nuevo — rojo sutil */
.badge--nuevo {
  background: rgba(248, 81, 73, 0.15);
  color: #F85149;
  border-color: rgba(248, 81, 73, 0.30);
}

.badge--nuevo:hover {
  background: rgba(248, 81, 73, 0.25);
  border-color: rgba(248, 81, 73, 0.50);
}
/* ─── HEADER ───────────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: 52px;
  background: var(--curso-surface);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--curso-border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 16px;
  z-index: 90;
  position: relative;

.header-progress {
  height: 3px;
  background: var(--curso-border);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.header-progress-fill {
  height: 100%;
  background: var(--curso-gradient);
  transition: width 0.6s ease;
}

.header-progress-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--curso-accent-2);
}
}

.app-header__breadcrumb {
  flex: 1;
  font-size: 13px;
  color: var(--text-muted);
}

.app-header__breadcrumb span {
  color: var(--text-secondary);
}

.app-header__breadcrumb strong {
  color: var(--text-primary);
  font-weight: 500;
}

.app-header__progress-text {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono), monospace;
}

.btn-logout {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  transition: all var(--transition-fast);
}

.btn-logout:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
}

/* ─── CONTENIDO PRINCIPAL ──────────────────────────────────────── */
.app-main {
  margin-left: var(--sidebar-width);
  padding-top: var(--header-height);
  min-height: 100vh;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.content-area {
  padding: 32px 40px;
  max-width: 100%;  /* sin límite artificial */
  width: 100%;
}

/* ─── PANTALLA DE BIENVENIDA ───────────────────────────────────── */
.welcome-screen {
  padding: 40px 40px 32px;
  max-width: 100%;
  width: 100%;
}

.welcome-screen__eyebrow {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

/* Eyebrow en tema oscuro */
[data-theme="dark"] .welcome-screen__eyebrow,
:root .welcome-screen__eyebrow {
  color: rgba(255,255,255,0.70) !important;
}

/* Eyebrow en tema claro */
[data-theme="light"] .welcome-screen__eyebrow {
  color: rgba(10,10,15,0.65) !important;
}

.welcome-screen__title {
  font-size: 38px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 14px;
}

.welcome-screen__title .accent-blue {
  color: var(--bai-blue);
}

.welcome-screen__title .accent-purple {
  color: var(--bai-purple);
}

.welcome-screen__desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 560px;
  margin-bottom: 36px;
}

/* Descripción en tema oscuro */
[data-theme="dark"] .welcome-screen__desc,
:root .welcome-screen__desc {
  color: rgba(255,255,255,0.72) !important;
}

/* Descripción en tema claro */
[data-theme="light"] .welcome-screen__desc {
  color: rgba(10,10,15,0.72) !important;
}

/* Banner "Continuar leyendo" */
.continue-banner {
  background: rgba(9,64,229,0.08);
  border: 1px solid rgba(9,64,229,0.25);
  border-left: 3px solid var(--bai-blue);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.continue-banner:hover {
  background: rgba(9,64,229,0.13);
}

.continue-banner__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bai-blue);
  margin-bottom: 3px;
}

.continue-banner__module {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.continue-banner__lesson {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.continue-banner__time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Grid de módulos overview */
.modules-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
}

@media (min-width: 1400px) {
  .modules-overview {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
  .content-area {
    padding: 40px 56px;
}
}
@media (min-width: 1800px) {
  .modules-overview {
    grid-template-columns: repeat(3, 1fr);
}
}
.module-overview-card {
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.module-overview-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.module-overview-card__icon {
  font-size: 22px;
  margin-bottom: 10px;
}

.module-overview-card__num {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono), monospace;
  margin-bottom: 3px;
}

/* Forzar contraste real en tema oscuro */
[data-theme="dark"] .module-overview-card__num,
:root .module-overview-card__num {
  color: rgba(255,255,255,0.70) !important;
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* Número de módulo en tema claro */
[data-theme="light"] .module-overview-card__num {
  color: rgba(10,10,15,0.60) !important;
}

.module-overview-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.4;
}

/* Título en tema oscuro */
[data-theme="dark"] .module-overview-card__title,
:root .module-overview-card__title {
  color: rgba(255,255,255,0.95) !important;
  font-weight: 600;
}

/* Título en tema claro */
[data-theme="light"] .module-overview-card__title {
  color: rgba(10,10,15,0.92) !important;
}

.module-overview-card__count {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Count en tema oscuro */
[data-theme="dark"] .module-overview-card__count,
:root .module-overview-card__count {
  color: rgba(255,255,255,0.65) !important;
}

/* Count en tema claro */
[data-theme="light"] .module-overview-card__count {
  color: rgba(10,10,15,0.60) !important;
}

.module-overview-card__badge {
  margin-top: 10px;
}

/* Historial de actualizaciones */
.update-log {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border-subtle);
}

.update-log__title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.update-entry {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--curso-border);
}

.update-entry:last-child {
  border-bottom: none;
}

.update-entry__date {
  font-family: var(--font-mono), monospace;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-3);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.update-entry__resumen {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.update-entry__badges {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.update-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--surface-4);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono), monospace;
}

.update-badge--changelog {
  background: var(--bai-blue-10);
  color: var(--bai-blue);
  border: rgba(9,64,229,0.20);
}

.update-badge--twitter {
  background: var(--bai-purple-10);
  color: var(--bai-purple);
  border: rgba(104,49,207,0.20);
}

.update-badge--blog {
  background: rgba(52,211,153,0.10);
  color: #34d399;
}

.update-badge--docs {
  background: rgba(245,158,11,0.10);
  color: #f59e0b;
}

/* ─── COMPONENTES DE LECCIÓN ───────────────────────────────────── */
.module-hero {
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  max-width: 100%;
}

.module-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--bai-blue), var(--bai-purple));
}

.module-hero__eyebrow {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.module-hero__title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.3;
}

.module-hero__desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 600px;
}

.module-hero__meta {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.module-hero__stat {
  font-size: 12px;
  color: var(--text-muted);
}

.module-hero__stat strong {
  color: var(--text-secondary);
}

/* Lesson card */
.lesson-card {
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color var(--transition-fast);
  max-width: 100%;
}

.lesson-card:hover {
  border-color: var(--border-active);
}

.lesson-card.expanded {
  border-color: var(--bai-blue-20);
}

.lesson-card__header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  cursor: pointer;
}

.lesson-card__num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
  font-family: var(--font-mono), monospace;
  background: transparent;
}

.lesson-card__num.done {
  background: #34d399;
  border-color: #34d399;
  color: #000;
  font-size: 14px;
}

.lesson-card__info {
  flex: 1;
}

.lesson-card__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.lesson-card__desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.5;
}

/* Lección completada — card con indicador visual */
.lesson-card.completada {
  border-color: rgba(52,211,153,0.30);
  background: rgba(52,211,153,0.04);
  border-left: 3px solid #34d399;
}

.lesson-card.completada .lesson-card__title {
  color: rgba(255,255,255,0.70);
}

.lesson-card.completada .lesson-card__desc {
  color: rgba(255,255,255,0.45);
}

/* Número con checkmark verde */
.lesson-card.completada .lesson-card__num {
  background: #34d399;
  border-color: #34d399;
  color: #000;
  font-size: 14px;
}

/* Hover en lección completada — mantener el estilo verde */
.lesson-card.completada:hover {
  border-color: rgba(52,211,153,0.50);
  border-left-color: #34d399;
}

/* En tema claro */
[data-theme="light"] .lesson-card.completada {
  border-color: rgba(52,211,153,0.40);
  background: rgba(52,211,153,0.06);
  border-left: 3px solid #059669;
}

[data-theme="light"] .lesson-card.completada .lesson-card__title {
  color: rgba(10,10,15,0.55);
}

[data-theme="light"] .lesson-card.completada .lesson-card__desc {
  color: rgba(10,10,15,0.40);
}

[data-theme="light"] .lesson-card.completada .lesson-card__num {
  background: #059669;
  border-color: #059669;
  color: #fff;
}

.lesson-card__tags {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono), monospace;
}

.lesson-card__arrow {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.lesson-card__arrow.open {
  transform: rotate(180deg);
}

.lesson-card__body {
  border-top: 1px solid var(--border-subtle);
  padding: 24px 32px 24px 64px;
  display: none;
  max-width: 100%;
}

.lesson-card__body.open {
  display: block;
}

/* Intro text más ancho */
.lesson-card__body p,
.lesson-card__body .intro-text {
  max-width: 100%;
  line-height: 1.7;
}

.lesson-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

@media (min-width: 1400px) {
  .checklist {
    columns: 2;
    gap: 24px;
  }
  .checklist__item {
    break-inside: avoid;
}
}
.checklist__item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.checklist__icon {
  color: #34d399;
  flex-shrink: 0;
  margin-top: 2px;
}

.tip-box {
  background: rgba(9,64,229,0.08);
  border: 1px solid rgba(9,64,229,0.20);
  border-left: 3px solid var(--bai-blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  margin: 16px 0;
  max-width: 100%;
}

.tip-box__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bai-blue);
  margin-bottom: 4px;
}

.tip-box__text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.tip-box--bai {
  border-left-color: var(--bai-purple);
  background: var(--bai-purple-10);
}

.tip-box--bai .tip-box__label {
  color: var(--bai-purple);
}

.code-block {
  background: #0D0D15;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 16px 0;
  overflow-x: auto;
  max-width: 100%;
}

.code-block code {
  font-family: var(--font-mono), monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  line-height: 1.7;
  white-space: pre;
}

.concept-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 16px 0;
}

@media (min-width: 1400px) {
  .concept-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.concept-card {
  background: var(--surface-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.concept-card__icon {
  font-size: 20px;
  margin-bottom: 8px;
}

.concept-card__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.concept-card__desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.vs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 12px 0;
}

.vs-card {
  background: var(--surface-4);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--border-subtle);
}

.vs-card__header {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.vs-card__header--blue {
  color: var(--bai-blue);
}

.vs-card__header--purple {
  color: var(--bai-purple);
}

.vs-card__item {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.alert-info {
  background: rgba(9,64,229,0.07);
  border: 1px solid rgba(9,64,229,0.20);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 20px 0;
}

.alert-info__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--bai-blue);
  margin-bottom: 4px;
}

.alert-info__text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.alert-warning {
  background: rgba(245,158,11,0.07);
  border: 1px solid rgba(245,158,11,0.20);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 20px 0;
}

.alert-warning__title {
  font-size: 12px;
  font-weight: 600;
  color: #f59e0b;
  margin-bottom: 4px;
}

.alert-warning__text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ─── BOTONES DE ACCIÓN ────────────────────────────────────────── */
.btn-primary {
  background: var(--bai-blue);
  color: var(--bai-white);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition-fast);
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: none;
}

.btn-primary:hover {
  background: var(--bai-blue-mid);
}

.btn-outline {
  background: transparent;
  color: var(--bai-blue);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  border: 1px solid var(--bai-blue);
  transition: all var(--transition-fast);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.btn-outline:hover {
  background: var(--bai-blue-10);
}

.btn-complete {
  background: rgba(52,211,153,0.10);
  color: #34d399;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(52,211,153,0.20);
  transition: all var(--transition-fast);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.btn-complete:hover {
  background: rgba(52,211,153,0.20);
}

.btn-complete.marked {
  background: #34d399;
  color: #000;
}

.lesson-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
  align-items: center;
}

/* ─── TOAST DE FEEDBACK ────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(52,211,153,0.95);
  color: #000;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  z-index: 1000;
  display: flex;
  gap: 8px;
  align-items: center;
  animation: fadeInRight 0.3s ease;
}

.toast.fade-out {
  animation: fadeOutRight 0.3s ease forwards;
}
@keyframes fadeInRight {
  from {
    transform: translateX(60px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOutRight {
  from {
    opacity: 1;
  }
  to {
    transform: translateX(60px);
    opacity: 0;
  }
}

/* ─── FOOTER ───────────────────────────────────────────────────── */
.app-footer {
  margin-left: var(--sidebar-width);
  padding: 24px 48px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: auto;
}

.app-footer a {
  color: var(--bai-blue);
}

.app-footer strong {
  color: var(--text-secondary);
}

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

  .sidebar {
    transform: translateX(-300px);
    transition: transform 0.3s ease;
    width: 300px;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .app-header {
    left: 0;
    padding: 0 16px;
    height: auto;
    min-height: var(--header-height);
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  /* Fila 1: hamburguesa + nombre usuario (a la derecha) */
  .btn-hamburger {
    order: 1;
    flex-shrink: 0;
  }

  .app-header__user {
    order: 2;
    flex: 1;
    text-align: right;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
  }

  /* Selector de temas — ocultar en móvil del header */
  .theme-selector {
    display: none;
  }

  /* Breadcrumb — segunda fila completa */
  .app-header__breadcrumb {
    order: 3;
    width: 100%;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Progreso — ocultar en móvil (ya está en sidebar) */
  .app-header__progress-text {
    display: none;
  }

  .app-main,
  .app-footer {
    margin-left: 0;
  }

  .content-area,
  .welcome-screen {
    padding: 24px 20px;
  }

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

  .concept-grid,
  .vs-grid {
    grid-template-columns: 1fr;
  }

  .welcome-screen__title {
    font-size: 26px;
  }

  .btn-hamburger {
    display: flex !important;
  }

  .app-footer {
    padding: 20px;
  }

  /* PWA — safe areas para notch y home indicator en iPhone */
  .app-header {
    padding-left: max(32px, env(safe-area-inset-left));
    padding-right: max(32px, env(safe-area-inset-right));
  }

  .sidebar {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .app-footer {
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  /* Mejorar tap targets en móvil */
  .lesson-card__header { padding: 16px; min-height: 56px; }
  .sidebar__lesson { min-height: 44px; }
  .sidebar__module-header { min-height: 52px; }
  .btn-primary, .btn-complete, .btn-outline { min-height: 44px; }
  .btn-tema { width: 36px; height: 36px; }
  .theme-selector { gap: 4px; }

  /* Texto más legible en pantallas pequeñas */
  .lesson-card__title { font-size: 15px; }
  .lesson-card__desc  { font-size: 13px; }
  .module-hero__title { font-size: 22px; }
  .welcome-screen__title { font-size: 24px; }

  /* Lesson body sin indent excesivo en móvil */
  .lesson-card__body { padding: 20px 16px; }
  .checklist__item { font-size: 13px; }
  .tip-box__text { font-size: 13px; }
}

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

/* ─── ANIMACIONES DE ENTRADA ─── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}



@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(60px); }
  to   { opacity: 1; transform: translateX(0); }
}


@keyframes fadeOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(60px); }
}


@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}



@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.65); }
}


/* ─── ANIMACIONES MEJORADAS (FRONTEND DESIGN SKILL) ─────────────────── */

/* Entrada de elementos — staggered slideInUp */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    transform: translateY(0);
  }
}

/* Check de lección completada — pop effect */
@keyframes checkPop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

/* Progress bar fill animation */
@keyframes progressFill {
  from {
    width: 0%;
    opacity: 0.6;
  }
  to {
    opacity: 1;
    opacity: 1;
  }
}

/* Glow effect para elementos activos */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(9,64,229,0.15), 0 0 40px rgba(9,64,229,0.05);
  }
  50% {
    box-shadow: 0 0 25px rgba(9,64,229,0.20), 0 0 50px rgba(9,64,229,0.08);
  }
}
/* Aplicar animación glow a lesson cards activas */
.lesson-card.activa {
  animation: glowPulse 2s ease-in-out infinite;
}

/* Aplicar a lección cards con stagger */
.lesson-card {
  animation: slideInUp 0.35s ease both;
}
.lesson-card:nth-child(1) { animation-delay: 0ms; }
.lesson-card:nth-child(2) { animation-delay: 50ms; }
.lesson-card:nth-child(3) { animation-delay: 100ms; }
.lesson-card:nth-child(4) { animation-delay: 150ms; }
.lesson-card:nth-child(5) { animation-delay: 200ms; }
.lesson-card:nth-child(6) { animation-delay: 250ms; }

/* Aplicar a module-overview-cards con stagger */
.module-overview-card {
  animation: slideInUp 0.4s ease both;
}
.module-overview-card:nth-child(1) { animation-delay: 0ms; }
.module-overview-card:nth-child(2) { animation-delay: 70ms; }
.module-overview-card:nth-child(3) { animation-delay: 140ms; }
.module-overview-card:nth-child(4) { animation-delay: 210ms; }
.module-overview-card:nth-child(5) { animation-delay: 280ms; }
.module-overview-card:nth-child(6) { animation-delay: 350ms; }

/* Cuerpo de lección expandido */
.lesson-card__body.open {
  animation: slideDown 0.25s ease both;
}
/* Respetar prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .lesson-card,
  .module-overview-card,
  .lesson-card__body.open,
  .lesson-card.activa {
    animation: none !important;
    transition: none !important;
}
}

/* ─── BOTÓN SIGUIENTE LECCIÓN ─── */
.btn-next-lesson {
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.btn-next-lesson:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
  background: var(--bai-blue-10);
}
.btn-next-lesson--modulo {
  color: var(--bai-purple);
  border-color: rgba(104,49,207,0.30);
}
.btn-next-lesson--modulo:hover {
  background: var(--bai-purple-10);
  border-color: rgba(104,49,207,0.50);
}

/* ─── ESTADO VACÍO ─── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state__icon { font-size: 32px; margin-bottom: 12px; }
.empty-state__text { font-size: 14px; line-height: 1.6; }
.empty-state__cta  { margin-top: 16px; }

/* ─── BADGE NUEVO en módulo ─── */
.module-hero__new-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239,68,68,0.12);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  margin-bottom: 12px;
}

/* ─── LECCIÓN ACTIVA RESALTADA EN SIDEBAR ─── */
.sidebar__lesson.reading {
  background: var(--bai-blue-10);
  border-left: 2px solid var(--bai-blue);
}
.sidebar__lesson.reading .sidebar__lesson-title {
  color: var(--bai-blue);
}

/* ─── SCROLLBAR PERSONALIZADA (Webkit) ─── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.10);
  border-radius: 2px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.20);
}

/* ─── HEADER USER ─── */
.app-header__user {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.app-header__user::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--bai-blue);
  border-radius: 50%;
}
.app-header__user span {
  font-weight: 500;
  color: var(--text-primary);
}

/* ─── ESCALA DE TIPOGRAFÍA ───────────────────────────────────── */
/* Elementos de contenido que escalan con --font-scale */
.lesson-card__title    { font-size: calc(14px * var(--font-scale)); }
.lesson-card__desc     { font-size: calc(13px * var(--font-scale)); }
.lesson-card__body     { font-size: calc(14px * var(--font-scale)); }
.checklist__item       { font-size: calc(13px * var(--font-scale)); }
.tip-box__text         { font-size: calc(13px * var(--font-scale)); }
.code-block code       { font-size: calc(12px * var(--font-scale)); }
.intro-text            { font-size: calc(14px * var(--font-scale)); }
.module-hero__desc     { font-size: calc(15px * var(--font-scale)); }
.concept-card__desc    { font-size: calc(12px * var(--font-scale)); }
.vs-card__item         { font-size: calc(12px * var(--font-scale)); }
.alert-info__text      { font-size: calc(13px * var(--font-scale)); }
.alert-warning__text   { font-size: calc(13px * var(--font-scale)); }
.welcome-screen__desc  { font-size: calc(15px * var(--font-scale)); }
.lesson-section-title  { font-size: calc(12px * var(--font-scale)); }

/* Selector de tamaño de fuente en header */
.font-size-selector {
  display: flex;
  gap: 2px;
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.btn-font {
  height: 30px;
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-font:first-child { font-size: 11px; }
.btn-font--reset      { font-size: 13px; }
.btn-font:last-child  { font-size: 15px; }

.btn-font:hover {
  background: var(--surface-4);
  color: var(--text-primary);
}

.btn-font.activo {
  background: var(--bai-blue-10);
  color: var(--bai-blue);
  border-color: rgba(9,64,229,0.20);
}

.btn-font-sidebar {
  padding: 0 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
}
.btn-font-sidebar:hover {
  background: var(--surface-4);
  color: var(--text-primary);
}
.btn-font-sidebar.activo {
  background: var(--bai-blue-10);
  color: var(--bai-blue);
  border-color: rgba(9,64,229,0.20);
}

/* Ocultar en móvil — el sidebar tiene los controles */
@media (max-width: 768px) {
  .font-size-selector { display: none; }
}
/* ─── ADMIN PANEL ────────────────────────────────────────────── */
.admin-main {
  max-width: 1000px;
  margin: 48px auto;
  padding: 0 24px;
}

.admin-section {
  margin-bottom: 48px;
}

.admin-section__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
}

/* Metric cards */
.metric-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .metric-cards {
    grid-template-columns: 1fr;
}
.metric-card {
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 24px;
}

.metric-card__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.metric-card__value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Usuarios list */
.usuarios-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.usuario-row {
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color var(--transition-fast);
}

.usuario-row:hover {
  border-color: var(--border-active);
}

.usuario-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bai-blue-10);
  color: var(--bai-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

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

.usuario-nombre {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.badge--admin {
  background: var(--bai-purple-10);
  color: var(--bai-purple);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 8px;
}

.usuario-progreso {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--surface-4);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: var(--bai-blue);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.usuario-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Form */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-3);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--bai-blue);
}

.form-error {
  font-size: 12px;
  color: #ef4444;
  margin-top: 4px;
}

.password-input {
  position: relative;
}

.password-input input {
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
}

.password-toggle:hover {
  color: var(--text-primary);
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bai-blue);
  color: white;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-primary:hover {
  background: var(--bai-blue-mid);
}

.btn-sm {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-3);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-sm:hover {
  background: var(--surface-4);
  color: var(--text-primary);
}

.btn-danger {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}

.modal-panel {
  background: var(--surface-2);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 440px;
  width: 100%;
  animation: fadeInUp 0.25s ease;
}
}
@keyframes fadeIn {
  from { opacity: 0; }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.modal-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-actions .btn-primary {
  width: auto;
}

.modal-actions .btn-ghost {
  width: auto;
}

.btn-ghost {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  z-index: 300;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast--success {
  background: #10b981;
  color: white;
}

.toast--error {
  background: #ef4444;
  color: white;
}

/* Link admin en sidebar */
.btn-admin-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--bai-purple);
  background: var(--bai-purple-10);
  border: 1px solid rgba(104,49,207,0.20);
  margin-bottom: 8px;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-admin-link:hover {
  background: var(--bai-purple-20);
  border-color: rgba(104,49,207,0.40);
}

/* Mobile - Limitar escala de fuente y ajustar layout para evitar overflow */
@media (max-width: 768px) {
  /* Limitar la escala máxima en móvil para evitar overflow */
  :root {
    --font-scale: min(var(--font-scale), 1.10);
  }

  /* Si --font-scale es grande, ajustar padding y layout */
  .lesson-card__body {
    padding: 16px 14px;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .lesson-card__title {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .checklist__item {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .tip-box__text {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .code-block {
    overflow-x: auto;
    max-width: 100%;
  }

  .code-block code {
    white-space: pre;
    word-break: normal;
  }

  /* Concept grid en móvil con fuentes grandes: 1 columna */
  .concept-grid {
    grid-template-columns: 1fr !important;
  }

  /* VS grid en móvil con fuentes grandes: 1 columna */
  .vs-grid {
    grid-template-columns: 1fr !important;
  }

  /* Lesson actions en columna en móvil */
  .lesson-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .lesson-actions button,
  .lesson-actions .btn-primary,
  .lesson-actions .btn-complete,
  .lesson-actions .btn-next-lesson {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  /* Módulo hero más compacto en móvil */
  .module-hero {
    padding: 20px 16px;
  }

  .module-hero__title {
    font-size: calc(20px * var(--font-scale));
    word-break: break-word;
}
/* ─── ASISTENTE IA ─── */

/* Botón flotante */
.ai-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--bai-blue), var(--bai-purple));
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(9,64,229,0.40);
  z-index: 500;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ai-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(9,64,229,0.55);
}
.ai-fab svg { width: 22px; height: 22px; }

/* Badge de consultas restantes */
.ai-fab__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #34d399;
  color: #000;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
}
.ai-fab__badge.warning { background: #f59e0b; }
.ai-fab__badge.empty   { background: #ef4444; color: #fff; }

/* Panel del asistente */
.ai-panel {
  position: fixed;
  bottom: 92px;
  right: 28px;
  width: 380px;
  max-height: 520px;
  background: var(--surface-2);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,0.40);
  z-index: 499;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeInUp 0.25s ease both;
}
.ai-panel.hidden { display: none; }

/* Header del panel */
.ai-panel__header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--curso-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.ai-panel__avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--bai-blue), var(--bai-purple));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.ai-panel__title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.ai-panel__subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.ai-panel__close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.ai-panel__close:hover {
  background: var(--surface-4);
  color: var(--text-primary);
}

/* Contador de consultas en el header */
.ai-quota {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-3);
  padding: 3px 8px;
  border-radius: 20px;
  font-family: var(--font-mono);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.ai-quota.warning { color: #f59e0b; border-color: rgba(245,158,11,0.30); }
.ai-quota.empty   { color: #ef4444; border-color: rgba(239,68,68,0.30); }

/* Mensajes */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.ai-msg--user {
  flex-direction: row-reverse;
}

.ai-msg__bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.ai-msg--assistant .ai-msg__bubble {
  background: var(--surface-3);
  color: var(--text-primary);
  border-radius: 4px 12px 12px 12px;
}

.ai-msg--user .ai-msg__bubble {
  background: var(--bai-blue);
  color: #fff;
  border-radius: 12px 4px 12px 12px;
}

/* Markdown en respuestas */
.ai-msg__bubble strong { font-weight: 600; }
.ai-msg__bubble code {
  background: rgba(255,255,255,0.10);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.ai-msg--assistant .ai-msg__bubble code {
  background: var(--surface-4);
  color: var(--bai-blue);
}
.ai-msg__bubble ul {
  margin: 6px 0 6px 16px;
}
.ai-msg__bubble li { margin-bottom: 3px; }

/* Typing indicator */
.ai-typing {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: var(--surface-3);
  border-radius: 4px 12px 12px 12px;
  width: fit-content;
}
.ai-typing span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: aiTyping 1.2s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
}
@keyframes aiTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Input */
.ai-panel__input-area {
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.ai-input {
  flex: 1;
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  font-family: var(--font-ui);
  color: var(--text-primary);
  resize: none;
  outline: none;
  max-height: 80px;
  line-height: 1.4;
  transition: border-color 0.2s;
}
.ai-input:focus { border-color: var(--bai-blue); }
.ai-input::placeholder { color: var(--text-muted); }

.ai-send {
  width: 34px;
  height: 34px;
  background: var(--bai-blue);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.ai-send:hover { background: var(--bai-blue-mid); }
.ai-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* Botón contextual en lección */
.btn-ask-ai {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--bai-purple);
  background: var(--bai-purple-10);
  border: 1px solid rgba(104,49,207,0.25);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-ui);
}
.btn-ask-ai:hover {
  background: var(--bai-purple-20);
  border-color: rgba(104,49,207,0.45);
}

/* Sidebar section */
.sidebar__ai-section {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--curso-surface);
  border: 0.5px solid var(--curso-border);
  border-radius: 10px;
  position: relative;
}

.sidebar__ai-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--curso-gradient);
}

.ai-quota-bar {
  height: 3px;
  background: var(--curso-surface-2);
  border-radius: 2px;
  margin-top: 8px;
}

.ai-quota-fill {
  height: 100%;
  background: var(--curso-accent-2);
  transition: width 0.3s ease;
}
.sidebar__ai-btn {
  width: 100%;
  padding: 10px 12px;
  background: linear-gradient(135deg, var(--bai-blue-10), var(--bai-purple-10));
  border: 1px solid rgba(9,64,229,0.20);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  font-family: var(--font-ui);
}
.sidebar__ai-btn:hover {
  background: linear-gradient(135deg, var(--bai-blue-20), var(--bai-purple-20));
  border-color: rgba(9,64,229,0.40);
}
.sidebar__ai-quota {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: center;
  font-family: var(--font-mono);
}

/* Responsive */
@media (max-width: 768px) {
  .ai-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .ai-fab {
    bottom: 20px;
    right: 20px;
    right: 20px;
  }
}
/* ─── SISTEMA DE NOVEDADES ─── */

/* Badge NUEVO en sidebar */
.sidebar__lesson-badge-new {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #34d399, #059669);
  color: #000;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 1.4;
  flex-shrink: 0;
}

/* Badge NUEVO en lesson cards */
.lesson-card__badge-new {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #34d399, #059669);
  color: #000;
  padding: 3px 8px;
  border-radius: 5px;
  margin-left: 8px;
  vertical-align: middle;
}

/* Sección novedades en welcome screen */
.novedades-section {
  margin-bottom: 40px;
}

.novedades-section__title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.novedades-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.novedad-card {
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid #34d399;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: border-color 0.2s;
}
.novedad-card:hover {
  border-color: var(--border-active);
  border-left-color: #34d399;
}

.novedad-card__fecha {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  margin-top: 2px;
  flex-shrink: 0;
}

.novedad-card__content { flex: 1; }

.novedad-card__titulo {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.novedad-card__version {
  font-size: 10px;
  font-weight: 600;
  background: var(--bai-blue-10);
  color: var(--bai-blue);
  border: 1px solid rgba(9,64,229,0.20);
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.novedad-card__desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.novedad-card__lecciones {
  font-size: 11px;
  color: #34d399;
  margin-top: 4px;
  font-weight: 500;
}

/* Toast de bienvenida especial */
.toast-bienvenida {
  cursor: pointer;
}
.toast-bienvenida:hover {
  filter: brightness(1.05);
}

/* ─── WINDSURF INTRO ─── */
.windsurf-intro {
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
}

.windsurf-intro__header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.windsurf-intro__icon {
  font-size: 36px;
  line-height: 1;
  flex-shrink: 0;
}

.windsurf-intro__eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--bai-blue);
  margin-bottom: 4px;
}

.windsurf-intro__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.windsurf-intro__desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 24px;
  max-width: 800px;
}

.windsurf-intro__desc strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Las 3 capas */
.windsurf-intro__layers {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
  padding: 20px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.windsurf-intro__layer {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.windsurf-intro__layer-icon {
  font-size: 20px;
  width: 36px;
  height: 36px;
  background: var(--bai-blue-10);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.windsurf-intro__layer-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.windsurf-intro__layer-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Beneficios */
.windsurf-intro__benefits {
  margin-bottom: 24px;
}

.windsurf-intro__benefits-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.windsurf-intro__benefits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.windsurf-intro__benefit {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.windsurf-intro__benefit strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.windsurf-intro__benefit-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* CTA */
.windsurf-intro__cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg,
    rgba(9,64,229,0.08), rgba(104,49,207,0.08));
  border: 1px solid rgba(9,64,229,0.20);
  border-radius: var(--radius-md);
}

.windsurf-intro__cta-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.windsurf-intro__cta-btn {
  background: var(--bai-blue);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-ui);
  white-space: nowrap;
  transition: background 0.2s;
  flex-shrink: 0;
}
.windsurf-intro__cta-btn:hover { background: var(--bai-blue-mid); }

/* Responsive */
@media (max-width: 768px) {
  .windsurf-intro { padding: 20px; }
  .windsurf-intro__benefits-grid { grid-template-columns: 1fr; }
  .windsurf-intro__cta { flex-direction: column; align-items: flex-start; }
  .windsurf-intro__cta-btn { width: 100%; text-align: center; }
}
/* ─── SELECTOR DE IDIOMA ─── */
.lang-selector {
  display: flex;
  gap: 4px;
  align-items: center;
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.lang-btn {
  height: 28px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.lang-btn:hover {
  background: var(--surface-4);
  color: var(--text-primary);
}

.lang-btn.activo {
  background: var(--bai-blue-10);
  color: var(--bai-blue);
  border-color: rgba(9,64,229,0.20);
}

/* En móvil — solo flags sin texto */
@media (max-width: 768px) {
.lang-btn span.lang-nombre { display: none; }
}



@media (prefers-reduced-motion: reduce) {
  .sidebar__lesson {
    animation: none;
  }
  
  .sidebar__lesson:nth-child(1),
  .sidebar__lesson:nth-child(2),
  .sidebar__lesson:nth-child(3),
  .sidebar__lesson:nth-child(4),
  .sidebar__lesson:nth-child(5) {
    animation-delay: 0s;
  }
}
