/* Loader Container - Covers entire screen */
#global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #ffffff;
    z-index: 999999; /* Highest priority */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
}

/* Hide state */
#global-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Content Wrapper */
.loader-content {
    text-align: center;
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    padding: 20px;
}

/* Main Title "FGV" */
.loader-title {
    font-size: 4rem;
    font-weight: 900;
    color: #1e293b; /* Slate 800 */
    letter-spacing: -2px;
    margin: 0;
    line-height: 1;
    opacity: 0;
    transform: translateY(30px);
    animation: slideUpFade 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Subtitle "Your CBT companion" */
.loader-subtitle {
    font-size: 1.25rem;
    font-weight: 300;
    color: #64748b; /* Slate 500 */
    margin-top: 10px;
    letter-spacing: 1px;
    opacity: 0;
    transform: translateY(20px);
    animation: slideUpFade 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

/* Spinner/Progress Element */
.loader-progress {
    margin-top: 40px;
    width: 60px;
    height: 4px;
    background: #f1f5f9;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 0.8s forwards;
}

.loader-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: #3b82f6; /* Blue 500 */
    animation: loadProgress 1.5s ease-in-out infinite;
    border-radius: 2px;
}

/* Animations */
@keyframes slideUpFade {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes loadProgress {
    0% { width: 0%; left: 0; }
    50% { width: 100%; left: 0; }
    100% { width: 0%; left: 100%; }
}

/* Dark Mode Support (optional, based on system preference) */
@media (prefers-color-scheme: dark) {
    #global-loader {
        background-color: #0f172a;
    }
    .loader-title {
        color: #f8fafc;
    }
    .loader-subtitle {
        color: #94a3b8;
    }
    .loader-progress {
        background: #334155;
    }
}
