
/* Preloader background uses an image so it only covers main content visually */
#preloader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000; /* fallback */
    background-image: url('/images/background-loader.webp');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 30;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

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

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

.logo-container {
    margin-bottom: 3rem;
    animation: fadeInScale 1s ease-out;
}

.logo-container img {
    max-width: 200px;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.3));
}

.loading-bar-container {
    position: relative;
    width: 400px;
    margin: 0 auto;
    padding: 30px 0;
}

.loading-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: visible;
    position: relative;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.loading-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a9eff, #3b82f6, #2563eb);
    border-radius: 10px;
    width: 0%;
    position: relative;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
    transition: width 0.1s linear;
}

.fish-loader {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    z-index: 10;
    transition: left 0.1s linear;
}

.fish-loader img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.spinner-container {
    margin-top: 2rem;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #fff;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

.dots-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 2rem;
}

.dot {
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-text {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 2px;
    margin-top: 2rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}



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

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.progress-percentage {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 1rem;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .logo-container img {
        max-width: 150px;
    }

    .loading-bar-container {
        width: 300px;
    }

    .fish-loader {
        width: 40px;
        height: 40px;
    }

    .loading-text {
        font-size: 1rem;
    }

    .progress-percentage {
        font-size: 1.2rem;
    }
}

/* Apply loader background to sidebar area as requested */
body.preloading .sidebar-pane,
body.preloading .sidebar-content {
    background-image: url('/images/background-loader.webp');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
}
