/* Page Loader CSS */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    overflow: hidden;
}

/* Decorative Background Blobs - Like your website */
.page-loader::before,
.page-loader::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    pointer-events: none;
    animation: blobFloat 8s ease-in-out infinite alternate;
}

.page-loader::before {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #FF8C42 0%, transparent 70%);
    top: -150px;
    left: -150px;
}

.page-loader::after {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, #ffaa5c 0%, transparent 70%);
    bottom: -120px;
    right: -120px;
    animation-delay: -4s;
}

@keyframes blobFloat {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(40px, 30px) scale(1.08);
    }
}

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

.loader-content {
    text-align: center;
}

/* Logo Animation */
.loader-logo {
    width: 100px;
    height: 100px;
    margin: 0 auto 30px;
    position: relative;
    animation: logoFloat 2s ease-in-out infinite;
    background: white;
    border-radius: 50%;
    padding: 15px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.08), 0 8px 20px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Fallback if no logo */
.loader-logo-fallback {
    width: 80px;
    height: 80px;
    margin: 0 auto 30px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    color: #667eea;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    animation: logoFloat 2s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Spinner — scoped to the full-page loader ONLY so it never overrides the
   small button spinners (.order-submit-btn .loader-spinner, etc.) that also
   use the .loader-spinner class. */
.page-loader .loader-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    position: relative;
}

.page-loader .spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(255, 140, 66, 0.2);
    border-radius: 50%;
    border-top-color: #FF8C42;
    animation: spin 1s linear infinite;
}

.page-loader .spinner-ring:nth-child(2) {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-width: 3px;
    border-top-color: #ffaa5c;
    animation-duration: 1.5s;
    animation-direction: reverse;
}

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

/* Loading Text */
.loader-text {
    color: #1e293b;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.loader-subtext {
    color: #475569;
    font-size: 14px;
    font-weight: 400;
}

/* Loading Dots Animation */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

/* Progress Bar */
.loader-progress {
    width: 200px;
    height: 3px;
    background: rgba(255, 140, 66, 0.15);
    border-radius: 10px;
    margin-top: 20px;
    overflow: hidden;
}

.loader-progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #FF8C42 0%, #ff6b1a 100%);
    border-radius: 10px;
    animation: progress 2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(255, 140, 66, 0.5);
}

@keyframes progress {
    0% {
        width: 0%;
        margin-left: 0%;
    }
    50% {
        width: 75%;
        margin-left: 0%;
    }
    100% {
        width: 0%;
        margin-left: 100%;
    }
}

/* Pulse Animation for Alternative Style */
.loader-pulse {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    position: relative;
}

.pulse-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: white;
    opacity: 0.6;
    animation: pulse 2s ease-out infinite;
}

.pulse-circle:nth-child(2) {
    animation-delay: 0.5s;
}

.pulse-circle:nth-child(3) {
    animation-delay: 1s;
}

@keyframes pulse {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .loader-logo {
        width: 80px;
        height: 80px;
        margin-bottom: 20px;
        padding: 12px;
    }
    
    .loader-logo-fallback {
        width: 60px;
        height: 60px;
        margin-bottom: 20px;
    }
    
    .loader-logo-fallback {
        font-size: 28px;
    }
    
    .page-loader .loader-spinner {
        width: 50px;
        height: 50px;
    }
    
    .loader-text {
        font-size: 16px;
    }
    
    .loader-subtext {
        font-size: 13px;
    }
    
    .loader-progress {
        width: 150px;
    }
}

/* Fade Out Animation */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Custom Colors for Different Pages */
.page-loader.admin {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.page-loader.dark {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

.page-loader.light {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

.page-loader.light .loader-text,
.page-loader.light .loader-subtext {
    color: #111827;
}

.page-loader.light .spinner-ring {
    border-color: rgba(79, 70, 229, 0.2);
    border-top-color: #4f46e5;
}

.page-loader.light .loader-progress-bar {
    background: #4f46e5;
}
