/* ========================================
   Spinner Loader Styles
   ======================================== */

/* Main Loader Overlay */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loader-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Dark theme for admin panel */
body.admin-panel .loader-overlay,
body:has(.sidebar) .loader-overlay {
    background-color: rgba(0, 0, 0, 0.75);
}

/* Spinner Container */
.loader-container {
    text-align: center;
}

/* Modern 3D Rotating Rings Spinner */
.spinner-modern {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.spinner-modern .ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: var(--brand-color, #495464);
    border-radius: 50%;
    animation: spin-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-modern .ring:nth-child(1) {
    animation-delay: -0.45s;
    border-top-color: var(--brand-color, #495464);
}

.spinner-modern .ring:nth-child(2) {
    animation-delay: -0.3s;
    border-top-color: rgba(73, 84, 100, 0.7);
    width: 70px;
    height: 70px;
    top: 5px;
    left: 5px;
}

.spinner-modern .ring:nth-child(3) {
    animation-delay: -0.15s;
    border-top-color: rgba(73, 84, 100, 0.5);
    width: 60px;
    height: 60px;
    top: 10px;
    left: 10px;
}

/* Central pulsing dot */
.spinner-modern::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: var(--brand-color, #495464);
    border-radius: 50%;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes spin-ring {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse-dot {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.5;
    }
}

/* Loading Text */
.loader-text {
    color: var(--text-primary, #495464);
    font-size: 16px;
    font-weight: 500;
    margin-top: 15px;
    letter-spacing: 0.5px;
    animation: fade-text 2s ease-in-out infinite;
}

body.admin-panel .loader-text,
body:has(.sidebar) .loader-text {
    color: #ffffff;
}

@keyframes fade-text {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* Loading dots animation */
.loader-text::after {
    content: '';
    animation: loading-dots 1.5s steps(4, end) infinite;
}

@keyframes loading-dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

/* Alternative Spinner Styles (can be used by adding classes) */

/* Bouncing Dots Spinner */
.spinner-bounce {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    height: 60px;
}

.spinner-bounce .dot {
    width: 12px;
    height: 12px;
    background-color: var(--brand-color, #495464);
    border-radius: 50%;
    animation: bounce-dot 1.4s ease-in-out infinite both;
}

.spinner-bounce .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.spinner-bounce .dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce-dot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Wave Spinner */
.spinner-wave {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    height: 60px;
}

.spinner-wave .bar {
    width: 6px;
    height: 40px;
    background-color: var(--brand-color, #495464);
    border-radius: 3px;
    animation: wave-bar 1.2s ease-in-out infinite;
}

.spinner-wave .bar:nth-child(1) {
    animation-delay: -1.1s;
}

.spinner-wave .bar:nth-child(2) {
    animation-delay: -1s;
}

.spinner-wave .bar:nth-child(3) {
    animation-delay: -0.9s;
}

.spinner-wave .bar:nth-child(4) {
    animation-delay: -0.8s;
}

.spinner-wave .bar:nth-child(5) {
    animation-delay: -0.7s;
}

@keyframes wave-bar {
    0%, 40%, 100% {
        transform: scaleY(0.4);
        opacity: 0.5;
    }
    20% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* Pulse Circle Spinner */
.spinner-pulse {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    position: relative;
}

.spinner-pulse::before,
.spinner-pulse::after {
    content: '';
    position: absolute;
    border: 3px solid var(--brand-color, #495464);
    border-radius: 50%;
    width: 100%;
    height: 100%;
    animation: pulse-circle 2s ease-in-out infinite;
}

.spinner-pulse::after {
    animation-delay: -1s;
}

@keyframes pulse-circle {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .spinner-modern {
        width: 60px;
        height: 60px;
    }

    .spinner-modern .ring {
        border-width: 3px;
    }

    .spinner-modern .ring:nth-child(2) {
        width: 50px;
        height: 50px;
    }

    .spinner-modern .ring:nth-child(3) {
        width: 40px;
        height: 40px;
    }

    .loader-text {
        font-size: 14px;
    }
}

/* RTL Support */
[dir="rtl"] .loader-container {
    direction: ltr;
}

