/* ═══════════════════════════════════════════════════════════════════
   ACCADEMIA ITALIANA — styles.css
   Diseño premium e-learning. Mobile-first, transiciones suaves.
═══════════════════════════════════════════════════════════════════ */

/* ── Variables globales ── */
:root {
  --verde:       #16a34a;
  --verde-light: #bbf7d0;
  --verde-dark:  #14532d;
  --azul:        #2563eb;
  --azul-light:  #dbeafe;
  --rojo:        #e11d48;
  --rojo-light:  #ffe4e6;
  --oro:         #b45309;
  --crema:       #fdfbf7;
  --sidebar-w:   260px;
  --transition:  0.3s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset mínimo ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'DM Sans', sans-serif; background: var(--crema); }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input  { font-family: inherit; }

/* ════════════════════════════════
   SPLASH SCREEN
════════════════════════════════ */
.splash-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #0f4c2a 0%, #16a34a 50%, #065f46 100%);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.splash-overlay.fade-out {
  opacity: 0; pointer-events: none; transform: scale(1.03);
}
.splash-content {
  text-align: center; padding: 2rem;
}
.splash-flag {
  font-size: 5rem; margin-bottom: 1rem;
  animation: float 2s ease-in-out infinite;
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
.splash-loader {
  width: 200px; height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px; overflow: hidden;
  margin: 0 auto;
}
.splash-loader-bar {
  height: 100%; width: 0%;
  background: white; border-radius: 2px;
  animation: loadbar 2s ease forwards;
}
@keyframes loadbar {
  0%   { width: 0%; }
  80%  { width: 90%; }
  100% { width: 100%; }
}

/* ════════════════════════════════
   APP LAYOUT
════════════════════════════════ */
.app-layout {
  display: flex; min-height: 100vh;
  transition: opacity 0.5s ease;
}
.app-layout.visible { opacity: 1 !important; }

/* ════════════════════════════════
   SIDEBAR
════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: linear-gradient(180deg, #0f2d1a 0%, #1a3d24 50%, #0f2d1a 100%);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto; overflow-x: hidden;
  transition: transform var(--transition);
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  margin-bottom: 0.75rem;
}
.avatar-ring {
  padding: 2px;
  background: linear-gradient(135deg, var(--oro), #fb923c);
  border-radius: 50%; flex-shrink: 0;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #2d6a42;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: 1rem;
}
.progress-track {
  height: 6px; background: rgba(255,255,255,0.1);
  border-radius: 3px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, #4ade80, #22c55e);
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}
.progress-fill--verde { background: linear-gradient(90deg, #4ade80, #16a34a); }
.progress-fill--azul  { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.progress-fill--rojo  { background: linear-gradient(90deg, #fb7185, #e11d48); }

/* Navegación sidebar */
.sidebar-nav { flex: 1; padding: 0 0.5rem; }
.sidebar-nav-label {
  font-size: 0.65rem; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
  padding: 0.5rem 0.75rem 0.25rem;
}
.nav-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 0.55rem 0.75rem;
  border-radius: 8px; color: rgba(255,255,255,0.65);
  font-size: 0.875rem; transition: background var(--transition), color var(--transition);
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active { background: rgba(74,222,128,0.15); color: #86efac; }
.nav-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.nav-dot--verde { background: #4ade80; }
.nav-dot--azul  { background: #60a5fa; }
.nav-dot--rojo  { background: #fb7185; }

.nav-group { margin-bottom: 2px; }
.nav-group-header {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 0.55rem 0.75rem;
  border-radius: 8px; transition: background var(--transition);
}
.nav-group-header:hover { background: rgba(255,255,255,0.06); }
.nav-chevron { color: rgba(255,255,255,0.4); font-size: 0.75rem; transition: transform var(--transition); }
.nav-chevron.rotated { transform: rotate(-90deg); }
.nav-group-items {
  overflow: hidden; max-height: 200px;
  transition: max-height var(--transition);
}
.nav-group-items.collapsed { max-height: 0; }
.nav-subitem {
  display: block; width: 100%;
  padding: 0.4rem 0.75rem 0.4rem 1.5rem;
  font-size: 0.8rem; color: rgba(255,255,255,0.5);
  border-radius: 6px; text-align: left;
  transition: background var(--transition), color var(--transition);
}
.nav-subitem:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85); }

/* Medallas en sidebar */
.sidebar-badges {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  margin-top: auto;
}
.sidebar-badges-title {
  font-size: 0.65rem; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3); margin-bottom: 0.5rem;
}
.sidebar-badge-item {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 20px; padding: 3px 8px;
  font-size: 0.7rem; color: rgba(255,255,255,0.6);
  margin: 2px;
}

/* ════════════════════════════════
   BOTÓN MENÚ MÓVIL
════════════════════════════════ */
.mobile-menu-btn {
  display: none;
  position: fixed; top: 1rem; left: 1rem; z-index: 200;
  width: 42px; height: 42px; border-radius: 10px;
  background: #0f2d1a;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.mobile-menu-btn span {
  display: block; width: 20px; height: 2px;
  background: white; border-radius: 1px;
  transition: transform var(--transition), opacity var(--transition);
}
.mobile-menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-menu-btn.open span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 99; backdrop-filter: blur(2px);
}

/* ════════════════════════════════
   CONTENIDO PRINCIPAL
════════════════════════════════ */
.main-content {
  flex: 1; min-width: 0;
  padding: 2rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* ════════════════════════════════
   VISTAS (navegación entre pantallas)
════════════════════════════════ */
.view { display: none; animation: fadeSlideIn 0.4s ease; }
.view.active { display: block; }
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════
   HEADER DE VISTAS
════════════════════════════════ */
.view-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
  margin-bottom: 2rem;
}
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.4rem 0.9rem;
  background: white; border-radius: 8px;
  border: 1.5px solid #e5e7eb;
  font-size: 0.875rem; color: #374151;
  transition: all var(--transition);
  font-family: 'DM Sans', sans-serif;
  margin-bottom: 0.5rem;
  align-self: flex-start;
}
.back-btn:hover { background: #f9fafb; transform: translateX(-2px); }
.header-xp-badge {
  display: flex; align-items: center; gap: 6px;
  background: #fef9c3; border: 1.5px solid #fde68a;
  border-radius: 20px; padding: 0.35rem 1rem;
  font-size: 0.875rem; color: #92400e;
}

/* ════════════════════════════════
   LEVEL CARDS (Dashboard)
════════════════════════════════ */
.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}
.level-card {
  border-radius: 20px; overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  transition: transform var(--transition), box-shadow var(--transition);
}
.level-card:not(.level-card--locked):hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.14);
}
.level-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 1.5rem;
}
.level-card--verde .level-card-header { background: linear-gradient(135deg, #166534, #16a34a); }
.level-card--azul  .level-card-header { background: linear-gradient(135deg, #1e3a8a, #2563eb); }
.level-card--rojo  .level-card-header { background: linear-gradient(135deg, #881337, #e11d48); }
.level-icon { font-size: 2.5rem; opacity: 0.9; }
.level-badge {
  display: inline-block; font-size: 0.65rem;
  letter-spacing: 0.1em; padding: 3px 10px;
  border-radius: 20px; font-weight: 600;
}
.level-badge--verde { background: rgba(74,222,128,0.25); color: #bbf7d0; }
.level-badge--azul  { background: rgba(96,165,250,0.25); color: #bfdbfe; }
.level-badge--rojo  { background: rgba(251,113,133,0.25); color: #fecdd3; }
.level-card-body { background: white; padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.level-card--locked { opacity: 0.75; cursor: not-allowed; }

/* Tarjeta de subnivel dentro de level card */
.sublevel-card {
  background: #f9fafb; border: 1.5px solid #e5e7eb;
  border-radius: 12px; padding: 1rem;
  cursor: pointer; transition: all var(--transition);
}
.sublevel-card:hover:not(.sublevel-card--locked) {
  border-color: #86efac; background: #f0fdf4;
  transform: translateX(3px);
}
.sublevel-card--locked { cursor: not-allowed; opacity: 0.6; }
.sublevel-status { font-size: 1.1rem; }
.locked-message { text-align: center; padding: 1.5rem 0; }

/* ════════════════════════════════
   SUBNIVEL GRID (vista A1)
════════════════════════════════ */
.subnivel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.subnivel-card {
  background: white; border-radius: 16px;
  border: 2px solid #e5e7eb;
  overflow: hidden; cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.subnivel-card:hover {
  border-color: #86efac;
  box-shadow: 0 8px 28px rgba(22,163,74,0.12);
  transform: translateY(-3px);
}
.subnivel-card.completed {
  border-color: #4ade80;
}
.subnivel-card-top {
  padding: 1.25rem;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}
.subnivel-card.completed .subnivel-card-top {
  background: linear-gradient(135deg, #bbf7d0, #86efac);
}
.subnivel-card-body { padding: 1rem 1.25rem 1.25rem; }
.subnivel-topics {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 0.5rem;
}
.topic-pill {
  display: inline-block; font-size: 0.7rem;
  padding: 2px 8px; border-radius: 20px;
  background: #f0fdf4; color: #166534;
  border: 1px solid #bbf7d0;
}
.subnivel-actions {
  display: flex; gap: 0.5rem; margin-top: 1rem;
}
.btn-lesson, .btn-test {
  flex: 1; padding: 0.55rem 0.5rem;
  border-radius: 9px; font-size: 0.8rem; font-weight: 500;
  transition: all var(--transition); text-align: center;
  font-family: 'DM Sans', sans-serif;
}
.btn-lesson {
  background: #f0fdf4; color: #166534;
  border: 1.5px solid #bbf7d0;
}
.btn-lesson:hover { background: #dcfce7; border-color: #86efac; }
.btn-test {
  background: #166534; color: white;
  border: 1.5px solid #166534;
}
.btn-test:hover { background: #14532d; }
.btn-test:disabled {
  background: #e5e7eb; color: #9ca3af;
  border-color: #e5e7eb; cursor: not-allowed;
}

/* ════════════════════════════════
   VISTA DE LECCIÓN
════════════════════════════════ */
.lesson-header {
  background: linear-gradient(135deg, #166534, #16a34a);
  border-radius: 20px; padding: 2rem;
  color: white; margin-bottom: 1.5rem;
}
.lesson-tabs {
  display: flex; gap: 0; border-bottom: 2px solid #e5e7eb;
  margin-bottom: 1.5rem; overflow-x: auto;
}
.tab-btn {
  padding: 0.75rem 1.25rem; font-size: 0.875rem; font-weight: 500;
  color: #6b7280; white-space: nowrap;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px; transition: all var(--transition);
  font-family: 'DM Sans', sans-serif;
}
.tab-btn:hover { color: #374151; }
.tab-btn.active { color: #166534; border-bottom-color: #16a34a; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeSlideIn 0.3s ease; }

/* Contenido de teoría */
.theory-block {
  background: white; border-radius: 16px;
  border: 1.5px solid #e5e7eb; padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.theory-block h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem; color: #111827; margin-bottom: 0.75rem;
}
.theory-block p { color: #374151; line-height: 1.75; margin-bottom: 0.5rem; }
.theory-highlight {
  background: #f0fdf4; border-left: 4px solid #16a34a;
  border-radius: 0 12px 12px 0; padding: 1rem 1.25rem;
  margin: 0.75rem 0;
}

/* Tabla gramatical */
.grammar-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.9rem; margin: 0.75rem 0;
}
.grammar-table th {
  background: #166534; color: white;
  padding: 0.6rem 1rem; text-align: left;
  font-weight: 500;
}
.grammar-table td {
  padding: 0.6rem 1rem; border-bottom: 1px solid #e5e7eb;
}
.grammar-table tr:nth-child(even) td { background: #f9fafb; }
.grammar-table tr:hover td { background: #f0fdf4; }
.grammar-table .it { font-style: italic; color: #166534; font-weight: 500; }
.grammar-table .es { color: #6b7280; }

/* Vocabulario */
.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}
.vocab-card {
  background: white; border-radius: 12px;
  border: 1.5px solid #e5e7eb; padding: 1rem;
  transition: all var(--transition);
}
.vocab-card:hover {
  border-color: #86efac;
  box-shadow: 0 4px 12px rgba(22,163,74,0.1);
}
.vocab-it { font-size: 1.1rem; font-weight: 600; color: #166534; }
.vocab-es { font-size: 0.875rem; color: #6b7280; margin-top: 2px; }
.vocab-example { font-size: 0.8rem; color: #9ca3af; margin-top: 6px; font-style: italic; }

/* Expresiones útiles */
.expr-card {
  background: linear-gradient(135deg, #fdfbf7, #fef9c3);
  border: 1.5px solid #fde68a; border-radius: 12px;
  padding: 1rem 1.25rem; margin-bottom: 0.75rem;
}
.expr-it { font-size: 1rem; font-weight: 600; color: #92400e; font-style: italic; }
.expr-es { font-size: 0.875rem; color: #78350f; margin-top: 2px; }
.expr-context { font-size: 0.78rem; color: #a16207; margin-top: 6px; }

/* Botón iniciar test */
.start-test-btn {
  display: block; width: 100%; max-width: 360px; margin: 2rem auto 0;
  padding: 0.9rem 1.5rem;
  background: linear-gradient(135deg, #166534, #16a34a);
  color: white; border-radius: 14px; font-size: 1rem; font-weight: 600;
  transition: all var(--transition); text-align: center;
  box-shadow: 0 4px 20px rgba(22,163,74,0.25);
  font-family: 'DM Sans', sans-serif;
}
.start-test-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(22,163,74,0.35);
}

/* ════════════════════════════════
   VISTA DE TEST
════════════════════════════════ */
.test-header {
  background: linear-gradient(135deg, #0f2d1a, #166534);
  border-radius: 20px; padding: 1.5rem 2rem;
  color: white; margin-bottom: 1.5rem;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
}
.test-progress-info { display: flex; align-items: center; gap: 1rem; }
.test-score-badge {
  background: rgba(255,255,255,0.15); border-radius: 20px;
  padding: 0.35rem 1rem; font-size: 0.875rem;
}

/* Tarjeta de pregunta */
.question-card {
  background: white; border-radius: 20px;
  border: 2px solid #e5e7eb; padding: 2rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  transition: border-color var(--transition);
  margin-bottom: 1.5rem;
}
.question-card.correct { border-color: #4ade80; }
.question-card.incorrect { border-color: #fb7185; }
.question-number {
  display: inline-block; font-size: 0.7rem; letter-spacing: 0.1em;
  font-weight: 600; color: #6b7280; margin-bottom: 0.75rem;
  background: #f3f4f6; border-radius: 6px; padding: 2px 8px;
}
.question-type-badge {
  display: inline-block; font-size: 0.7rem;
  padding: 2px 8px; border-radius: 6px; margin-left: 6px;
  font-weight: 500;
}
.qtype--mc   { background: #eff6ff; color: #1d4ed8; }
.qtype--fill { background: #fefce8; color: #854d0e; }
.qtype--sort { background: #fdf4ff; color: #7e22ce; }
.question-text {
  font-size: 1.1rem; color: #111827; margin-bottom: 1.25rem;
  line-height: 1.6; font-weight: 400;
}

/* Opciones múltiple */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem;
}
.option-btn {
  padding: 0.75rem 1rem; border-radius: 10px;
  border: 2px solid #e5e7eb; background: #f9fafb;
  text-align: left; font-size: 0.9rem; color: #374151;
  transition: all var(--transition); line-height: 1.4;
  font-family: 'DM Sans', sans-serif;
}
.option-btn:hover:not(:disabled) {
  border-color: #86efac; background: #f0fdf4; color: #166534;
}
.option-btn.selected  { border-color: #3b82f6; background: #eff6ff; color: #1e40af; }
.option-btn.correct   { border-color: #22c55e; background: #f0fdf4; color: #166534; }
.option-btn.incorrect { border-color: #ef4444; background: #fff1f2; color: #9f1239; }
.option-btn:disabled  { cursor: default; }

/* Fill-in-the-blank */
.fill-input-wrap { position: relative; display: inline-block; min-width: 120px; }
.fill-input {
  min-width: 120px; max-width: 300px; width: 100%;
  padding: 0.6rem 1rem; border-radius: 10px;
  border: 2px solid #d1d5db; background: #f9fafb;
  font-size: 1rem; color: #111827;
  transition: border-color var(--transition);
  outline: none;
}
.fill-input:focus { border-color: #16a34a; background: white; }
.fill-input.correct   { border-color: #22c55e; background: #f0fdf4; color: #166534; }
.fill-input.incorrect { border-color: #ef4444; background: #fff1f2; color: #9f1239; }
.blank-hint { font-size: 0.8rem; color: #5b6370; margin-top: 4px; }

/* Ordenar frases */
.sort-words-container { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1rem; }
.sort-slot-area {
  min-height: 50px; background: #f9fafb;
  border: 2px dashed #d1d5db; border-radius: 12px;
  padding: 0.75rem; display: flex; flex-wrap: wrap;
  gap: 8px; margin-bottom: 0.75rem;
  transition: border-color var(--transition);
}
.sort-slot-area:hover { border-color: #86efac; }
.sort-word {
  padding: 0.45rem 0.85rem; border-radius: 8px;
  background: white; border: 2px solid #e5e7eb;
  font-size: 0.9rem; color: #374151; cursor: pointer;
  transition: all var(--transition); user-select: none;
  font-family: 'DM Sans', sans-serif;
}
.sort-word:hover { border-color: #86efac; transform: translateY(-2px); }
.sort-word.in-slot { background: #f0fdf4; border-color: #86efac; color: #166534; }
.sort-word.correct { background: #dcfce7; border-color: #22c55e; color: #166534; }
.sort-word.incorrect { background: #ffe4e6; border-color: #fb7185; color: #9f1239; }

/* Feedback de respuesta */
.feedback-block {
  margin-top: 1rem; padding: 0.9rem 1.25rem;
  border-radius: 12px; font-size: 0.9rem;
  display: none; animation: fadeSlideIn 0.3s ease;
}
.feedback-block.visible { display: flex; align-items: flex-start; gap: 10px; }
.feedback-block.success { background: #f0fdf4; border: 1.5px solid #86efac; color: #166534; }
.feedback-block.error   { background: #fff1f2; border: 1.5px solid #fca5a5; color: #9f1239; }
.feedback-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.feedback-text p { margin-bottom: 4px; }
.feedback-text .feedback-correction {
  font-style: italic; color: #166534; font-weight: 500;
}

/* Botones de control del test */
.test-controls {
  display: flex; justify-content: flex-end; gap: 0.75rem; flex-wrap: wrap;
  margin-top: 1.5rem;
}
.btn-check, .btn-next, .btn-finish {
  padding: 0.7rem 1.75rem; border-radius: 12px;
  font-size: 0.9rem; font-weight: 600;
  transition: all var(--transition);
  font-family: 'DM Sans', sans-serif;
}
.btn-check {
  background: #166534; color: white;
  box-shadow: 0 3px 12px rgba(22,163,74,0.2);
}
.btn-check:hover { background: #14532d; transform: translateY(-1px); }
.btn-next  { background: white; color: #166534; border: 2px solid #86efac; }
.btn-next:hover  { background: #f0fdf4; }
.btn-finish { background: linear-gradient(135deg, #f59e0b, #d97706); color: white;
  box-shadow: 0 3px 12px rgba(245,158,11,0.25); }
.btn-finish:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(245,158,11,0.35); }

/* Resultado final del test */
.test-result {
  text-align: center; padding: 2.5rem 1.5rem;
  background: white; border-radius: 20px;
  border: 2px solid #e5e7eb;
  box-shadow: 0 8px 40px rgba(0,0,0,0.08);
  animation: bounceIn 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes bounceIn {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.result-score-circle {
  width: 120px; height: 120px; border-radius: 50%;
  margin: 0 auto 1.5rem;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  font-size: 2rem; font-weight: 700;
  border: 6px solid;
}
.result-score-circle.excellent { border-color: #22c55e; color: #166534; background: #f0fdf4; }
.result-score-circle.good      { border-color: #f59e0b; color: #92400e; background: #fef9c3; }
.result-score-circle.poor      { border-color: #ef4444; color: #9f1239; background: #fff1f2; }
.result-xp {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fef9c3; border: 2px solid #fde68a;
  border-radius: 20px; padding: 0.5rem 1.25rem;
  font-size: 1rem; font-weight: 600; color: #92400e;
  margin: 1rem 0;
}

/* ════════════════════════════════
   BADGES
════════════════════════════════ */
.badges-section {
  background: white; border-radius: 20px;
  border: 1.5px solid #e5e7eb; padding: 1.5rem;
}
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1rem;
}
.badge-card {
  text-align: center; padding: 1.25rem 0.75rem;
  background: linear-gradient(135deg, #fdfbf7, #fef9c3);
  border: 2px solid #fde68a; border-radius: 16px;
  animation: badgePop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes badgePop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.badge-emoji { font-size: 2.5rem; }
.badge-name  { font-size: 0.75rem; font-weight: 600; color: #92400e; margin-top: 6px; }
.badge-desc  { font-size: 0.68rem; color: #a16207; margin-top: 2px; }

/* ════════════════════════════════
   PROGRESO (vista)
════════════════════════════════ */
.progress-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.progress-stat {
  background: white; border-radius: 16px;
  border: 1.5px solid #e5e7eb; padding: 1.25rem;
  text-align: center;
}
.progress-stat-value { font-size: 2rem; font-weight: 700; color: #166534; }
.progress-stat-label { font-size: 0.8rem; color: #6b7280; margin-top: 4px; }
.progress-detail-card {
  background: white; border-radius: 16px;
  border: 1.5px solid #e5e7eb; padding: 1.5rem;
  margin-bottom: 1rem;
}

/* ════════════════════════════════
   MODAL
════════════════════════════════ */
.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: 1rem;
}
.modal-card {
  background: white; border-radius: 24px;
  padding: 2.5rem; max-width: 420px; width: 100%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2);
  animation: bounceIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-badge-emoji { font-size: 5rem; margin-bottom: 1rem; }
.modal-close-btn {
  margin-top: 1.5rem;
  padding: 0.75rem 2.5rem; border-radius: 14px;
  background: #166534; color: white; font-size: 1rem; font-weight: 600;
  transition: all var(--transition); font-family: 'DM Sans', sans-serif;
}
.modal-close-btn:hover { background: #14532d; transform: translateY(-2px); }

/* ════════════════════════════════
   TOAST
════════════════════════════════ */
.toast {
  position: fixed; top: 1.25rem; right: 1.25rem; z-index: 500;
  padding: 0.75rem 1.25rem; border-radius: 12px;
  font-size: 0.875rem; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  animation: toastSlide 0.3s ease;
  max-width: 320px;
}
@keyframes toastSlide {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
.toast--success { background: #f0fdf4; border: 1.5px solid #86efac; color: #166534; }
.toast--error   { background: #fff1f2; border: 1.5px solid #fca5a5; color: #9f1239; }
.toast--info    { background: #eff6ff; border: 1.5px solid #bfdbfe; color: #1e40af; }

/* ════════════════════════════════
   ANIMACIONES DE XP
════════════════════════════════ */
.xp-popup {
  position: fixed; pointer-events: none; z-index: 9999;
  font-size: 1.1rem; font-weight: 700; color: #f59e0b;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  animation: xpFly 1.2s ease forwards;
}
@keyframes xpFly {
  0%   { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-60px) scale(1.3); opacity: 0; }
}

/* ════════════════════════════════
   UTILIDADES
════════════════════════════════ */
.hidden { display: none !important; }
.shimmer { animation: shimmer 1.5s infinite linear; }
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.italic-it { font-style: italic; color: #166534; }

/* ════════════════════════════════
   RESPONSIVE — MOBILE
════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); z-index: 150;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu-btn { display: flex; }
  .main-content { padding: 1rem 1rem 1rem 1rem; margin-top: 3.5rem; }
  .view-header { flex-direction: column; }
  .levels-grid { grid-template-columns: 1fr; }
  .options-grid { grid-template-columns: 1fr; }
  .test-header { flex-direction: column; gap: 0.5rem; }
  .grammar-table { font-size: 0.78rem; }
  .grammar-table th, .grammar-table td { padding: 0.45rem 0.6rem; }
  .question-card { padding: 1.25rem; }
  .vocab-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (max-width: 480px) {
  .lesson-header { padding: 1.25rem; }
  .subnivel-actions { flex-direction: column; }
}

/* ═══════════════════════════════════════════════════════════════════
   MEJORA UI/UX v2 — Identidad visual, interactividad y modo Repaso
═══════════════════════════════════════════════════════════════════ */

:root {
  --terracotta:       #d97757;
  --terracotta-light: #fde9e1;
  --terracotta-dark:  #9a4a30;
}

/* ── Textura sutil de fondo (puntos) ── */
body {
  background-color: var(--crema);
  background-image: radial-gradient(circle at 1px 1px, rgba(22,101,52,0.05) 1px, transparent 0);
  background-size: 26px 26px;
}

/* ── Franja decorativa tricolor ── */
.italia-stripe {
  position: fixed; top: 0; left: 0; right: 0; height: 4px;
  z-index: 1000; pointer-events: none;
  background: linear-gradient(90deg,
    #16a34a 0%, #16a34a 33.33%,
    #f7f5ef 33.33%, #f7f5ef 66.66%,
    #e11d48 66.66%, #e11d48 100%);
}

/* ════════════════════════════════
   SIDEBAR — Repaso rápido + Racha
════════════════════════════════ */
.nav-item--flash {
  background: linear-gradient(90deg, rgba(217,119,87,0.20), rgba(217,119,87,0.04));
  color: #fed7c3;
  border: 1px solid rgba(217,119,87,0.28);
  margin-bottom: 6px; position: relative;
}
.nav-item--flash:hover {
  background: linear-gradient(90deg, rgba(217,119,87,0.32), rgba(217,119,87,0.1));
  color: #ffe8d9;
  transform: translateX(2px);
}
.nav-icon-flash { font-size: 1.05rem; line-height: 1; }
.nav-pill-new {
  margin-left: auto; font-size: 0.6rem; letter-spacing: 0.06em;
  background: var(--terracotta); color: white; font-weight: 700;
  padding: 2px 6px; border-radius: 6px;
}

.streak-chip {
  display: inline-flex; align-items: center; gap: 3px;
  background: rgba(245,158,11,0.16); border: 1px solid rgba(245,158,11,0.3);
  border-radius: 20px; padding: 1px 8px;
  font-size: 0.7rem; color: #fde68a; font-weight: 600;
}
.streak-flame { display: inline-block; font-size: 0.75rem; animation: flameFlicker 1.6s ease-in-out infinite; }
@keyframes flameFlicker {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.18) rotate(-6deg); }
}

/* ════════════════════════════════
   SECTION TITLE ROW
════════════════════════════════ */
.section-title-row {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem;
}

/* ════════════════════════════════
   DASHBOARD HERO
════════════════════════════════ */
.dashboard-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0f2d1a 0%, #166534 55%, #15803d 100%);
  border-radius: 24px; padding: 2rem;
  margin-bottom: 2rem;
  display: flex; flex-wrap: wrap; gap: 1.5rem;
  align-items: center; justify-content: space-between;
  box-shadow: 0 12px 40px rgba(15,45,26,0.25);
  animation: fadeSlideIn 0.5s ease;
}
.hero-bg-deco { position: absolute; inset: 0; pointer-events: none; }
.hero-deco-circle { position: absolute; border-radius: 50%; }
.hero-deco-circle--1 {
  width: 280px; height: 280px; top: -120px; right: -90px;
  background: rgba(255,255,255,0.05);
}
.hero-deco-circle--2 {
  width: 170px; height: 170px; bottom: -70px; right: 160px;
  background: rgba(255,255,255,0.04);
}
.hero-greeting { position: relative; z-index: 1; flex: 1 1 260px; }
.hero-eyebrow {
  color: #bbf7d0; font-size: 0.7rem; letter-spacing: 0.18em;
  text-transform: uppercase; margin-bottom: 6px; font-weight: 600;
}
.hero-cta {
  margin-top: 1.25rem; display: inline-flex; align-items: center; gap: 6px;
  background: white; color: #166534; font-weight: 600;
  padding: 0.65rem 1.5rem; border-radius: 14px; font-size: 0.9rem;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  font-family: 'DM Sans', sans-serif;
}
.hero-cta:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 10px 28px rgba(0,0,0,0.22); }
.hero-cta:active { transform: scale(0.97); }

.hero-stats {
  position: relative; z-index: 1;
  display: flex; gap: 0.85rem; flex-wrap: wrap;
}
.hero-stat-card {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px; padding: 0.85rem 1.1rem; text-align: center;
  min-width: 104px; backdrop-filter: blur(6px);
  transition: transform var(--transition), background var(--transition);
}
.hero-stat-card:hover { transform: translateY(-3px); background: rgba(255,255,255,0.13); }

/* Anillos de progreso SVG */
.ring-svg { width: 60px; height: 60px; transform: rotate(-90deg); }
.ring-bg  { fill: none; stroke: rgba(255,255,255,0.15); stroke-width: 6; }
.ring-fill {
  fill: none; stroke-width: 6; stroke-linecap: round;
  transition: stroke-dashoffset 1.1s cubic-bezier(0.4,0,0.2,1);
}
.hero-stat-icon-wrap { position: relative; width: 60px; height: 60px; margin: 0 auto; }
.hero-stat-icon {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; font-size: 1.4rem;
}
.hero-stat-value { font-size: 1.2rem; font-weight: 700; color: white; margin-top: 6px; }
.hero-stat-label { font-size: 0.68rem; color: rgba(255,255,255,0.6); }

/* ════════════════════════════════
   MICRO-INTERACCIONES MEJORADAS
════════════════════════════════ */
.levels-grid > .level-card { animation: fadeSlideIn 0.45s ease both; }
.levels-grid > .level-card:nth-child(1) { animation-delay: 0.05s; }
.levels-grid > .level-card:nth-child(2) { animation-delay: 0.15s; }
.levels-grid > .level-card:nth-child(3) { animation-delay: 0.25s; }

.subnivel-grid > .subnivel-card { animation: fadeSlideIn 0.4s ease both; }
.subnivel-grid > .subnivel-card:nth-child(1) { animation-delay: 0.05s; }
.subnivel-grid > .subnivel-card:nth-child(2) { animation-delay: 0.12s; }
.subnivel-grid > .subnivel-card:nth-child(3) { animation-delay: 0.19s; }
.subnivel-grid > .subnivel-card:nth-child(4) { animation-delay: 0.26s; }

.subnivel-card:hover { transform: translateY(-4px) scale(1.012); }
.level-card:not(.level-card--locked):hover { transform: translateY(-6px) scale(1.008); }

.vocab-card { transition: all var(--transition); }
.vocab-card:hover { transform: translateY(-3px) scale(1.02); }

.expr-card { transition: all var(--transition); }
.expr-card:hover { transform: translateX(4px); box-shadow: 0 4px 16px rgba(245,158,11,0.12); }

.option-btn:hover:not(:disabled) { transform: translateY(-1px); }
.option-btn:active:not(:disabled) { transform: scale(0.98); }

.sort-word:active { transform: scale(0.95); }

.lesson-tab-pill:active { transform: scale(0.96); }

.btn-lesson:active, .btn-test:active, .back-btn:active,
.btn-check:active, .btn-next:active, .btn-finish:active,
.start-test-btn:active, .modal-close-btn:active {
  transform: scale(0.97);
}

/* ════════════════════════════════
   BOTÓN DE AUDIO (pronunciación)
════════════════════════════════ */
.audio-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: #f0fdf4; color: #166534; border: 1.5px solid #bbf7d0;
  font-size: 0.85rem; transition: all var(--transition); cursor: pointer;
}
.audio-btn:hover { background: #dcfce7; transform: scale(1.12); border-color: #86efac; }
.audio-btn:active { transform: scale(0.92); }
.audio-btn.playing {
  background: #16a34a; color: white; border-color: #16a34a;
  animation: audioPulse 0.7s ease infinite;
}
@keyframes audioPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0.35); }
  50%      { box-shadow: 0 0 0 7px rgba(22,163,74,0); }
}
.audio-btn--lg {
  width: 44px; height: 44px; font-size: 1.2rem;
  background: rgba(255,255,255,0.15); color: white; border: 1.5px solid rgba(255,255,255,0.3);
}
.audio-btn--lg:hover { background: rgba(255,255,255,0.28); }
.audio-btn--lg.playing { background: white; color: #166534; border-color: white; }
.audio-btn--amber {
  background: #fef9c3; color: #92400e; border-color: #fde68a;
}
.audio-btn--amber:hover { background: #fef08a; }
.audio-btn--amber.playing { background: #f59e0b; color: white; border-color: #f59e0b; }

.vocab-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.expr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

/* ════════════════════════════════
   FLASHCARDS — Repaso rápido
════════════════════════════════ */
.flashcards-intro {
  display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.5rem;
}
.deck-chip {
  padding: 0.5rem 1.1rem; border-radius: 20px; font-size: 0.82rem; font-weight: 500;
  border: 2px solid #e5e7eb; background: white; color: #4b5563;
  transition: all var(--transition); font-family: 'DM Sans', sans-serif; cursor: pointer;
}
.deck-chip:hover { border-color: #86efac; color: #166534; background: #f0fdf4; }
.deck-chip.active { background: #166534; color: white; border-color: #166534; }

.flashcard-empty {
  text-align: center; padding: 3rem 1.5rem; background: white;
  border-radius: 20px; border: 2px dashed #e5e7eb; color: #9ca3af;
}

.flashcard-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8rem; color: #9ca3af; margin-bottom: 0.75rem; max-width: 480px; margin-left:auto; margin-right:auto;
}
.flashcard-mastery-bar {
  flex: 1; height: 6px; background: #e5e7eb; border-radius: 3px; margin: 0 10px;
  overflow: hidden;
}
.flashcard-mastery-fill {
  height: 100%; background: linear-gradient(90deg, #4ade80, #16a34a);
  border-radius: 3px; transition: width 0.5s ease;
}

.flashcard-wrap {
  perspective: 1400px; max-width: 480px; margin: 0 auto 1.25rem;
}
.flashcard {
  position: relative; width: 100%; height: 290px;
  cursor: pointer; transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4,0.0,0.2,1);
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard.shake { animation: shakeCard 0.4s ease; }
@keyframes shakeCard {
  0%,100% { transform: translateX(0) rotateY(var(--ry,0)); }
  25% { transform: translateX(-6px) rotateY(var(--ry,0)); }
  75% { transform: translateX(6px) rotateY(var(--ry,0)); }
}
.flashcard-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: 24px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 2rem;
  text-align: center; gap: 0.6rem;
}
.flashcard-front {
  background: linear-gradient(135deg, #166534, #16a34a);
  color: white; box-shadow: 0 14px 40px rgba(22,101,52,0.25);
}
.flashcard-back {
  background: linear-gradient(135deg, #fdfbf7, #fef3c7);
  color: #166534; border: 2px solid #fde68a;
  transform: rotateY(180deg);
  box-shadow: 0 14px 40px rgba(245,158,11,0.12);
}
.flashcard-lang-tag {
  font-size: 0.65rem; letter-spacing: 0.2em; font-weight: 700;
  opacity: 0.6;
}
.flashcard-word {
  font-family: 'Playfair Display', serif; font-size: 1.9rem; font-weight: 700;
  line-height: 1.25;
}
.flashcard-back .flashcard-word { color: #92400e; }
.flashcard-example {
  font-size: 0.9rem; font-style: italic; opacity: 0.75; max-width: 320px;
}
.flashcard-hint {
  font-size: 0.75rem; opacity: 0.55; margin-top: 0.25rem;
}

.flashcard-progress-track {
  max-width: 480px; margin: 0 auto 1.5rem; height: 6px;
  background: #e5e7eb; border-radius: 3px; overflow: hidden;
}
.flashcard-progress-fill {
  height: 100%; background: linear-gradient(90deg, #4ade80, #16a34a);
  border-radius: 3px; transition: width 0.4s ease;
}

.flashcard-controls {
  display: flex; gap: 0.75rem; max-width: 480px; margin: 0 auto 1rem;
  flex-wrap: wrap;
}
.fc-btn {
  flex: 1; min-width: 140px; padding: 0.8rem 1rem; border-radius: 14px;
  font-size: 0.9rem; font-weight: 600; transition: all var(--transition);
  font-family: 'DM Sans', sans-serif; border: 2px solid transparent;
}
.fc-btn--no {
  background: #fff1f2; color: #9f1239; border-color: #fecdd3;
}
.fc-btn--no:hover { background: #ffe4e6; transform: translateY(-2px); }
.fc-btn--yes {
  background: #f0fdf4; color: #166534; border-color: #bbf7d0;
}
.fc-btn--yes:hover { background: #dcfce7; transform: translateY(-2px); }
.fc-btn:active { transform: scale(0.97); }

.flashcard-nav {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 480px; margin: 0 auto; font-size: 0.85rem; color: #6b7280;
}
.flashcard-nav button {
  padding: 0.4rem 0.9rem; border-radius: 10px; font-size: 0.82rem;
  background: white; border: 1.5px solid #e5e7eb; color: #4b5563;
  transition: all var(--transition); font-family: 'DM Sans', sans-serif;
}
.flashcard-nav button:hover { border-color: #86efac; color: #166534; }
.flashcard-nav button:active { transform: scale(0.96); }
.flashcard-nav button:disabled { opacity: 0.35; cursor: not-allowed; }

.flashcard-complete {
  text-align: center; padding: 2.5rem 1.5rem; background: white;
  border-radius: 20px; border: 2px solid #bbf7d0;
  box-shadow: 0 8px 32px rgba(22,163,74,0.1);
  animation: bounceIn 0.5s cubic-bezier(0.34,1.56,0.64,1);
  max-width: 480px; margin: 0 auto;
}

@media (max-width: 480px) {
  .flashcard { height: 250px; }
  .flashcard-word { font-size: 1.5rem; }
  .dashboard-hero { padding: 1.5rem; }
  .hero-stats { width: 100%; justify-content: space-between; }
  .hero-stat-card { flex: 1; min-width: 90px; padding: 0.7rem 0.5rem; }
}

/* ═══════════════════════════════════════════════════════════════════
   AUTENTICACIÓN — Login / Registro / Verificación
═══════════════════════════════════════════════════════════════════ */

.auth-screen {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f2d1a 0%, #166534 55%, #15803d 100%);
  padding: 1.25rem; overflow-y: auto;
}
.auth-bg-deco { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.auth-deco {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.auth-deco--1 { width: 380px; height: 380px; top: -160px; right: -120px; }
.auth-deco--2 { width: 240px; height: 240px; bottom: -100px; left: -80px; background: rgba(255,255,255,0.04); }
.auth-deco--3 { width: 140px; height: 140px; bottom: 60px; right: 18%; background: rgba(217,119,87,0.12); }

.auth-card {
  position: relative; z-index: 1;
  background: white; border-radius: 24px;
  padding: 2.25rem; max-width: 420px; width: 100%;
  box-shadow: 0 24px 70px rgba(0,0,0,0.25);
  animation: bounceIn 0.5s cubic-bezier(0.34,1.56,0.64,1);
  max-height: 92vh; overflow-y: auto;
}
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #0f2d1a 0%, #1a3d24 100%);
  padding: 1.25rem 1rem;
  border-radius: 16px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.auth-demo-banner {
  background: #fff7ed; border: 1.5px solid #fed7aa; color: #9a4a30;
  border-radius: 12px; padding: 0.85rem 1rem; font-size: 0.82rem;
  line-height: 1.5; margin-bottom: 1.25rem;
}
.auth-demo-btn {
  display: block; margin-top: 0.6rem;
  background: var(--terracotta); color: white; font-weight: 600;
  padding: 0.5rem 1rem; border-radius: 10px; font-size: 0.82rem;
  transition: all var(--transition); font-family: 'DM Sans', sans-serif;
}
.auth-demo-btn:hover { background: var(--terracotta-dark); }
.auth-demo-btn:active { transform: scale(0.97); }

.auth-form { display: none; }
.auth-form.active { display: block; animation: fadeSlideIn 0.35s ease; }

.auth-label {
  display: block; font-size: 0.78rem; font-weight: 600; color: #4b5563;
  margin-bottom: 0.3rem; margin-top: 0.85rem;
}
.auth-input {
  width: 100%; padding: 0.7rem 0.95rem; border-radius: 12px;
  border: 2px solid #e5e7eb; background: #f9fafb;
  font-size: 0.92rem; color: #111827; outline: none;
  transition: border-color var(--transition), background var(--transition);
  font-family: 'DM Sans', sans-serif;
}
.auth-input:focus { border-color: #16a34a; background: white; }
.auth-input--code {
  text-align: center; font-size: 1.5rem; font-weight: 700;
  letter-spacing: 0.5em; padding-left: 0.5em;
}

.auth-role-selector { display: flex; gap: 0.6rem; margin-top: 0.4rem; }
.auth-role-option { flex: 1; cursor: pointer; }
.auth-role-option input { position: absolute; opacity: 0; pointer-events: none; }
.auth-role-card {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0.7rem 0.5rem; border-radius: 12px;
  border: 2px solid #e5e7eb; background: #f9fafb;
  font-size: 0.85rem; font-weight: 500; color: #4b5563;
  transition: all var(--transition);
}
.auth-role-option input:checked + .auth-role-card {
  border-color: #16a34a; background: #f0fdf4; color: #166534;
}

.auth-error {
  color: #be123c; font-size: 0.82rem; margin-top: 0.6rem;
  min-height: 0; line-height: 1.4;
}
.auth-success {
  color: #166534; font-size: 0.82rem; margin-top: 0.6rem; line-height: 1.4;
}

.auth-submit {
  width: 100%; margin-top: 1.25rem;
  padding: 0.8rem 1rem; border-radius: 14px;
  background: linear-gradient(135deg, #166534, #16a34a);
  color: white; font-size: 0.95rem; font-weight: 600;
  transition: all var(--transition);
  box-shadow: 0 4px 18px rgba(22,163,74,0.25);
  font-family: 'DM Sans', sans-serif;
}
.auth-submit:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(22,163,74,0.32); }
.auth-submit:active { transform: scale(0.98); }
.auth-submit:disabled { opacity: 0.6; cursor: wait; transform: none; }

.auth-link-btn {
  width: 100%; margin-top: 0.6rem; padding: 0.5rem;
  background: transparent; color: #166534; font-size: 0.85rem; font-weight: 500;
  border-radius: 10px; transition: background var(--transition);
  font-family: 'DM Sans', sans-serif;
}
.auth-link-btn:hover { background: #f0fdf4; }
.auth-link-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-switch {
  text-align: center; font-size: 0.85rem; color: #6b7280; margin-top: 1.1rem;
}
.auth-switch a {
  color: #166534; font-weight: 600; cursor: pointer; text-decoration: underline;
}

/* ════════════════════════════════
   ROLE BADGE + SIDEBAR EXTRAS
════════════════════════════════ */
.role-badge {
  display: inline-block; font-size: 0.62rem; letter-spacing: 0.06em;
  font-weight: 700; text-transform: uppercase;
  padding: 2px 8px; border-radius: 6px;
  background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.75);
}
.role-badge--admin    { background: rgba(217,119,87,0.25); color: #fed7c3; }
.role-badge--docente  { background: rgba(96,165,250,0.22); color: #bfdbfe; }
.role-badge--alumno   { background: rgba(74,222,128,0.2);  color: #bbf7d0; }

.nav-item--role { display: none; } /* se muestra via JS según rol */
.nav-item--logout {
  color: #fca5a5;
}
.nav-item--logout:hover { background: rgba(225,29,72,0.12); color: #fecaca; }

/* ════════════════════════════════
   PANEL DOCENTE / ADMIN — TABLAS
════════════════════════════════ */
.panel-summary-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.panel-summary-card {
  background: white; border-radius: 16px; border: 1.5px solid #e5e7eb;
  padding: 1.1rem; text-align: center;
}
.panel-summary-value { font-size: 1.6rem; font-weight: 700; color: #166534; }
.panel-summary-label { font-size: 0.78rem; color: #6b7280; margin-top: 2px; }

.panel-table-wrap {
  background: white; border-radius: 18px; border: 1.5px solid #e5e7eb;
  overflow-x: auto; box-shadow: 0 2px 12px rgba(0,0,0,0.03);
}
.panel-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; min-width: 640px; }
.panel-table th {
  text-align: left; padding: 0.85rem 1rem; background: #f9fafb;
  color: #6b7280; font-weight: 600; font-size: 0.72rem;
  letter-spacing: 0.06em; text-transform: uppercase;
  border-bottom: 2px solid #e5e7eb; white-space: nowrap;
}
.panel-table td {
  padding: 0.85rem 1rem; border-bottom: 1px solid #f3f4f6;
  color: #374151; vertical-align: middle;
}
.panel-table tbody tr { transition: background var(--transition); }
.panel-table tbody tr:hover { background: #f9fafb; }
.panel-table tbody tr:last-child td { border-bottom: none; }

.student-row { cursor: pointer; }

.cell-name { font-weight: 600; color: #111827; }
.cell-email { color: #5b6370; font-size: 0.78rem; }
.cell-score {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-weight: 700; font-size: 0.8rem;
}
.cell-score--high { background: #f0fdf4; color: #166534; }
.cell-score--mid  { background: #fef9c3; color: #92400e; }
.cell-score--low  { background: #fff1f2; color: #9f1239; }
.cell-score--none { background: #e5e7eb; color: #4b5563; }

.role-select, .status-select {
  padding: 0.35rem 0.6rem; border-radius: 8px; border: 1.5px solid #e5e7eb;
  font-size: 0.8rem; color: #374151; background: white;
  font-family: 'DM Sans', sans-serif; transition: border-color var(--transition);
}
.role-select:focus, .status-select:focus { border-color: #16a34a; outline: none; }

.table-action-btn {
  padding: 0.35rem 0.7rem; border-radius: 8px; font-size: 0.78rem; font-weight: 500;
  background: #fff1f2; color: #9f1239; border: 1.5px solid #fecdd3;
  transition: all var(--transition); font-family: 'DM Sans', sans-serif;
}
.table-action-btn:hover { background: #ffe4e6; }
.table-action-btn:active { transform: scale(0.95); }

.verified-icon { font-size: 1rem; }

.empty-panel-state {
  text-align: center; padding: 3rem 1.5rem; color: #9ca3af;
  background: white; border-radius: 18px; border: 2px dashed #e5e7eb;
}

/* Modal ancho (detalle de alumno) */
.modal-card--wide {
  max-width: 560px; text-align: left;
}
.modal-card--wide h2 { text-align: center; }
.student-detail-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.75rem; margin: 1rem 0;
}
.student-detail-list { margin-top: 0.75rem; }
.student-detail-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 0; border-bottom: 1px solid #f3f4f6; font-size: 0.88rem;
}
.student-detail-item:last-child { border-bottom: none; }

@media (max-width: 640px) {
  .auth-card { padding: 1.5rem; border-radius: 18px; }
  .panel-table { font-size: 0.78rem; }
}
