/* ============================================
   GAUVEDA GLOBAL - PREMIUM PROFESSIONAL LOADER
   ============================================ */

:root {
    --loader-primary: #1a5f23;
    --loader-secondary: #2d7c3a;
    --loader-accent: #4CAF50;
    --loader-light: #81C784;
    --loader-white: #ffffff;
    --loader-dark: #0d2818;
    --loader-shadow: rgba(26, 95, 35, 0.15);
    --loader-glow: rgba(76, 175, 80, 0.3);
}

/* Main Loader Overlay */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(248, 250, 252, 0.98) 50%, 
        rgba(255, 255, 255, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.page-loader.fade-out {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
}

/* Subtle Background Pattern */
.page-loader::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle at 25% 25%, var(--loader-glow) 0%, transparent 50%),
                      radial-gradient(circle at 75% 75%, rgba(129, 199, 132, 0.1) 0%, transparent 50%);
    animation: backgroundPulse 4s ease-in-out infinite alternate;
    z-index: -1;
}

@keyframes backgroundPulse {
    0% { opacity: 0.3; }
    100% { opacity: 0.6; }
}

/* Premium Loader Container */
.loader-container {
    position: relative;
    z-index: 10;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 24px;
    padding: 40px 30px;
    box-shadow: 0 20px 60px var(--loader-shadow),
                0 8px 32px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    animation: containerFloat 3s ease-in-out infinite alternate;
}

@keyframes containerFloat {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-8px); }
}

/* Modern Floating Elements */
.loader-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

.particle {
    position: absolute;
    background: var(--loader-accent);
    border-radius: 50%;
    opacity: 0.1;
    animation: modernFloat 12s linear infinite;
}

.particle:nth-child(1) { left: 5%; width: 2px; height: 2px; animation-delay: 0s; }
.particle:nth-child(2) { left: 15%; width: 3px; height: 3px; animation-delay: 2s; }
.particle:nth-child(3) { left: 25%; width: 1px; height: 1px; animation-delay: 4s; }
.particle:nth-child(4) { left: 35%; width: 2px; height: 2px; animation-delay: 1s; }
.particle:nth-child(5) { left: 45%; width: 1px; height: 1px; animation-delay: 3s; }
.particle:nth-child(6) { left: 55%; width: 3px; height: 3px; animation-delay: 5s; }
.particle:nth-child(7) { left: 65%; width: 2px; height: 2px; animation-delay: 1.5s; }
.particle:nth-child(8) { left: 75%; width: 1px; height: 1px; animation-delay: 3.5s; }
.particle:nth-child(9) { left: 85%; width: 2px; height: 2px; animation-delay: 2.5s; }
.particle:nth-child(10) { left: 95%; width: 1px; height: 1px; animation-delay: 4.5s; }

@keyframes modernFloat {
    0% {
        transform: translateY(100vh) translateX(-50px);
        opacity: 0;
    }
    5% {
        opacity: 0.3;
    }
    95% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-10vh) translateX(50px);
        opacity: 0;
    }
}

/* Premium Brand Logo - High Quality */
.loader-logo {
    width: 200px;
    height: 200px;
    margin: 0 auto 35px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: logoBreath 2.5s ease-in-out infinite;
    /* Enhance container for crisp logo display */
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.loader-logo img {
    width: 100%;
    height: 100%;
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
    object-position: center;
    /* High-quality image rendering properties */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -moz-crisp-edges;
    image-rendering: -o-crisp-edges;
    image-rendering: crisp-edges;
    image-rendering: high-quality;
    /* Prevent blur and ensure sharp edges */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0) scale(1);
    transform: translateZ(0) scale(1);
    /* Enhanced shadow and visual effects */
    filter: contrast(1.1) saturate(1.1) drop-shadow(0 4px 20px rgba(26, 95, 35, 0.15));
    /* Remove border radius to prevent pixelation */
    border-radius: 0;
    /* Smooth anti-aliasing */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent image smoothing blur */
    -ms-interpolation-mode: nearest-neighbor;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    /* Final override for sharp rendering */
    image-rendering: auto;
}

@keyframes logoBreath {
    0%, 100% { 
        transform: scale(1) translateZ(0);
        filter: contrast(1.1) saturate(1.1) drop-shadow(0 4px 20px rgba(26, 95, 35, 0.15));
    }
    50% { 
        transform: scale(1.03) translateZ(0);
        filter: contrast(1.15) saturate(1.15) drop-shadow(0 6px 25px rgba(26, 95, 35, 0.2));
    }
}

/* Modern Professional Spinner */
.organic-spinner {
    width: 60px;
    height: 60px;
    margin: 30px auto;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.leaf {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--loader-accent);
    border-radius: 50%;
    opacity: 0.8;
    animation: modernSpin 1.2s ease-in-out infinite;
}

.leaf:nth-child(1) { 
    top: 4px; 
    left: 50%; 
    margin-left: -4px;
    animation-delay: 0s; 
}
.leaf:nth-child(2) { 
    top: 15px; 
    right: 4px; 
    animation-delay: 0.1s; 
}
.leaf:nth-child(3) { 
    bottom: 15px; 
    right: 4px; 
    animation-delay: 0.2s; 
}
.leaf:nth-child(4) { 
    bottom: 4px; 
    left: 50%; 
    margin-left: -4px;
    animation-delay: 0.3s; 
}
.leaf:nth-child(5) { 
    bottom: 15px; 
    left: 4px; 
    animation-delay: 0.4s; 
}
.leaf:nth-child(6) { 
    top: 15px; 
    left: 4px; 
    animation-delay: 0.5s; 
}

@keyframes modernSpin {
    0% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.3;
        transform: scale(1.4);
    }
    100% { 
        opacity: 1;
        transform: scale(1);
    }
}

/* Premium Progress Ring */
.progress-ring {
    width: 60px;
    height: 60px;
    margin: 25px auto;
    position: relative;
    background: linear-gradient(135deg, var(--loader-white), rgba(248, 250, 252, 0.8));
    border-radius: 50%;
    padding: 8px;
    box-shadow: 0 4px 20px var(--loader-shadow),
                inset 0 1px 0 rgba(255, 255, 255, 0.9),
                inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.progress-circle {
    width: 44px;
    height: 44px;
    border: 3px solid transparent;
    border-top: 3px solid var(--loader-accent);
    border-right: 3px solid var(--loader-light);
    border-radius: 50%;
    animation: smoothSpin 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    position: relative;
}

.progress-circle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: var(--loader-accent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: centerPulse 1.5s ease-in-out infinite;
}

@keyframes smoothSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes centerPulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.7;
    }
}

/* Premium Brand Typography */
.loader-text {
    color: var(--loader-primary);
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 28px;
    margin: 20px 0 8px;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--loader-primary) 0%, var(--loader-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(26, 95, 35, 0.1);
    animation: brandGlow 2s ease-in-out infinite alternate;
    position: relative;
}

.loader-subtext {
    color: rgba(26, 95, 35, 0.7);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 35px;
    letter-spacing: 0.3px;
    line-height: 1.4;
    opacity: 0.8;
}

@keyframes brandGlow {
    0% { 
        text-shadow: 0 2px 10px rgba(26, 95, 35, 0.1);
        transform: translateY(0);
    }
    100% { 
        text-shadow: 0 4px 20px rgba(26, 95, 35, 0.2);
        transform: translateY(-1px);
    }
}

/* Dots Loading Animation */
.dots-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
    margin: 0 4px;
    animation: dotBounce 1.4s ease-in-out infinite both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
.dot:nth-child(3) { animation-delay: 0s; }

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Seeds Growing Animation */
.seeds-animation {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 60px;
    margin: 20px 0;
}

.seed-stem {
    width: 3px;
    background: linear-gradient(to top, #4CAF50, #8BC34A);
    margin: 0 5px;
    border-radius: 2px;
    animation: stemGrow 2s ease-in-out infinite;
}

.seed-stem:nth-child(1) { height: 20px; animation-delay: 0s; }
.seed-stem:nth-child(2) { height: 35px; animation-delay: 0.2s; }
.seed-stem:nth-child(3) { height: 45px; animation-delay: 0.4s; }
.seed-stem:nth-child(4) { height: 30px; animation-delay: 0.6s; }
.seed-stem:nth-child(5) { height: 25px; animation-delay: 0.8s; }

@keyframes stemGrow {
    0%, 50% { transform: scaleY(0.7); opacity: 0.7; }
    25%, 75% { transform: scaleY(1.2); opacity: 1; }
    100% { transform: scaleY(1); opacity: 0.9; }
}

/* Premium Progress Bar */
.loading-progress {
    width: 240px;
    height: 6px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.2), rgba(248, 250, 252, 0.3));
    border-radius: 10px;
    margin: 30px auto 20px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1),
                0 1px 2px rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, 
        var(--loader-accent) 0%, 
        var(--loader-light) 50%, 
        var(--loader-accent) 100%);
    background-size: 200% 100%;
    border-radius: 10px;
    position: relative;
    animation: modernProgressMove 2.5s ease-in-out infinite,
               modernProgressGlow 2.5s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%);
    border-radius: 10px;
    animation: progressShimmer 2s ease-in-out infinite;
}

@keyframes modernProgressMove {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

@keyframes modernProgressGlow {
    0%, 100% { 
        background-position: 0% 50%;
        box-shadow: 0 0 15px rgba(76, 175, 80, 0.4),
                    inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    50% { 
        background-position: 100% 50%;
        box-shadow: 0 0 25px rgba(76, 175, 80, 0.6),
                    inset 0 1px 0 rgba(255, 255, 255, 0.5);
    }
}

@keyframes progressShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Premium Percentage Display */
.loading-percentage {
    color: var(--loader-primary);
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 600;
    margin-top: 20px;
    background: linear-gradient(135deg, var(--loader-primary) 0%, var(--loader-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    animation: percentagePulse 1.5s ease-in-out infinite;
    position: relative;
}

.loading-percentage::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--loader-accent), transparent);
    border-radius: 2px;
    animation: underlineGlow 1.5s ease-in-out infinite;
}

@keyframes percentagePulse {
    0%, 100% { 
        transform: scale(1);
        text-shadow: 0 2px 8px rgba(26, 95, 35, 0.1);
    }
    50% { 
        transform: scale(1.05);
        text-shadow: 0 4px 16px rgba(26, 95, 35, 0.2);
    }
}

@keyframes underlineGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .loader-logo {
        width: 180px;
        height: 180px;
    }
    
    .loader-logo img {
        max-width: 180px;
        max-height: 180px;
    }
    
    .loader-text {
        font-size: 24px;
        letter-spacing: -0.3px;
    }
    
    .loader-subtext {
        font-size: 14px;
    }
    
    .organic-spinner {
        width: 60px;
        height: 60px;
    }
    
    .progress-ring {
        width: 60px;
        height: 60px;
    }
    
    .progress-circle {
        width: 44px;
        height: 44px;
    }
    
    .loading-progress {
        width: 200px;
    }
}

@media (max-width: 480px) {
    .loader-logo {
        width: 160px;
        height: 160px;
        margin-bottom: 30px;
    }
    
    .loader-logo img {
        max-width: 160px;
        max-height: 160px;
    }
    
    .loader-text {
        font-size: 22px;
    }
    
    .loader-subtext {
        font-size: 13px;
    }
    
    .organic-spinner {
        width: 50px;
        height: 50px;
    }
    
    .seeds-animation {
        height: 50px;
    }
    
    .loading-progress {
        width: 180px;
    }
    
    .loading-percentage {
        font-size: 16px;
    }
}

/* Performance Optimizations */
.page-loader * {
    will-change: transform, opacity;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .page-loader * {
        animation-duration: 0.5s !important;
        animation-iteration-count: 1 !important;
    }
    
    .particle {
        animation: none;
        opacity: 0.1;
    }
}
