/* ============================================================
   ESTRUCTURA BENTO — shell y home del dashboard
   ------------------------------------------------------------
   A diferencia de tokens/theme.css (que solo define COLORES y
   funciona para cualquier vista), este archivo define la
   ESTRUCTURA: nav en píldora en vez de sidebar, y un home de tres
   columnas. Es la única estructura de la plataforma — no hay
   selector de tema del que colgar esto, así que va directo sobre
   las clases.

   La vista de categoría (grilla de cápsulas) NO se toca acá: ya
   hereda el look bento solo con los tokens (--panel blanco,
   --radius grande, --accent naranja), porque components.css y
   dashboard.css consumen esas variables. Este archivo es
   estructura pura, no una reescritura de componentes que ya andan.
   ============================================================ */

/* ─── Shell: sin sidebar, topbar flotante ────────────────────── */
.app {
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: 'topbar' 'main';
}

/* La topbar sigue el modo como cualquier tarjeta: --panel es blanco
   en modo claro y oscuro en modo oscuro. Es una tarjeta más del
   bento, no una "isla" de marca fija. */
.topbar {
  position: sticky;
  top: var(--sp-4);
  z-index: var(--z-sticky);
  width: calc(100% - 2 * var(--sp-5));
  max-width: var(--maxw);
  margin: var(--sp-4) auto 0;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--drop-lg);
}

/* min-width:0 en los dos niveles (el <div> flex y el <input> de
   adentro) es lo que deja que el buscador ceda espacio de verdad: un
   <input> tiene un ancho mínimo intrínseco propio del navegador que
   ignora flex-shrink si no se lo desactiva así, y sin esto se
   superpone al resto de la topbar en mobile en vez de angostarse. */
.topbar__search {
  min-width: 0;
}
.topbar__search .input {
  min-width: 0;
  width: 100%;
  border-radius: var(--radius-pill);
}
/* Negro total a pedido, pero SOLO en modo claro: el fondo del campo
   sigue --bg-2, que en oscuro es casi negro — texto negro ahí
   adentro sería invisible. */
:root[data-mode='light'] .topbar__search .input {
  color: #000000;
}

/* ─── Nav en píldora ──────────────────────────────────────────
   Reemplaza al menú de categorías: Dashboard vuelve al home, Mi
   perfil abre la vista de perfil. El modo claro/oscuro tiene su
   propio botón (#themeToggle) al costado, no vive acá adentro. */
.pill-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 4px;
  margin-inline: auto;
  border-radius: var(--radius-pill);
  background: var(--bg-2);
}

.pill-nav__item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.pill-nav__item[aria-current='page'] {
  background: var(--accent);
  color: var(--on-accent);
}

/* ─── Racha + progreso de nivel en la topbar ─────────────────── */
.topbar__streak {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-body-sm);
}

.user-menu__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.3;
}

.user-menu__progress {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

#userName::before {
  content: 'Hola, ';
  font-weight: 400;
}

/* ─── Rail de categorías ──────────────────────────────────────
   Reemplaza al sidebar vertical: una fila de chips con scroll
   horizontal, siempre visible arriba del contenido (home Y vista
   de categoría), así cambiar de categoría no depende de volver
   primero al home. */
.category-rail {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding-bottom: var(--sp-1);
  margin-bottom: var(--sp-5);
  scrollbar-width: thin;
}

.category-rail__item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 0 0 auto;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--ink-2);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--drop);
}

.category-rail__item[aria-current='page'] {
  background: var(--accent);
  color: var(--on-accent);
}

.category-rail__icon {
  display: inline-flex;
}

.category-rail__count {
  color: inherit;
  opacity: 0.7;
  font-weight: 400;
}

/* ─── Home bento ─────────────────────────────────────────────── */
#eduviewHome:not([hidden]) {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr) minmax(0, 320px);
  gap: var(--sp-5);
  align-items: start;
  margin-bottom: var(--sp-5);
}

.eduview-col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
}

/* ─── Tarjeta base del bento ──────────────────────────────────
   Todas las piezas parten de acá; los modificadores solo cambian
   fondo y color de tinta. */
.bento {
  position: relative;
  padding: var(--sp-5);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--drop);
  overflow: hidden;
}

.bento h2,
.bento h3 {
  font-family: var(--font-display);
  font-size: var(--fs-body);
  font-weight: 700;
  color: inherit;
}

/* Botón circular de "abrir" / "continuar", reutilizado en varias
   tarjetas del bento (promo, dark, continuar). */
.bento__open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--drop);
  transition: transform var(--dur-fast) var(--ease);
}
.bento__open-btn:hover {
  transform: translateX(2px);
}

/* ─── Promo (celeste, esquina superior izquierda) ────────────── */
.bento--promo {
  background: linear-gradient(150deg, var(--diamond) 0%, color-mix(in srgb, var(--diamond) 55%, var(--panel)) 100%);
  color: var(--on-diamond);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.bento--promo__art {
  display: inline-flex;
}
.bento--promo__title {
  font-size: var(--fs-display);
}
.bento--promo__desc {
  font-size: var(--fs-body-sm);
  opacity: 0.85;
  flex: 1;
}
.bento--promo__cta {
  align-self: flex-end;
}

/* ─── Métricas rápidas ────────────────────────────────────────── */
.eduview-metrics {
  display: flex;
  gap: var(--sp-3);
}
.eduview-metric {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--drop);
}
.eduview-metric__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  font-size: 18px;
}
.eduview-metric__icon[data-tone='grass'] { background: var(--grass); color: var(--on-grass); }
.eduview-metric__icon[data-tone='diamond'] { background: var(--diamond); color: var(--on-diamond); }
.eduview-metric__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.eduview-metric__label {
  font-size: 11px;
  color: var(--muted);
}
.eduview-metric__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-display);
  color: var(--ink);
}

/* ─── Chips de categoría ──────────────────────────────────────── */
.eduview-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  list-style: none;
  margin: 0;
  padding: 0;
}
.eduview-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--ink-2);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--drop);
}
.eduview-chip__icon {
  display: inline-flex;
}
.eduview-chip__count {
  color: var(--muted);
  font-weight: 400;
}

/* ─── Tarjeta oscura ("seguir viendo") ────────────────────────── */
/* Fija, no sigue el modo — mismo motivo que .topbar más arriba: es
   la tarjeta "acento oscuro" del bento, no una superficie de --panel. */
.bento--dark {
  background: #1E1E24;
  color: #F5F5FA;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--sp-3);
}
.bento--dark::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 159, 104, 0.25) 0%, transparent 55%);
  pointer-events: none;
}
.bento--dark__tag,
.bento--soft__tag,
.bento--routine__tag {
  display: inline-block;
  align-self: flex-start;
  padding: 2px var(--sp-3);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.14);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bento--soft__tag,
.bento--routine__tag {
  background: rgba(0, 0, 0, 0.08);
  color: var(--on-diamond);
}
.bento--dark__title {
  position: relative;
  font-size: var(--fs-body);
}
.bento--dark__cta {
  align-self: flex-end;
}
/* La tarjeta oscura no sigue el modo (ver arriba), así que su botón
   circular tampoco: var(--panel)/var(--ink) se vuelven oscuros sobre
   oscuro en modo oscuro y el círculo desaparece. */
.bento--dark .bento__open-btn {
  background: #FFFFFF;
  color: #1E1E24;
}

/* ─── Banner secundario (celeste suave) ───────────────────────── */
.bento--soft {
  background: color-mix(in srgb, var(--diamond) 30%, var(--panel));
  color: var(--on-diamond);
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-2);
}
.bento--soft__title {
  font-size: var(--fs-body-sm);
}

/* ─── Progreso semanal (centro, naranja) ─────────────────────── */
.bento--progress {
  background: var(--grass);
  color: var(--on-grass);
}
.bento--progress__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.bento--progress__scope {
  padding: 2px var(--sp-3);
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.1);
  font-size: 11px;
  font-weight: 700;
}
.bento--progress__stats {
  display: flex;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-body-sm);
}
.bento--progress__stats strong {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  margin-right: 4px;
}

.eduview-bars {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-3);
  height: 140px;
  padding-top: 22px;
}
.eduview-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  height: 100%;
}
.eduview-bar-col__track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
}
.eduview-bar {
  position: relative;
  width: 100%;
  min-height: 6px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: rgba(0, 0, 0, 0.16);
}
/* Fijo, no sigue el modo — es la MISMA barra oscura en claro y en
   oscuro, igual que .bento--dark; --panel-3 ya no vale para esto
   (ver tokens/theme.css: volvió a ser una superficie hundida normal). */
.eduview-bar--peak {
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.35) 0 4px,
      transparent 4px 9px
    ),
    #1E1E24;
}
.eduview-bar__value {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
}
.eduview-bar-col__label {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.8;
}

/* ─── Logros (reemplaza el ranking del mock: no hay leaderboard) ── */
.bento--achievements {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.bento--achievements__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  background: var(--gold);
  color: var(--on-gold);
  font-size: 18px;
}
.bento--achievements__text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.bento--achievements__title {
  font-weight: 700;
}
.bento--achievements__sub {
  font-size: 12px;
  color: var(--muted);
}
.bento--achievements__badges {
  display: flex;
  gap: 4px;
}
.eduview-ach-badge {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--ach-color, var(--gold));
  color: #fff;
  font-size: 14px;
  box-shadow: 0 0 0 2px var(--panel);
}

/* ─── Lista de cápsulas ───────────────────────────────────────── */
.eduview-lesson-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  list-style: none;
  padding: 0;
}
.eduview-lesson {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.eduview-lesson__thumb {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  object-fit: cover;
}
.eduview-lesson__text {
  flex: 1;
  min-width: 0;
}
.eduview-lesson__title {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.eduview-lesson__meta {
  font-size: 12px;
  color: var(--muted);
}
.eduview-lesson--empty {
  color: var(--muted);
  font-size: var(--fs-body-sm);
}
.eduview-lesson .bento__open-btn {
  width: 32px;
  height: 32px;
  font-size: 14px;
  background: var(--bg-2);
}

/* ─── Racha semanal ───────────────────────────────────────────── */
.bento--reading__sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: var(--sp-3);
}
.eduview-week {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
}
.eduview-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
}
.eduview-day__dot {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: var(--bg-2);
  color: var(--muted);
  font-size: 13px;
}
.eduview-day[data-active='true'] .eduview-day__dot {
  background: var(--grass);
  color: var(--on-grass);
}
.eduview-day__label {
  font-size: 11px;
  color: var(--muted);
}

/* ─── Rendimiento mensual ─────────────────────────────────────── */
.eduview-months {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-3);
  height: 72px;
  margin-top: var(--sp-3);
}
.eduview-month-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  height: 100%;
}
.eduview-month-col__track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
}
.eduview-month-bar {
  width: 100%;
  min-height: 4px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--diamond);
}
.eduview-month-col__label {
  font-size: 10px;
  color: var(--muted);
}

/* ─── Rutina de aprendizaje ───────────────────────────────────── */
.bento--routine {
  background: color-mix(in srgb, var(--diamond) 30%, var(--panel));
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  align-items: flex-start;
}
.bento--routine__title {
  font-weight: 600;
  color: var(--ink);
}

/* ─── Recomendado para vos ────────────────────────────────────── */
.eduview-recommend__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}
.eduview-recommend__empty {
  grid-column: 1 / -1;
  margin-top: var(--sp-3);
  font-size: var(--fs-body-sm);
  color: var(--muted);
}
.eduview-recommend-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.eduview-recommend-card__img {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  object-fit: cover;
}
.eduview-recommend-card__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1180px) {
  #eduviewHome:not([hidden]) {
    grid-template-columns: 1fr 1fr;
  }
  .eduview-col--right {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .eduview-col--right > * {
    flex: 1 1 260px;
  }
}

@media (max-width: 760px) {
  .topbar {
    width: calc(100% - 2 * var(--sp-3));
    margin: var(--sp-3) auto 0;
    flex-wrap: wrap;
  }
  /* Tres filas: marca + accesos de usuario arriba, buscador y
     pill-nav abajo a ancho completo. Sin esto el buscador se achica
     a un cuadradito inservible en vez de bajar de línea. */
  .topbar__brand {
    order: 1;
  }
  .topbar__side {
    order: 2;
  }
  .topbar__search {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
    margin-inline: 0;
  }
  .pill-nav {
    order: 4;
    width: 100%;
  }
  #eduviewHome:not([hidden]) {
    grid-template-columns: 1fr;
  }
  .eduview-col--right {
    flex-direction: column;
  }
  .eduview-col--right > * {
    flex: 1 1 auto;
  }
}
