/* ───────────────────────────────────────────────────────────────────────
   Global Loader — Modern brand-aligned UI
   Navy (#003366) → Red (#990033) gradient ring, frosted glass backdrop,
   refined typography. Toggled via the `.active` class from global-loader.js.
   ─────────────────────────────────────────────────────────────────────── */

#globalLoader {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility .25s ease;
}

#globalLoader.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ─── Glass card holding the spinner + text ─── */
#globalLoader .logo-ring {
    position: relative;
    width: 132px;
    height: 132px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* White inner disc — frosted, soft shadow, holds the logo */
#globalLoader .logo-bg {
    position: relative;
    width: 104px;
    height: 104px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: none;
}

#globalLoader .logo-img {
    width: 78%;
    height: 78%;
    object-fit: contain;
    animation: gl-breathe 2.4s ease-in-out infinite;
}

/* Conic-gradient ring — primary navy sweep */
#globalLoader .logo-ring .ring {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    width: 132px;
    height: 132px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        rgba(0, 51, 102, 0) 0deg,
        rgba(0, 51, 102, 0.55) 90deg,
        rgba(0, 51, 102, 1) 270deg,
        rgba(0, 51, 102, 0) 360deg
    );
    /* Hollow out the centre so only the ring is visible */
    -webkit-mask: radial-gradient(circle, transparent 50px, #000 52px);
            mask: radial-gradient(circle, transparent 50px, #000 52px);
    animation: gl-ring-spin 1.4s linear infinite;
    z-index: 1;
}

@keyframes gl-ring-spin {
    to { transform: rotate(360deg); }
}

@keyframes gl-breathe {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.06); opacity: 0.95; }
}

@keyframes gl-halo {
    0%, 100% { transform: scale(1); opacity: 0.55; }
    50%      { transform: scale(1.18); opacity: 0.20; }
}

/* ─── Caption ─── */
#globalLoader .loader-text {
    margin-top: 22px;
    margin-bottom: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
}

/* Animated dots — tighter, premium feel */
#globalLoader .dots {
    display: inline-block;
    width: 1.2em;
    text-align: left;
    color: #ffffff;
}

#globalLoader .dots::after {
    content: "";
    display: inline-block;
    animation: gl-dots 1.4s steps(4, end) infinite;
}

@keyframes gl-dots {
    0%   { content: ""; }
    25%  { content: "."; }
    50%  { content: ".."; }
    75%  { content: "..."; }
    100% { content: ""; }
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
    #globalLoader .logo-img,
    #globalLoader .logo-ring .ring,
    #globalLoader .logo-ring::after,
    #globalLoader .dots::after {
        animation: none;
    }
    #globalLoader .logo-ring .ring {
        background: conic-gradient(
            from 0deg,
            rgba(0, 51, 102, 0.40) 0deg,
            rgba(0, 51, 102, 1)    180deg,
            rgba(0, 51, 102, 0.40) 360deg
        );
    }
}

/* ─── Small phones ─── */
@media (max-width: 479.98px) {
    #globalLoader .logo-ring { width: 112px; height: 112px; }
    #globalLoader .logo-bg   { width: 88px;  height: 88px;  }
    #globalLoader .logo-ring .ring { width: 112px; height: 112px;
        -webkit-mask: radial-gradient(circle, transparent 42px, #000 44px);
                mask: radial-gradient(circle, transparent 42px, #000 44px);
    }
    #globalLoader .loader-text { font-size: 13px; margin-top: 18px; }
}
