/* StreamingPanel: portada (index.php). Tema "liquid glass" negro.
   Capas: fondo negro → luces líquidas desenfocadas (.sp-luz) → grano → tarjeta de vidrio.
   El vidrio refracta las luces de atrás (backdrop-filter); el borde es un degradado enmascarado
   (brillo especular) y el reflejo sigue al puntero con --mx / --my (lo pone el script de index.php). */
:root {
  --sp-negro: #050507;
  --sp-texto: #f4f4f6;
  --sp-tenue: rgba(244, 244, 246, .56);
  --sp-mas-tenue: rgba(244, 244, 246, .34);
  --sp-vidrio: rgba(255, 255, 255, .03);
  --sp-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sp-serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
}

* { box-sizing: border-box; }

html { background: var(--sp-negro); }

body.sp-glass {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  overflow-x: hidden;
  background: var(--sp-negro);
  color: var(--sp-texto);
  font-family: var(--sp-sans);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Luces líquidas ---------- */
.sp-luces { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.sp-luz {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .75;
  will-change: transform;
}
.sp-luz.hielo   { width: 46vmax; height: 46vmax; left: -12vmax; top: -16vmax; background: radial-gradient(circle at 40% 40%, #9ec5ff 0%, rgba(158,197,255,0) 62%); animation: sp-deriva-a 38s ease-in-out infinite alternate; }
.sp-luz.violeta { width: 40vmax; height: 40vmax; right: -14vmax; top: 18vh; background: radial-gradient(circle at 50% 50%, #8b7bff 0%, rgba(139,123,255,0) 60%); opacity: .6; animation: sp-deriva-b 46s ease-in-out infinite alternate; }
.sp-luz.centro  { width: 30vmax; height: 30vmax; left: calc(50% - 15vmax); top: calc(50% - 15vmax); background: conic-gradient(from 0deg, #9ec5ff, #8b7bff, #5fe0c8, #9ec5ff); opacity: .34; filter: blur(70px); animation: sp-orbita 28s linear infinite; }
.sp-luz.agua    { width: 34vmax; height: 34vmax; left: 22vw; bottom: -20vmax; background: radial-gradient(circle at 50% 50%, #5fe0c8 0%, rgba(95,224,200,0) 58%); opacity: .45; animation: sp-deriva-c 52s ease-in-out infinite alternate; }

@keyframes sp-deriva-a { to { transform: translate(14vw, 12vh) scale(1.12); } }
@keyframes sp-deriva-b { to { transform: translate(-18vw, -10vh) scale(.9); } }
@keyframes sp-orbita { from { transform: rotate(0deg) translateX(6vmax) rotate(0deg); } to { transform: rotate(360deg) translateX(6vmax) rotate(-360deg); } }
@keyframes sp-deriva-c { to { transform: translate(-10vw, -14vh) scale(1.18); } }

/* Viñeta: oscurece los bordes para que la luz quede detrás del vidrio */
.sp-luces::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(5,5,7,0) 0%, rgba(5,5,7,.35) 72%, rgba(5,5,7,.92) 100%);
}

/* Grano fino (evita el degradado "plano" de pantalla) */
body.sp-glass::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* ---------- Tarjeta de vidrio ---------- */
.sp-vidrio {
  --mx: 50%;
  --my: 0%;
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 468px;
  padding: 44px 36px 32px;
  border-radius: 30px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255,255,255,.07) 0%, rgba(255,255,255,.015) 38%, rgba(255,255,255,.03) 100%),
    var(--sp-vidrio);
  -webkit-backdrop-filter: blur(30px) saturate(180%) brightness(1.08);
  backdrop-filter: blur(30px) saturate(180%) brightness(1.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.16),
    inset 0 -1px 0 rgba(255,255,255,.04),
    0 40px 80px -30px rgba(0,0,0,.9),
    0 0 0 1px rgba(0,0,0,.5);
  isolation: isolate;
  animation: sp-aparece .9s cubic-bezier(.2,.8,.2,1) both;
}

/* Borde especular: más brillante arriba a la izquierda, como luz rasante sobre el canto */
.sp-vidrio::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(145deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.08) 28%, rgba(255,255,255,.02) 55%, rgba(255,255,255,.22) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

/* Reflejo que sigue al puntero */
.sp-vidrio::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(255,255,255,.09), rgba(255,255,255,0) 45%);
  pointer-events: none;
  transition: opacity .4s;
}

@keyframes sp-aparece {
  from { opacity: 0; transform: translateY(14px) scale(.985); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* ---------- Contenido ---------- */
.sp-marca {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
  color: var(--sp-texto);
  text-decoration: none;
}
.sp-marca svg { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 6px 18px rgba(158,197,255,.25)); }
.sp-marca span { font-size: 21px; font-weight: 600; letter-spacing: -.4px; }
.sp-marca b { font-weight: 600; color: var(--sp-tenue); }

.sp-ceja {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--sp-tenue);
}
.sp-ceja::before,
.sp-ceja::after {
  content: "";
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.35));
}
.sp-ceja::after { transform: scaleX(-1); }

.sp-vidrio h1 {
  margin: 0 0 18px;
  font-size: clamp(28px, 6.4vw, 36px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.9px;
}
.sp-vidrio h1 em {
  font-family: var(--sp-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.2px;
  background: linear-gradient(100deg, #ffffff 10%, #c9dbff 45%, #bfb4ff 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sp-desc {
  margin: 0 auto 32px;
  max-width: 370px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--sp-tenue);
}

/* Botón: píldora blanca sólida; el destello cruza al pasar el puntero */
.sp-entrar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 200px;
  padding: 15px 30px;
  border-radius: 999px;
  overflow: hidden;
  background: #f4f4f6;
  color: #0a0a0c;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.1px;
  text-decoration: none;
  box-shadow: 0 10px 30px -10px rgba(158,197,255,.45), inset 0 -2px 0 rgba(0,0,0,.08);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s;
}
.sp-entrar svg { width: 16px; height: 16px; transition: transform .25s cubic-bezier(.2,.8,.2,1); }
.sp-entrar::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 40%;
  background: linear-gradient(100deg, rgba(255,255,255,0), rgba(255,255,255,.9), rgba(255,255,255,0));
  transform: skewX(-20deg);
  opacity: 0;
}
.sp-entrar:hover { transform: translateY(-1px); box-shadow: 0 16px 40px -12px rgba(158,197,255,.6), inset 0 -2px 0 rgba(0,0,0,.08); }
.sp-entrar:hover svg { transform: translateX(3px); }
.sp-entrar:hover::after { opacity: 1; animation: sp-destello .8s ease-out; }
.sp-entrar:active { transform: translateY(0) scale(.98); }
.sp-entrar:focus-visible { outline: 2px solid #9ec5ff; outline-offset: 4px; }

@keyframes sp-destello { from { left: -60%; } to { left: 130%; } }

.sp-pie {
  margin: 34px -36px 0;
  padding: 18px 28px 0;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: 12px;
  line-height: 1.6;
  color: var(--sp-mas-tenue);
}
.sp-pie strong {
  font-weight: 600;
  color: var(--sp-tenue);
}

/* ---------- Pantallas chicas ---------- */
@media (max-width: 480px) {
  .sp-vidrio { padding: 36px 22px 26px; border-radius: 24px; }
  .sp-pie { margin: 28px -22px 0; padding: 16px 18px 0; }
  .sp-entrar { width: 100%; }
  .sp-ceja { letter-spacing: .2em; font-size: 10px; }
  .sp-ceja::before, .sp-ceja::after { display: none; }
}

/* Sin backdrop-filter (navegadores viejos): vidrio más opaco para que se lea */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sp-vidrio { background: rgba(18,18,22,.92); }
}

@media (prefers-reduced-motion: reduce) {
  .sp-luz, .sp-vidrio, .sp-entrar::after { animation: none !important; }
  .sp-entrar, .sp-entrar svg { transition: none; }
}

/* ---------- Tema claro (?tema=claro) ----------
   Mismo vidrio sobre fondo perla: las luces van más saturadas porque sobre blanco se lavan,
   el vidrio es blanco translúcido y el botón se invierte (píldora negra). */
body.sp-glass.claro {
  --sp-negro: #eceef3;
  --sp-texto: #0b0c10;
  --sp-tenue: rgba(11, 12, 16, .58);
  --sp-mas-tenue: rgba(11, 12, 16, .42);
  --sp-vidrio: rgba(255, 255, 255, .38);
}
html:has(body.sp-glass.claro) { background: #eceef3; }
.claro .sp-luz { opacity: .9; filter: blur(80px); }
.claro .sp-luz.hielo   { background: radial-gradient(circle at 40% 40%, #7fb2ff 0%, rgba(127,178,255,0) 62%); }
.claro .sp-luz.violeta { background: radial-gradient(circle at 50% 50%, #a78bfa 0%, rgba(167,139,250,0) 60%); opacity: .75; }
.claro .sp-luz.agua    { background: radial-gradient(circle at 50% 50%, #3fd3b6 0%, rgba(63,211,182,0) 58%); opacity: .6; }
.claro .sp-luz.centro  { opacity: .55; }
.claro .sp-luces::after { background: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(236,238,243,0) 0%, rgba(236,238,243,.3) 72%, rgba(236,238,243,.9) 100%); }
body.sp-glass.claro::after { opacity: .05; mix-blend-mode: multiply; }

.claro .sp-vidrio {
  background:
    linear-gradient(180deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.18) 40%, rgba(255,255,255,.28) 100%),
    var(--sp-vidrio);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  backdrop-filter: blur(30px) saturate(190%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    inset 0 -1px 0 rgba(255,255,255,.35),
    0 40px 80px -36px rgba(30,34,60,.35),
    0 0 0 1px rgba(255,255,255,.4);
}
.claro .sp-vidrio::before { background: linear-gradient(145deg, rgba(255,255,255,1) 0%, rgba(255,255,255,.3) 30%, rgba(11,12,16,.06) 60%, rgba(255,255,255,.8) 100%); }
.claro .sp-vidrio::after { background: radial-gradient(420px circle at var(--mx) var(--my), rgba(255,255,255,.55), rgba(255,255,255,0) 45%); }

.claro .sp-marca svg { filter: drop-shadow(0 8px 18px rgba(30,34,60,.25)); }
.claro .sp-ceja::before, .claro .sp-ceja::after { background: linear-gradient(90deg, rgba(11,12,16,0), rgba(11,12,16,.3)); }
.claro .sp-vidrio h1 em { background: linear-gradient(100deg, #0b0c10 5%, #3b5bdb 50%, #7048e8 90%); -webkit-background-clip: text; background-clip: text; }

.claro .sp-entrar {
  background: #0b0c10;
  color: #f4f4f6;
  box-shadow: 0 12px 30px -12px rgba(30,34,60,.55), inset 0 1px 0 rgba(255,255,255,.12);
}
.claro .sp-entrar:hover { box-shadow: 0 18px 40px -14px rgba(30,34,60,.6), inset 0 1px 0 rgba(255,255,255,.12); }
.claro .sp-entrar::after { background: linear-gradient(100deg, rgba(255,255,255,0), rgba(255,255,255,.35), rgba(255,255,255,0)); }
.claro .sp-entrar:focus-visible { outline-color: #3b5bdb; }
.claro .sp-pie { border-top-color: rgba(11,12,16,.08); }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .claro .sp-vidrio { background: rgba(255,255,255,.92); }
}

/* ---------- Login (views/login.view.php) ---------- */
.sp-login { max-width: 432px; }
.sp-login .sp-marca { margin-bottom: 28px; }
.sp-login h1 { margin-bottom: 10px; }
.sp-login .sp-desc { margin-bottom: 26px; font-size: 13.5px; }

.sp-form { text-align: left; }

.sp-campo { display: block; margin-bottom: 14px; }
.sp-campo-txt {
  display: block;
  margin: 0 0 7px 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--sp-tenue);
}
.sp-campo-caja {
  position: relative;
  display: flex;
  align-items: center;
  height: 50px;
  border-radius: 16px;
  background: rgba(255,255,255,.05);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.09);
  color: var(--sp-mas-tenue);
  transition: box-shadow .2s, background .2s;
}
.sp-campo-caja > svg { width: 18px; height: 18px; margin: 0 2px 0 15px; flex: none; transition: color .2s; }
.sp-campo-caja input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 14px 0 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--sp-texto);
  font: 500 15px/1 var(--sp-sans);
}
.sp-campo-caja input::placeholder { color: var(--sp-mas-tenue); font-weight: 400; }
.sp-campo-caja:focus-within {
  background: rgba(255,255,255,.08);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.35), inset 0 0 0 1px rgba(158,197,255,.55), 0 0 0 4px rgba(158,197,255,.14);
  color: var(--sp-texto);
}
/* Autorrelleno del navegador: sin el fondo amarillo/azul que rompe el vidrio */
.sp-campo-caja input:-webkit-autofill {
  -webkit-text-fill-color: var(--sp-texto);
  -webkit-box-shadow: 0 0 0 1000px transparent inset;
  transition: background-color 9999s;
}

.sp-ver {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-right: 5px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--sp-mas-tenue);
  cursor: pointer;
}
.sp-ver svg { width: 18px; height: 18px; }
.sp-ver:hover, .sp-ver[aria-pressed="true"] { color: var(--sp-texto); background: rgba(255,255,255,.06); }
.sp-ver:focus-visible { outline: 2px solid #9ec5ff; outline-offset: -2px; }

.sp-recordar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 22px 4px;
  font-size: 13px;
  color: var(--sp-tenue);
  cursor: pointer;
  user-select: none;
}
.sp-recordar input { position: absolute; opacity: 0; pointer-events: none; }
.sp-check {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  transition: background .15s, box-shadow .15s;
}
.sp-check::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2.5px;
  width: 4.5px;
  height: 9px;
  border: solid #0a0a0c;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .15s;
}
.sp-recordar input:checked + .sp-check { background: #f4f4f6; box-shadow: none; }
.sp-recordar input:checked + .sp-check::after { transform: rotate(45deg) scale(1); }
.sp-recordar input:focus-visible + .sp-check { outline: 2px solid #9ec5ff; outline-offset: 2px; }

.sp-form .sp-entrar { width: 100%; border: 0; cursor: pointer; font-family: var(--sp-sans); }
.sp-entrar.cargando { opacity: .75; cursor: progress; transform: none; }
.sp-entrar.cargando svg { animation: sp-empuja .8s ease-in-out infinite alternate; }
@keyframes sp-empuja { to { transform: translateX(4px); } }

.sp-error {
  margin: -6px 0 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 92, 92, .1);
  box-shadow: inset 0 0 0 1px rgba(255, 120, 120, .28);
  color: #ffb4b4;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  animation: sp-sacude .4s cubic-bezier(.36,.07,.19,.97);
}
@keyframes sp-sacude {
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

/* Login en tema claro */
.claro .sp-campo-caja {
  background: rgba(255,255,255,.55);
  box-shadow: inset 0 1px 2px rgba(30,34,60,.08), inset 0 0 0 1px rgba(11,12,16,.09);
}
.claro .sp-campo-caja:focus-within {
  background: rgba(255,255,255,.85);
  box-shadow: inset 0 1px 2px rgba(30,34,60,.06), inset 0 0 0 1px rgba(59,91,219,.55), 0 0 0 4px rgba(59,91,219,.12);
}
.claro .sp-ver:hover, .claro .sp-ver[aria-pressed="true"] { background: rgba(11,12,16,.05); }
.claro .sp-ver:focus-visible, .claro .sp-recordar input:focus-visible + .sp-check { outline-color: #3b5bdb; }
.claro .sp-check { background: rgba(255,255,255,.7); box-shadow: inset 0 0 0 1px rgba(11,12,16,.2); }
.claro .sp-check::after { border-color: #fff; }
.claro .sp-recordar input:checked + .sp-check { background: #0b0c10; }
.claro .sp-error { background: rgba(224, 49, 49, .08); box-shadow: inset 0 0 0 1px rgba(224, 49, 49, .25); color: #c92a2a; }

@media (prefers-reduced-motion: reduce) {
  .sp-error, .sp-entrar.cargando svg { animation: none; }
}

/* ---------- Botón claro / oscuro (#spTema, lo maneja sp-tema.js) ---------- */
.sp-tema {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 3;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: var(--sp-texto);
  background: rgba(255,255,255,.06);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), inset 0 0 0 1px rgba(255,255,255,.1), 0 10px 24px -12px rgba(0,0,0,.8);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), background .25s;
}
.sp-tema:hover { transform: scale(1.06); background: rgba(255,255,255,.1); }
.sp-tema:active { transform: scale(.94); }
.sp-tema:focus-visible { outline: 2px solid #9ec5ff; outline-offset: 3px; }
.sp-tema svg {
  position: absolute;
  width: 20px;
  height: 20px;
  transition: transform .5s cubic-bezier(.2,.8,.2,1), opacity .3s;
}
/* En oscuro se ve el sol (para pasar a claro); en claro, la luna */
.sp-tema .sol  { opacity: 1; transform: rotate(0) scale(1); }
.sp-tema .luna { opacity: 0; transform: rotate(-70deg) scale(.5); }
.claro .sp-tema .sol  { opacity: 0; transform: rotate(70deg) scale(.5); }
.claro .sp-tema .luna { opacity: 1; transform: rotate(0) scale(1); }

.claro .sp-tema {
  background: rgba(255,255,255,.55);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.95), inset 0 0 0 1px rgba(11,12,16,.08), 0 10px 24px -12px rgba(30,34,60,.4);
}
.claro .sp-tema:hover { background: rgba(255,255,255,.8); }
.claro .sp-tema:focus-visible { outline-color: #3b5bdb; }

/* Cambio de tema con el botón: fundido de colores */
.sp-cambiando, .sp-cambiando *, .sp-cambiando *::before, .sp-cambiando *::after {
  transition: background .5s ease, background-color .5s ease, color .5s ease, box-shadow .5s ease, opacity .5s ease !important;
}

@media (prefers-reduced-motion: reduce) {
  .sp-tema, .sp-tema svg { transition: none; }
}
