/* ─────────────────────────────────────────────────────────────────────────
   VocabSnacks — sistema de diseño
   Paleta cálida de academia: verde profundo + ámbar sobre crema.
   Fichero estático servido desde public/css (sin build, sin CDN).
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-2: #fbf9f5;
  --ink: #22312f;
  --muted: #6b7a77;
  --line: #e7e0d5;

  --brand: #146c5a;
  --brand-700: #0f5445;
  --brand-900: #0b3d32;
  --brand-soft: #e3f1ec;
  --accent: #f0a202;
  --accent-soft: #fdf1d8;
  --danger: #c2553e;
  --danger-soft: #fbe9e4;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(34, 49, 47, .05), 0 10px 30px rgba(34, 49, 47, .07);
  --shadow-sm: 0 1px 2px rgba(34, 49, 47, .06);

  --font-display: "Outfit", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at -10% 110%, rgba(20, 108, 90, .10), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1.02rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
a { color: var(--brand); }

.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ── Estructura: barra lateral + contenido ─────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--brand-700), var(--brand-900));
  color: #eaf4f0;
  padding: 1.4rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: #fff;
}
.brand .logo {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(140deg, var(--accent), #f7c948);
  color: var(--brand-900);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
}
.brand .name { font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; line-height: 1.15; }
.brand .name small { display: block; font-size: .72rem; opacity: .75; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: .3rem; }
.nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .62rem .8rem;
  border-radius: var(--radius-sm);
  color: #d7e7e1;
  text-decoration: none;
  font-weight: 500;
  font-size: .95rem;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: rgba(255, 255, 255, .10); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .16); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }

.sidebar .spacer { flex: 1; }
.sidebar .whoami {
  border-top: 1px solid rgba(255, 255, 255, .15);
  padding-top: 1rem;
  display: flex;
  align-items: center;
  gap: .7rem;
}

/* Botón ☰ (sólo se ve en móvil: la navegación queda en un panel desplegable) */
.menu-toggle {
  display: none;
  align-items: center;
  gap: .5rem;
  margin-left: auto;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 10px;
  padding: .5rem .9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.menu-toggle:hover { background: rgba(255, 255, 255, .2); }
.sidebar .whoami .avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  display: grid;
  place-items: center;
  font-weight: 600;
}
.sidebar .whoami .meta { min-width: 0; }
.sidebar .whoami .meta strong { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .whoami .meta span { font-size: .76rem; opacity: .75; }

.content { flex: 1; padding: 2rem 2.25rem 3.5rem; max-width: 1080px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-head .lead { color: var(--muted); max-width: 62ch; }

/* ── Iconos ───────────────────────────────────────────────────────────── */
.icon { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }

/* ── Tarjetas ─────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.3rem;
}
.card > h2:first-child { margin-top: 0; }

.grid { display: grid; gap: 1.1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.stat .label { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: var(--brand-700); line-height: 1.2; }

/* Tarjeta de curso (variedad de color por curso con --h) */
.course-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.5rem;
}
.course-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, hsl(var(--h, 165) 55% 42%), hsl(calc(var(--h, 165) + 28) 65% 55%));
}
.course-card .tag {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: hsl(var(--h, 165) 55% 95%);
  color: hsl(var(--h, 165) 60% 28%);
  border-radius: 999px;
  padding: .18rem .65rem;
  font-size: .76rem;
  font-weight: 600;
}

/* ── Botones ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  padding: .62rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, var(--brand), var(--brand-700));
  color: #fff;
  box-shadow: 0 6px 16px rgba(20, 108, 90, .28);
}
.btn-primary:hover { background: var(--brand-700); }
.btn-soft { background: var(--brand-soft); color: var(--brand-700); }
.btn-soft:hover { background: #d5e9e2; }
.btn-warm { background: linear-gradient(180deg, var(--accent), #e09400); color: #4a3200; box-shadow: 0 6px 16px rgba(240, 162, 2, .28); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #f5d8d1; }
.btn-ghost { background: transparent; color: var(--brand-700); border-color: var(--line); }
.btn-sm { padding: .38rem .75rem; font-size: .85rem; }

/* ── Formularios ──────────────────────────────────────────────────────── */
.field { margin-bottom: .95rem; }
.field label { display: block; font-size: .88rem; font-weight: 600; color: var(--ink); margin-bottom: .32rem; }
.field .hint { font-size: .82rem; color: var(--muted); margin: .3rem 0 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="file"], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .62rem .85rem;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(20, 108, 90, .14);
}
textarea { min-height: 120px; resize: vertical; }
input[type="file"] { padding: .45rem .65rem; background: #fff; }
input[type="checkbox"] { width: auto; accent-color: var(--brand); margin-right: .45rem; }
.check { display: flex; align-items: center; font-size: .92rem; }

.form-row { display: flex; gap: .85rem; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 220px; margin-bottom: 0; }

/* ── Tablas ───────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: .78rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: .55rem .6rem;
  border-bottom: 1px solid var(--line);
}
.table td { padding: .78rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }

/* ── Píldoras, avisos, estados ────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--brand-soft);
  color: var(--brand-700);
  border-radius: 999px;
  padding: .22rem .7rem;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}
.pill.warm { background: var(--accent-soft); color: #8a5c00; }
.pill.grey { background: #efece6; color: var(--muted); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }

.flash {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  background: var(--brand-soft);
  border: 1px solid rgba(20, 108, 90, .25);
  color: var(--brand-900);
  border-radius: var(--radius-sm);
  padding: .85rem 1.05rem;
  margin-bottom: 1.2rem;
}
.flash.error { background: var(--danger-soft); border-color: rgba(194, 85, 62, .3); color: #7c2f1e; }
.flash ul { margin: 0; padding-left: 1.1rem; }
.flash code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 1.05rem;
  background: rgba(255, 255, 255, .7);
  padding: .15rem .55rem;
  border-radius: 6px;
  letter-spacing: .04em;
}

/* Bienvenida del alumno (pantalla de entrada) */
.welcome {
  background: linear-gradient(135deg, var(--brand), var(--brand-700));
  color: #fff;
  border-radius: var(--radius);
  padding: 1.55rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 12px 30px rgba(20, 108, 90, .22);
}
.welcome h1 { color: #fff; margin: 0 0 .35rem; font-size: 1.65rem; }
.welcome p { margin: 0; opacity: .88; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 1.6rem 1rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.empty .big { font-size: 2rem; margin-bottom: .35rem; }

/* Desplegable de contacto (details/summary, funciona sin JavaScript) */
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown[open] > summary { box-shadow: 0 0 0 4px rgba(240, 162, 2, .25); }
.dropdown-menu {
  margin-top: .55rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: .45rem;
  min-width: 280px;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink);
}
.dropdown-item:hover { background: var(--brand-soft); color: var(--brand-700); }

/* Widget de calendario (barra lateral) */
.sidebar-widget {
  background: rgba(255, 255, 255, .08);
  border-radius: 12px;
  padding: .85rem;
  display: grid;
  gap: .55rem;
}
.widget-titulo {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  font-size: .92rem;
}
.widget-linea {
  display: flex;
  gap: .55rem;
  align-items: flex-start;
  color: #d7e7e1;
  text-decoration: none;
  background: rgba(255, 255, 255, .08);
  border-radius: 10px;
  padding: .55rem .65rem;
  font-size: .82rem;
  line-height: 1.35;
}
.widget-linea:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.widget-linea small { opacity: .8; }
.widget-chip { font-size: 1rem; }
.widget-vacio { color: #d7e7e1; opacity: .75; font-size: .82rem; margin: 0; }

/* ── Temas (acordeón) ─────────────────────────────────────────────────── */
.topic {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: .85rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.topic > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .95rem 1.15rem;
  font-weight: 600;
  background: var(--surface-2);
  transition: background .15s ease;
}
.topic > summary::-webkit-details-marker { display: none; }
.topic > summary:hover { background: var(--brand-soft); }
.topic > summary .chev { margin-left: auto; transition: transform .18s ease; color: var(--muted); }
.topic[open] > summary .chev { transform: rotate(180deg); }
.topic .body { padding: 1.15rem; border-top: 1px solid var(--line); }
.topic .body > :first-child { margin-top: 0; }

.divider { height: 1px; background: var(--line); margin: 1.25rem 0; border: 0; }

/* ── Ficheros ─────────────────────────────────────────────────────────── */
.file-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;           /* los botones bajan solos si no caben */
  gap: .85rem;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  margin-bottom: .55rem;
}
.file-row:hover { background: var(--brand-soft); }
.file-row .thumb {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--brand-700);
  overflow: hidden;
  flex-shrink: 0;
}
.file-row .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-row .meta { min-width: 0; flex: 1 1 220px; }
.file-row .meta strong {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.35;
}
.file-row .meta .badges { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: .4rem; align-items: center; }
.file-row .meta .badges .pill { font-size: .72rem; padding: .12rem .6rem; }
.file-row .meta .badges .size { font-size: .82rem; color: var(--muted); }

/* Paginación */
.paginacion {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.15rem;
  flex-wrap: wrap;
}

/* Contenido de los temas (HTML del editor visual) */
.topic-body { line-height: 1.7; }
.topic-body h1, .topic-body h2, .topic-body h3, .topic-body h4 {
  font-family: var(--font-display);
  color: var(--brand-700);
  margin: 1.15rem 0 .55rem;
}
.topic-body h1 { font-size: 1.45rem; }
.topic-body h2 { font-size: 1.25rem; }
.topic-body h3 { font-size: 1.1rem; }
.topic-body p { margin: .65rem 0; }
.topic-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  margin: .55rem 0;
}
.topic-body iframe, .topic-body video {
  max-width: 100%;
  width: 100%;
  min-height: 220px;
  border: 0;
  border-radius: 12px;
  margin: .75rem 0;
}
.topic-body video { min-height: 0; }
.topic-body ul, .topic-body ol { margin: .55rem 0 .55rem 1.35rem; }
.topic-body li { margin: .28rem 0; }
.topic-body a { color: var(--brand-700); font-weight: 600; }
.topic-body blockquote {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  margin: .85rem 0;
  padding: .65rem 1rem;
  border-radius: 8px;
}
.topic-body table { width: 100%; border-collapse: collapse; margin: .75rem 0; }
.topic-body th, .topic-body td { border: 1px solid var(--line); padding: .5rem .65rem; }
.topic-body th { background: var(--surface-2); }

/* ── Pasos (panel) ────────────────────────────────────────────────────── */
.steps { counter-reset: step; display: grid; gap: .85rem; }
.step { display: flex; gap: .95rem; align-items: flex-start; }
.step .num {
  counter-increment: step;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: #8a5c00;
  font-family: var(--font-display);
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.step .num::before { content: counter(step); }
.step .num.orange { background: var(--brand-soft); color: var(--brand-700); }

/* ── Login ────────────────────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-hero {
  background: linear-gradient(155deg, var(--brand-700), var(--brand-900) 70%);
  color: #eaf4f0;
  padding: 3.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-hero::after {
  content: "";
  position: absolute;
  width: 460px;
  height: 460px;
  right: -140px;
  bottom: -160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 108, 90, .25), transparent 65%);
}
.auth-hero h1 { color: #fff; font-size: 2.45rem; line-height: 1.12; max-width: 15ch; }
.auth-hero .tagline { font-size: 1.06rem; opacity: .85; max-width: 42ch; }
.auth-hero .brand .name { color: #fff; }
.auth-hero .points { display: grid; gap: .75rem; margin: 1.5rem 0 0; }
.auth-hero .points li { list-style: none; display: flex; gap: .6rem; align-items: center; opacity: .92; }
.auth-hero .points li .icon { color: var(--accent); }

.auth-form { display: grid; place-items: center; padding: 2.5rem 2rem; }
.auth-form .box { width: 100%; max-width: 380px; }
.auth-form h2 { font-size: 1.65rem; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {  /* Filas de material: en móvil, título y datos ocupan todo el ancho y los
     botones bajan a su propia fila (antes el título se colapsaba a «…»). */
  .file-row { flex-wrap: wrap; gap: .75rem; padding: 1rem; align-items: flex-start; }
  .file-row .thumb { order: 1; width: 52px; height: 52px; }
  .file-row .meta {
    order: 2;
    flex: 1 1 calc(100% - 68px);
    min-width: 0;
  }
  .file-row .meta strong { font-size: 1.05rem; }
  .file-row a.btn, .file-row form {
    order: 3;
    flex: 1 1 45%;
    margin: 0;
  }
  .file-row a.btn, .file-row form .btn { width: 100%; justify-content: center; }

  .topic > summary { flex-wrap: wrap; row-gap: .35rem; padding: .85rem 1rem; }
  .topic > summary .chev { margin-left: auto; }
  .topic .body { padding: 1rem; }

  .page-head { flex-direction: column; }
  .page-head .btn { width: 100%; }
  .form-row .btn { width: 100%; }

  .table th, .table td { padding: .55rem .35rem; font-size: .88rem; }
  h1 { font-size: 1.45rem; }
  .content { padding: 1.15rem .9rem 2.5rem; }
}

@media (max-width: 980px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: .85rem 1.15rem;
    padding: .9rem 1.15rem;
  }
  /* Menú hamburguesa: la navegación se oculta tras el botón ☰ */
  .menu-toggle { display: inline-flex; }
  .sidebar-body {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: .85rem;
  }
  .sidebar.open .sidebar-body { display: flex; }
  .sidebar .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar .spacer { display: none; }
  .sidebar .whoami { border-top: 1px solid rgba(255,255,255,.15); padding-top: .85rem; margin-left: 0; }
  .content { padding: 1.5rem 1.15rem 3rem; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 2.25rem 1.5rem; }
  .auth-hero h1 { font-size: 1.9rem; }
}
