/* ==========================================================================
   DISEÑO DE SISTEMA - PREPARADOR OPOSICIONES EMT MADRID (DARK GLASSMORPHISM)
   ========================================================================== */

/* --- 1. CONFIGURACIÓN GENERAL Y VARIABLES (PALETA DE COLORES HSL) --- */
:root {
  --font-title: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Design tokens oficiales OpoBus */
  --color-primary: #0f2d52;
  --color-secondary: #11b5ae;
  --color-accent-brand: #ffb400;
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-surface-muted: #eef2f4;
  --color-text: #0f2d52;
  --color-muted: #40516d;
  --color-muted-soft: #7a8798;
  --color-border: rgba(15, 45, 82, 0.10);
  --color-focus: rgba(17, 181, 174, 0.35);
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-soft: 0 12px 30px rgba(15, 45, 82, 0.08);
  --shadow-lifted: 0 18px 42px rgba(15, 45, 82, 0.12);
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Colores Corporativos EMT e Indicadores */
  --color-bg-deep: var(--color-bg);
  --color-bg-base: var(--color-surface-muted);
  --color-bg-glass: rgba(255, 255, 255, 0.92);
  --color-border-glass: var(--color-border);
  --color-border-glass-focus: var(--color-focus);
  
  --color-emt-blue: var(--color-primary);
  --color-emt-blue-glow: rgba(15, 45, 82, 0.18);
  
  --color-accent: var(--color-secondary);
  --color-success: var(--color-secondary);
  --color-success-glow: rgba(17, 181, 174, 0.18);
  --color-warning: var(--color-accent-brand);
  --color-warning-glow: rgba(255, 180, 0, 0.22);
  --color-danger: #ef4444;
  --color-danger-glow: rgba(239, 68, 68, 0.25);
  
  --color-text-primary: var(--color-text);
  --color-text-secondary: var(--color-muted);
  --color-text-muted: var(--color-muted-soft);
  
  --shadow-premium: var(--shadow-soft);
  --border-radius-lg: var(--radius-lg);
  --border-radius-md: var(--radius-md);
  --border-radius-sm: 8px;
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 2. RESET Y ESTILOS BASE --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--color-bg-deep);
  background-image: 
    linear-gradient(135deg, rgba(238, 242, 244, 0.92) 0%, rgba(255, 255, 255, 0.98) 52%, rgba(17, 181, 174, 0.10) 100%);
  background-attachment: fixed;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-weight: 400;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: 0;
}

/* --- 3. DISEÑO DE ESTRUCTURA Y GRID (SIDEBAR + MAIN) --- */
.app-container {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

/* Barra lateral */
.app-sidebar {
  width: 280px;
  background-color: rgba(11, 14, 21, 0.85);
  border-right: 1px solid var(--color-border-glass);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  display: flex;
  flex-direction: column;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  position: fixed;
  height: 100vh;
  height: 100dvh;
  left: 0;
  top: 0;
  z-index: 100;
  transition: var(--transition-smooth);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border-glass);
  margin-bottom: 24px;
}

.brand-main-logo {
  width: 100%;
  max-width: 220px;
  height: auto;
  display: block;
  object-fit: contain;
}

.brand-main-logo-wrap {
  display: block;
  width: 100%;
  max-width: 220px;
}

.brand-logo {
  background: linear-gradient(135deg, var(--color-emt-blue) 0%, #1e40af 100%);
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 20px var(--color-emt-blue-glow);
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
}

.brand-text span {
  font-size: 11px;
  color: var(--color-text-secondary);
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.menu-item {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: var(--transition-smooth);
}

.menu-item i {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.menu-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--color-text-primary);
}

.menu-item.active {
  background-color: var(--color-emt-blue);
  color: var(--color-text-primary);
  box-shadow: 0 4px 15px var(--color-emt-blue-glow);
}

.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: auto;
  text-transform: uppercase;
}

.badge-accent { background-color: var(--color-accent); color: #fff; }
.badge-warning { background-color: var(--color-warning); color: #000; }
.badge-danger { background-color: var(--color-danger); color: #fff; }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--color-border-glass);
  padding-top: 16px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  background-color: rgba(255, 255, 255, 0.08);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--color-text-primary);
}

.user-info h4 {
  font-size: 13px;
  font-weight: 600;
}

.user-info p {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.account-action-btn {
  width: 100%;
  margin-top: 12px;
  border: 1px solid rgba(17, 181, 174, 0.24);
  background: rgba(17, 181, 174, 0.08);
  color: var(--color-emt-blue);
  border-radius: var(--border-radius-md);
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.account-action-btn:hover {
  background: rgba(17, 181, 174, 0.14);
  border-color: rgba(17, 181, 174, 0.45);
}

.account-action-btn.is-connected {
  background: rgba(15, 45, 82, 0.08);
  border-color: rgba(15, 45, 82, 0.18);
}

/* Área de contenido principal */
.app-main {
  flex-grow: 1;
  margin-left: 280px;
  padding: 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
}

/* Cabecera superior */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--color-border-glass);
  padding-bottom: 20px;
}

.header-welcome h2 {
  font-size: 28px;
  font-weight: 700;
}

.header-welcome p {
  color: var(--color-text-secondary);
  font-size: 14px;
}

.header-actions {
  display: flex;
  gap: 16px;
}

.stat-indicator {
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-glass);
  padding: 8px 16px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
}

.account-header-btn {
  color: var(--color-emt-blue);
}

.text-amber { color: var(--color-warning); }
.text-green { color: var(--color-success); }
.text-red { color: var(--color-danger); }
.text-blue { color: var(--color-accent); }
.text-pink { color: #ec4899; }
.text-purple { color: #a855f7; }

/* --- 4. CLASES DE DISEÑO DE INTERFAZ GLASSMORPHISM --- */
.glass-panel {
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-glass);
  border-radius: var(--border-radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-premium);
  padding: 24px;
  position: relative;
  transition: var(--transition-smooth);
}

.glass-panel:hover {
  border-color: var(--color-border-glass-focus);
}

.border-blue { border-color: rgba(59, 130, 246, 0.3) !important; }
.border-purple { border-color: rgba(168, 85, 247, 0.3) !important; }
.border-amber { border-color: rgba(245, 158, 11, 0.3) !important; }
.border-green { border-color: rgba(16, 185, 129, 0.3) !important; }
.border-danger { border-color: rgba(239, 68, 68, 0.3) !important; }

/* --- 5. CONTROLADOR DE VISTAS (SPA MOSTRAR/OCULTAR) --- */
.app-view {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.app-view.active {
  display: block;
}

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

.hidden {
  display: none !important;
}

/* --- PANEL DE ADMINISTRACION --- */
.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 24px;
}

.admin-hero h3 {
  font-size: 26px;
  margin: 6px 0 8px;
}

.admin-hero p,
.admin-warning p,
.admin-action-card p {
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.admin-warning {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  border-color: rgba(255, 180, 0, 0.35) !important;
}

.admin-warning i {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 180, 0, 0.16);
  color: var(--color-warning);
  font-size: 20px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.admin-metric-card {
  padding: 18px;
  display: grid;
  gap: 8px;
}

.admin-metric-card span {
  color: var(--color-text-secondary);
  font-weight: 700;
  font-size: 13px;
}

.admin-metric-card strong {
  color: var(--color-emt-blue);
  font-family: var(--font-title);
  font-size: 32px;
  line-height: 1;
}

.admin-metric-card small {
  color: var(--color-text-muted);
  font-weight: 600;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 18px;
  margin-bottom: 18px;
}

.admin-section {
  padding: 22px;
}

.admin-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.admin-section-header h4 {
  margin-top: 4px;
  font-size: 18px;
}

.admin-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(17, 181, 174, 0.13);
  color: var(--color-secondary);
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}

.admin-status-pill.is-premium {
  background: rgba(255, 180, 0, 0.17);
  color: #9a6a00;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.admin-table th,
.admin-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.admin-table th {
  color: var(--color-text-secondary);
  font-size: 12px;
  text-transform: uppercase;
}

.admin-table td {
  color: var(--color-text-primary);
  font-weight: 700;
}

.admin-table td span:not(.admin-status-pill) {
  display: block;
  margin-top: 3px;
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 12px;
}

.admin-health-list {
  display: grid;
  gap: 12px;
}

.admin-health-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.admin-health-item span {
  color: var(--color-text-secondary);
}

.admin-health-item strong {
  color: var(--color-emt-blue);
  text-align: right;
}

.admin-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.admin-action-card {
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(238, 242, 244, 0.48);
}

.admin-action-card i {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  background: rgba(17, 181, 174, 0.13);
  color: var(--color-secondary);
}

.admin-action-card h5 {
  margin-bottom: 6px;
  font-size: 15px;
}

/* --- 6. DISEÑO DE ELEMENTOS DE PANEL (DASHBOARD) --- */
@media (max-width: 1080px) {
  .admin-grid,
  .admin-actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .admin-hero,
  .admin-section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-grid,
  .admin-actions-grid {
    grid-template-columns: 1fr;
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.bg-blue-glow { background-color: rgba(59, 130, 246, 0.15); color: var(--color-accent); }
.bg-green-glow { background-color: rgba(16, 185, 129, 0.15); color: var(--color-success); }
.bg-amber-glow { background-color: rgba(245, 158, 11, 0.15); color: var(--color-warning); }
.bg-red-glow { background-color: rgba(239, 68, 68, 0.15); color: var(--color-danger); }

.stat-details h3 {
  font-size: 13px;
  color: var(--color-text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  margin: 4px 0;
  font-family: var(--font-title);
}

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

.dashboard-details-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
  margin-bottom: 24px;
}

.quick-study-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.quick-study-card h3 {
  margin-bottom: 0;
}

.quick-study-actions,
.micro-mode-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.micro-mode-grid {
  flex-direction: column;
  margin-top: 16px;
}

.dashboard-card h3 {
  font-size: 18px;
  margin-bottom: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Círculo de Progreso */
.progress-analytics-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.circular-progress-container {
  margin: 20px 0;
  position: relative;
}

.circular-progress {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: conic-gradient(var(--color-emt-blue) 0deg, rgba(255,255,255,0.05) 0deg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: var(--transition-smooth);
}

.circular-progress::before {
  content: "";
  position: absolute;
  width: 126px;
  height: 126px;
  border-radius: 50%;
  background-color: var(--color-bg-base);
}

.circular-value {
  position: relative;
  font-family: var(--font-title);
  font-size: 32px;
  font-weight: 800;
  color: var(--color-text-primary);
}

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

/* Tarjeta de Recomendaciones */
.recommendation-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rec-alert-box {
  background: rgba(255, 255, 255, 0.03);
  border-left: 4px solid var(--color-emt-blue);
  padding: 16px;
  border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
  display: flex;
  gap: 16px;
}

.rec-icon {
  font-size: 24px;
  color: var(--color-emt-blue);
}

.rec-text h4 {
  font-size: 15px;
  margin-bottom: 6px;
}

.rec-text p {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

/* Barras de habilidad por temas */
.theme-performance-card h3 {
  margin-bottom: 8px;
}

.section-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}

.skills-bars-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.skill-bar-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.skill-label {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 280px;
  font-size: 14px;
  font-weight: 500;
}

.skill-label i {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.skill-track {
  flex-grow: 1;
  height: 10px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
}

.skill-fill {
  height: 100%;
  border-radius: 999px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.1, 0.8, 0.3, 1);
}

.bg-blue { background-color: var(--color-accent); }
.bg-red { background-color: var(--color-danger); }
.bg-purple { background-color: #a855f7; }
.bg-pink { background-color: #ec4899; }
.bg-amber { background-color: var(--color-warning); }
.bg-green { background-color: var(--color-success); }

.skill-percent {
  font-size: 13px;
  font-weight: 700;
  width: 45px;
  text-align: right;
}

/* --- 7. TARJETAS DE SELECCIÓN DE TESTS Y CONTENIDO --- */
.test-selector-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  margin-top: 20px;
}

.selector-card {
  padding: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: var(--transition-smooth);
}

.selector-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  color: #fff;
  letter-spacing: 0;
}

.selector-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.selector-card h3 {
  font-size: 22px;
  margin-bottom: 12px;
  font-weight: 700;
}

.selector-card p {
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.selector-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  width: 100%;
  margin-bottom: 30px;
  background: rgba(255, 255, 255, 0.02);
  padding: 16px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-border-glass);
}

.selector-features li {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-text-secondary);
}

.selector-features li i {
  color: var(--color-success);
}

.form-group {
  width: 100%;
  text-align: left;
  margin-bottom: 16px;
}

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

.custom-select {
  width: 100%;
  background: rgba(11, 14, 21, 0.8);
  border: 1px solid var(--color-border-glass);
  color: var(--color-text-primary);
  padding: 12px;
  border-radius: var(--border-radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.custom-select:focus {
  outline: none;
  border-color: var(--color-accent);
}

.border-top-glass {
  border-top: 1px solid var(--color-border-glass);
  padding-top: 20px;
  margin-top: 10px;
}

/* --- 8. BOTONES PREMIUM --- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: var(--border-radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-blue {
  background: linear-gradient(135deg, var(--color-emt-blue) 0%, #1e40af 100%);
  color: #fff;
  box-shadow: 0 4px 15px var(--color-emt-blue-glow);
}

.btn-purple {
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.25);
}

.btn-amber {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.25);
}

.btn-green {
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  color: #fff;
  box-shadow: 0 4px 15px var(--color-success-glow);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #fff;
  box-shadow: 0 4px 15px var(--color-danger-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--color-border-glass);
  color: var(--color-text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--color-warning);
}

.btn-warning:hover {
  background: rgba(245, 158, 11, 0.2);
}

.btn-full {
  width: 100%;
}

.account-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.account-modal.hidden {
  display: none;
}

.account-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 45, 82, 0.35);
  backdrop-filter: blur(8px);
}

.account-dialog {
  width: min(460px, 100%);
  position: relative;
  background: #fff;
  border: 1px solid rgba(15, 45, 82, 0.12);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 45, 82, 0.24);
  padding: 26px;
  color: var(--color-emt-blue);
}

.account-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--color-soft-surface);
  color: var(--color-emt-blue);
  cursor: pointer;
}

.account-dialog-header {
  padding-right: 32px;
  margin-bottom: 18px;
}

.account-dialog-header h3 {
  font-family: var(--font-title);
  font-size: 24px;
  margin: 6px 0 8px;
}

.account-dialog-header p {
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.account-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.account-panel.hidden {
  display: none;
}

.account-auth-view,
.account-social-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-social-btn {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(15, 45, 82, 0.14);
  border-radius: var(--border-radius-md);
  background: #fff;
  color: var(--color-emt-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.account-social-btn:hover {
  border-color: rgba(17, 181, 174, 0.38);
  box-shadow: 0 10px 26px rgba(15, 45, 82, 0.08);
  transform: translateY(-1px);
}

.account-social-btn i {
  font-size: 17px;
}

.account-separator {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.account-separator span {
  height: 1px;
  background: rgba(15, 45, 82, 0.12);
}

.account-separator strong {
  font-weight: 800;
  color: rgba(15, 45, 82, 0.55);
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-emt-blue);
}

.account-field input {
  border: 1px solid rgba(15, 45, 82, 0.16);
  border-radius: var(--border-radius-md);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-emt-blue);
  background: #fff;
}

.account-field input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px rgba(17, 181, 174, 0.12);
}

.account-manual-register {
  margin-top: 2px;
  padding: 14px;
  border: 1px solid rgba(17, 181, 174, 0.18);
  border-radius: var(--border-radius-md);
  background: rgba(238, 242, 244, 0.42);
}

.account-link-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}

.account-text-link {
  border: none;
  background: transparent;
  color: var(--color-accent);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  padding: 4px;
}

.account-text-link:hover {
  color: var(--color-emt-blue);
  text-decoration: underline;
}

.account-note,
.account-message {
  border-radius: var(--border-radius-md);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
}

.account-note {
  background: var(--color-soft-surface);
  color: var(--color-text-secondary);
}

.account-message {
  margin-top: 14px;
  background: rgba(17, 181, 174, 0.10);
  border: 1px solid rgba(17, 181, 174, 0.24);
  color: var(--color-emt-blue);
}

.account-message.is-error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.24);
}

.account-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--border-radius-md);
  background: var(--color-soft-surface);
}

.account-user-card h4 {
  font-size: 15px;
  margin-bottom: 2px;
}

.account-user-card p {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.account-avatar {
  background: var(--color-accent);
  color: #fff;
}

.account-sync-summary {
  display: grid;
  gap: 8px;
  color: var(--color-text-secondary);
  font-size: 13px;
}

/* Botón interactivo brillante para el Tutor de IA */
.btn-tutor-glowing {
  margin-top: 15px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #a5f3fc;
  padding: 10px 18px;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition-smooth);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.15);
  animation: tutorGlowBreath 3s infinite alternate;
}

.btn-tutor-glowing:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(168, 85, 247, 0.25) 100%);
  border-color: rgba(165, 243, 252, 0.8);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.35);
  transform: translateY(-1px);
}

@keyframes tutorGlowBreath {
  0% { box-shadow: 0 0 10px rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.3); }
  100% { box-shadow: 0 0 20px rgba(168, 85, 247, 0.25); border-color: rgba(168, 85, 247, 0.6); }
}

/* --- 9. INTERFAZ ACTIVA DE EXÁMENES (TEST PANEL) --- */
.test-container {
  padding: 32px;
  max-width: 900px;
  margin: 0 auto;
}

.test-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.test-category-tag {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  background-color: var(--color-emt-blue);
  padding: 4px 12px;
  border-radius: var(--border-radius-sm);
  text-transform: uppercase;
}

.test-timer {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  font-family: var(--font-title);
  color: var(--color-warning);
}

.test-progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 30px;
}

.test-progress-bar {
  height: 100%;
  background-color: var(--color-accent);
  transition: width 0.3s ease;
}

.test-question-box {
  margin-bottom: 30px;
}

.question-topic-label {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 8px;
  display: block;
}

.question-title {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 24px;
}

.question-reference {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: -10px 0 18px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 45, 82, 0.06);
  color: var(--color-muted-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
}

.pre-wrap {
  white-space: pre-wrap;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--color-border-glass);
  padding: 16px 20px;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition-smooth);
}

.option-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--color-border-glass-focus);
}

.option-letter {
  background: rgba(255, 255, 255, 0.05);
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.option-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-primary);
  flex-grow: 1;
}

.option-item.selected {
  border-color: var(--color-accent);
  background-color: rgba(59, 130, 246, 0.08);
}

.option-item.selected .option-letter {
  background-color: var(--color-accent);
  color: #fff;
}

/* Respuesta Correcta / Incorrecta después de validar */
.option-item.correct {
  border-color: var(--color-success);
  background-color: rgba(16, 185, 129, 0.1);
}

.option-item.correct .option-letter {
  background-color: var(--color-success);
  color: #fff;
}

.option-item.incorrect {
  border-color: var(--color-danger);
  background-color: rgba(239, 68, 68, 0.08);
}

.option-item.incorrect .option-letter {
  background-color: var(--color-danger);
  color: #fff;
}

/* Caja de Explicación */
.explanation-box {
  background: rgba(245, 158, 11, 0.04);
  border: 1px dashed rgba(245, 158, 11, 0.25);
  border-radius: var(--border-radius-md);
  padding: 20px;
  margin-bottom: 24px;
  animation: slideDown 0.3s ease forwards;
}

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

.explanation-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-weight: 600;
}

.explanation-header i {
  color: var(--color-warning);
}

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

.test-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--color-border-glass);
  padding-top: 20px;
  margin-top: 24px;
}

.test-footer-right {
  display: flex;
  gap: 12px;
}

/* --- 10. PANTALLA DE RESULTADOS DE EXAMEN --- */
.results-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px;
}

.results-header-box {
  text-align: center;
  margin-bottom: 36px;
}

.results-trophy {
  font-size: 60px;
  color: var(--color-success);
  margin-bottom: 16px;
}

.results-header-box h2 {
  font-size: 28px;
  margin-bottom: 8px;
}

.results-header-box p {
  color: var(--color-text-secondary);
  font-size: 14px;
}

.results-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 30px;
}

.results-stat-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--color-border-glass);
  border-radius: var(--border-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.results-stat-card .lbl {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.results-stat-card .val {
  font-size: 24px;
  font-weight: 800;
  font-family: var(--font-title);
}

.results-stat-card .sub {
  font-size: 9px;
  color: var(--color-text-muted);
  margin-top: 4px;
  text-align: center;
}

.results-verdict-box {
  background-color: var(--color-bg-base);
  border-left: 4px solid var(--color-success);
}

.results-action-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* --- 11. MODULACIÓN PSICOTÉCNICOS INTENSIVOS --- */
.psy-intro-box {
  display: flex;
  gap: 20px;
  padding: 20px;
  margin-bottom: 24px;
  border-radius: var(--border-radius-lg);
  background: rgba(255, 255, 255, 0.02);
}

.psy-intro-box .intro-icon {
  font-size: 32px;
  display: flex;
  align-items: center;
}

.psy-intro-box h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.psy-intro-box p {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* Temporizador circular psicotécnicos */
.psy-question-timer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.psy-question-timer .lbl {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.timer-pie-wrapper {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--color-warning);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  font-family: var(--font-title);
}

/* Toggle Switch */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: #fff;
  transition: .3s;
}

input:checked + .slider {
  background-color: var(--color-warning);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.toggle-labels {
  display: flex;
  flex-direction: column;
}

.toggle-title {
  font-size: 14px;
  font-weight: 600;
}

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

.cheatsheet-mini-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  margin-top: 10px;
}

.mini-item {
  display: flex;
  gap: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-secondary);
}

.mini-item i {
  margin-top: 4px;
}

/* --- 12. TEST DE PERSONALIDAD Y COMPETENCIAS --- */
.competencies-report-container {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--color-border-glass);
  padding: 24px;
  border-radius: var(--border-radius-lg);
  margin-top: 20px;
}

.competencies-report-container h3 {
  font-size: 16px;
  margin-bottom: 20px;
}

.competency-report-row {
  margin-bottom: 20px;
}

.comp-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.comp-track {
  height: 8px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.comp-fill {
  height: 100%;
  border-radius: 999px;
  width: 0%;
  transition: width 1s ease-out;
}

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

.personality-tips-card {
  padding: 20px;
}

.personality-tips-card h4 {
  font-size: 14px;
  margin-bottom: 12px;
}

.tips-bullet-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tips-bullet-list li {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  position: relative;
  padding-left: 18px;
}

.tips-bullet-list li::before {
  content: "•";
  color: var(--color-warning);
  position: absolute;
  left: 0;
  font-size: 16px;
  line-height: 1;
}

/* --- 13. GUÍA DE ESTUDIO ACTIVA --- */
.guide-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--color-border-glass);
  padding-bottom: 12px;
}

.tab-btn {
  background: transparent;
  border: none;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 15px;
  color: var(--color-text-secondary);
  padding: 10px 16px;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
}

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

.tab-btn.active {
  color: var(--color-emt-blue);
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -13px;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: var(--color-emt-blue);
  border-radius: 999px;
}

.guide-tab-panel {
  display: none;
}

.guide-tab-panel.active {
  display: block;
  animation: fadeIn 0.4s ease forwards;
}

.summary-desc {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}

.guide-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.guide-card-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--color-border-glass);
  border-radius: var(--border-radius-md);
  padding: 20px;
}

.guide-card-item h4 {
  font-size: 15px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.guide-card-item h4 i {
  font-size: 8px;
}

.guide-card-item p {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* --- 14. SECCIÓN: CAJA DE ERRORES --- */
.mistakes-intro-box {
  display: flex;
  gap: 20px;
  background: rgba(239, 68, 68, 0.02);
  padding: 20px;
  border-radius: var(--border-radius-lg);
  margin-bottom: 24px;
}

.mistakes-intro-box .intro-icon {
  font-size: 32px;
  display: flex;
  align-items: center;
}

.mistakes-intro-box h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.mistakes-intro-box p {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.mistakes-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.mistakes-stats {
  font-size: 14px;
}

.mistakes-list {
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.no-mistakes-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.no-mistakes-placeholder i {
  font-size: 54px;
  margin-bottom: 16px;
}

.no-mistakes-placeholder h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.no-mistakes-placeholder p {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.mistake-list-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--color-border-glass);
  border-radius: var(--border-radius-md);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.mistake-item-details {
  flex-grow: 1;
}

.mistake-item-category {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-danger);
  margin-bottom: 4px;
  display: block;
}

.mistake-item-question {
  font-size: 13px;
  line-height: 1.5;
}

.mistake-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.mistake-item-meta span {
  background: var(--color-bg-base);
  border-radius: 999px;
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
}

/* Tooltip básico */
.tooltip {
  position: relative;
  cursor: help;
}

/* ==========================================================
   15. ESTILOS DEL DRAWER DEL TUTOR DE IA (PREMIUM GLOWING)
   ========================================================== */
.ai-tutor-drawer {
  position: fixed;
  right: 0;
  top: 0;
  width: 440px;
  height: 100vh;
  background: rgba(10, 15, 24, 0.94);
  border-left: 1px solid rgba(59, 130, 246, 0.2);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateX(0); /* Estado por defecto cuando visible */
}

.ai-tutor-drawer.hidden {
  transform: translateX(100%) !important;
  display: flex !important; /* Mantener la estructura cargada pero fuera de vista */
}

.tutor-header {
  padding: 24px;
  border-bottom: 1px solid var(--color-border-glass);
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.01);
}

.tutor-avatar {
  background: linear-gradient(135deg, #3b82f6 0%, #a855f7 100%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  position: relative;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.avatar-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  opacity: 0.4;
  animation: radarPulse 2s infinite;
  z-index: -1;
}

@keyframes radarPulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.4); opacity: 0; }
}

.tutor-title-box h3 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.tutor-title-box span {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.tutor-close {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-size: 20px;
  cursor: pointer;
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.tutor-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Área de conversación */
.tutor-chat-area {
  flex-grow: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Estilos de scrollbar personalizados */
.tutor-chat-area::-webkit-scrollbar {
  width: 5px;
}
.tutor-chat-area::-webkit-scrollbar-track {
  background: transparent;
}
.tutor-chat-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

/* Burbujas de chat */
.chat-msg {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: var(--border-radius-md);
  font-size: 13px;
  line-height: 1.5;
  animation: messageSlideIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

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

.msg-tutor {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border-glass);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.msg-user {
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

/* Títulos y listas dentro del chat del tutor */
.msg-tutor strong {
  color: #a5f3fc;
  font-weight: 600;
}

.msg-tutor ul {
  margin-top: 8px;
  margin-left: 16px;
}

.msg-tutor li {
  margin-bottom: 6px;
}

/* Indicador de escritura "Pensando..." */
.msg-typing {
  display: flex;
  gap: 5px;
  padding: 12px 18px;
  align-self: flex-start;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--color-border-glass);
  border-radius: var(--border-radius-md);
}

.dot {
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out both;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Footer del tutor y Respuestas rápidas */
.tutor-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--color-border-glass);
  background: rgba(11, 14, 21, 0.95);
}

.quick-reply-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.quick-replies-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-reply {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border-glass);
  border-radius: var(--border-radius-sm);
  color: var(--color-text-secondary);
  padding: 10px 14px;
  font-size: 12px;
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-reply:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--color-accent);
}

/* Estilo para las opciones del mini-test interactivo dentro del chat */
.tutor-mini-quiz {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.mini-quiz-opt {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.mini-quiz-opt:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-border-glass-focus);
}

.mini-quiz-opt.correct {
  border-color: var(--color-success);
  background-color: rgba(16, 185, 129, 0.08);
  color: #a7f3d0;
}

.mini-quiz-opt.incorrect {
  border-color: var(--color-danger);
  background-color: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
}

/* --- 16. DISEÑO RESPONSIVO (TABLETS Y MÓVILES) --- */
@media (max-width: 992px) {
  .app-sidebar {
    width: 80px;
    padding: 16px 8px;
  }
  .sidebar-brand {
    justify-content: center;
  }
  .brand-text, .menu-item span, .user-info, .badge {
    display: none;
  }
  .menu-item {
    justify-content: center;
    padding: 12px;
  }
  .app-main {
    margin-left: 80px;
    padding: 30px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-details-grid {
    grid-template-columns: 1fr;
  }
  .quick-study-card {
    align-items: flex-start;
    flex-direction: column;
  }
  .ai-tutor-drawer {
    width: 380px;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .app-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--color-border-glass);
    padding: calc(16px + env(safe-area-inset-top)) 16px 16px;
  }
  .sidebar-brand {
    padding-bottom: 12px;
    margin-bottom: 12px;
  }
  .brand-text {
    display: block;
  }
  .sidebar-menu {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .menu-item {
    width: auto;
    padding: 8px 12px;
  }
  .menu-item span {
    display: block;
    font-size: 12px;
  }
  .sidebar-footer {
    display: none;
  }
  .app-main {
    margin-left: 0;
    padding: 20px max(16px, env(safe-area-inset-left)) calc(20px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-right));
  }
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .quick-study-actions {
    width: 100%;
  }
  .quick-study-actions .btn {
    flex: 1 1 140px;
  }
  .test-selector-grid {
    grid-template-columns: 1fr;
  }
  .guide-cards-grid {
    grid-template-columns: 1fr;
  }
  .results-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .skill-label {
    width: 180px;
    font-size: 12px;
  }
  .ai-tutor-drawer {
    width: 100%;
  }
}

/* ==========================================================================
   CAPA DE MARCA OPOBUS
   Basada en la guia visual: azul confianza, turquesa progreso,
   amarillo impulso, blanco y gris niebla.
   ========================================================================== */

.app-sidebar {
  background: rgba(255, 255, 255, 0.96);
  border-right: 1px solid rgba(15, 45, 82, 0.10);
  box-shadow: 10px 0 30px rgba(15, 45, 82, 0.06);
}

.sidebar-brand {
  border-bottom-color: rgba(15, 45, 82, 0.10);
  justify-content: flex-start;
}

.brand-logo {
  background: #0f2d52;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(15, 45, 82, 0.20);
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-logo i {
  display: none;
}

.brand-text h1 {
  color: #0f2d52;
  font-size: 22px;
  font-weight: 800;
}

.brand-name-opo {
  color: var(--color-primary);
}

.brand-name-bus {
  color: var(--color-secondary);
}

.brand-tagline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-transform: none;
}

.brand-tagline span:nth-child(1),
.brand-slogan span:nth-child(1) {
  color: var(--color-primary);
}

.brand-tagline span:nth-child(2),
.brand-slogan span:nth-child(2) {
  color: var(--color-accent-brand);
}

.brand-tagline span:nth-child(3),
.brand-slogan span:nth-child(3) {
  color: var(--color-secondary);
}

.brand-slogan {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}

.brand-text span,
.user-info p,
.header-welcome p,
.selector-card p,
.section-desc,
.summary-desc {
  color: #40516d;
}

.menu-item {
  color: #40516d;
  border: 1px solid transparent;
}

.menu-item:hover {
  background: #eef2f4;
  color: #0f2d52;
}

.menu-item.active {
  background: #0f2d52;
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(15, 45, 82, 0.18);
}

.menu-item.active i,
.menu-item.active .badge {
  color: inherit;
}

.sidebar-footer {
  border-top-color: rgba(15, 45, 82, 0.10);
}

.avatar {
  background: rgba(17, 181, 174, 0.12);
  color: #11b5ae;
}

.app-header {
  border-bottom-color: rgba(15, 45, 82, 0.10);
}

.header-welcome h2 {
  color: #0f2d52;
  font-weight: 800;
}

.stat-indicator,
.glass-panel,
.selector-card,
.option-item,
.custom-select,
.results-stat-card,
.guide-card-item,
.mistake-item,
.chat-msg {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(15, 45, 82, 0.10);
  box-shadow: 0 12px 30px rgba(15, 45, 82, 0.08);
}

.glass-panel:hover,
.selector-card:hover,
.option-item:hover {
  border-color: rgba(17, 181, 174, 0.35);
}

.stat-icon,
.selector-icon,
.intro-icon {
  border-radius: 14px;
}

.bg-blue-glow,
.bg-green-glow {
  background: rgba(17, 181, 174, 0.12);
  color: #11b5ae;
}

.bg-amber-glow {
  background: rgba(255, 180, 0, 0.16);
  color: #c98100;
}

.stat-value,
.circular-value,
.results-stat-card .val {
  color: #0f2d52;
}

.badge-accent,
.badge {
  background: #11b5ae;
  color: #ffffff;
}

.badge-warning {
  background: #ffb400;
  color: #0f2d52;
}

.badge-danger {
  background: #ef4444;
  color: #ffffff;
}

.btn-blue,
.btn-purple,
.btn-green {
  background: linear-gradient(135deg, #11b5ae 0%, #0f9f98 100%);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(17, 181, 174, 0.22);
}

.btn-warning {
  background: linear-gradient(135deg, #ffb400 0%, #f1a000 100%);
  color: #0f2d52;
  box-shadow: 0 10px 22px rgba(255, 180, 0, 0.22);
}

.btn-secondary {
  background: #ffffff;
  color: #0f2d52;
  border: 1px solid rgba(15, 45, 82, 0.14);
}

.btn-secondary:hover {
  background: #eef2f4;
}

.btn-tutor-glowing {
  background: linear-gradient(135deg, #0f2d52 0%, #11b5ae 100%);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 45, 82, 0.20);
}

.border-blue,
.border-purple,
.border-green {
  border-color: rgba(17, 181, 174, 0.30) !important;
}

.border-amber {
  border-color: rgba(255, 180, 0, 0.38) !important;
}

.skill-track,
.test-progress-bar-container,
.comp-track {
  background: #eef2f4;
}

.skill-fill,
.test-progress-bar,
.comp-fill,
.bg-blue,
.bg-purple,
.bg-green {
  background: #11b5ae;
}

.bg-amber {
  background: #ffb400;
}

.question-topic-label,
.test-category-tag {
  background: rgba(17, 181, 174, 0.12);
  color: #0f2d52;
}

.option-item.selected {
  border-color: #11b5ae;
  background: rgba(17, 181, 174, 0.10);
}

.option-item.correct {
  border-color: #11b5ae;
}

.option-letter {
  background: #eef2f4;
  color: #0f2d52;
}

.option-item.selected .option-letter,
.option-item.correct .option-letter {
  background: #11b5ae;
  color: #ffffff;
}

.ai-tutor-drawer {
  background: #ffffff;
  color: #0f2d52;
  border-left: 1px solid rgba(15, 45, 82, 0.12);
}

.tutor-header {
  background: linear-gradient(135deg, #0f2d52 0%, #11b5ae 100%);
}

.tutor-avatar {
  background: rgba(255, 255, 255, 0.16);
}

.custom-select,
input,
textarea {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.custom-select:focus,
input:focus,
textarea:focus {
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(17, 181, 174, 0.14);
  outline: none;
}

.guide-tabs {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 6px;
}

.tab-btn {
  color: var(--color-muted);
  border-radius: var(--radius-md);
}

.tab-btn:hover {
  background: var(--color-surface-muted);
  color: var(--color-primary);
}

.tab-btn.active {
  background: var(--color-primary);
  color: #ffffff;
}

.tab-btn.active::after {
  background: var(--color-secondary);
}

.results-verdict-box,
.explanation-box,
.personality-tips-card,
.rec-alert-box {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

.results-verdict-box {
  border-left-color: var(--color-secondary);
}

.mistakes-intro-box,
.psy-intro-box,
.personality-intro-box {
  background: var(--color-surface);
}

.no-mistakes-placeholder,
.no-mistakes-placeholder h3 {
  color: var(--color-text);
}

.no-mistakes-placeholder p,
.mistakes-stats,
.per-status-text,
.text-muted {
  color: var(--color-muted);
}

.text-purple,
.text-pink {
  color: var(--color-secondary);
}

.bg-purple,
.bg-pink {
  background: var(--color-secondary);
}

.msg-tutor {
  color: var(--color-text);
}

.msg-user {
  background: var(--color-primary);
  color: #ffffff;
}

.btn-reply {
  background: var(--color-surface);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

.btn-reply:hover {
  background: rgba(17, 181, 174, 0.10);
  border-color: var(--color-secondary);
  color: var(--color-primary);
}

.mini-quiz-opt {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

.mini-quiz-opt:hover {
  background: var(--color-surface-muted);
  border-color: var(--color-secondary);
}

.mini-quiz-opt.correct {
  background: rgba(17, 181, 174, 0.12);
  border-color: var(--color-secondary);
  color: var(--color-primary);
}

.mini-quiz-opt.incorrect {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.selector-badge {
  background: var(--color-accent-brand);
  color: var(--color-primary);
}

.selector-card.border-blue .selector-badge,
.selector-card.border-purple .selector-badge,
.selector-card.border-green .selector-badge {
  background: var(--color-secondary);
  color: #ffffff;
}

.selector-card.border-amber .selector-badge {
  background: var(--color-accent-brand);
  color: var(--color-primary);
}

.test-timer {
  background: rgba(255, 180, 0, 0.12);
  border-color: rgba(255, 180, 0, 0.36);
  color: var(--color-primary);
}

.progress-footer-text,
.stat-subtext,
.results-stat-card .sub,
.comp-tip {
  color: var(--color-muted-soft);
}

@media (max-width: 768px) {
  .app-sidebar {
    box-shadow: 0 10px 24px rgba(15, 45, 82, 0.08);
  }

  .brand-logo {
    width: 46px;
    height: 46px;
  }

  .brand-main-logo {
    max-width: 180px;
  }
}

/* OpoBus course module */
#view-estudio > .guide-tabs,
#view-estudio > .guide-content-wrapper {
  display: none;
}

.course-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
  padding: 22px;
}

.course-hero-icon,
.course-module-icon,
.course-lesson-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.course-hero-icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: rgba(17, 181, 174, 0.12);
  color: var(--color-secondary);
  font-size: 24px;
}

.course-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--color-secondary);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.course-hero-copy h3,
.course-sidebar-header h3,
.course-module-header h3,
.course-lesson-detail h3 {
  margin: 0;
  color: var(--color-primary);
  font-family: var(--font-heading);
  letter-spacing: 0;
}

.course-hero-copy p,
.course-module-header p,
.course-lesson-detail p {
  margin: 8px 0 0;
  color: var(--color-muted);
  line-height: 1.55;
}

.course-overview-stat {
  min-width: 118px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  text-align: center;
}

.course-overview-stat span {
  display: block;
  color: var(--color-secondary);
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
}

.course-overview-stat small {
  color: var(--color-muted);
  font-weight: 700;
}

.course-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.course-sidebar,
.course-main {
  padding: 20px;
}

.course-sidebar-header,
.course-module-header,
.course-detail-top,
.course-detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.course-sidebar-header {
  margin-bottom: 16px;
}

.course-sidebar-header > span,
.course-module-meta span,
.course-detail-time {
  color: var(--color-muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.course-modules-list,
.course-lessons-list {
  display: grid;
  gap: 10px;
}

.course-module-group {
  display: grid;
  gap: 8px;
}

.course-module-card,
.course-lesson-row {
  width: 100%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.course-module-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border-radius: var(--radius-lg);
}

.course-module-card:hover,
.course-lesson-row:hover {
  border-color: rgba(17, 181, 174, 0.45);
  box-shadow: 0 10px 22px rgba(15, 45, 82, 0.08);
  transform: translateY(-1px);
}

.course-module-card.active,
.course-lesson-row.active {
  border-color: var(--color-secondary);
  background: rgba(17, 181, 174, 0.08);
  box-shadow: 0 12px 28px rgba(17, 181, 174, 0.13);
}

.course-module-card.premium .course-module-card-progress {
  background: rgba(255, 180, 0, 0.16);
  color: var(--color-primary);
}

.course-module-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(15, 45, 82, 0.06);
  color: var(--color-primary);
  font-size: 17px;
}

.course-module-card.active .course-module-icon {
  background: var(--color-secondary);
  color: #ffffff;
}

.course-module-icon .opobus-icon-steering-wheel {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid currentColor;
  border-radius: 50%;
  background:
    linear-gradient(currentColor, currentColor) 50% 50% / 4px 9px no-repeat,
    linear-gradient(135deg, transparent 43%, currentColor 44% 56%, transparent 57%) 20% 72% / 12px 10px no-repeat,
    linear-gradient(45deg, transparent 43%, currentColor 44% 56%, transparent 57%) 80% 72% / 12px 10px no-repeat;
}

.course-module-icon .opobus-icon-steering-wheel::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.course-module-card-copy {
  min-width: 0;
}

.course-module-card-copy strong,
.course-lesson-copy strong {
  display: block;
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-size: 0.94rem;
  line-height: 1.25;
}

.course-module-card-copy small,
.course-lesson-copy small {
  display: block;
  margin-top: 4px;
  color: var(--color-muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.course-module-card-progress {
  min-width: 46px;
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--color-surface-muted);
  color: var(--color-secondary);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.course-access-badge {
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
  padding: 6px 9px;
  white-space: nowrap;
}

.course-access-badge.free {
  background: rgba(17, 181, 174, 0.12);
  color: var(--color-secondary);
}

.course-access-badge.preview {
  background: rgba(255, 180, 0, 0.16);
  color: #9b6b00;
}

.course-access-badge.premium {
  background: rgba(15, 45, 82, 0.10);
  color: var(--color-primary);
}

.course-module-badge {
  display: inline-flex;
  align-items: center;
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(17, 181, 174, 0.12);
  color: var(--color-secondary);
  font-size: 0.78rem;
  font-weight: 900;
}

.course-module-badge.premium {
  background: rgba(255, 180, 0, 0.18);
  color: var(--color-primary);
}

.course-premium-notice {
  align-items: center;
  background: rgba(255, 180, 0, 0.12);
  border: 1px solid rgba(255, 180, 0, 0.28);
  border-radius: var(--radius-md);
  color: var(--color-primary);
  display: flex;
  font-size: 0.84rem;
  font-weight: 800;
  gap: 10px;
  line-height: 1.4;
  margin: 12px 0 16px;
  padding: 12px 14px;
}

.course-module-meta {
  display: grid;
  gap: 8px;
  justify-items: end;
  white-space: nowrap;
}

.course-progress-track {
  width: 100%;
  height: 9px;
  margin: 18px 0 20px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-surface-muted);
}

.course-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--color-secondary);
  transition: width 0.25s ease;
}

.course-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.course-content-grid > .course-lessons-list {
  display: none;
}

.course-module-lessons {
  display: grid;
  gap: 8px;
  padding: 0 0 10px 18px;
  border-left: 2px solid rgba(17, 181, 174, 0.18);
  margin-left: 22px;
}

.course-lesson-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 64px;
  padding: 11px;
  border-radius: var(--radius-md);
}

.course-lesson-index {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-surface-muted);
  color: var(--color-primary);
  font-weight: 900;
}

.course-lesson-row.completed .course-lesson-index {
  background: var(--color-secondary);
  color: #ffffff;
}

.course-lesson-detail {
  min-height: 360px;
  padding: 22px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.course-detail-top {
  margin-bottom: 14px;
}

.course-detail-module {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 45, 82, 0.07);
  color: var(--color-primary);
  font-size: 0.78rem;
  font-weight: 900;
}

.course-detail-block {
  margin-top: 18px;
}

.course-lesson-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
}

.course-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  font-weight: 900;
}

.course-tab-btn.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: 0 8px 18px rgba(15, 45, 82, 0.08);
}

.course-tab-btn.active i {
  color: var(--color-secondary);
}

.course-study-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.course-study-flow span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  color: var(--color-primary);
  font-size: 0.78rem;
  font-weight: 900;
}

.course-study-flow i {
  color: var(--color-secondary);
}

.course-summary-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(17, 181, 174, 0.22);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(17, 181, 174, 0.08) 0%, #ffffff 100%);
}

.course-section-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--color-secondary);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.course-summary-panel p {
  margin: 0 0 10px;
  color: var(--color-primary);
  font-weight: 800;
  line-height: 1.45;
}

.course-summary-panel ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--color-text);
  line-height: 1.45;
}

.course-study-sections {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.course-study-player {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid rgba(17, 181, 174, 0.22);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #ffffff 0%, rgba(238, 242, 244, 0.46) 100%);
}

.course-study-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--color-primary);
  font-weight: 900;
}

.course-study-progress span,
.course-study-progress strong {
  font-size: 0.84rem;
}

.course-study-progress strong {
  color: var(--color-secondary);
}

.course-study-progress-track {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-surface-muted);
}

.course-study-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--color-secondary);
  transition: width 0.22s ease;
}

.course-study-section {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(17, 181, 174, 0.20);
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 45, 82, 0.05);
}

.course-study-section-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.course-study-section-top span,
.course-study-section-top small {
  color: var(--color-secondary);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.course-study-section-top small {
  color: var(--color-muted);
  text-transform: none;
}

.course-study-section h4 {
  margin: 0 0 8px;
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-size: 1rem;
}

.course-study-section p {
  margin: 0;
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.62;
}

.course-study-visual {
  margin: 16px 0 0;
  padding: 12px;
  border: 1px solid rgba(17, 181, 174, 0.22);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(238, 242, 244, 0.62), #ffffff 100%);
}

.course-study-visual img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
}

.course-study-visual figcaption {
  margin-top: 8px;
  color: var(--color-muted);
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: center;
}

.course-study-list {
  margin: 16px 0 0;
  padding-left: 20px;
  color: var(--color-text);
  line-height: 1.7;
  font-size: 0.95rem;
}

.course-study-list li + li {
  margin-top: 6px;
}

.course-study-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.course-study-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.course-study-table th,
.course-study-table td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.course-study-table th {
  color: var(--color-primary);
  background: var(--color-bg-soft);
  font-weight: 800;
}

.course-study-table tr:last-child td {
  border-bottom: 0;
}

.course-study-table td:first-child {
  font-weight: 800;
  color: var(--color-primary);
  white-space: nowrap;
}

.course-study-note {
  margin-top: 14px !important;
  padding: 12px 14px;
  border-left: 4px solid var(--color-accent);
  background: rgba(255, 180, 0, 0.1);
  border-radius: var(--radius-sm);
  font-size: 0.9rem !important;
  line-height: 1.6 !important;
}

.course-flashcard {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(17, 181, 174, 0.28);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(17, 181, 174, 0.09), rgba(255, 255, 255, 0.96));
}

.course-flashcard-top,
.course-flashcard-question small,
.course-flashcard-answer small {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--color-secondary);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.course-flashcard-top strong {
  color: var(--color-primary);
}

.course-flashcard-question,
.course-flashcard-answer {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.course-flashcard-question strong,
.course-flashcard-answer strong {
  display: block;
  margin-top: 8px;
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-size: 1.15rem;
}

.course-flashcard-answer {
  background: var(--color-bg-soft);
}

.course-flashcard-answer.revealed {
  background: rgba(17, 181, 174, 0.11);
  border-color: rgba(17, 181, 174, 0.32);
}

.course-flashcard-answer p {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.course-flashcard-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--color-muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.course-study-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.course-study-nav .btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.course-practice-panel {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid rgba(17, 181, 174, 0.24);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(17, 181, 174, 0.08) 0%, #ffffff 100%);
}

.course-practice-panel h4 {
  margin: 0 0 8px;
  color: var(--color-primary);
  font-family: var(--font-heading);
}

.course-practice-panel p {
  margin: 0;
  color: var(--color-muted);
  line-height: 1.55;
}

.course-high-value {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(255, 180, 0, 0.34);
  border-left: 4px solid var(--color-accent-brand);
  border-radius: var(--radius-md);
  background: rgba(255, 180, 0, 0.08);
}

.course-high-value span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--color-primary);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.course-high-value strong {
  display: block;
  color: var(--color-primary);
  font-family: var(--font-heading);
  line-height: 1.38;
}

.course-high-value p {
  margin: 8px 0 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.course-detail-block h4 {
  margin: 0 0 10px;
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-size: 0.98rem;
}

.course-detail-block ul {
  margin: 0;
  padding-left: 18px;
  color: var(--color-text);
  line-height: 1.6;
}

.course-extra-detail {
  margin-top: 18px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.course-extra-detail summary {
  cursor: pointer;
  padding: 13px 14px;
  color: var(--color-primary);
  font-weight: 900;
}

.course-extra-detail .course-detail-block {
  margin: 0;
  padding: 0 14px 14px;
}

.course-exam-bullets ul {
  display: grid;
  gap: 8px;
  padding-left: 0;
  list-style: none;
}

.course-exam-bullets li {
  position: relative;
  padding: 10px 12px 10px 34px;
  border-radius: var(--radius-md);
  background: rgba(17, 181, 174, 0.08);
  color: var(--color-primary);
  font-weight: 700;
  line-height: 1.4;
}

.course-exam-bullets li::before {
  content: "";
  position: absolute;
  top: 15px;
  left: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-secondary);
}

.course-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.course-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--color-surface-muted);
  color: var(--color-primary);
  font-size: 0.8rem;
  font-weight: 800;
}

.course-study-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.course-study-card {
  min-height: 138px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, rgba(238, 242, 244, 0.42) 100%);
}

.course-study-card span {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--color-secondary);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.course-study-card strong {
  display: block;
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  line-height: 1.3;
}

.course-study-card p {
  margin: 8px 0 0;
  color: var(--color-muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.course-detail-actions {
  flex-wrap: wrap;
  margin-top: 22px;
  justify-content: flex-start;
}

.course-empty-state {
  display: grid;
  min-height: 200px;
  place-items: center;
  color: var(--color-muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .course-shell,
  .course-content-grid,
  .course-study-cards,
  .course-study-flow,
  .course-lesson-tabs {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .course-hero {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .course-overview-stat {
    width: 100%;
  }

  .course-module-header,
  .course-detail-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .course-module-meta {
    justify-items: start;
  }

  .course-sidebar,
  .course-main {
    padding: 16px;
  }

  .course-module-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .course-module-card-progress,
  .course-access-badge {
    justify-self: start;
    grid-column: 2;
  }

  .course-module-lessons {
    margin-left: 12px;
    padding-left: 12px;
  }

  .course-lesson-detail {
    padding: 16px;
  }

  .course-lesson-tabs,
  .course-study-flow {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .course-tab-btn,
  .course-study-flow span {
    flex: 0 0 auto;
    min-width: 132px;
    scroll-snap-align: start;
  }

  .course-study-table {
    min-width: 460px;
    font-size: 0.84rem;
  }

  .course-study-table th,
  .course-study-table td {
    padding: 10px;
  }

  .course-flashcard {
    padding: 14px;
  }

  .course-flashcard-top,
  .course-flashcard-actions,
  .course-study-nav,
  .course-detail-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .course-study-nav .btn,
  .course-detail-actions .btn,
  .course-flashcard-actions .btn {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .course-module-card,
  .course-lesson-row {
    gap: 10px;
  }

  .course-module-icon {
    width: 38px;
    height: 38px;
  }

  .course-lesson-index {
    width: 32px;
    height: 32px;
  }

  .course-flashcard-question strong,
  .course-flashcard-answer strong {
    font-size: 1rem;
  }
}
