/* ==========================================================================
   SORTEOWEB · Estilos GLOBALES (se cargan en todas las vistas)
   Variables, base, botones, header/menú, footer y modal de mensajes.
   Los estilos de la vista principal están en assets/css/vista.css
   [1] Variables y base   [2] Utilidades   [3] Header / navegación
   [4] Footer             [5] Modal        [6] Animaciones globales
   [7] Responsive global  [8] Accesibilidad
   ========================================================================== */

/* [1] VARIABLES Y BASE ==================================================== */
:root {
    /* Paleta tomada del logo de Wardy: azul #0c57d3 + blanco */
    --bg: #030b24;
    --bg-2: #061238;
    --text: #f2f7ff;
    --muted: #9db4dc;
    --blue: #0c57d3;          /* azul del logo */
    --blue-bright: #2f8bff;   /* azul brillante para resplandores y texto */
    --sky: #8fd3ff;           /* celeste de acento */
    --white: #ffffff;
    --glass: rgba(255, 255, 255, .06);
    --border: rgba(255, 255, 255, .13);
    --grad: linear-gradient(120deg, var(--blue-bright), var(--sky));
    --grad-loop: linear-gradient(120deg, var(--blue-bright), var(--sky), var(--white), var(--sky), var(--blue-bright)); /* empieza y termina igual: animación sin cortes */
    --grad-btn: linear-gradient(120deg, #0a4fc9, #2478f0, #0a4fc9);   /* botones: buen contraste con texto blanco */
    --grad-white: linear-gradient(120deg, #ffffff, #dff1ff, var(--sky));
    --radius: 20px;
    --header-h: 72px;
    --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-num: "Orbitron", "Poppins", system-ui, sans-serif;

    /* Canales RGB (sin alfa) de los 3 tonos de acento, para poder armar rgba(var(--x-rgb), .N)
       con distinta opacidad en cada resplandor/sombra de assets/css/vista.css. Cada plantilla
       (assets/css/plantillas/*.css) redefine estos 3 junto con --blue/--blue-bright/--sky para
       re-teñir todos los brillos de la vista principal de una sola vez. */
    --blue-rgb: 12, 87, 211;
    --blue-bright-rgb: 47, 139, 255;
    --sky-rgb: 143, 211, 255;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }

body.no-scroll { overflow: hidden; }

/* [2] UTILIDADES ========================================================== */
.container { width: min(1180px, 100% - 2rem); margin-inline: auto; }

.grad-text {
    background: var(--grad-loop);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    background-size: 200% 100%;
    animation: shine 6s linear infinite;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .95rem 1.6rem;
    border: 0;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: .02em;
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.btn em { font-style: normal; font-weight: 600; opacity: .9; padding-left: .6rem; border-left: 1px solid rgba(255, 255, 255, .4); }
.btn em:empty { display: none; }
.btn[hidden] { display: none; } /* .btn ya fija display:inline-flex, así que hay que reforzar [hidden] o no se oculta */

.btn--primary {
    background: var(--grad-btn);
    background-size: 200% 100%;
    color: #fff;
    box-shadow: 0 0 22px rgba(47, 139, 255, .45), 0 8px 26px rgba(12, 87, 211, .35);
    animation: shine 5s linear infinite, pulse-glow 2.4s ease-in-out infinite;
}
.btn--primary:hover { transform: translateY(-3px) scale(1.03); filter: brightness(1.1); }
.btn--primary:active { transform: translateY(0) scale(.99); }

.btn--ghost { background: var(--glass); border: 1px solid var(--border); }
.btn--ghost:hover { background: rgba(255, 255, 255, .12); transform: translateY(-2px); }

.section-title { font-size: clamp(1.7rem, 3.6vw, 2.5rem); font-weight: 800; text-align: center; }
.section-sub { text-align: center; color: var(--muted); margin-top: .4rem; }

/* [3] HEADER / NAVEGACIÓN ================================================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    background: rgba(3, 11, 36, .72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.site-header::after {
    content: "";
    position: absolute;
    inset: auto 0 -1px 0;
    height: 1px;
    background: var(--grad);
    opacity: .7;
}
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.brand { display: flex; align-items: center; gap: .7rem; }
.brand__logo { height: 42px; width: auto; border-radius: 10px; filter: drop-shadow(0 0 10px rgba(12, 87, 211, .6)); }
.brand__name {
    font-family: var(--font-num);
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: .14em;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
/* Nombres largos (Panel -> Identidad del sitio): se achica la letra y puede ocupar 2 líneas,
   para no empujar el menú fuera del encabezado. La clase la pone view/partials/header.php
   (Sitio::nombreLargo()) y la vista previa del panel usa la misma regla. */
.brand { min-width: 0; }
.brand__name { line-height: 1.15; overflow-wrap: anywhere; }
.brand__name--largo { font-size: 1rem; letter-spacing: .08em; }

.main-nav ul { display: flex; gap: .4rem; list-style: none; margin: 0; padding: 0; }
.main-nav a {
    position: relative;
    display: block;
    padding: .55rem 1.1rem;
    border-radius: 999px;
    font-weight: 600;
    color: var(--muted);
    transition: color .2s ease, background .2s ease, box-shadow .2s ease;
}
.main-nav a[aria-current="page"] { color: #fff; background: var(--glass); box-shadow: 0 0 0 1px var(--border); }
.main-nav a:hover, .main-nav a:focus-visible {
    color: #fff;
    background: var(--glass);
    box-shadow: 0 0 0 1px var(--border), 0 0 18px rgba(143, 211, 255, .25);
}

.header-admin {
    display: flex; align-items: center; gap: .5rem; flex: none;
    padding: .5rem 1rem;
    font-size: .82rem; font-weight: 600;
    color: var(--muted);
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: color .2s ease, background .2s ease, box-shadow .2s ease;
}
.header-admin svg { flex: none; }
.header-admin:hover, .header-admin:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, .12);
    box-shadow: 0 0 0 1px var(--border), 0 0 16px rgba(143, 211, 255, .25);
}

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.nav-toggle span { display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px; transition: transform .25s ease, opacity .25s ease; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* [4] FOOTER ============================================================== */
.site-footer { padding: 1.8rem 0; border-top: 1px solid var(--border); background: var(--bg-2); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: .88rem; }
.footer-brand { font-family: var(--font-num); font-weight: 800; letter-spacing: .14em; color: var(--text); }

/* [5] MODAL DE MENSAJES =================================================== */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(2, 6, 20, .78); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade-in .25s ease; }
.modal__dialog {
    --accent: var(--sky);
    position: relative;
    width: min(440px, 100%);
    padding: 2.2rem 1.8rem 1.6rem;
    text-align: center;
    background: linear-gradient(170deg, #0d2260, #061238);
    border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
    border-radius: 24px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .05), 0 0 50px color-mix(in srgb, var(--accent) 35%, transparent), 0 30px 80px rgba(0, 0, 0, .6);
    outline: none;
    animation: pop-in .35s cubic-bezier(.2, 1.2, .3, 1);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}
.modal__extra { margin-top: 1.1rem; padding: .9rem 1rem; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid var(--border); }
.modal__extra[hidden] { display: none; }
.modal__extra h3 { font-size: 1rem; margin-bottom: .5rem; }
.modal__extra img { display: block; width: min(220px, 70%); margin: .3rem auto .6rem; border-radius: 12px; background: #fff; padding: .4rem; }
.modal__extra p { color: var(--muted); font-size: .88rem; white-space: pre-line; }
.modal__dialog[data-type="success"] { --accent: #35f2a0; }
.modal__dialog[data-type="error"] { --accent: #ff4d6d; }
.modal__dialog[data-type="warning"] { --accent: #ffc93c; }
.modal__dialog[data-type="info"] { --accent: var(--sky); }

.modal__close {
    position: absolute;
    top: .8rem;
    right: .8rem;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    line-height: 1;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 50%;
    transition: background .2s ease, transform .2s ease;
}
.modal__close:hover { background: rgba(255, 255, 255, .16); transform: rotate(90deg); }

.modal__icon {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    border: 2px solid var(--accent);
    box-shadow: 0 0 26px color-mix(in srgb, var(--accent) 55%, transparent);
    animation: bob 3.4s ease-in-out infinite;
}
.modal__icon svg { width: 38px; height: 38px; }
.modal__title { font-size: 1.45rem; font-weight: 800; margin-bottom: .5rem; }
.modal__body { color: var(--muted); white-space: pre-line; }
.modal__body:empty { display: none; }
.modal__code {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .8rem;
    flex-wrap: wrap;
    margin-top: 1.1rem;
    padding: .9rem 1rem;
    border: 1.5px dashed color-mix(in srgb, var(--accent) 70%, transparent);
    border-radius: 16px;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.modal__code[hidden] { display: none; }
.modal__code-text {
    font-family: var(--font-num);
    font-weight: 800;
    font-size: clamp(1.25rem, 5vw, 1.7rem);
    letter-spacing: .08em;
    color: #fff;
    text-shadow: 0 0 16px color-mix(in srgb, var(--accent) 80%, transparent);
    user-select: all;
}
/* Varios códigos (compra de varios tickets): uno por línea, con scroll si son muchos */
.modal__code.is-multiple { flex-direction: column; }
.modal__code.is-multiple .modal__code-text {
    white-space: pre-line; text-align: center; line-height: 1.7;
    font-size: clamp(.95rem, 3.6vw, 1.15rem);
    max-height: 32vh; overflow-y: auto; width: 100%; padding-right: .3rem;
}
.modal__copy {
    padding: .4rem .9rem;
    font-size: .82rem;
    font-weight: 700;
    color: var(--white);
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: background .2s ease;
}
.modal__copy:hover { background: rgba(255, 255, 255, .16); }
.modal__actions { display: flex; justify-content: center; gap: .7rem; margin-top: 1.5rem; flex-wrap: wrap; }
.modal__actions .btn { padding: .8rem 1.5rem; }

/* [6] ANIMACIONES GLOBALES ================================================ */
@keyframes shine { to { background-position: 200% 0; } }
@keyframes pulse-glow { 50% { box-shadow: 0 0 34px rgba(47, 139, 255, .75), 0 8px 34px rgba(12, 87, 211, .5); } }
@keyframes bob { 50% { transform: translateY(-12px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(20px) scale(.9); } }

/* [7] RESPONSIVE GLOBAL =================================================== */
@media (max-width: 560px) {
    .brand__logo { height: 34px; }
    .brand__name { font-size: 1.05rem; }
    .brand__name--largo { font-size: .8rem; letter-spacing: .05em; }
    .header-admin span { display: none; }
    .header-admin { padding: .55rem; }
}

@media (max-width: 760px) {
    .nav-toggle { display: flex; }
    .main-nav {
        position: absolute;
        top: calc(var(--header-h) + 1px);
        left: 0;
        right: 0;
        padding: .8rem 1rem 1.2rem;
        background: rgba(3, 11, 36, .96);
        border-bottom: 1px solid var(--border);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s;
    }
    .main-nav.is-open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
    .main-nav ul { flex-direction: column; gap: .3rem; }
    .main-nav a { padding: .85rem 1rem; font-size: 1.05rem; }
    .footer-inner { justify-content: center; text-align: center; }
}

/* [8] ACCESIBILIDAD ======================================================= */
:focus-visible { outline: 2px solid var(--sky); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   PIE DE PÁGINA: redes, enlaces legales, botón flotante de WhatsApp y franja de
   mantenimiento para usuarios del panel (datos de Panel -> Configuración)
   ========================================================================== */
.footer-redes { display: flex; gap: .5rem; }
.footer-redes a { display: grid; place-items: center; width: 36px; height: 36px; color: var(--muted); border: 1px solid var(--border); border-radius: 50%; transition: color .2s, border-color .2s, transform .2s; }
.footer-redes a:hover { color: #fff; border-color: var(--sky); transform: translateY(-2px); }
.footer-links { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid rgba(255, 255, 255, .06); font-size: .82rem; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--sky); }
.wa-flotante {
    position: fixed; right: 18px; bottom: 18px; z-index: 60; display: grid; place-items: center; width: 58px; height: 58px;
    color: #fff; background: #25d366; border-radius: 50%; box-shadow: 0 8px 26px rgba(37, 211, 102, .45), 0 4px 12px rgba(0, 0, 0, .35);
    transition: transform .2s ease; animation: wa-pulso 2.6s ease-in-out infinite;
}
.wa-flotante:hover { transform: scale(1.08); }
@keyframes wa-pulso { 50% { box-shadow: 0 8px 26px rgba(37, 211, 102, .45), 0 0 0 10px rgba(37, 211, 102, .12); } }
@media (prefers-reduced-motion: reduce) { .wa-flotante { animation: none; } }
.mant-franja { position: relative; z-index: 101; padding: .55rem 1rem; text-align: center; font-size: .85rem; font-weight: 600; color: #1a1300; background: #ffc93c; }
.mant-franja a { color: #1a1300; text-decoration: underline; font-weight: 800; }
@media (max-width: 720px) { .footer-links { justify-content: center; } .footer-redes { justify-content: center; width: 100%; } }
