/* ==========================================================================
   Selector de tema (login y barra superior). Plantilla: bases/_selector_tema.html
   Cada opción muestra una miniatura del portal con los colores de su tema.
   Usa las variables del tema activo con respaldo propio (el login no carga tema.css).
   ========================================================================== */

.st {
  --st-fondo: var(--t-sup-1, rgba(18, 21, 30, 0.96));
  --st-texto: var(--t-texto, #eef1f6);
  --st-suave: var(--t-texto-suave, #8b93a5);
  --st-borde: var(--t-borde, rgba(255, 255, 255, 0.09));
  --st-anillo: var(--t-acento-fondo-2, #ffb864);
  width: min(392px, calc(100vw - 24px));
  margin: 0;
  padding: 14px;
  color: var(--st-texto);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-align: left;
}
.st-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 2px 4px 12px; }
.st-titulo { margin: 0; font-size: .95rem; font-weight: 700; letter-spacing: -.01em; }
.st-sub { margin: 0; font-size: .72rem; color: var(--st-suave); }

.st-grilla { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.st-opcion {
  position: relative;
  display: flex; flex-direction: column; gap: 3px;
  padding: 7px 7px 9px;
  border: 1px solid var(--st-borde);
  border-radius: 14px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.st-opcion:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--st-anillo) 55%, transparent); }
.st-opcion:focus-visible { outline: 2px solid var(--st-anillo); outline-offset: 2px; }
.st-opcion[aria-pressed="true"] { border-color: var(--st-anillo); box-shadow: 0 0 0 1px var(--st-anillo); }
.st-opcion[aria-pressed="true"]::after {
  content: "";
  position: absolute; top: 12px; right: 12px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--v-acento) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 11px no-repeat;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}

/* Miniatura: menú lateral + dos tarjetas con su barra de acento */
.st-vista {
  display: flex; gap: 5px;
  height: 62px; padding: 5px;
  margin-bottom: 4px;
  border-radius: 9px;
  background: var(--v-fondo);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .18);
}
.st-v-menu {
  display: flex; flex-direction: column; gap: 4px;
  width: 26%; padding: 6px 5px;
  border-radius: 5px; background: var(--v-panel);
}
.st-v-menu i { display: block; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .28); }
.st-v-menu i:first-child { background: var(--v-acento); width: 70%; }
.st-v-cuerpo { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.st-v-tarjeta {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
  padding: 6px; border-radius: 5px; background: var(--v-tarjeta);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.st-v-tarjeta b { display: block; height: 4px; width: 80%; border-radius: 2px; background: color-mix(in srgb, var(--v-panel) 55%, transparent); }
.st-v-tarjeta s { display: block; height: 7px; border-radius: 3px; background: var(--v-acento); }

/* Cristal: la miniatura es una escena con tarjetas de vidrio */
.st-cristal .st-vista {
  background:
    radial-gradient(70% 80% at 10% 100%, #ff7a45, transparent 62%),
    radial-gradient(60% 70% at 60% 50%, #c2367a, transparent 65%),
    radial-gradient(70% 80% at 100% 0%, #4b33b5, transparent 65%),
    #1d1236;
}
.st-cristal :is(.st-v-menu, .st-v-tarjeta) {
  background: rgba(255, 255, 255, .16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.st-cristal .st-v-tarjeta b { background: rgba(255, 255, 255, .5); }

.st-nombre { padding: 0 3px; font-size: .82rem; font-weight: 650; }
.st-nombre em { font-style: normal; font-weight: 500; font-size: .68rem; color: var(--st-suave); margin-left: 2px; }
.st-desc { padding: 0 3px; font-size: .7rem; line-height: 1.35; color: var(--st-suave); }

.st-otro-fondo {
  display: none;
  align-items: center; justify-content: center; gap: 7px;
  width: 100%; margin-top: 12px; padding: 9px 12px;
  border: 1px solid var(--st-borde); border-radius: 11px;
  background: rgba(255, 255, 255, .06); color: inherit;
  font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer;
}
.st-otro-fondo:hover { background: rgba(255, 255, 255, .12); }
.st-otro-fondo:focus-visible { outline: 2px solid var(--st-anillo); outline-offset: 2px; }
html[data-tema="cristal"] .st-otro-fondo { display: flex; }

/* ── Portal: dentro del menú desplegable de la barra superior ── */
.dropdown-menu.st-menu { padding: 0; border-radius: 18px !important; overflow: hidden; }
.dropdown-menu.st-menu .st { --st-fondo: transparent; }

/* ── Login: botón "Tema" en la píldora de controles y panel flotante ── */
.boton-tema {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px 0 8px; margin-right: 4px;
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 99px;
  background: rgba(255, 255, 255, .06); color: #e9ecf2;
  font: 600 .74rem/1 "Inter", system-ui, sans-serif; letter-spacing: .01em;
  cursor: pointer; transition: background .2s ease;
}
.boton-tema:hover, .boton-tema[aria-expanded="true"] { background: rgba(255, 255, 255, .14); }
.boton-tema:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.boton-tema .gota {
  width: 12px; height: 12px; border-radius: 50%;
  background: conic-gradient(#ffb864 0 25%, #ea580c 0 40%, #17a29d 0 55%, #961b2b 0 70%, #868b32 0 85%, #a9cbee 0);
}
.panel-tema {
  position: fixed; top: 62px; right: 22px; z-index: 30;
  border-radius: 20px;
  background: var(--t-sup-1, rgba(18, 21, 30, .94));
  border: 1px solid var(--t-borde, rgba(255, 255, 255, .1));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(20px) saturate(140%); backdrop-filter: blur(20px) saturate(140%);
  max-height: calc(100vh - 80px); overflow-y: auto;
  transform-origin: top right;
  animation: st-entra .22s cubic-bezier(.2, .8, .2, 1);
}
.panel-tema[hidden] { display: none; }
@keyframes st-entra { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
@media (max-width: 560px) {
  .panel-tema { top: 54px; right: 12px; left: 12px; }
  .panel-tema .st { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .panel-tema { animation: none; }
  .st-opcion { transition: none; }
}
