/* ==========================================================================
   Te Preparo - Aula Virtual: Premium Design System & Styles
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-base: #060911;
  --bg-surface: #0b1120;
  --bg-surface-elevated: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(59, 130, 246, 0.4);
  --border-glow: rgba(6, 182, 212, 0.4);

  /* Accents */
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.35);

  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.3);

  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.25);

  --rose: #f43f5e;
  --rose-glow: rgba(244, 63, 94, 0.25);

  --amber: #f59e0b;
  --purple: #8b5cf6;

  /* Typography */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;

  /* UI Tokens */
  --header-height: 70px;
  --app-sidebar-width: 260px;
  --app-sidebar-collapsed-width: 76px;
  --sidebar-width: 360px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* Background Atmospheric Glows */
.ambient-glow {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
}
.glow-1 {
  width: 500px;
  height: 500px;
  background: var(--primary);
  top: -150px;
  right: -100px;
}
.glow-2 {
  width: 450px;
  height: 450px;
  background: var(--cyan);
  bottom: 50px;
  left: -150px;
}

/* ==========================================================================
   APP SHELL & COLLAPSIBLE LEFT SIDEBAR NAVIGATION
   ========================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
  background: var(--bg-base);
}

/* Sidebar Lateral Izquierdo */
.app-sidebar {
  width: var(--app-sidebar-width);
  background: rgba(11, 17, 32, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 120;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  overflow: hidden;
}

.app-sidebar.collapsed {
  width: var(--app-sidebar-collapsed-width);
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  padding: 16px 12px;
  overflow: hidden;
}

/* 1. Header del Sidebar: Logo, Nombre & Botón Toggle */
.app-sidebar .sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 16px 6px;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 60px;
  gap: 8px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
  overflow: hidden;
  flex: 1;
}

.sidebar-logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 50%;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(6, 182, 212, 0.35));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sidebar-brand:hover .sidebar-logo-img {
  transform: scale(1.08);
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.2s ease, width 0.2s ease;
  white-space: nowrap;
}

.sidebar-brand-name {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.sidebar-brand-name span {
  color: var(--cyan);
}

.sidebar-brand-badge {
  font-size: 10px;
  color: var(--cyan);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.btn-toggle-sidebar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.btn-toggle-sidebar:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--cyan);
  border-color: var(--border-glow);
}

.btn-toggle-sidebar i {
  transition: transform 0.3s ease;
}

.app-sidebar.collapsed .btn-toggle-sidebar i {
  transform: rotate(180deg);
}

.app-sidebar.collapsed .sidebar-brand-text {
  opacity: 0;
  width: 0;
  display: none;
}

.app-sidebar.collapsed .sidebar-header {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0 14px 0;
}

.app-sidebar.collapsed .sidebar-brand {
  justify-content: center;
  flex: none;
}

/* 2. Tarjeta del Perfil de Usuario */
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  margin: 14px 0 10px 0;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all 0.25s ease;
  overflow: hidden;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid var(--border-subtle);
  overflow: hidden;
}

.sidebar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-user-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-badge {
  font-size: 10px;
  color: var(--cyan);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.app-sidebar.collapsed .sidebar-user-card {
  justify-content: center;
  padding: 8px 0;
  background: transparent;
  border-color: transparent;
}

.app-sidebar.collapsed .sidebar-user-meta {
  display: none;
}

/* 3. Navegación Principal */
.sidebar-nav-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: 6px;
  padding-right: 2px;
}

.sidebar-nav-wrap::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.sidebar-nav-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-dim);
  font-weight: 700;
  padding: 10px 8px 6px 8px;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.app-sidebar.collapsed .sidebar-nav-section-title {
  text-align: center;
  padding: 10px 0 4px 0;
  font-size: 8px;
  opacity: 0.4;
}

.sidebar-nav-list {
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav-btn i {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  color: var(--text-dim);
  transition: color 0.2s ease, transform 0.2s ease;
}

.sidebar-nav-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.08);
}

.sidebar-nav-btn:hover i {
  color: var(--cyan);
  transform: scale(1.1);
}

.sidebar-nav-btn.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(6, 182, 212, 0.12));
  color: var(--cyan);
  border-color: rgba(6, 182, 212, 0.35);
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.12);
  font-weight: 700;
}

.sidebar-nav-btn.active i {
  color: var(--cyan);
}

.app-sidebar.collapsed .sidebar-nav-btn {
  justify-content: center;
  padding: 10px 0;
  gap: 0;
}

.app-sidebar.collapsed .sidebar-nav-btn .nav-label {
  display: none;
}

/* 4. Footer & Logout */
.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: rgba(244, 63, 94, 0.06);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: #fca5a5;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logout-btn i {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-logout-btn:hover {
  background: rgba(244, 63, 94, 0.15);
  color: #fff;
  border-color: rgba(244, 63, 94, 0.4);
}

.app-sidebar.collapsed .sidebar-logout-btn {
  justify-content: center;
  padding: 10px 0;
  gap: 0;
}

.app-sidebar.collapsed .sidebar-logout-btn .nav-label {
  display: none;
}

/* Contenedor Principal de Vistas */
.app-main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* Mobile Header Bar (<900px) */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(6, 9, 17, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(16px);
  overflow: hidden;
  box-sizing: border-box;
}

.btn-mobile-toggle {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  cursor: pointer;
}

.mobile-brand-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 15px;
}

.mobile-user-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  border: 2px solid var(--border-subtle);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.mobile-user-avatar:active {
  transform: scale(0.95);
}

.mobile-user-avatar img,
.mobile-user-avatar svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 110;
  backdrop-filter: blur(4px);
}

/* Comportamiento Responsivo */
@media (max-width: 900px) {
  .mobile-topbar {
    display: flex;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  }

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

  .sidebar-backdrop.active {
    display: block;
  }
}

/* Compatibilidad con clases existentes */
.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 50%;
  filter: drop-shadow(0 2px 10px rgba(6, 182, 212, 0.35));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
  display: block;
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
}
.brand-name span {
  color: var(--cyan);
}

/* Common Buttons */
.btn-aula {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
  text-decoration: none;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: #fff;
  box-shadow: 0 4px 16px var(--primary-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-cyan {
  background: linear-gradient(135deg, var(--cyan), #0891b2);
  color: #fff;
  box-shadow: 0 4px 16px var(--cyan-glow);
}
.btn-cyan:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--cyan-glow);
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}
.btn-outline:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-hover);
}

.btn-danger-outline {
  background: transparent;
  color: #fca5a5;
  border: 1px solid rgba(244, 63, 94, 0.3);
}
.btn-danger-outline:hover {
  background: rgba(244, 63, 94, 0.1);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ==========================================================================
   VIEW 1: AUTHENTICATION (LOGIN / REGISTRO)
   ========================================================================== */
.view-container {
  flex: 1;
  position: relative;
  z-index: 1;
}

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}
.auth-header h2 {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 8px;
}
.auth-header p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Form inputs */
.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}
.input-with-icon i {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  font-size: 14px;
}
.form-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: rgba(11, 17, 32, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: var(--transition-smooth);
}
.form-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
  background: rgba(15, 23, 42, 0.9);
}

.auth-tabs {
  display: flex;
  background: rgba(11, 17, 32, 0.6);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}
.auth-tab-btn {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition-smooth);
}
.auth-tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.demo-login-box {
  margin-top: 20px;
  padding: 14px;
  background: rgba(6, 182, 212, 0.08);
  border: 1px dashed rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-sm);
  text-align: center;
}
.demo-login-box p {
  font-size: 12px;
  color: var(--cyan);
  margin-bottom: 8px;
}

/* Alert Notification Banner */
.alert-toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-error {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
}
.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

/* ==========================================================================
   VIEW 2: STUDENT DASHBOARD (MIS CURSOS)
   ========================================================================== */
.dashboard-layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.welcome-banner {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.4) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.welcome-text h1 {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 6px;
}
.welcome-text p {
  color: var(--text-muted);
  font-size: 15px;
}

.stats-grid {
  display: flex;
  gap: 20px;
}
.stat-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  text-align: center;
}
.stat-value {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  color: var(--cyan);
}
.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}

.section-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title i {
  color: var(--cyan);
}

/* Courses Grid */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
}

.course-card-enrolled {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
}
.course-card-enrolled:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.course-card-header {
  height: 180px;
  position: relative;
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
}
.course-card-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 9, 17, 0.2) 0%, rgba(6, 9, 17, 0.9) 100%);
  z-index: 1;
}

.course-badge-category {
  position: relative;
  z-index: 2;
  align-self: flex-start;
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
}

.course-progress-header {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #fff;
  font-weight: 600;
}

.course-card-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.course-card-body h3 {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}
.course-card-body p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 20px;
  flex: 1;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 20px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
  border-radius: 99px;
  transition: width 0.6s ease;
}

.course-meta-tags {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 20px;
}
.course-meta-tags span {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   VIEW 3: CLASSROOM VIEWER (TEMARIO + REPRODUCTOR + APUNTES)
   ========================================================================== */
.classroom-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-base);
}
@media (max-width: 900px) {
  .classroom-layout {
    height: calc(100vh - 55px);
  }
}

/* Sidebar Accordion */
.classroom-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  z-index: 20;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.btn-back-dashboard {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
  margin-bottom: 12px;
  cursor: pointer;
}
.btn-back-dashboard:hover {
  color: var(--cyan);
}
.sidebar-course-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

/* Modules & Lessons tree */
.module-group {
  border-bottom: 1px solid var(--border-subtle);
}
.module-title-btn {
  width: 100%;
  padding: 14px 20px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.module-title-btn:hover {
  background: rgba(255, 255, 255, 0.02);
}
.module-title-btn.active i.chevron {
  transform: rotate(180deg);
}
.module-lessons-list {
  list-style: none;
  padding: 4px 0 10px;
  background: rgba(6, 9, 17, 0.4);
}

.lesson-item-btn {
  width: 100%;
  padding: 10px 20px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.lesson-item-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}
.lesson-item-btn.active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--cyan);
  border-left: 3px solid var(--cyan);
}

.lesson-check-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
  color: transparent;
  transition: var(--transition-smooth);
}
.lesson-check-icon.completed {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #fff;
}

.lesson-item-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lesson-item-duration {
  font-size: 11px;
  color: var(--text-dim);
}

/* Exam Lesson Special Item */
.lesson-item-btn.is-exam {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--amber);
  color: #fcd34d;
}

/* Module Locking & Progress Status Badges */
.module-group.is-locked {
  opacity: 0.72;
}
.module-group.is-locked .module-title-btn {
  cursor: pointer;
}
.module-group.is-locked .module-title-btn:hover {
  background: rgba(255, 255, 255, 0.02);
}
.badge-mod-locked {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(148, 163, 184, 0.25);
  white-space: nowrap;
}
.badge-mod-completed {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(16, 185, 129, 0.25);
  white-space: nowrap;
}

.lesson-item-btn.locked {
  cursor: not-allowed;
  opacity: 0.55;
}
.lesson-item-btn.locked:hover {
  background: transparent;
  color: var(--text-muted);
}
.lesson-item-btn.locked .lesson-check-icon {
  border-color: rgba(148, 163, 184, 0.3);
  color: var(--text-dim);
}

/* Module Test Item in Sidebar */
.module-quiz-sidebar-item {
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  margin-top: 6px;
  padding-top: 6px;
  list-style: none;
}
.lesson-item-btn.is-module-test {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin: 2px 10px 6px;
  width: calc(100% - 20px);
  transition: all 0.25s ease;
  align-items: flex-start;
}
.lesson-item-btn.is-module-test.test-approved {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.lesson-item-btn.is-module-test.test-approved:hover {
  background: rgba(16, 185, 129, 0.16);
}
.lesson-item-btn.is-module-test.test-ready {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  animation: pulse-amber 2.5s infinite ease-in-out;
}
@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.25); }
  50% { box-shadow: 0 0 10px 2px rgba(245, 158, 11, 0.35); }
}
.lesson-item-btn.is-module-test.test-ready:hover {
  background: rgba(245, 158, 11, 0.22);
}
.lesson-item-btn.is-module-test.test-pending {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  opacity: 0.72;
}

/* Module Quiz CTA Banner in Lesson Detail View */
.module-quiz-cta-banner {
  margin-top: 24px;
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.quiz-cta-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Classroom Main Area */
.classroom-main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

.video-stage-container {
  width: 100%;
  background: #000;
  position: relative;
  max-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.responsive-video-wrapper {
  width: 100%;
  max-width: 1100px;
  aspect-ratio: 16 / 9;
  position: relative;
}
.responsive-video-wrapper iframe,
.responsive-video-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.classroom-details-pane {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 30px 24px 60px;
}

.lesson-headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.lesson-headline h2 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
}

.btn-toggle-complete {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  transition: var(--transition-smooth);
}
.btn-toggle-complete:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--emerald);
  color: #6ee7b7;
}
.btn-toggle-complete.completed {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #fff;
  box-shadow: 0 4px 12px var(--emerald-glow);
}

/* Tabs: Resumen & Descargas */
.classroom-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}
.classroom-tab-btn {
  padding: 10px 4px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}
.classroom-tab-btn.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.lesson-body-content {
  color: #cbd5e1;
  font-size: 15px;
  line-height: 1.7;
}
.lesson-body-content p {
  margin-bottom: 16px;
}

/* Downloads List */
.resources-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.resource-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: var(--transition-smooth);
}
.resource-item:hover {
  border-color: var(--cyan);
  background: rgba(15, 23, 42, 0.9);
}
.resource-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.resource-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.resource-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}
.resource-meta {
  font-size: 11px;
  color: var(--text-dim);
}

/* ==========================================================================
   VIEW 4: INTERACTIVE EXAM SIMULATOR
   ========================================================================== */
.simulator-wrapper {
  max-width: 880px;
  margin: 0 auto;
  padding: 30px 20px 80px;
  width: 100%;
}

.exam-intro-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}
.exam-intro-icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.2);
}
.exam-intro-card h2 {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 12px;
}
.exam-intro-card p {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 600px;
  margin: 0 auto 30px;
}

.exam-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.rule-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  padding: 16px;
  border-radius: var(--radius-md);
  text-align: center;
}
.rule-card i {
  font-size: 20px;
  color: var(--cyan);
  margin-bottom: 8px;
}
.rule-card .rule-val {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
}
.rule-card .rule-lbl {
  font-size: 12px;
  color: var(--text-dim);
}

/* Exam Active Runner */
.exam-runner-header {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.timer-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--amber);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
}
.timer-badge.urgent {
  background: rgba(244, 63, 94, 0.2);
  border-color: var(--rose);
  color: var(--rose);
  animation: pulse 1s infinite;
}

.question-nav-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.q-pill {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.q-pill.answered {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--cyan);
  color: var(--cyan);
}
.q-pill.current {
  border-color: #fff;
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
}
.question-number-tag {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 8px;
}
.question-prompt {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 24px;
  color: var(--text-main);
}

.options-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.option-label {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(11, 17, 32, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-smooth);
}
.option-label:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-hover);
}
.option-label.selected {
  background: rgba(6, 182, 212, 0.12);
  border-color: var(--cyan);
  box-shadow: 0 0 14px var(--cyan-glow);
}
.option-radio-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition-smooth);
}
.option-label.selected .option-radio-circle {
  border-color: var(--cyan);
  background: var(--cyan);
}
.option-label.selected .option-radio-circle::after {
  content: '';
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
}
.option-text {
  font-size: 14px;
  color: #e2e8f0;
  line-height: 1.4;
}

.exam-nav-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Exam Results Screen */
.results-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  margin-bottom: 32px;
}
.score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  margin: 0 auto 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 6px solid var(--border-subtle);
}
.score-circle.approved {
  border-color: var(--emerald);
  box-shadow: 0 0 30px var(--emerald-glow);
}
.score-circle.failed {
  border-color: var(--rose);
  box-shadow: 0 0 30px var(--rose-glow);
}
.score-number {
  font-family: var(--font-heading);
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
}
.score-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.result-status-badge {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;
  padding: 8px 24px;
  border-radius: var(--radius-full);
  margin-bottom: 16px;
}
.badge-passed {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid var(--emerald);
}
.badge-failed {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  border: 1px solid var(--rose);
}

.review-section h3 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.review-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  text-align: left;
}
.review-item-card.correct {
  border-left: 4px solid var(--emerald);
}
.review-item-card.incorrect {
  border-left: 4px solid var(--rose);
}

.review-question-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}
.review-answers-box {
  font-size: 13px;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: rgba(6, 9, 17, 0.5);
  border-radius: var(--radius-sm);
}
.review-explanation {
  background: rgba(6, 182, 212, 0.08);
  border: 1px dashed rgba(6, 182, 212, 0.3);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #cbd5e1;
}
.review-explanation strong {
  color: var(--cyan);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .classroom-layout {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }
  .classroom-sidebar {
    width: 100%;
    height: auto;
    max-height: 400px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .sidebar-content {
    max-height: 250px;
  }
  .courses-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-layout,
  .admin-layout {
    padding: 20px 16px 60px;
  }

  .welcome-banner {
    padding: 22px 18px;
    margin-bottom: 24px;
  }

  .welcome-text h1 {
    font-size: 22px;
  }

  .welcome-text p {
    font-size: 13px;
  }

  .stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
  }

  .stat-pill {
    padding: 10px 6px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-label {
    font-size: 9px;
    letter-spacing: 0.3px;
  }
}

/* ==========================================================================
   VIEW 5: MANTENEDOR DE USUARIOS & GESTIÓN DE ROLES (ADMIN PANEL)
   ========================================================================== */
.admin-layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.admin-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}
.admin-header-title h1 {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-header-title p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Admin Metrics Grid */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.admin-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition-smooth);
}
.admin-stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}
.admin-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.icon-total { background: rgba(255, 255, 255, 0.05); color: #fff; }
.icon-admin { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; }
.icon-editor { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.icon-reviewer { background: rgba(245, 158, 11, 0.15); color: #fde68a; }
.icon-student { background: rgba(16, 185, 129, 0.15); color: #a7f3d0; }

.admin-stat-num {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}
.admin-stat-lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}

/* Toolbar & Filters */
.admin-toolbar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.admin-search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
}
.admin-search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
}
.admin-search-box input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: rgba(6, 9, 17, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: var(--transition-smooth);
}
.admin-search-box input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
}

.role-filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-filter-role {
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-filter-role:hover,
.btn-filter-role.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* User Directory Table */
.admin-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
}
.admin-table-responsive {
  width: 100%;
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.admin-table th {
  background: rgba(11, 17, 32, 0.9);
  padding: 14px 18px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  font-weight: 700;
  border-bottom: 1px solid var(--border-subtle);
}
.admin-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.user-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* User Cell */
.user-cell-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-cell-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.user-cell-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.user-cell-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}
.badge-you {
  background: rgba(6, 182, 212, 0.2);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: 800;
}
.user-cell-email {
  font-size: 12px;
  color: var(--text-muted);
}

/* Role Badges & Inline Select */
.role-selector-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.badge-role {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: fit-content;
}
.badge-role-admin {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}
.badge-role-editor {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
}
.badge-role-reviewer {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fde68a;
}
.badge-role-student {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
}

.role-select-input {
  background: rgba(11, 17, 32, 0.85);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 11px;
  padding: 4px 6px;
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.role-select-input:hover {
  border-color: var(--cyan);
  color: var(--text-main);
}

/* Enrolled Courses Tags & Mini Tags */
.user-courses-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.user-courses-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.course-mini-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--cyan);
  white-space: nowrap;
}

/* Actions Cell */
.user-actions-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-action-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: var(--transition-smooth);
}
.btn-action-icon:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--cyan);
  color: var(--cyan);
}
.btn-action-key:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--amber);
  color: var(--amber);
}
.btn-action-delete:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: var(--rose);
  color: var(--rose);
}

/* Admin Modals */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.admin-modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.6);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.admin-modal-header h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
}
.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}
.btn-close-modal:hover {
  color: #fff;
}

.modal-course-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(11, 17, 32, 0.7);
  border: 1px solid var(--border-subtle);
  margin-bottom: 10px;
  transition: var(--transition-smooth);
}
.modal-course-row.enrolled {
  border-color: rgba(6, 182, 212, 0.4);
  background: rgba(6, 182, 212, 0.05);
}

/* ==========================================================================
   VIEW 6: COURSE STUDIO & CREADOR DE CURSOS DESDE CERO
   ========================================================================== */
.studio-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 30px 24px 80px;
}

.studio-header {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.studio-title-area {
  display: flex;
  align-items: center;
  gap: 16px;
}
.studio-title-area h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
}

/* Studio Tabs */
.studio-tabs {
  display: flex;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px;
  margin-bottom: 28px;
}
.studio-tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition-smooth);
}
.studio-tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.studio-tab-btn:disabled {
  cursor: not-allowed;
}

.studio-tab-pane {
  animation: fadeIn 0.3s ease;
}

/* Studio Module Cards & Tree */
.studio-module-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow: hidden;
  transition: var(--transition-smooth);
}
.studio-module-card:hover {
  border-color: var(--border-hover);
}

.studio-module-header {
  padding: 18px 24px;
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.studio-lessons-list {
  padding: 8px 16px;
}

.studio-lesson-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin: 6px 0;
  background: rgba(6, 9, 17, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}
.studio-lesson-row:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--cyan);
}

.lesson-type-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.lesson-type-icon.video {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}
.lesson-type-icon.exam {
  background: rgba(245, 158, 11, 0.15);
  color: #fde68a;
}

/* Studio Exam Questions */
.studio-question-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  margin-bottom: 16px;
  transition: var(--transition-smooth);
}
.studio-question-card:hover {
  border-color: var(--border-hover);
}

.studio-options-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.option-preview-item {
  padding: 10px 14px;
  background: rgba(6, 9, 17, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #cbd5e1;
}
.option-preview-item.correct {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.1);
  color: #a7f3d0;
}

/* Resource Manager in lesson modal */
.resource-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin: 4px 6px 4px 0;
}
.btn-remove-chip {
  background: transparent;
  border: none;
  color: var(--rose);
  cursor: pointer;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
}

/* Modern Resource Cards List */
.resource-manage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.resource-manage-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: all 0.2s ease;
}
.resource-manage-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(0, 242, 254, 0.3);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.resource-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.resource-type-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.resource-type-icon.type-pdf { background: rgba(244, 63, 94, 0.12); color: #f43f5e; border: 1px solid rgba(244, 63, 94, 0.25); }
.resource-type-icon.type-word { background: rgba(59, 130, 246, 0.12); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.25); }
.resource-type-icon.type-excel { background: rgba(16, 185, 129, 0.12); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.25); }
.resource-type-icon.type-ppt { background: rgba(249, 115, 22, 0.12); color: #f97316; border: 1px solid rgba(249, 115, 22, 0.25); }
.resource-type-icon.type-zip { background: rgba(245, 158, 11, 0.12); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.25); }
.resource-type-icon.type-link { background: rgba(0, 242, 254, 0.12); color: #00f2fe; border: 1px solid rgba(0, 242, 254, 0.25); }
.resource-type-icon.type-file { background: rgba(148, 163, 184, 0.12); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.25); }

.resource-card-info {
  min-width: 0;
  flex: 1;
}
.resource-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.resource-card-meta {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.resource-card-meta .meta-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
  color: var(--text-muted);
}
.resource-card-meta .meta-url {
  overflow: hidden;
  text-overflow: ellipsis;
}

.resource-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.btn-res-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  text-decoration: none;
}
.btn-res-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}
.btn-res-view:hover {
  color: var(--cyan);
  border-color: rgba(0, 242, 254, 0.4);
}
.btn-res-edit:hover {
  color: var(--amber);
  border-color: rgba(245, 158, 11, 0.4);
}
.btn-res-delete:hover {
  color: var(--rose);
  border-color: rgba(244, 63, 94, 0.4);
}

/* Resource Inline Edit Form */
.resource-edit-box {
  background: rgba(245, 158, 11, 0.04);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.2s ease-out;
}
.resource-edit-box-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--amber);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.resource-edit-grid {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr;
  gap: 10px;
}
@media (max-width: 600px) {
  .resource-edit-grid {
    grid-template-columns: 1fr;
  }
}
.resource-edit-box .form-input-sm {
  padding: 7px 10px;
  font-size: 12px;
  height: 34px;
}

/* Add Manual Resource Panel */
.resource-manual-panel {
  background: rgba(0, 242, 254, 0.04);
  border: 1px solid rgba(0, 242, 254, 0.25);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeIn 0.2s ease-out;
}
.resource-manual-panel-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.resource-empty-notice {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-dim);
  font-size: 12px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.01);
}

.video-preview-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  margin-top: 10px;
  border: 1px solid var(--border-subtle);
}
.video-preview-box iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ==========================================================================
   Custom Modal Dialog (Sustituto de confirm y alert nativos)
   ========================================================================== */
.modal-dialog-card {
  max-width: 440px !important;
  text-align: center;
  padding: 32px 28px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: dialogPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes dialogPopIn {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-dialog-icon-wrapper {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 18px;
  transition: all 0.3s ease;
}

.modal-dialog-icon-wrapper.danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--rose);
  border: 1px solid rgba(244, 63, 94, 0.4);
  box-shadow: 0 0 25px rgba(244, 63, 94, 0.25);
}

.modal-dialog-icon-wrapper.warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.25);
}

.modal-dialog-icon-wrapper.info {
  background: rgba(0, 242, 254, 0.15);
  color: var(--cyan);
  border: 1px solid rgba(0, 242, 254, 0.4);
  box-shadow: 0 0 25px rgba(0, 242, 254, 0.25);
}

.modal-dialog-icon-wrapper.success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.25);
}

.modal-dialog-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
  line-height: 1.3;
}

.modal-dialog-message {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal-dialog-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

.modal-dialog-actions .btn-aula {
  flex: 1;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.btn-danger {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  color: #fff !important;
  border: 1px solid rgba(244, 63, 94, 0.5);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #fb7185 0%, #f43f5e 100%);
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.5);
  transform: translateY(-1px);
}

/* Botón Púrpura para Navegación del Mantenedor de Marca */
.btn-purple {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: #fff !important;
  border: 1px solid rgba(139, 92, 246, 0.5);
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}
.btn-purple:hover {
  background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
  transform: translateY(-1px);
}

/* ==========================================================================
   MÓDULO DE CONFIGURACIÓN & MARCA BLANCA (BRANDING STUDIO)
   ========================================================================== */
.settings-main-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: start;
  margin-top: 24px;
}

@media (max-width: 1100px) {
  .settings-main-grid {
    grid-template-columns: 1fr;
  }
}

.settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.settings-card-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-card-title i {
  color: var(--cyan);
  font-size: 16px;
}

/* Fila de Selector de Color con Picker nativo y HEX input */
.color-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  transition: border-color 0.2s ease;
}

.color-picker-item:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.color-label-wrap {
  display: flex;
  flex-direction: column;
}

.color-label-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

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

.color-inputs-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-circle-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 36px;
  height: 36px;
  background: none;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  outline: none;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.color-circle-input:hover {
  transform: scale(1.08);
  border-color: #fff;
}

.color-circle-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-circle-input::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.color-circle-input::-moz-color-swatch {
  border: none;
  border-radius: 50%;
}

.color-hex-field {
  width: 90px;
  text-transform: uppercase;
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

/* Contenedor de Paletas Predefinidas */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.preset-palette-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
}

.preset-palette-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.preset-palette-colors {
  display: flex;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.preset-palette-colors span {
  flex: 1;
  height: 100%;
}

.preset-palette-info {
  display: flex;
  flex-direction: column;
}

.preset-palette-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-palette-desc {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.3;
  margin-top: 2px;
}

/* ==========================================================================
   MOCKUP INTERACTIVO EN VIVO (LIVE PREVIEW CARD)
   ========================================================================== */
.mockup-preview-sticky {
  position: sticky;
  top: 90px;
}

.mockup-preview-window {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.mockup-window-topbar {
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mockup-window-dots {
  display: flex;
  gap: 6px;
}

.mockup-window-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.mockup-window-dots span:nth-child(1) { background: #ff5f56; }
.mockup-window-dots span:nth-child(2) { background: #ffbd2e; }
.mockup-window-dots span:nth-child(3) { background: #27c93f; }

.mockup-window-title {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
}

.mockup-canvas {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 480px;
}

.mockup-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mockup-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mockup-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
}

.mockup-brand-name {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.mockup-course-card {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 16px;
  transition: all 0.3s ease;
}

.mockup-course-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  border: 1px solid transparent;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.mockup-course-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.mockup-course-desc {
  font-size: 11px;
  opacity: 0.75;
  line-height: 1.4;
  margin-bottom: 12px;
}

.mockup-progress-wrap {
  margin-bottom: 14px;
}

.mockup-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  margin-bottom: 4px;
  opacity: 0.8;
}

.mockup-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.mockup-progress-fill {
  height: 100%;
  width: 65%;
  border-radius: 999px;
}

.mockup-btn {
  width: 100%;
  padding: 9px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: default;
  color: #fff;
  transition: all 0.2s ease;
}

/* ==========================================================================
   DIPLOMA DE PARTICIPACIÓN & ACREDITACIÓN OFICIAL (PDF & PRINT)
   ========================================================================== */
.diploma-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 18, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.diploma-modal-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 1240px;
  width: 100%;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

.diploma-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(11, 17, 32, 0.75);
}

.diploma-modal-header h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  margin: 0;
}

.diploma-modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Toolbar de Acciones */
.diploma-actions-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.diploma-meta-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.diploma-badge-id {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.diploma-badge-valid {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.diploma-btns-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Viewport con Scroll Horizontal para Pantallas Menores */
.diploma-scroll-viewport {
  width: 100%;
  overflow-x: auto;
  padding: 10px 0;
  display: flex;
  justify-content: center;
}

/* Hoja del Diploma (Formato Oficial ISO 216 A4 Horizontal: 297mm x 210mm) */
.diploma-paper {
  width: 297mm;
  min-width: 297mm;
  max-width: 297mm;
  height: 210mm;
  min-height: 210mm;
  max-height: 210mm;
  background: #ffffff;
  color: #0b1528;
  padding: 8mm;
  position: relative;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
  font-family: 'Outfit', sans-serif;
  overflow: hidden;
  user-select: none;
  page-break-inside: avoid;
  break-inside: avoid;
}

.diploma-border-outer {
  width: 100%;
  height: 100%;
  border: 5px solid #0f172a;
  padding: 3mm;
  box-sizing: border-box;
  position: relative;
}

.diploma-border-inner {
  width: 100%;
  height: 100%;
  border: 2px solid #d4af37;
  padding: 5mm 10mm;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: radial-gradient(circle at 50% 35%, #ffffff 50%, #faf8f5 100%);
  position: relative;
}

/* Esquinas Ornamentales Doradas */
.diploma-corner {
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: #d4af37;
  border-style: solid;
  pointer-events: none;
}
.corner-tl { top: 4px; left: 4px; border-width: 3px 0 0 3px; }
.corner-tr { top: 4px; right: 4px; border-width: 3px 3px 0 0; }
.corner-bl { bottom: 4px; left: 4px; border-width: 0 0 3px 3px; }
.corner-br { bottom: 4px; right: 4px; border-width: 0 3px 3px 0; }

/* Marca de Agua de Fondo */
.diploma-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 260px;
  color: rgba(212, 175, 55, 0.04);
  pointer-events: none;
  z-index: 1;
}

/* Encabezado */
.diploma-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 2;
  border-bottom: 1px solid rgba(212, 175, 55, 0.35);
  padding-bottom: 12px;
}

.diploma-brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.diploma-logo-img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 6px;
}

.diploma-empresa-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #0f172a;
  line-height: 1.2;
}

.diploma-division-text {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  font-weight: 600;
}

.diploma-header-cert-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #b45309;
  background: rgba(245, 158, 11, 0.12);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

/* Título */
.diploma-title-area {
  text-align: center;
  position: relative;
  z-index: 2;
  margin-top: 6px;
}

.diploma-main-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #0f172a;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.diploma-award-text {
  font-size: 13px;
  color: #475569;
  font-style: italic;
  letter-spacing: 0.2px;
}

/* Nombre del Estudiante */
.diploma-student-area {
  text-align: center;
  position: relative;
  z-index: 2;
  margin: 6px 0 8px 0;
}

.diploma-student-name {
  font-size: 28px;
  font-weight: 900;
  color: #091a36;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: inline-block;
  padding: 0 10px;
}

.diploma-name-line {
  width: 480px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #d4af37, #d4af37, transparent);
  margin: 4px auto 0 auto;
}

/* Cuerpo y Curso */
.diploma-body-area {
  text-align: center;
  position: relative;
  z-index: 2;
  max-width: 720px;
  margin: 0 auto;
}

.diploma-statement {
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 6px;
}

.diploma-course-title {
  font-size: 22px;
  font-weight: 800;
  color: #0284c7;
  letter-spacing: -0.2px;
  margin-bottom: 6px;
}

.diploma-course-metrics {
  font-size: 12px;
  color: #334155;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.diploma-course-metrics .sep {
  color: #cbd5e1;
}

/* Pie Institucional */
.diploma-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  position: relative;
  z-index: 2;
  padding-top: 10px;
  border-top: 1px solid rgba(212, 175, 55, 0.35);
}

/* Sello Dorado */
.diploma-seal-col {
  width: 130px;
}

.diploma-gold-seal {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fde047, #d97706 70%, #92400e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 14px rgba(180, 83, 9, 0.4);
  margin-bottom: 4px;
}

.seal-inner-circle {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.seal-star { font-size: 7px; color: #fff; }
.seal-icon { font-size: 12px; margin: 2px 0; color: #fff; }
.seal-text-center { font-size: 8px; font-weight: 900; letter-spacing: 0.8px; }
.seal-subtext { font-size: 6.5px; font-weight: 800; letter-spacing: 0.5px; }

/* Firma */
.diploma-signature-col {
  flex: 1;
  text-align: center;
  padding: 0 20px;
}

.diploma-signature-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.diploma-signature-img {
  height: 50px;
  max-width: 180px;
  object-fit: contain;
  margin-bottom: -6px;
}

.diploma-signature-placeholder {
  height: 50px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.diploma-signature-line {
  width: 200px;
  height: 1.5px;
  background: #334155;
  margin-bottom: 4px;
}

.diploma-rep-name {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}

.diploma-rep-cargo {
  font-size: 10px;
  color: #475569;
  font-weight: 600;
}

.diploma-rep-empresa {
  font-size: 9px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Verificación & QR */
.diploma-verify-col {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: right;
}

.diploma-qr-box {
  width: 80px;
  height: 80px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.diploma-verify-meta {
  display: flex;
  flex-direction: column;
}

.diploma-id-lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
}

.diploma-id-val {
  font-size: 14px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: 0.8px;
  font-family: monospace;
}

.diploma-verify-url {
  font-size: 9px;
  color: #0284c7;
  font-weight: 600;
  margin-top: 2px;
}

/* Botón Diploma en Tarjetas de Curso */
.btn-diploma-ready {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.15);
  font-weight: 700;
  transition: all 0.25s ease;
}

.btn-diploma-ready:hover {
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #fff;
  border-color: #34d399;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
}

/* REGLAS DE IMPRESIÓN DIRECTA EN FORMATO OFICIAL A4 HORIZONTAL */
@media print {
  @page {
    size: A4 landscape;
    margin: 0;
  }
  html, body {
    width: 297mm !important;
    height: 210mm !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
    overflow: hidden !important;
  }
  body * {
    visibility: hidden !important;
  }
  #modalDiplomaViewer {
    position: static !important;
    display: block !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .diploma-modal-card {
    position: static !important;
    display: block !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    width: 297mm !important;
    height: 210mm !important;
  }
  .diploma-actions-toolbar,
  .diploma-modal-header {
    display: none !important;
  }
  .diploma-scroll-viewport {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    display: block !important;
  }
  #diplomaPrintArea, #diplomaPrintArea * {
    visibility: visible !important;
  }
  #diplomaPrintArea {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 297mm !important;
    height: 210mm !important;
    min-width: 297mm !important;
    min-height: 210mm !important;
    max-width: 297mm !important;
    max-height: 210mm !important;
    box-shadow: none !important;
    padding: 8mm !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
  }
}

