/* ============================================
   Loader - Elegant Perfume Bottle
   ============================================ */

.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #FAF8F5 0%, #F5F3F0 50%, #FAF8F5 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    overflow: hidden;
}

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

/* Contenedor principal */
.loader__container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

/* Botella */
.loader__perfume {
    position: relative;
    width: 220px;
    height: 320px;
    filter: drop-shadow(0 20px 50px rgba(201, 162, 39, 0.2));
}

.loader__bottle-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Marca */
.loader__brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 30px;
}

.loader__brand-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    color: #1A1A1A;
}

.loader__brand-accent {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-style: italic;
    color: #C9A227;
}

/* Porcentaje */
.loader__percentage {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 400;
    color: #1A1A1A;
    margin-top: 20px;
    letter-spacing: 0.05em;
}

.loader__percentage span {
    color: #C9A227;
}

/* Líquido - animación de llenado */
.loader__liquid {
    transition: clip-path 0.15s ease-out;
}

/* ============================================
   Spray Effect - Hacia la pantalla
   ============================================ */

.loader__spray-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    z-index: 10;
}

.loader__spray-container.active {
    opacity: 1;
}

/* Partículas */
.loader__particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    left: 50%;
    top: 40%;
}

.loader__particle--gold {
    background: radial-gradient(circle at 30% 30%, #F5E6C4 0%, #C9A227 50%, #9A7B1A 100%);
    box-shadow: 
        0 0 20px rgba(201, 162, 39, 0.8),
        0 0 40px rgba(201, 162, 39, 0.4),
        inset 0 -2px 6px rgba(154, 123, 26, 0.6),
        inset 0 3px 6px rgba(255, 255, 255, 0.5);
}

.loader__particle--light {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(245, 230, 196, 0.6) 60%, transparent 70%);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.8);
}

.loader__particle--mist {
    background: radial-gradient(circle, rgba(201, 162, 39, 0.4) 0%, rgba(201, 162, 39, 0.1) 50%, transparent 70%);
    filter: blur(10px);
}

/* Posiciones de partículas - efecto hacia la pantalla */
.loader__particle:nth-child(1) { width: 12px; height: 12px; --tx: -250px; --ty: -200px; --scale: 12; animation-delay: 0s; }
.loader__particle:nth-child(2) { width: 10px; height: 10px; --tx: 200px; --ty: -180px; --scale: 15; animation-delay: 0.02s; }
.loader__particle:nth-child(3) { width: 14px; height: 14px; --tx: -100px; --ty: -250px; --scale: 10; animation-delay: 0.01s; }
.loader__particle:nth-child(4) { width: 8px; height: 8px; --tx: 300px; --ty: 120px; --scale: 18; animation-delay: 0.04s; }
.loader__particle:nth-child(5) { width: 11px; height: 11px; --tx: -350px; --ty: 100px; --scale: 14; animation-delay: 0.02s; }
.loader__particle:nth-child(6) { width: 16px; height: 16px; --tx: 80px; --ty: -300px; --scale: 8; animation-delay: 0s; }
.loader__particle:nth-child(7) { width: 7px; height: 7px; --tx: -200px; --ty: 250px; --scale: 20; animation-delay: 0.05s; }
.loader__particle:nth-child(8) { width: 13px; height: 13px; --tx: 150px; --ty: 200px; --scale: 12; animation-delay: 0.02s; }
.loader__particle:nth-child(9) { width: 9px; height: 9px; --tx: -300px; --ty: -80px; --scale: 16; animation-delay: 0.03s; }
.loader__particle:nth-child(10) { width: 12px; height: 12px; --tx: 350px; --ty: -100px; --scale: 11; animation-delay: 0.01s; }
.loader__particle:nth-child(11) { width: 8px; height: 8px; --tx: 0px; --ty: -350px; --scale: 17; animation-delay: 0.03s; }
.loader__particle:nth-child(12) { width: 15px; height: 15px; --tx: -120px; --ty: 300px; --scale: 9; animation-delay: 0s; }
.loader__particle:nth-child(13) { width: 6px; height: 6px; --tx: 250px; --ty: 280px; --scale: 22; animation-delay: 0.04s; }
.loader__particle:nth-child(14) { width: 10px; height: 10px; --tx: -400px; --ty: -150px; --scale: 13; animation-delay: 0.02s; }
.loader__particle:nth-child(15) { width: 9px; height: 9px; --tx: 400px; --ty: 80px; --scale: 15; animation-delay: 0.03s; }

/* Brillos de luz */
.loader__particle:nth-child(16) { width: 20px; height: 20px; --tx: -60px; --ty: -120px; --scale: 6; animation-delay: 0.01s; }
.loader__particle:nth-child(17) { width: 18px; height: 18px; --tx: 100px; --ty: -100px; --scale: 7; animation-delay: 0.02s; }
.loader__particle:nth-child(18) { width: 25px; height: 25px; --tx: -40px; --ty: 80px; --scale: 5; animation-delay: 0s; }
.loader__particle:nth-child(19) { width: 15px; height: 15px; --tx: 70px; --ty: 120px; --scale: 8; animation-delay: 0.02s; }
.loader__particle:nth-child(20) { width: 22px; height: 22px; --tx: -130px; --ty: 20px; --scale: 6; animation-delay: 0.01s; }

/* Niebla */
.loader__particle:nth-child(21) { width: 150px; height: 150px; --tx: 0px; --ty: 0px; --scale: 10; animation-delay: 0s; }
.loader__particle:nth-child(22) { width: 120px; height: 120px; --tx: -150px; --ty: -80px; --scale: 8; animation-delay: 0.02s; }
.loader__particle:nth-child(23) { width: 130px; height: 130px; --tx: 150px; --ty: 80px; --scale: 9; animation-delay: 0.01s; }

.loader__spray-container.active .loader__particle {
    animation: particleToScreen 1.3s ease-out forwards;
}

@keyframes particleToScreen {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.3);
    }
    40% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(var(--scale));
    }
}

/* Flash dorado */
.loader__flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 40%, rgba(201, 162, 39, 0.5) 0%, rgba(201, 162, 39, 0.2) 30%, transparent 60%);
    opacity: 0;
    pointer-events: none;
    z-index: 5;
}

.loader__flash.active {
    animation: flashGold 0.6s ease-out forwards;
}

@keyframes flashGold {
    0% { opacity: 0; }
    30% { opacity: 1; }
    100% { opacity: 0; }
}

/* Animación botella */
.loader__perfume.spraying {
    animation: bottleSpray 0.25s ease-in-out;
}

@keyframes bottleSpray {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(3px) scale(0.98); }
}

/* Responsive */
@media (max-width: 480px) {
    .loader__perfume {
        width: 140px;
        height: 220px;
    }
    
    .loader__brand-text {
        font-size: 1rem;
    }
    
    .loader__brand-accent {
        font-size: 1.2rem;
    }
    
    .loader__percentage {
        font-size: 1.5rem;
    }
}