/**
 * Global loader — Guruji Student Credit Card Scheme (Government of Jharkhand)
 *
 * VISIBILITY STRATEGY
 * ───────────────────
 * We use opacity + visibility for transitions instead of display:none.
 * display is controlled ONLY by JS (no !important, no CSS fighting).
 * The HTML element starts with inline style="display:flex; opacity:1"
 * set by the layout, so it shows immediately without FOUC.
 */

#global-loader {
    position: fixed;
    z-index: 99999;
    inset: 0;               /* left:0 top:0 right:0 bottom:0 */
    display: flex;          /* JS overrides this; NO !important here */
    align-items: center;
    justify-content: center;
    background: rgba(10, 28, 18, 0.68);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    /* Smooth fade in/out via opacity — JS drives the value */
    opacity: 1;
    transition: opacity 0.2s ease-out;
}

#global-loader.is-hidden,
#global-loader[hidden],
#global-loader[aria-busy="false"],
#global-loader[data-gscc-hiding="1"] {
    pointer-events: none !important;
}

/* ── Content card ─────────────────────────────────────────────── */
#global-loader .loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    max-width: 400px;
    width: 90%;
    padding: 2rem 2.25rem 1.75rem;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 14px;
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    position: relative;
    overflow: hidden;
}

/* Top accent line */
#global-loader .loader-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 72px;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(110, 231, 183, 0.9), transparent);
    border-radius: 0 0 3px 3px;
}

/* ── Text ─────────────────────────────────────────────────────── */
#global-loader .loader-title {
    color: #fff;
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    letter-spacing: 0.02em;
    margin-bottom: 0.35rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

#global-loader .loader-subtitle {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    margin-bottom: 1.4rem;
}

/* ── Spinner ──────────────────────────────────────────────────── */
#global-loader .loader-spinner-wrap {
    position: relative;
    width: 58px;
    height: 58px;
    margin-bottom: 1.1rem;
}

#global-loader .loader-spinner {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #6ee7b7;       /* green accent */
    animation: gscc-spin 0.85s linear infinite;
}

#global-loader .loader-spinner-inner {
    position: absolute;
    inset: 9px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.7);
    animation: gscc-spin 0.6s linear infinite reverse;
}

#global-loader .loader-text {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ── Keyframes ────────────────────────────────────────────────── */
@keyframes gscc-spin {
    to { transform: rotate(360deg); }
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 480px) {
    #global-loader .loader-content {
        padding: 1.6rem 1.25rem 1.4rem;
    }
    #global-loader .loader-title    { font-size: 0.95rem; }
    #global-loader .loader-subtitle { font-size: 0.68rem; }
    #global-loader .loader-spinner-wrap { width: 48px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
    #global-loader .loader-spinner,
    #global-loader .loader-spinner-inner {
        animation-duration: 2s;
    }
}
