/* =============================================================================
   tenant-plus-loader.css
   (wwwroot/css/tenant-plus-loader.css)
   -----------------------------------------------------------------------------
   Tenant+ branded post-sign-in loader.

   When a user signs into Tenant+ via the modal (tenant-plus-signin.js), the
   redirect into /tenant-portal/... used to flash the generic Ikhayalami
   loader. That loader was right for the marketing site but wrong for a
   premium ops dashboard.

   This is the Tenant+ version:
     • Charcoal canvas (same #14141A as the sidebar) so it visually pre-rolls
       into the dashboard chrome.
     • Orange + sky-blue gradient ring (brand colours from the existing
       palette — no new tokens introduced).
     • A pulsing "+" glyph at the center — the brand mark used in the
       sidebar, header chip, and burger drawer card.
     • Stacked status messages that cycle while the page loads.
     • A bottom progress bar with the same gradient.

   Self-contained — namespaced under .tpl- so it can co-exist with the
   generic site loader on shared pages.
   ============================================================================= */

.tpl-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(1200px 800px at 50% 30%, #1f1f28 0%, #14141A 60%, #0c0c11 100%);
    color: rgba(255, 255, 255, 0.92);
    font-family: 'DM Sans', 'Inter', system-ui, sans-serif;
    opacity: 1;
    /* Exit fade halved 2026-05 (480ms → 240ms) — pairs with halved
       MIN/MAX_DISPLAY in tenant-plus-loader.js so the whole reveal
       lifecycle feels snappier without losing the brand cue. */
    transition: opacity 240ms cubic-bezier(.22, 1, .36, 1);
    overflow: hidden;
}

    .tpl-overlay.tpl-hidden {
        opacity: 0;
        pointer-events: none;
    }

    /* Faint ambient grid behind the glyph — gives the canvas dimension */
    .tpl-overlay::before {
        content: '';
        position: absolute;
        inset: 0;
        background-image: linear-gradient(rgba(255, 255, 255, 0.024) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.024) 1px, transparent 1px);
        background-size: 48px 48px;
        mask-image: radial-gradient(closest-side at 50% 50%, #000 30%, transparent 90%);
        -webkit-mask-image: radial-gradient(closest-side at 50% 50%, #000 30%, transparent 90%);
        pointer-events: none;
    }

    /* Aurora glow — sky-blue → orange smear behind the brand mark */
    .tpl-overlay::after {
        content: '';
        position: absolute;
        width: 520px;
        height: 520px;
        border-radius: 50%;
        background: radial-gradient(closest-side at 30% 40%, rgba(245, 130, 32, 0.22), transparent 70%), radial-gradient(closest-side at 70% 60%, rgba(56, 189, 248, 0.18), transparent 70%);
        filter: blur(40px);
        animation: tplAurora 4s ease-in-out infinite;
        pointer-events: none;
    }

@keyframes tplAurora {
    0%, 100% {
        transform: translate(-12px, -8px) scale(1);
    }

    50% {
        transform: translate(12px, 8px) scale(1.06);
    }
}


/* ── Brand mark — animated ring + plus glyph ────────────────────────────── */

.tpl-mark {
    position: relative;
    width: 132px;
    height: 132px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

/* Outer gradient ring — segmented sweep */
.tpl-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #F58220 0deg, #FBBF24 60deg, transparent 120deg, transparent 240deg, #38BDF8 300deg, #F58220 360deg);
    /* Punch the inner circle out with a CSS mask so we get a ring,
       not a filled disc. */
    -webkit-mask: radial-gradient(closest-side, transparent 62%, #000 64%);
    mask: radial-gradient(closest-side, transparent 62%, #000 64%);
    animation: tplRingSpin 1.2s linear infinite;
    filter: drop-shadow(0 4px 20px rgba(245, 130, 32, 0.28));
}

@keyframes tplRingSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Inner static disc — gives the glyph somewhere to sit */
.tpl-disc {
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: radial-gradient(closest-side, #1f1f28 60%, #14141A 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 6px 12px rgba(0, 0, 0, 0.4);
}

/* The "+" wordmark — Tenant+ identity */
.tpl-glyph {
    position: relative;
    z-index: 3;
    font-family: 'Clash Display', 'DM Sans', sans-serif;
    font-size: 3.2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
    background: linear-gradient(135deg, #F58220 0%, #FBBF24 50%, #38BDF8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: tplGlyphPulse 0.9s ease-in-out infinite;
}

@keyframes tplGlyphPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.08);
        opacity: 0.85;
    }
}


/* ── Wordmark ───────────────────────────────────────────────────────────── */
.tpl-wordmark {
    margin-top: 22px;
    font-family: 'Clash Display', 'DM Sans', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #fff;
    z-index: 2;
}

    .tpl-wordmark .tpl-plus {
        background: linear-gradient(135deg, #F58220, #FBBF24);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        font-weight: 700;
        margin-left: 1px;
    }

.tpl-tagline {
    margin-top: 4px;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.42);
    z-index: 2;
}


/* ── Status cycler — stacked, fades through messages ────────────────────── */
.tpl-status {
    margin-top: 28px;
    height: 22px;
    overflow: hidden;
    position: relative;
    z-index: 2;
    text-align: center;
    width: 280px;
}

.tpl-status-line {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.72);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 200ms ease, transform 200ms ease;
}

    .tpl-status-line.is-active {
        opacity: 1;
        transform: translateY(0);
    }

    .tpl-status-line.is-leaving {
        opacity: 0;
        transform: translateY(-8px);
    }


/* ── Progress bar — bottom of viewport ──────────────────────────────────── */
.tpl-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
    z-index: 2;
}

.tpl-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #F58220 0%, #FBBF24 40%, #38BDF8 100%);
    box-shadow: 0 0 12px rgba(245, 130, 32, 0.4);
    transition: width 200ms cubic-bezier(.22, 1, .36, 1);
}


/* ── Footer credit — subtle "by Ikhayalami" ─────────────────────────────── */
.tpl-credit {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.28);
    z-index: 2;
    white-space: nowrap;
}


/* ── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .tpl-ring,
    .tpl-glyph,
    .tpl-overlay::after {
        animation: none !important;
    }

    .tpl-overlay {
        transition: opacity 200ms linear;
    }
}

/* ── Small phones ───────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .tpl-mark {
        width: 108px;
        height: 108px;
    }

    .tpl-glyph {
        font-size: 2.6rem;
    }

    .tpl-wordmark {
        font-size: 1.25rem;
    }

    .tpl-status {
        width: 88vw;
    }
}
