/* =====================================
   Modern Elegant Preloader
   ===================================== */

/* Preloader Container */
.preloader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2c4f91 0%, #3e5174 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

.preloader-wrapper.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Preloader Content */
.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* Logo/Branding Area */
.preloader-logo {
    font-size: 24px;
    font-weight: 700;
    color: white;
    letter-spacing: 2px;
    animation: logoFadeIn 0.8s ease-out forwards;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

@keyframes logoFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animated Spinner Container */
.spinner-container {
    position: relative;
    width: 80px;
    height: 80px;
}

/* Main Spinner - Gradient Circle */
.spinner-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    border-top-color: white;
    border-right-color: rgba(255, 255, 255, 0.5);
    animation: spinRotate 1.2s cubic-bezier(0.4, 0.1, 0.8, 0.9) infinite;
}

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

/* Pulse Ring Effect */
.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: pulseBorder 1.8s ease-in-out infinite;
}

@keyframes pulseBorder {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* Secondary Spinner - Counter Rotation */
.spinner-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    animation: spinRotate 2s cubic-bezier(0.4, 0.1, 0.8, 0.9) reverse infinite;
}

/* Loading Text */
.loading-text {
    color: white;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 1px;
    animation: textFade 1.5s ease-in-out infinite;
    text-transform: uppercase;
}

@keyframes textFade {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Dots Animation */
.dots {
    display: inline-flex;
    gap: 4px;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: white;
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
}

.dot:nth-child(1) {
    animation-delay: 0s;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotBounce {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    50% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Progress Bar (Optional) */
.progress-bar-wrapper {
    width: 120px;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 20px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, white, rgba(255, 255, 255, 0.5));
    border-radius: 10px;
    animation: progressMove 1.5s ease-in-out infinite;
}

@keyframes progressMove {
    0% {
        width: 0%;
    }
    50% {
        width: 100%;
    }
    100% {
        width: 0%;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .spinner-container {
        width: 60px;
        height: 60px;
    }

    .spinner-circle {
        border-width: 3px;
    }

    .preloader-logo {
        font-size: 20px;
    }

    .loading-text {
        font-size: 12px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .preloader-wrapper {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }
}
