/* ===================================================================
   SPLASH — Pantalla de carga del panel (como la de RebootCodes)
   Se carga antes de style.css para pintar sin destello.
   Usa las variables del tema, así hereda color de acento, tema y modo.
   =================================================================== */

html.splash-active,
html.splash-active body {
    overflow: hidden;
}

.splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    opacity: 1;
    visibility: visible;
    transition: opacity 350ms ease-out, visibility 350ms ease-out;
}

/* Halo radial del color de acento detrás del contenido */
.splash::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(150vw, 860px);
    height: min(150vw, 860px);
    transform: translate(-50%, -50%);
    background: radial-gradient(circle,
        rgba(var(--accent-rgb), 0.15) 0%,
        transparent 62%);
    pointer-events: none;
}

.splash.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px;
    text-align: center;
    animation: splash-in 480ms ease-out both;
}

@keyframes splash-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* --- Anillo + logo --- */

.splash-ring {
    position: relative;
    width: 132px;
    height: 132px;
    display: grid;
    place-items: center;
    margin-bottom: 24px;
}

/* Pista base del anillo: tenue, para que el arco que gira destaque */
.splash-ring::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 999px;
    border: 3px solid rgba(var(--accent-rgb), 0.12);
}

/* Solo border-top coloreado → arco de ~90°. Un arco corto y nítido
   deja ver la rotación; uno largo y difuminado se lee como un anillo fijo. */
.splash-ring-arc {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    border: 3px solid transparent;
    border-top-color: var(--accent);
    filter: drop-shadow(0 0 3px rgba(var(--accent-rgb), 0.5));
    animation: splash-spin .9s linear infinite;
}

.splash-ring-arc--outer {
    inset: -13px;
    border-width: 2px;
    border-top-color: transparent;
    border-bottom-color: rgba(var(--accent-rgb), 0.45);
    animation-duration: 1.8s;
    animation-direction: reverse;
}

@keyframes splash-spin {
    to { transform: rotate(360deg); }
}

.splash-logo {
    position: relative;
    width: 94px;
    height: 94px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 0 26px rgba(var(--accent-rgb), 0.35),
                inset 0 0 20px rgba(var(--accent-rgb), 0.07);
    animation: splash-breathe 2.8s ease-in-out infinite;
}

@keyframes splash-breathe {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.035); }
}

.splash-logo-img {
    width: 62px;
    height: 62px;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.splash-logo i {
    font-size: 2.25rem;
    line-height: 1;
    color: var(--accent);
}

/* --- Textos --- */

.splash-title {
    margin: 0;
    font-family: var(--font);
    font-size: clamp(1.75rem, 4.5vw, 2.5rem);
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--text);
}

.splash-title-accent {
    color: var(--accent);
}

.splash-subtitle {
    margin: 8px 0 0;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 2.2px;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* --- Pulso tipo radar --- */

.splash-pulse {
    position: relative;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    margin: 32px 0 20px;
}

.splash-pulse::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.splash-pulse span {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    border: 2px solid var(--accent);
    opacity: 0;
    animation: splash-pulse 1.8s ease-out infinite;
}

.splash-pulse span:nth-child(2) { animation-delay: .6s; }
.splash-pulse span:nth-child(3) { animation-delay: 1.2s; }

@keyframes splash-pulse {
    0%   { transform: scale(.32); opacity: .85; }
    100% { transform: scale(1);   opacity: 0; }
}

.splash-status {
    margin: 0 0 16px;
    min-height: 1.3em;
    font-size: 0.85rem;
    letter-spacing: .4px;
    color: var(--text-muted);
}

/* --- Barra de progreso --- */

/* El porcentaje se posiciona fuera del flujo para que la barra
   quede centrada en el mismo eje que el logo y el título. */
.splash-progress-row {
    position: relative;
    display: flex;
    align-items: center;
}

.splash-progress {
    position: relative;
    width: min(330px, 62vw);
    height: 4px;
    border-radius: 999px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    overflow: hidden;
}

.splash-progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg,
        rgba(var(--accent-rgb), 0.5),
        var(--accent));
    box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.4);
}

.splash-pct {
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.72rem;
    letter-spacing: 1px;
    color: var(--accent);
}

/* --- Tres puntos --- */

.splash-dots {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.splash-dots i {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--accent);
    opacity: .25;
    animation: splash-dot 1.4s ease-in-out infinite;
}

.splash-dots i:nth-child(2) { animation-delay: .2s; }
.splash-dots i:nth-child(3) { animation-delay: .4s; }

@keyframes splash-dot {
    0%, 100% { opacity: .25; transform: translateY(0); }
    50%      { opacity: 1;   transform: translateY(-4px); }
}

/* --- Responsive --- */

@media (max-width: 480px) {
    .splash-ring {
        width: 108px;
        height: 108px;
        margin-bottom: 20px;
    }

    .splash-logo {
        width: 76px;
        height: 76px;
    }

    .splash-logo-img {
        width: 50px;
        height: 50px;
    }

    .splash-pulse {
        margin: 24px 0 16px;
    }
}

/* --- Accesibilidad: sin movimiento --- */

/* El giro del spinner es feedback esencial de carga, así que se mantiene
   (solo más lento). Se eliminan escalado, desplazamiento y aros expansivos,
   que son los que molestan de verdad. */
@media (prefers-reduced-motion: reduce) {
    .splash-inner,
    .splash-logo,
    .splash-pulse span,
    .splash-dots i {
        animation: none;
    }

    .splash-ring-arc        { animation-duration: 1.6s; }
    .splash-ring-arc--outer { animation-duration: 3.2s; }

    .splash-pulse span {
        opacity: 0;
    }

    .splash-dots i {
        opacity: .5;
    }
}
