/* Preloader Component */
.preloader {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

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

.preloader__content {
    text-align: center;
    position: relative;
}

/* Spinning Loader */
.preloader__spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    position: relative;
}

.preloader__ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--brand);
    animation: spin 1s linear infinite;
}

.preloader__ring:nth-child(2) {
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    border-top-color: var(--accent);
    animation-duration: 1.5s;
    animation-direction: reverse;
}

.preloader__ring:nth-child(3) {
    width: 40%;
    height: 40%;
    top: 30%;
    left: 30%;
    border-top-color: var(--success);
    animation-duration: 2s;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pulse Animation */
.preloader__pulse {
    width: 60px;
    height: 60px;
    margin: 0 auto 24px;
    background: var(--brand-gradient);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: var(--shadow-brand);
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* Wave Animation */
.preloader__wave {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    height: 60px;
    margin: 0 auto 24px;
}

.preloader__wave-bar {
    width: 8px;
    height: 40px;
    background: var(--brand-gradient);
    border-radius: var(--radius-full);
    animation: wave 1.2s ease-in-out infinite;
}

.preloader__wave-bar:nth-child(1) { animation-delay: 0s; }
.preloader__wave-bar:nth-child(2) { animation-delay: 0.1s; }
.preloader__wave-bar:nth-child(3) { animation-delay: 0.2s; }
.preloader__wave-bar:nth-child(4) { animation-delay: 0.3s; }
.preloader__wave-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1); }
}

/* Brand Logo Animation */
.preloader__logo {
    font-family: "Fraunces", Georgia, serif;
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
    animation: logoFade 2s ease-in-out infinite;
}

@keyframes logoFade {
    0%, 100% { opacity: 0.6; transform: scale(0.98); }
    50% { opacity: 1; transform: scale(1.02); }
}

.preloader__text {
    color: var(--muted);
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    animation: textPulse 2s ease-in-out infinite;
}

@keyframes textPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Progress Bar */
.preloader__progress {
    width: 200px;
    height: 4px;
    background: rgba(19, 32, 51, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 20px auto 0;
}

.preloader__progress-bar {
    height: 100%;
    width: 0%;
    background: var(--brand-gradient);
    animation: progress 2s ease-in-out infinite;
    border-radius: var(--radius-full);
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Dots Loading */
.preloader__dots {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 20px auto 0;
}

.preloader__dot {
    width: 12px;
    height: 12px;
    background: var(--brand);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite both;
}

.preloader__dot:nth-child(1) { animation-delay: -0.32s; }
.preloader__dot:nth-child(2) { animation-delay: -0.16s; }
.preloader__dot:nth-child(3) { animation-delay: 0s; }

@keyframes dotBounce {
    0%, 80%, 100% { 
        transform: scale(0);
        opacity: 0.5;
    }
    40% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* Gradient Background Animation */
.preloader::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(12, 124, 107, 0.1), transparent 70%);
    animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}
