/* ==========================================
   ASIR Lab — Dracula Theme
   ========================================== */

:root {
  /* Dracula palette */
  --bg:          #282a36;
  --bg-alt:      #21222c;
  --bg-card:     #2d2f3f;
  --bg-input:    #1e1f29;
  --current:     #44475a;
  --fg:          #f8f8f2;
  --fg-muted:    #6272a4;
  --comment:     #6272a4;
  --cyan:        #8be9fd;
  --green:       #50fa7b;
  --orange:      #ffb86c;
  --pink:        #ff79c6;
  --purple:      #bd93f9;
  --red:         #ff5555;
  --yellow:      #f1fa8c;

  /* Semantic */
  --success:     #50fa7b;
  --error:       #ff5555;
  --warning:     #ffb86c;
  --info:        #8be9fd;

  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 4px 20px rgba(0,0,0,0.4);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.3);
}

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

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-alt);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-alt); }
::-webkit-scrollbar-thumb { background: var(--current); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-muted); }

/* ── NAVBAR ── */
.navbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 2rem;
  height: 56px;
  background: var(--bg);
  border-bottom: 1px solid var(--current);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-icon { font-size: 1.4rem; }
.nav-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.5px;
}
.nav-accent { color: var(--purple); }
.nav-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  background: var(--current);
  color: var(--fg-muted);
  padding: 1px 6px;
  border-radius: 999px;
}

.nav-links { display: flex; gap: 0.25rem; flex: 1; }
.nav-link {
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius);
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-link:hover { color: var(--fg); background: var(--current); }
.nav-link.active { color: var(--cyan); background: rgba(139,233,253,0.1); }
.nav-link.mode-active { color: var(--pink); }

.mode-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
}
.mode-practica { background: rgba(80,250,123,0.12); color: var(--green); border: 1px solid rgba(80,250,123,0.25); }
.mode-evaluacion { background: rgba(255,121,198,0.12); color: var(--pink); border: 1px solid rgba(255,121,198,0.25); }

/* ── LAYOUT ── */
.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.main-content.wide { max-width: 1400px; }
.main-content.narrow { max-width: 860px; }

/* ── PAGE HEADER ── */
.page-header {
  margin-bottom: 2rem;
}
.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 0.35rem;
}
.page-header p {
  color: var(--fg-muted);
  font-size: 0.95rem;
}
.breadcrumb {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
}
.breadcrumb a { color: var(--purple); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--current); }

/* ── HERO DASHBOARD ── */
.hero {
  background: linear-gradient(135deg, var(--bg) 0%, #1a1b2e 100%);
  border: 1px solid var(--current);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  margin-bottom: 2.5rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(189,147,249,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.hero-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  color: var(--fg-muted);
  font-size: 1rem;
  margin-bottom: 1.5rem;
}
.hero-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--cyan);
}
.stat-label { font-size: 0.8rem; color: var(--fg-muted); }

/* ── MODULE GRID ── */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.module-card {
  background: var(--bg-card);
  border: 1px solid var(--current);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--mod-color, var(--purple));
  opacity: 0;
  transition: opacity 0.2s;
}
.module-card:hover {
  border-color: var(--mod-color, var(--purple));
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.module-card:hover::before { opacity: 1; }

.module-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.module-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}
.module-info h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.2rem;
}
.module-info p {
  font-size: 0.8rem;
  color: var(--fg-muted);
  line-height: 1.4;
}

.module-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--current);
}
.module-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--fg-muted);
}
.module-progress-bar {
  height: 4px;
  background: var(--current);
  border-radius: 2px;
  flex: 1;
  margin: 0 0.75rem;
  overflow: hidden;
}
.module-progress-fill {
  height: 100%;
  background: var(--mod-color, var(--purple));
  border-radius: 2px;
  transition: width 0.4s;
}
.module-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--mod-color, var(--purple));
  min-width: 32px;
  text-align: right;
}

/* ── EXERCISE LIST ── */
.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.exercise-item {
  background: var(--bg-card);
  border: 1px solid var(--current);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.15s;
}
.exercise-item:hover {
  border-color: var(--purple);
  background: var(--bg);
}
.exercise-item.completed { border-left: 3px solid var(--green); }
.exercise-item.failed { border-left: 3px solid var(--red); }

.exercise-level {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
}
.level-1 { background: rgba(80,250,123,0.15); color: var(--green); }
.level-2 { background: rgba(255,184,108,0.15); color: var(--orange); }
.level-3 { background: rgba(255,85,85,0.15); color: var(--red); }

.exercise-info { flex: 1; }
.exercise-info h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 2px; }
.exercise-info p { font-size: 0.8rem; color: var(--fg-muted); }

.exercise-type {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  background: var(--current);
  color: var(--fg-muted);
  flex-shrink: 0;
}
.type-completar { background: rgba(139,233,253,0.1); color: var(--cyan); }
.type-corregir { background: rgba(255,85,85,0.1); color: var(--red); }
.type-transformar { background: rgba(189,147,249,0.1); color: var(--purple); }
.type-codigo { background: rgba(80,250,123,0.1); color: var(--green); }
.type-opcion_multiple { background: rgba(255,184,108,0.1); color: var(--orange); }
.type-interpretar { background: rgba(255,121,198,0.1); color: var(--pink); }

.exercise-status { font-size: 1rem; flex-shrink: 0; }

/* ── EXERCISE VIEW ── */
.exercise-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 1000px) {
  .exercise-container { grid-template-columns: 1fr 380px; }
}

.exercise-panel {
  background: var(--bg-card);
  border: 1px solid var(--current);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel-header {
  padding: 0.85rem 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid var(--current);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.panel-header .dot {
  width: 10px; height: 10px; border-radius: 50%;
}
.dot-red { background: #ff5f56; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }
.panel-header-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-left: 0.5rem;
}

.panel-body { padding: 1.5rem; }

.exercise-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 0.5rem;
}
.exercise-meta-tags {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
}
.tag-nivel { background: var(--current); color: var(--fg-muted); }
.tag-tipo { }

.exercise-enunciado {
  font-size: 0.925rem;
  line-height: 1.7;
  color: var(--fg);
  margin-bottom: 1.5rem;
}
.exercise-enunciado code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-input);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--cyan);
  font-size: 0.875rem;
}
.exercise-enunciado strong { color: var(--yellow); }

/* ── CODE EDITOR ── */
.code-editor-wrapper {
  margin-bottom: 1.25rem;
}
.editor-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.editor-label::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--purple);
  border-radius: 50%;
}

.code-editor {
  position: relative;
}

.code-reference {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  background: var(--bg-input);
  border: 1px solid var(--current);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--fg);
  white-space: pre;
  overflow-x: auto;
  line-height: 1.6;
  margin-bottom: 1rem;
}
.code-reference .kw { color: var(--pink); }
.code-reference .str { color: var(--yellow); }
.code-reference .var { color: var(--purple); }
.code-reference .cmd { color: var(--cyan); }
.code-reference .cmt { color: var(--comment); }
.code-reference .blank { color: var(--orange); background: rgba(255,184,108,0.15); padding: 0 3px; border-radius: 3px; }

textarea.code-input {
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  background: var(--bg-input);
  color: var(--fg);
  border: 2px solid var(--current);
  border-radius: var(--radius);
  padding: 1rem;
  resize: vertical;
  min-height: 160px;
  line-height: 1.6;
  tab-size: 2;
  transition: border-color 0.2s;
  outline: none;
}
textarea.code-input:focus { border-color: var(--purple); }
textarea.code-input.correct { border-color: var(--green); }
textarea.code-input.incorrect { border-color: var(--red); }

/* ── OPTIONS (multiple choice) ── */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.option-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 2px solid var(--current);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.875rem;
}
.option-item:hover { border-color: var(--purple); background: var(--bg); }
.option-item.selected { border-color: var(--purple); background: rgba(189,147,249,0.08); }
.option-item.correct-option { border-color: var(--green); background: rgba(80,250,123,0.08); }
.option-item.wrong-option { border-color: var(--red); background: rgba(255,85,85,0.08); }
.option-letter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--purple);
  flex-shrink: 0;
  width: 20px;
}
.option-item input[type="radio"] { display: none; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
}
.btn-primary {
  background: var(--purple);
  color: var(--bg);
}
.btn-primary:hover { background: #caa9fa; transform: translateY(-1px); }
.btn-secondary {
  background: var(--current);
  color: var(--fg);
}
.btn-secondary:hover { background: #55577a; }
.btn-success { background: var(--green); color: var(--bg); }
.btn-danger { background: var(--red); color: var(--fg); }
.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--current);
}
.btn-ghost:hover { color: var(--fg); border-color: var(--fg-muted); }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.8rem; }
.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── FEEDBACK ── */
.feedback {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  display: none;
  animation: fadeIn 0.25s ease;
}
.feedback.show { display: block; }
.feedback-correct {
  background: rgba(80,250,123,0.1);
  border: 1px solid rgba(80,250,123,0.3);
  color: var(--green);
}
.feedback-incorrect {
  background: rgba(255,85,85,0.1);
  border: 1px solid rgba(255,85,85,0.3);
  color: var(--red);
}
.feedback-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}
.feedback-body { color: var(--fg); opacity: 0.9; }
.feedback-body code {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(0,0,0,0.25);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.8rem;
}

/* ── SOLUTION BOX ── */
.solution-box {
  display: none;
  background: var(--bg-input);
  border: 1px solid rgba(80,250,123,0.3);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 0.75rem;
}
.solution-box.show { display: block; }
.solution-box pre {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--green);
  white-space: pre;
  overflow-x: auto;
  line-height: 1.6;
}
.solution-label {
  font-size: 0.7rem;
  color: var(--green);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 0.5rem;
  opacity: 0.7;
}

/* ── HINTS PANEL ── */
.hints-panel {
  background: var(--bg);
  border: 1px solid var(--current);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.hints-panel-title {
  padding: 0.75rem 1.25rem;
  background: rgba(189,147,249,0.05);
  border-bottom: 1px solid var(--current);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--purple);
  font-family: 'JetBrains Mono', monospace;
}
.hint-item {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--current);
  font-size: 0.83rem;
  color: var(--fg-muted);
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  line-height: 1.5;
}
.hint-item:last-child { border-bottom: none; }
.hint-icon { color: var(--yellow); flex-shrink: 0; }
.hint-item.hidden-hint { filter: blur(4px); transition: filter 0.3s; cursor: pointer; }
.hint-item.hidden-hint:hover { filter: blur(2px); }
.hint-item.hidden-hint.revealed { filter: none; cursor: default; }

/* ── NAVIGATION EXERCISE ── */
.exercise-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg);
  border-top: 1px solid var(--current);
  gap: 1rem;
}
.exercise-counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--fg-muted);
  flex-shrink: 0;
}

/* ── PROGRESS BAR ── */
.progress-bar {
  height: 4px;
  background: var(--current);
  border-radius: 2px;
  overflow: hidden;
  margin: 1rem 0;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ── TERMINAL OUTPUT ── */
.terminal-output {
  background: #1a1b26;
  border: 1px solid var(--current);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #a9b1d6;
  overflow-x: auto;
  margin: 0.5rem 0;
  line-height: 1.5;
}

/* ── INFO CARDS (sidebar) ── */
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--current);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 0.83rem;
  margin-bottom: 1rem;
}
.info-card h4 {
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--cyan);
  margin-bottom: 0.5rem;
}
.info-card p { color: var(--fg-muted); line-height: 1.5; }
.info-card code {
  font-family: 'JetBrains Mono', monospace;
  color: var(--yellow);
  font-size: 0.8rem;
}

/* ── ORDENAR BLOQUES ── */
.bloques-lista {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.bloque-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--bg-input);
  border: 2px solid var(--current);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  cursor: grab;
  transition: all 0.15s;
  user-select: none;
}
.bloque-item:active { cursor: grabbing; }
.bloque-item.drag-over { border-color: var(--purple); background: rgba(189,147,249,0.08); }
.bloque-item.dragging { opacity: 0.4; border-style: dashed; }
.bloque-handle {
  color: var(--fg-muted);
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.bloque-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--fg);
  margin: 0;
  line-height: 1.5;
  flex: 1;
  white-space: pre;
}

/* ── REFERENCIA RÁPIDA ── */
.ref-search {
  width: 100%;
  background: var(--bg-input);
  border: 2px solid var(--current);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  color: var(--fg);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
.ref-search:focus { border-color: var(--purple); }

#ref-categorias {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.ref-categoria {
  background: var(--bg-card);
  border: 1px solid var(--current);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.ref-cat-titulo {
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--cat-color, var(--purple));
  background: rgba(0,0,0,0.15);
  border-bottom: 1px solid var(--current);
  font-family: 'JetBrains Mono', monospace;
}
.ref-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid var(--current);
  font-size: 0.8rem;
  transition: background 0.1s;
}
.ref-item:last-child { border-bottom: none; }
.ref-item:hover { background: var(--bg); }
.ref-item.hidden { display: none; }
.ref-cmd {
  font-family: 'JetBrains Mono', monospace;
  color: var(--cyan);
  font-size: 0.75rem;
  flex-shrink: 0;
  min-width: 140px;
}
.ref-desc {
  color: var(--fg-muted);
  flex: 1;
  line-height: 1.4;
  font-size: 0.78rem;
}
.ref-copy {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0;
  padding: 1px 4px;
  border-radius: 3px;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.ref-item:hover .ref-copy { opacity: 0.7; }
.ref-copy:hover { opacity: 1 !important; background: var(--current); }

/* ── EVALUATION MODE INDICATOR ── */
.eval-banner {
  background: linear-gradient(90deg, rgba(255,121,198,0.1), rgba(189,147,249,0.1));
  border: 1px solid rgba(255,121,198,0.3);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  color: var(--pink);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ── FOOTER ── */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--current);
  padding: 1rem 2rem;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--fg-muted);
  max-width: 1200px;
  margin: 0 auto;
}
.footer-logo { font-weight: 700; color: var(--fg); }
.footer-sep { opacity: 0.3; }
.accent-purple { color: var(--purple); }

/* ── ANIMATIONS ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}
.loading { animation: pulse 1.5s infinite; }

/* ── UTILITIES ── */
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-purple { color: var(--purple); }
.text-cyan   { color: var(--cyan); }
.text-yellow { color: var(--yellow); }
.text-muted  { color: var(--fg-muted); }
.mono { font-family: 'JetBrains Mono', monospace; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-sm { gap: 0.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; }
  .nav-links { display: none; }
  .main-content { padding: 1rem; }
  .hero { padding: 1.5rem; }
  .hero-title { font-size: 1.5rem; }
  .modules-grid { grid-template-columns: 1fr; }
  .exercise-container { grid-template-columns: 1fr; }
}

/* =========================================================
   RESPONSIVE ADITIVO v2.1 — PC · Tablet · Móvil
   Solo AÑADE reglas nuevas al final del archivo: no modifica
   ni elimina ninguna regla anterior. Mantiene el tema Dracula.
   Como los bloques @media van DESPUÉS de los existentes, en caso
   de solapamiento ganan por orden de cascada (misma especificidad).
   ========================================================= */

/* ---- Utilidad genérica: cualquier tabla envuelta scrollea en horizontal ---- */
.responsive-table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* ===== TABLET Y MÓVIL GRANDE (<= 1024px) ===== */
@media (max-width: 1024px) {
  .main-content { padding: 1.25rem; }
  .hero { padding: 2rem; }

  /* Las tablas de apuntes scrollean si no caben, sin desbordar la página */
  .apunte-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  /* Selectores genéricos solicitados (por compatibilidad; inertes si no existen) */
  .grid-modulos, .grid-ejercicios, .grid-tarjetas {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
  .tabla-comandos, .tabla-permisos, .tabla-senales, .tabla-cron, .tabla-responsive {
    overflow-x: auto;
    display: block;
    white-space: nowrap;
  }
}

/* ===== MÓVIL GRANDE / TABLET PEQUEÑA (<= 768px) ===== */
@media (max-width: 768px) {
  /* --- Navegación: volver a MOSTRAR los enlaces (estaban ocultos) y dejar que envuelvan --- */
  .navbar {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
  }
  .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    flex: 1 1 100%;
    order: 3;
  }
  .nav-link { font-size: 0.8rem; padding: 0.3rem 0.6rem; }
  .nav-status { margin-left: auto; }

  /* --- Apuntes: la columna de navegación lateral (grid inline 200px 1fr) pasa arriba --- */
  .main-content.wide[style*="grid"] { grid-template-columns: 1fr !important; }

  /* --- Botones de acción a ancho completo (sin afectar a los pequeños .btn-sm) --- */
  .btn-group { flex-direction: column; align-items: stretch; }
  .btn-group > .btn { width: 100%; }
  .btn:not(.btn-sm) { width: 100%; }

  /* --- Navegación entre ejercicios apilada y centrada --- */
  .exercise-nav { flex-wrap: wrap; justify-content: center; }

  /* Selectores genéricos solicitados */
  .grid-modulos, .grid-ejercicios, .grid-tarjetas { grid-template-columns: 1fr; }
  .botones-accion { flex-direction: column; gap: 0.5rem; }
}

/* ===== MÓVIL PEQUEÑO (<= 480px) ===== */
@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }
  h3 { font-size: 1rem; }

  .hero { padding: 1.25rem; }
  .hero-title { font-size: 1.4rem; }
  .hero-sub { font-size: 0.9rem; }
  .hero-stats { gap: 1.25rem; }
  .stat-num { font-size: 1.3rem; }

  .main-content { padding: 0.85rem; }
  .panel-body { padding: 1rem; }

  /* Editores y código un poco más compactos para que quepan */
  .code-input, .code-reference { font-size: 0.8rem; }

  .btn:not(.btn-sm) { padding: 0.6rem 0.8rem; }
}
