/* ── Temas ───────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:        #0f172a;
  --surface:   #1e293b;
  --border:    #334155;
  --text:      #e2e8f0;
  --muted:     #94a3b8;
  --accent:    #38bdf8;
  --ok:        #22c55e;
  --ok-bg:     rgba(34,197,94,0.1);
  --ok-border: rgba(34,197,94,0.35);
  --heading:   #f8fafc;
  --pill-bg:   rgba(255,255,255,0.06);
  --pill-text: #94a3b8;
}

[data-theme="light"] {
  --bg:        #f1f5f9;
  --surface:   #ffffff;
  --border:    #e2e8f0;
  --text:      #334155;
  --muted:     #64748b;
  --accent:    #0284c7;
  --ok:        #16a34a;
  --ok-bg:     rgba(22,163,74,0.08);
  --ok-border: rgba(22,163,74,0.3);
  --heading:   #0f172a;
  --pill-bg:   #f1f5f9;
  --pill-text: #64748b;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

a { color: var(--accent); text-decoration: none; }

/* ── Navbar ──────────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--heading);
  letter-spacing: -0.01em;

  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.nav-logo:hover { color: var(--accent); }

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo-img {
  height: 28px;
  width: auto;
  display: block;
  transition: opacity 0.15s;
}

.nav-logo-name {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--heading);
  letter-spacing: -0.01em;
  transition: color 0.15s;
}

.nav-logo:hover .nav-logo-img { opacity: 0.8; }
.nav-logo:hover .nav-logo-name { color: var(--accent); }

.theme-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text);
  line-height: 1;
  transition: border-color 0.15s;
}

.theme-btn:hover { border-color: var(--accent); }

/* ── Layout 3 columnas ───────────────────────────────── */
.page-wrapper {
  display: grid;
  grid-template-columns: 160px 1fr 160px;
  gap: 24px;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 12px;
  align-items: start;
}

.ad-sidebar {
  position: sticky;
  top: 80px;
  min-height: 600px;
}

@media (max-width: 1100px) {
  .page-wrapper { grid-template-columns: 1fr; }
  .ad-sidebar { display: none; }
}

.container {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* ── Encabezado de página ────────────────────────────── */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--heading);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.page-header p {
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.9rem;
}

/* ── Botón volver ────────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 20px;
  padding: 6px 10px 6px 6px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.back-btn:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

.back-btn svg {
  width: 16px; height: 16px;
  stroke: currentColor; fill: none;
  stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* ── Buscador ────────────────────────────────────────── */
.search-wrap {
  position: relative;
  margin-bottom: 16px;
}

.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  stroke: var(--muted); fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px 10px 36px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.search-wrap input::placeholder { color: var(--muted); }
.search-wrap input:focus { outline: none; border-color: var(--accent); }

/* ── Pill ────────────────────────────────────────────── */
.pill {
  display: inline-block;
  background: var(--pill-bg);
  color: var(--pill-text);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 0.75rem;
  white-space: nowrap;
  font-weight: 500;
}

/* ── Lista de cursos ─────────────────────────────────── */
.item-list { list-style: none; }

.item-list li { border-bottom: 1px solid var(--border); }
.item-list li:last-child { border-bottom: none; }

.item-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 12px;
  border-radius: 8px;
  transition: background 0.12s;
  margin: 2px 0;
}

.item-list a { background: var(--surface); }

.item-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--heading);
  flex: 1;
  line-height: 1.4;
}

.item-list a:hover .item-title { color: var(--accent); }

/* ── Tarjetas de preguntas ───────────────────────────── */
.question {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}

.question:hover { border-color: var(--accent); }

.q-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.q-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 12px;
  line-height: 1.5;
}

.answer {
  background: var(--ok-bg);
  border-left: 3px solid var(--ok);
  padding: 9px 12px;
  border-radius: 0 6px 6px 0;
  font-size: 0.9rem;
  color: var(--text);
  margin-top: 6px;
}

.no-answer {
  color: var(--muted);
  font-style: italic;
  font-size: 0.875rem;
}

/* ── Footer ──────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 24px 16px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  font-size: 0.8rem;
}

.site-footer a {
  color: var(--muted);
  transition: color 0.15s;
}

.site-footer a:hover { color: var(--accent); }

/* ── Pagina de privacidad ────────────────────────────── */
.privacy-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  line-height: 1.75;
}

.privacy-body h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading);
  margin: 24px 0 8px;
}

.privacy-body h2:first-child { margin-top: 0; }

.privacy-body p {
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 10px;
}

.privacy-body code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.85em;
}

/* ── Estado vacío ────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 40px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Acordeón de módulos ─────────────────────────────── */
.item-list .group-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  margin: 6px 0;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 16px;
  cursor: pointer;
  transition: background 0.12s;
}

/* .group-header:hover { background: var(--bg); } */
.group-header:hover .item-title { color: var(--accent); }

.group-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.chevron {
  transition: transform 0.2s;
  color: var(--muted);
}

.group-item.open .chevron { transform: rotate(90deg); }

.submodule-list {
  display: none;
  list-style: none;
  border-top: 1px solid var(--border);
  padding: 6px 16px;
  margin: 0;
  background: var(--surface);
}

.group-item.open .submodule-list { display: block; }

.submodule-list li { border-bottom: 1px solid var(--border); }
.submodule-list li:last-child { border-bottom: none; }

.submodule-list a {
  border-radius: 8px;
  padding: 11px 12px;
  margin: 2px 0;
  background: transparent;
  transition: background 0.12s;
}

.submodule-list a:hover { background: var(--surface); }
.submodule-list a:hover .item-title { color: var(--accent); }
