/* ==========================================================================
   site-ui.css — Mierda, no era David
   • Controles discretos: idioma (ES/EN) y tema (oscuro/claro)
   • Tema claro: se aplica con la clase `light` en <html> (darkMode:'class')
   ========================================================================== */

/* ---------- controles flotantes (idioma + tema) — esquina superior derecha ---------- */
.mnd-ui {
  position: fixed;
  right: max(.9rem, env(safe-area-inset-right));
  top: calc(5.5rem + env(safe-area-inset-top));
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: opacity .2s ease;
}
.mnd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, .3);
  background: rgba(15, 23, 42, .22);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: #e2e8f0;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.mnd-btn:hover { background: rgba(30, 41, 59, .75); color: #fff; transform: translateY(-1px); }
.mnd-btn svg { width: 1.15rem; height: 1.15rem; }
.mnd-flag { font-size: 1.15rem; line-height: 1; }
@media (max-width: 640px) {
  .mnd-btn { width: 2.1rem; height: 2.1rem; }
  .mnd-btn svg { width: 1.05rem; height: 1.05rem; }
  .mnd-flag { font-size: 1.05rem; }
}

/* ---------- pie de página: contador de visitantes ---------- */
.mnd-visits {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .72rem;
  color: #94a3b8;
  opacity: .9;
}
.mnd-visits .dot {
  width: .42rem; height: .42rem; border-radius: 9999px;
  background: #34d399; display: inline-block;
}

/* ==========================================================================
   TEMA CLARO  (html.light)
   El sitio está maquetado en oscuro con utilidades slate; aquí las remapeamos.
   Se usan selectores de atributo (substring) para cubrir las variantes /opacity.
   ========================================================================== */
html.light body {
  background-color: #f6f8fb !important;
  color: #0f172a !important;
}
html.light {
  color-scheme: light;
  background-color: #f6f8fb !important;
  color: #0f172a !important;
}
html.light [class*="bg-[#0B1120]"],
html.light [class*="bg-slate-950"],
html.light [class*="bg-slate-900"] {
  background-color: #ffffff !important;
}
html.light [class*="bg-slate-800"] { background-color: #eef2f7 !important; }
html.light [class*="bg-slate-700"] { background-color: #e2e8f0 !important; }
html.light [class*="bg-slate-100"] { background-color: #ffffff !important; }

html.light [class*="text-white"],
html.light [class*="text-slate-50"],
html.light [class*="text-slate-100"],
html.light [class*="text-slate-200"],
html.light [class*="text-slate-300"] { color: #0f172a !important; }
html.light [class*="text-slate-400"] { color: #475569 !important; }
html.light [class*="text-slate-500"] { color: #64748b !important; }
html.light [class*="text-slate-600"] { color: #64748b !important; }
html.light [class*="placeholder-slate"]::placeholder { color: #94a3b8 !important; }

html.light [class*="border-slate-"] { border-color: #dbe3ec !important; }
html.light [class*="divide-slate-"] > * + * { border-color: #e5eaf1 !important; }
html.light [class*="border-white"] { border-color: #dbe3ec !important; }

/* tarjetas/toolbars con blur y semitransparencia clara */
html.light [class*="backdrop-blur"] { background-color: rgba(255, 255, 255, .86) !important; }

/* el botón/segmento activo del menú lateral y pestañas */
html.light .mnd-btn {
  border-color: #94a3b8;
  background: rgba(255, 255, 255, .42);
  color: #334155;
  text-shadow: 0 1px 2px rgba(255, 255, 255, .6);
}
html.light .mnd-btn:hover { background: #ffffff; color: #0f172a; }

/* degradado del logo y textos con gradiente: mantener legibles */
html.light .text-gradient {
  background: linear-gradient(135deg, #0369a1 0%, #4f46e5 55%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* imágenes de láminas/portada con fondo oscuro -> borde suave en claro */
html.light img.bg-white { background-color: #fff !important; }

/* sombras un poco más suaves en claro */
html.light .shadow-2xl, html.light .shadow-lg { box-shadow: 0 10px 25px -12px rgba(15, 23, 42, .25) !important; }

/* ==========================================================================
   REPRODUCTOR DEL LECTOR (capitulo.html)
   Mac: la caja de control se veía negra en tema claro y el control de
   "Velocidad" se perdía. Se fija una caja AZUL OSCURA legible en ambos temas.
   ========================================================================== */
.player-box {
  background: linear-gradient(180deg, #0d2b45 0%, #0a2036 100%) !important;
  border: 1px solid #1e4b73 !important;
  color: #e6f1fb !important;
  box-shadow: 0 10px 28px -14px rgba(2, 16, 32, .6);
}
.player-box #tiempo { color: #9fc7ea !important; }
.player-box .player-rate { color: #cfe6ff !important; font-weight: 600; }
.player-box select, .player-box .player-select {
  background: #12324f !important;
  color: #eaf4ff !important;
  border: 1px solid #2f6493 !important;
  border-radius: .45rem;
  padding: .25rem .5rem;
  font-weight: 600;
}
.player-box select option { background: #12324f; color: #eaf4ff; }
.player-box input[type="range"] { accent-color: #38bdf8 !important; }
/* el tema claro no debe repintar la caja del reproductor */
html.light .player-box { background: linear-gradient(180deg, #0d2b45 0%, #0a2036 100%) !important; color: #e6f1fb !important; }
html.light .player-box .player-rate { color: #cfe6ff !important; }

/* ==========================================================================
   BOTÓN DE SESIÓN (nombre del usuario) + MENÚ DESPLEGABLE — arriba derecha
   ========================================================================== */
.mnd-session {
  width: auto;
  max-width: 12rem;
  padding: 0 .6rem;
  gap: .35rem;
  border-radius: 9999px;
}
.mnd-session svg { width: 1rem; height: 1rem; flex: none; }
.mnd-session .mnd-uname {
  max-width: 7.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .74rem;
  font-weight: 700;
}
.mnd-session .mnd-caret { width: .7rem; height: .7rem; opacity: .8; }
.mnd-usermenu {
  position: absolute;
  top: calc(100% + .45rem);
  right: 0;
  min-width: 11.5rem;
  display: none;
  flex-direction: column;
  padding: .35rem;
  border-radius: .7rem;
  border: 1px solid rgba(148, 163, 184, .3);
  background: rgba(15, 23, 42, .97);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .7);
  z-index: 60;
}
.mnd-usermenu.open { display: flex; }
.mnd-usermenu a, .mnd-usermenu button {
  display: block;
  width: 100%;
  padding: .5rem .65rem;
  border: 0;
  border-radius: .5rem;
  background: transparent;
  color: #e2e8f0;
  font-size: .8rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.mnd-usermenu a:hover, .mnd-usermenu button:hover { background: rgba(56, 189, 248, .16); color: #fff; }
.mnd-usermenu .mnd-sep { height: 1px; margin: .3rem .2rem; background: rgba(148, 163, 184, .25); }
html.light .mnd-usermenu { background: #ffffff; border-color: #dbe3ec; }
html.light .mnd-usermenu a, html.light .mnd-usermenu button { color: #0f172a; }
html.light .mnd-usermenu a:hover, html.light .mnd-usermenu button:hover { background: #e0f2fe; color: #0369a1; }
