/* ========== RESET BÁSICO ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #050510;
  color: #f5f5ff;
  display: flex;
}

/* ========== LAYOUT GENERAL ========== */

.sidebar {
  width: 280px;
  min-width: 240px;
  background: linear-gradient(180deg, #050510 0%, #050510 40%, #0b1020 100%);
  border-right: 1px solid rgba(120, 120, 255, 0.3);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top left, #151530 0, #050510 45%, #020208 100%);
}

/* ========== SIDEBAR ========== */

.sidebar-header h2 {
  font-size: 1.4rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7df9ff;
}

.sidebar-header p {
  font-size: 0.85rem;
  color: #b0b0ff;
  margin-top: 0.25rem;
}

.sidebar-nav {
  margin-top: 2rem;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 0.5rem;
}

.sidebar-nav button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: #e0e0ff;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  transition: all 0.18s ease-out;
}

.sidebar-nav button span.unit-code {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #7df9ff;
}

.sidebar-nav button span.unit-title {
  font-size: 0.9rem;
}

.sidebar-nav button:hover {
  border-color: rgba(125, 249, 255, 0.7);
  background: radial-gradient(circle at left, rgba(125, 249, 255, 0.12), transparent 60%);
  transform: translateX(2px);
}

.sidebar-nav button.active {
  border-color: #ff4bcb;
  background: linear-gradient(90deg, rgba(255, 75, 203, 0.18), transparent);
}

/* ========== TOPBAR ========== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem 0.75rem;
  border-bottom: 1px solid rgba(120, 120, 255, 0.25);
}

.topbar h1 {
  font-size: 1.4rem;
  font-weight: 600;
}

/* Progreso */

.progress-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: #b0b0ff;
}

.progress-bar {
  width: 180px;
  height: 6px;
  border-radius: 999px;
  background: rgba(80, 80, 160, 0.5);
  overflow: hidden;
  position: relative;
}

.progress-bar #progressFill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7df9ff, #ff4bcb);
  box-shadow: 0 0 12px rgba(125, 249, 255, 0.8);
  transition: width 0.3s ease-out;
}

/* ========== CONTENIDO PRINCIPAL ========== */

.content-area {
  padding: 1.5rem 1.75rem 1.25rem;
  overflow-y: auto;
  flex: 1;
}

/* Caja de bienvenida */

.welcome-box {
  border-radius: 1rem;
  padding: 1.5rem 1.75rem;
  background: radial-gradient(circle at top left, rgba(125, 249, 255, 0.12), rgba(10, 10, 40, 0.9));
  border: 1px solid rgba(125, 249, 255, 0.35);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.7);
}

.welcome-box h2 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.welcome-box p {
  font-size: 0.95rem;
  color: #d0d0ff;
}

/* Secciones de contenido */

.section-block {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.4rem;
  border-radius: 0.9rem;
  background: rgba(10, 10, 35, 0.9);
  border: 1px solid rgba(120, 120, 255, 0.35);
  position: relative;
  overflow: hidden;
}

.section-block::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255, 75, 203, 0.18), transparent 60%);
  opacity: 0.7;
  pointer-events: none;
}

.section-title {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  color: #ffffff;
}

.section-meta {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #7df9ff;
  margin-bottom: 0.4rem;
}

.section-block p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #d8d8ff;
}

.section-block ul {
  margin-top: 0.5rem;
  padding-left: 1.1rem;
}

.section-block li {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #d8d8ff;
}

/* ========== QUIZ AREA ========== */

.quiz-area {
  padding: 0.75rem 1.75rem 1.5rem;
  border-top: 1px solid rgba(120, 120, 255, 0.25);
  background: radial-gradient(circle at bottom, rgba(10, 10, 40, 0.9), rgba(5, 5, 16, 1));
}

.quiz-card {
  border-radius: 0.9rem;
  padding: 1rem 1.25rem;
  background: rgba(8, 8, 30, 0.95);
  border: 1px solid rgba(125, 249, 255, 0.35);
}

.quiz-card h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.quiz-option {
  border-radius: 0.6rem;
  border: 1px solid rgba(120, 120, 255, 0.4);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
  background: transparent;
  color: #e0e0ff;
  text-align: left;
  transition: all 0.18s ease-out;
}

.quiz-option:hover {
  border-color: #7df9ff;
  background: rgba(125, 249, 255, 0.08);
}

.quiz-option.correct {
  border-color: #4dff88;
  background: rgba(77, 255, 136, 0.12);
}

.quiz-option.incorrect {
  border-color: #ff4b6b;
  background: rgba(255, 75, 107, 0.12);
}

/* ========== WIDGET IA ========== */

.ai-widget {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  z-index: 50;
}

/* Avatar circular tipo holograma */

.ai-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, #ffffff, #7df9ff 40%, #050510 70%);
  border: 2px solid rgba(125, 249, 255, 0.8);
  box-shadow:
    0 0 12px rgba(125, 249, 255, 0.9),
    0 0 32px rgba(255, 75, 203, 0.6);
  position: relative;
  overflow: hidden;
}

.ai-avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at bottom, transparent 40%, rgba(5, 5, 16, 0.9));
}

/* Burbuja de diálogo */

.ai-dialog {
  max-width: 280px;
  background: rgba(10, 10, 35, 0.96);
  border-radius: 0.9rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(125, 249, 255, 0.6);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.9);
  position: relative;
}

.ai-dialog::before {
  content: "";
  position: absolute;
  right: 40px;
  bottom: -8px;
  width: 14px;
  height: 14px;
  background: inherit;
  border-left: 1px solid rgba(125, 249, 255, 0.6);
  border-bottom: 1px solid rgba(125, 249, 255, 0.6);
  transform: rotate(45deg);
}

.ai-dialog p {
  font-size: 0.8rem;
  line-height: 1.4;
  color: #e8e8ff;
}

/* ========== UTILIDADES ========== */

.hidden {
  display: none !important;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 900px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    border-right: none;
    border-bottom: 1px solid rgba(120, 120, 255, 0.3);
  }

  .sidebar-nav {
    margin-top: 0;
    max-height: 180px;
  }

  .main-content {
    height: calc(100vh - 200px);
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .progress-container {
    align-items: flex-start;
  }

  .ai-widget {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .ai-dialog {
    max-width: 220px;
  }
}
.ai-pop {
  animation: aiPop 0.35s ease-out;
}

@keyframes aiPop {
  0% { transform: scale(0.85); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}
.fade-in {
  animation: fadeIn 0.45s ease-out;
}

@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
