:root {
  --bg: #366b62;
  --card: #12131778;
  --muted: #e9edf0;
  --text: #e9edf0;
  --brand: #6ee7b7;
  --brand-2: #60a5fa;
  --ring: rgba(110, 231, 183, 0.35);

  /* Ajustes de alturas */
  --hero-card-max-h: 100%;
  --tb-h: 36px; /* altura de la topbar */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: url("../../img/bg.png") center / cover fixed no-repeat;
  background-color: #0b0c10; /* fallback */
  color: var(--text);
  line-height: 1.5;
}

/* =========================
      TOPBAR
   ========================= */
.topbar{
  position: sticky;
  top: 0;
  z-index: 60;
  background: #000;
  color: #fff;
  border-bottom: 0px solid rgba(255,255,255,.08);
}

.topbar-inner{
  max-width: 1100px;
  margin: 0 auto;
  padding: 6px 16px;
  min-height: var(--tb-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.clock{ font-variant-numeric: tabular-nums; opacity: .95; }
.topbar-title{ letter-spacing: .4px; text-transform: uppercase; font-size: 13px; }

@media (max-width: 480px){
  .topbar-inner{ font-size: 12px; }
  .topbar-title{ font-size: 12px; }
}

/* =========================
      HEADER Y LOGO
   ========================= */
.header {
  position: sticky;
  top: var(--tb-h);
  z-index: 50;
  backdrop-filter: blur(8px);
  background: rgba(11, 12, 16, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  transition: padding 0.25s ease;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-decoration: none;
  color: #fff;
  opacity: 0;
  transform: translateY(-6px) scale(.98);
  animation: brandIn .5s ease .05s forwards;
}

.brand .logo {
  width: 40%;
  height: 40%;
  border-radius: 10px;
  overflow: hidden;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width .25s ease, height .25s ease, transform .25s ease, box-shadow .25s ease;
}

.brand .logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.brand span {
  font-size: 22px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color .3s ease, font-size .25s ease;
}

.brand span small {
  opacity: 0.7;
  font-weight: 600;
  font-size: 16px;
  transition: font-size .25s ease, opacity .25s ease;
}

.brand:hover { filter: brightness(1.08); }
.brand .logo:hover { transform: scale(1.06); box-shadow: 0 0 12px rgba(110, 231, 183, 0.5); }

.header.shrink {
  background: rgba(11, 12, 16, 0.95);
  border-bottom-color: rgba(255,255,255,0.08);
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.header.shrink .header-inner { padding: 10px 16px; }
.header.shrink .brand .logo { width: 40px; height: 40px; }
.header.shrink .brand span { font-size: 18px; }
.header.shrink .brand span small { font-size: 14px; opacity: .65; }

@media (max-width: 768px) {
  .brand .logo { width: 40%; height: 40%; }
  .brand span { font-size: 20px; }
  .brand span small { font-size: 15px; }
  .header.shrink .brand .logo { width: 36px; height: 36px; }
  .header.shrink .brand span { font-size: 17px; }
  .header.shrink .brand span small { font-size: 13px; }
}

@media (max-width: 480px) {
  .brand .logo { width: 40%; height: 40%; }
  .brand span { font-size: 18px; }
  .brand span small { font-size: 14px; }
  .header.shrink .brand .logo { width: 32px; height: 32px; }
  .header.shrink .brand span { font-size: 16px; }
  .header.shrink .brand span small { font-size: 12px; }
}

@keyframes brandIn { to { opacity: 1; transform: translateY(0) scale(1); } }

/* =========================
      BOTONES Y FILTROS
   ========================= */
.searchbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
  flex-wrap: wrap;
}

.input, .select, .btn {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #0b0c10;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}

.input:focus, .select:focus {
  box-shadow: 0 0 0 4px var(--ring);
  border-color: transparent;
}

.btn { cursor: pointer; font-weight: 600; }
.btn.brand {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #ffffff;
  border-color: transparent;
}
.btn.ghost { background: transparent; }

/* =========================
      HERO
   ========================= */
.hero {
  max-width: 1100px;
  margin: 18px auto 6px;
  padding: 18px 16px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  align-items: center;
}

.hero h1 { margin: 6px 0 8px; font-size: 28px; }
.hero p { margin: 0; color: var(--muted); }

@media (max-width: 1024px) { .hero { grid-template-columns: 1fr; } }

:root{ --hero-card-max-h: 100%; }
.hero{ align-items: stretch !important; }
.hero > .card{
  display: flex;
  flex-direction: column;
  height: var(--hero-card-max-h);
  max-height: var(--hero-card-max-h);
  overflow: hidden;
  position: relative;
}
.hero > .card::after{
  content:"";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 28px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(11,12,16,0), rgba(11,12,16,.55));
}
.hero .ann-list{
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin-top: 0;
}
@media (max-width: 1024px){
  .hero > .card{ height: auto; max-height: none; overflow: visible; }
  .hero .ann-list{ overflow: visible; }
}
.hero.single{
  grid-template-columns: 1fr;
  justify-items: center;
}
.hero.single > .card{
  justify-self: center;
  width: auto;
  max-width: 560px;
  text-align: center;
}
.hero .card.card-center { max-width: 560px; margin: 0 auto; text-align: center; }

/* =========================
      CONTENEDOR PRINCIPAL
   ========================= */
.container{
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 16px 40px;
  box-sizing: border-box;
}

/* =========================
      GRID DE TARJETAS (centrado)
   ========================= */
/* Usamos Flex para centrar filas con pocos ítems */
.grid{
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;     /* ← centra cada fila */
  align-content: flex-start;
  width: 100%;
  padding: 10px 12px 32px;
}

/* Títulos que ocupan toda la fila */
.grid-title,
.grid-title1,
.grid-subtitle{
  flex-basis: 100%;
  text-align: center;
  margin: 18px 0 10px;
}
.grid-subtitle > span,
.section-title > span{
  display: inline-block;
  font-weight: 800;
  color: #000;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
  background: rgba(255,255,255,.92);
  padding: 6px 12px;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
}

/* =========================
      TARJETAS
   ========================= */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 0px;
  padding: 1px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
  align-items: center;
}

.grid > .card,
.grid > a.card,
.grid > .modelo,
.grid > a.modelo,
.card.course{
  width: 170px;                 /* ancho fijo para mosaico consistente */
  display: block;
  text-align: center;
  margin: 0;
  float: none;                  /* neutraliza floats heredados */
  position: relative;
  transform-origin: center;
  will-change: transform, filter;
  transition: transform .25s ease, filter .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.card.course:hover,
.card.course:focus-within{
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.08);
  border-color: rgba(110,231,183,.45);
  box-shadow: 0 18px 50px rgba(110,231,183,.18), 0 10px 30px rgba(0,0,0,.35);
  z-index: 2;
}

.card.course .title{ transition: color .25s ease; }
.card.course:hover .title,
.card.course:focus-within .title{ color: var(--brand); }

.card.course > a:first-child{ display:block; width:100%; }

/* Miniatura centrada */
.thumb {
  width: 150px;
  height: 100px;
  object-fit: cover;
  display: block;
  margin: 8px auto 0; /* centra horizontalmente */
}

/* Centrar todo el contenido de la tarjeta */
.card.course {
  text-align: center; /* centra texto e inline elements */
}

.card.course .card-body {
  padding: 1px 1px 1px;
  display: grid;
  gap: 1px;
  place-items: center; /* centra elementos del grid */
}

.card.course .title{
  display: block;
  font-weight: 700;
  font-size: 12px;
  margin: 0;
  color: #ffffff;
  text-align: center;
  text-decoration: none;
}

.card.course .desc{
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  max-height: 2.7em;
  overflow: hidden;
  text-align: center;
}

.actions{ display:flex; gap:8px; justify-content:center; flex-wrap:wrap; }
.btn{ padding: 8px 10px; font-size: 13px; border-radius: 8px; }

.card.course .card-body .btn{ display:inline-block; }

/* Tarjetas .modelo clickables */
.card.course.modelo{ cursor: pointer; justify-content: center; }
.card.course.modelo.metro-btn{ text-decoration: none; color: inherit; }
.card.course.modelo.metro-btn .btn.brand{ pointer-events: none; }

/* Responsive tarjetas */
@media (max-width: 480px){
  .grid{ gap: 10px; }
  .grid > .card,
  .grid > a.card,
  .grid > .modelo,
  .grid > a.modelo,
  .card.course{
    width: 160px;
  }
  .thumb{ width: 100px; height: 60px; }
}

/* =========================
      COURSE PAGE (player/lista)
   ========================= */
.player-wrap {
  max-width: 1100px;
  margin: 18px auto;
  padding: 0 16px 24px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}
@media (max-width: 1024px) { .player-wrap { grid-template-columns: 1fr; } }

.player {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
}

.player-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.player-title { font-size: 18px; font-weight: 700; }
.player-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.pill { padding: 8px 10px; border-radius: 999px; font-size: 13px; border: 1px solid rgba(255,255,255,0.1); }
.pill.saved { border-color: var(--brand); color: var(--brand); background: rgba(110,231,183,0.08); }

.sec { background: var(--card); border: 1px solid rgba(255,255,255,0.06); border-radius: 16px; padding: 14px; }
.sec h3 { margin: 0 0 8px; font-size: 16px; }

.list { display: grid; gap: 10px; max-height: 420px; overflow: auto; padding-right: 6px; }

.lesson {
  border: 1px solid rgba(255,255,255,0.06);
  padding: 10px;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255,255,255,0.02);
}
.lesson small { color: var(--muted); }

/* =========================
      MODAL
   ========================= */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
}
.modal.open { display: flex; }

.modal-card {
  width: min(92vw, 520px);
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.5);
}
.modal-card h3 { margin: 0 0 8px; }
.modal-card p { margin: 10px 0 0; color: var(--muted); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

/* =========================
      FOOTER
   ========================= */
.footer {
  color: #9aa4ad;
  font-size: 12px;
  text-align: center;
  padding: 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* =========================
      SCROLLBAR FINO
   ========================= */
.list::-webkit-scrollbar { width: 10px; }
.list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 999px; }

/* =========================
      OPACIDAD CONTENEDORES
   ========================= */
.card, .player, .sec, .modal-card { background: var(--card) !important; }

/* =========================
      EFECTOS Y ACCESIBILIDAD
   ========================= */
.btn.brand{
  position: fixed;
  transition: transform .22s ease, filter .22s ease, box-shadow .22s ease;
  will-change: transform, filter, box-shadow;
  border-color: transparent;
}
.btn.brand::after{
  content:"";
  position:absolute;
  inset:-2px;
  border-radius:inherit;
  pointer-events:none;
  box-shadow: 0 0 0 rgba(110,231,183,0);
  transition: box-shadow .22s ease;
}
.btn.brand:hover, .btn.brand:focus-visible{
  transform: translateY(-1px) scale(1.04);
  filter: brightness(1.08);
  box-shadow: 0 12px 28px rgba(110,231,183,.22);
}
.btn.brand:hover::after, .btn.brand:focus-visible::after{
  box-shadow: 0 0 18px rgba(110,231,183,.45);
}
.btn.brand:active{
  transform: translateY(0) scale(.98);
  box-shadow: 0 6px 16px rgba(110,231,183,.18);
}
.btn.brand:focus-visible{
  outline: none;
  box-shadow: 0 12px 28px rgba(110,231,183,.22), inset 0 0 0 2px rgba(110,231,183,.5);
}

.kfx-anim-neutral{
  position: relative;
  transition: transform .22s ease, filter .22s ease, box-shadow .22s ease;
  will-change: transform, filter, box-shadow;
}
.kfx-anim-neutral::after{
  content:"";
  position:absolute;
  inset:-2px;
  border-radius:inherit;
  pointer-events:none;
  box-shadow: 0 0 0 rgba(255,255,255,0);
  transition: box-shadow .22s ease;
}
.kfx-anim-neutral:hover, .kfx-anim-neutral:focus-visible{
  transform: translateY(-1px) scale(1.04);
  filter: brightness(1.04);
  box-shadow: 0 10px 24px rgba(255,255,255,.15);
}
.kfx-anim-neutral:hover::after, .kfx-anim-neutral:focus-visible::after{
  box-shadow: 0 0 18px rgba(255,255,255,.25);
}
.kfx-anim-neutral:active{
  transform: translateY(0) scale(.98);
  box-shadow: 0 6px 16px rgba(255,255,255,.12);
}
.kfx-anim-neutral:focus-visible{
  outline: none;
  box-shadow: 0 10px 24px rgba(255,255,255,.15), inset 0 0 0 2px rgba(255,255,255,.35);
}

@media (prefers-reduced-motion: reduce){
  .btn.brand,
  .kfx-anim-neutral,
  .card.course,
  .card.course .thumb{
    transition: none !important;
  }
  .card.course:hover, .card.course:focus-within{
    transform: none; filter: none;
  }
}

/* =========================
      SECTION TITLES
   ========================= */
.section-title{
  margin: 22px 0 14px;
  text-align: center;
}
.section-title > span{
  display: inline-block;
  color: #000;
  background: rgba(255,255,255,.0);
  padding: 6px 12px;
  border-radius: 10px;
  font-weight: 800;
  letter-spacing: .3px;
  text-decoration: underline;
  text-decoration-color: #000;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
}

/* =========================
      TOOLTIP
   ========================= */
.kfx-tooltip{
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease;
  max-width: 340px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0,0,0,0.88);
  color: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  font-size: 13px;
  line-height: 1.35;
  white-space: normal;
  word-wrap: break-word;
}
.kfx-tooltip.show{ opacity: 1; transform: translateY(0); }
.kfx-tip-title{ font-weight: 700; margin-bottom: 6px; color: var(--brand); font-size: 14px; }
.kfx-tip-body{ color: #e7ecef; }

/* =========================
      LISTA INLINE (perfil)
   ========================= */
.kfx-inline-list{
  display: flex;
  gap: 16px;
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.kfx-inline-list li{ margin: 0; white-space: nowrap; }
.kfx-inline-list li:not(:last-child)::after{
  content: "";
  display: inline-block;
  width: 1px;
  height: 14px;
  background: rgba(255,255,255,.35);
  margin: 0 8px 0 12px;
  vertical-align: middle;
}
:root{
  --card-w: 150px;     /* ancho tarjeta desktop */
  --card-w-sm: 140px;  /* ancho tarjeta móvil */
  --thumb-w: 130px;
  --thumb-h: 86px;
}

.grid > .card,
.grid > a.card,
.grid > .modelo,
.grid > a.modelo,
.card.course{ width: var(--card-w); }

@media (max-width: 480px){
  .grid > .card,
  .grid > a.card,
  .grid > .modelo,
  .grid > a.modelo,
  .card.course{ width: var(--card-w-sm); }
}

.thumb{ width: var(--thumb-w); height: var(--thumb-h); }
/* === Centrar el botón "Cerrar sesión" === */
.actions-row{
  margin-top: 14px;
  width: 100%;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  text-align: center;
  padding: 10px 12px;
}

/* Asegura que el propio botón no tenga posicionamiento raro ni floats */
#btnLogout{
  position: static !important;
  float: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* ========== FOOTER ========== */
footer {
  background-color: #00000066;
  color: white;
  padding: 25px 20px;
  text-align: center;
  font-size: 13px;
  width: 100%;
  margin-top: auto;
}

.footer-content img {
  height: 70px;
}

.footer-content p {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: bold;
}