/* =====================================================
   GLOBAL LOADER / SPLASHSCREEN
   Enhanced with better animations and performance
   ===================================================== */

   #global-loader {
    position: fixed;
    inset: 0;
    background-color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#global-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Logo Container */
.loader-logo-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Logo Image */
#img-splashscreen {
    height: 120px;
    width: 120px;
    object-fit: contain;
    animation: breathe 2s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}

/* Breathing Animation */
@keyframes breathe {
    0%, 100% {
        opacity: 0.7;
        transform: scale(0.95);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Loading Text */
.loader-text {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    opacity: 0.9;
    animation: fadeInOut 2s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* Progress Bar Container */
.loader-progress {
    width: 280px;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Progress Bar Fill */
#loader-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffffff 0%, rgba(255, 255, 255, 0.8) 100%);
    border-radius: 20px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Spinner (Optional Alternative) */
.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Dots Animation (Optional) */
.loader-dots {
    display: flex;
    gap: 0.5rem;
}

.loader-dots span {
    width: 10px;
    height: 10px;
    background-color: #ffffff;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.loader-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loader-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 576px) {
    #img-splashscreen {
        height: 100px;
        width: 100px;
    }
    
    .loader-progress {
        width: 240px;
    }
    
    .loader-text {
        font-size: 0.875rem;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    #img-splashscreen {
        animation: none;
        opacity: 1;
        transform: none;
    }
    
    .loader-text,
    .loader-spinner,
    .loader-dots span {
        animation: none;
    }
    
    #loader-bar {
        transition: none;
    }
}