/* Preloader Styles */
#preloader {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #060c19;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
    z-index: 2000000;
    transition: opacity 0.8s cubic-bezier(0.65, 0, 0.35, 1), visibility 0.8s;
    overflow: hidden;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

#preloader::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(59, 130, 246, 0.12) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    z-index: 0;
}

#preloader::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 0, 0, 0.04) 2px, rgba(0, 0, 0, 0.04) 3px);
    pointer-events: none;
    z-index: 0;
}

/* HUD Decorative Elements */
.hud-c {
    position: absolute;
    width: 16px;
    height: 16px;
    z-index: 2;
    animation: hud-b 3s ease-in-out infinite;
}

.hud-tl {
    top: 20px;
    left: 20px;
    border-top: 1.5px solid rgba(59, 130, 246, 0.6);
    border-left: 1.5px solid rgba(59, 130, 246, 0.6);
}

.hud-tr {
    top: 20px;
    right: 20px;
    border-top: 1.5px solid rgba(59, 130, 246, 0.6);
    border-right: 1.5px solid rgba(59, 130, 246, 0.6);
}

.hud-bl {
    bottom: 20px;
    left: 20px;
    border-bottom: 1.5px solid rgba(59, 130, 246, 0.6);
    border-left: 1.5px solid rgba(59, 130, 246, 0.6);
}

.hud-br {
    bottom: 20px;
    right: 20px;
    border-bottom: 1.5px solid rgba(59, 130, 246, 0.6);
    border-right: 1.5px solid rgba(59, 130, 246, 0.6);
}

@keyframes hud-b {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.95; }
}

/* Center Content */
.pl-center {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

/* Logo Area & Halo */
.logo-area {
    position: relative;
    width: 140px;
    height: 140px;
}

.logo-halo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    animation: halo 2.4s ease-in-out infinite;
}

@keyframes halo {
    0%, 100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.3; }
    50% { transform: translate(-50%, -50%) scale(1.4); opacity: 0.85; }
}

/* SVG Rings */
.rings {
    position: absolute;
    top: 0;
    left: 0;
    width: 140px;
    height: 140px;
}

.r-dash {
    fill: none;
    stroke: rgba(59, 130, 246, 0.14);
    stroke-width: 0.8;
    stroke-dasharray: 3 5;
    transform-origin: 70px 70px;
    animation: rslow 10s linear infinite;
}

.r-inner {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 0.8;
    stroke-dasharray: 2 7;
    transform-origin: 70px 70px;
    animation: rccw 7s linear infinite;
}

.r-prog {
    fill: none;
    stroke: rgba(59, 130, 246, 0.9);
    stroke-width: 2;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.35s ease;
}

.r-accent {
    fill: none;
    stroke: rgba(59, 130, 246, 0.8);
    stroke-width: 1.5;
    stroke-dasharray: 8 60;
    stroke-linecap: round;
    transform-origin: 70px 70px;
    animation: rfast 1.6s linear infinite;
}

@keyframes rslow { to { transform: rotate(360deg); } }
@keyframes rfast { to { transform: rotate(360deg); } }
@keyframes rccw { to { transform: rotate(-360deg); } }

/* Triloader Shell */
.tri-shell {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
}

.svg-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.triloader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    transform-origin: 50% 50%;
    animation: spin-full 4.5s infinite cubic-bezier(0.3, 1, 0, 1);
}

.triloader svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.py { transform-box: view-box; transform-origin: 50% 50%; animation: ey 4.5s infinite; }
.pb { transform-box: view-box; transform-origin: 50% 50%; animation: eb 4.5s infinite; }
.pr { transform-box: view-box; transform-origin: 50% 50%; animation: er 4.5s infinite; }

@keyframes spin-full {
    0%, 10% { transform: rotate(0deg); }
    23% { transform: rotate(120deg); }
    33%, 43% { transform: rotate(120deg); }
    57% { transform: rotate(240deg); }
    67%, 77% { transform: rotate(240deg); }
    90% { transform: rotate(360deg); }
    100% { transform: rotate(360deg); }
}

@keyframes ey {
    0% { transform: translate(0, 0); }
    10%, 23% { transform: translate(0, -5px); }
    33% { transform: translate(0, 0); }
    43%, 57% { transform: translate(0, -5px); }
    67% { transform: translate(0, 0); }
    77%, 90% { transform: translate(0, -5px); }
    100% { transform: translate(0, 0); }
}

@keyframes eb {
    0% { transform: translate(0, 0); }
    10%, 23% { transform: translate(-4.33px, 2.5px); }
    33% { transform: translate(0, 0); }
    43%, 57% { transform: translate(-4.33px, 2.5px); }
    67% { transform: translate(0, 0); }
    77%, 90% { transform: translate(-4.33px, 2.5px); }
    100% { transform: translate(0, 0); }
}

@keyframes er {
    0% { transform: translate(0, 0); }
    10%, 23% { transform: translate(4.33px, 2.5px); }
    33% { transform: translate(0, 0); }
    43%, 57% { transform: translate(4.33px, 2.5px); }
    67% { transform: translate(0, 0); }
    77%, 90% { transform: translate(4.33px, 2.5px); }
    100% { transform: translate(0, 0); }
}

/* Status Text */
.pl-status {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.pl-text {
    position: relative;
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
}

.pl-text::before, .pl-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
}

.pl-text::before {
    color: rgba(59, 130, 246, 0.9);
    clip-path: polygon(0 15%, 100% 15%, 100% 45%, 0 45%);
    animation: ga 6s steps(1) infinite;
}

.pl-text::after {
    color: rgba(220, 38, 38, 0.8);
    clip-path: polygon(0 60%, 100% 60%, 100% 85%, 0 85%);
    animation: gb 6s steps(1) infinite;
}

@keyframes ga {
    0%, 87%, 89%, 100% { transform: translate(0); opacity: 0; }
    88% { transform: translate(-2px, 1px); opacity: 1; }
}

@keyframes gb {
    0%, 91%, 93%, 100% { transform: translate(0); opacity: 0; }
    92% { transform: translate(2px, -1px); opacity: 1; }
}

.pl-pct {
    font-size: 10px;
    color: rgba(59, 130, 246, 0.85);
    letter-spacing: 0.06em;
    min-width: 30px;
}

/* Loader Dots */
.pl-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}

.dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.5);
    animation: db 1.5s ease-in-out infinite;
}

.dot:nth-child(2) { animation-delay: 0.25s; }
.dot:nth-child(3) { animation-delay: 0.5s; }

@keyframes db {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(2.2); opacity: 1; }
}

/* Progress Bar Track & Fill */
.pl-bar-wrap {
    width: 190px;
}

.pl-bar-track {
    width: 100%;
    height: 2px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 99px;
    position: relative;
}

.pl-bar-track::before, .pl-bar-track::after {
    content: '';
    position: absolute;
    top: -2px;
    width: 1px;
    height: 6px;
    background: rgba(59, 130, 246, 0.25);
}

.pl-bar-track::before { left: 0; }
.pl-bar-track::after { right: 0; }

.pl-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 99px;
    background: rgba(59, 130, 246, 1);
    position: relative;
    transition: width 0.35s ease;
}

.pl-bar-fill::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -3px;
    width: 2px;
    height: 8px;
    border-radius: 99px;
    background: #fff;
    box-shadow: 0 0 8px 2px rgba(59, 130, 246, 0.9);
}

/* Bottom HUD */
.pl-hud {
    display: flex;
    justify-content: space-between;
    width: 190px;
    font-size: 9px;
    letter-spacing: 0.12em;
    color: rgba(59, 130, 246, 0.28);
    animation: flicker 5s steps(1) infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    39%, 40% { opacity: 0.15; }
    68%, 69% { opacity: 0.6; }
}

/* Ocultar contenido del sitio mientras el preloader está activo para evitar parpadeos */
body.preloader-active>*:not(#preloader):not(script):not(style):not(link) {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.5s ease;
}