body.preloader-active {
    overflow: hidden !important;
}

#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #ffffff 0%, #f4fafb 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.6s;
    visibility: visible;
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.logo-container {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.preloader-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    z-index: 2;
    animation: pulseLogo 2s ease-in-out infinite;
}

.fallback-logo {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background-color: rgba(56, 123, 128, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(56, 123, 128, 0.1);
    z-index: 2;
}

.fallback-svg {
    width: 48px;
    height: 48px;
    color: #387B80;
    animation: rotateSvg 15s linear infinite;
}

.loader-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 3px solid rgba(56, 123, 128, 0.1);
    border-top: 3px solid #387B80;
    border-radius: 50%;
    animation: spinRing 1.5s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
    z-index: 1;
}

.loading-text {
    font-family: 'Noto Sans Sinhala', 'Montserrat', sans-serif;
    font-size: 18px;
    font-weight: 500;
    color: #387B80;
    letter-spacing: 1px;
    opacity: 0.8;
    animation: shimmerText 2s ease-in-out infinite alternate;
}

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

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

@keyframes pulseLogo {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0px rgba(56, 123, 128, 0)); }
    50% { transform: scale(1.05); filter: drop-shadow(0 0 15px rgba(56, 123, 128, 0.3)); }
}

@keyframes shimmerText {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}
