/* =========================================================
   S'gelaHub App Launch Experience
   Level 19 cinematic boot screen
   ========================================================= */

#sgh-app-loader {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    overflow: hidden;
    isolation: isolate;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 50% 42%, rgba(29,155,240,.18), transparent 28%),
        radial-gradient(circle at 18% 78%, rgba(14,165,233,.10), transparent 30%),
        radial-gradient(circle at 84% 18%, rgba(99,102,241,.10), transparent 30%),
        #050b18;
    color: #fff;
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transition:
        opacity .55s cubic-bezier(.22,1,.36,1),
        visibility 0s linear .55s;
}

#sgh-app-loader.is-leaving {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#sgh-app-loader::before {
    content: "";
    position: absolute;
    inset: -35%;
    background:
        radial-gradient(circle, rgba(56,189,248,.10) 0 1px, transparent 1.5px);
    background-size: 34px 34px;
    opacity: .35;
    transform: rotate(-8deg);
    animation: sghLoaderDrift 14s linear infinite;
}

#sgh-app-loader::after {
    content: "";
    position: absolute;
    width: min(78vw, 620px);
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid rgba(56,189,248,.10);
    box-shadow:
        0 0 90px rgba(14,165,233,.10),
        inset 0 0 90px rgba(14,165,233,.06);
    animation: sghLoaderPulse 2.4s cubic-bezier(.4,0,.2,1) infinite;
}

.sgh-loader-orbit {
    position: absolute;
    width: min(58vw, 420px);
    aspect-ratio: 1;
    border: 1px solid rgba(96,165,250,.13);
    border-radius: 50%;
    animation: sghLoaderSpin 5.5s linear infinite;
}

.sgh-loader-orbit::before,
.sgh-loader-orbit::after {
    content: "";
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 18px rgba(56,189,248,.95);
}

.sgh-loader-orbit::before {
    top: 7%;
    left: 50%;
}

.sgh-loader-orbit::after {
    right: 8%;
    bottom: 22%;
    width: 4px;
    height: 4px;
    opacity: .75;
}

.sgh-loader-content {
    position: relative;
    z-index: 2;
    width: min(88vw, 440px);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: sghLoaderContentIn 1.15s cubic-bezier(.16,1,.3,1) .15s both;
}

.sgh-loader-brand {
    position: relative;
    display: grid;
    place-items: center;
    width: 132px;
    height: 132px;
    margin-bottom: 24px;
}

.sgh-loader-brand::before {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 34px;
    background: rgba(29,155,240,.10);
    border: 1px solid rgba(125,211,252,.22);
    box-shadow:
        0 0 38px rgba(29,155,240,.22),
        inset 0 0 30px rgba(255,255,255,.04);
    backdrop-filter: blur(12px);
    animation: sghLoaderLogoGlow 1.8s ease-in-out infinite;
}

.sgh-loader-brand img {
    position: relative;
    z-index: 2;
    width: 92px;
    height: 92px;
    object-fit: contain;
    border-radius: 24px;
    filter:
        drop-shadow(0 0 14px rgba(56,189,248,.55))
        drop-shadow(0 10px 28px rgba(0,0,0,.35));
    animation: sghLoaderLogoIn 1.25s cubic-bezier(.16,1,.3,1) .35s both;
}

.sgh-loader-brand::after {
    content: "";
    position: absolute;
    z-index: 3;
    inset: 8px;
    border-radius: 30px;
    background: linear-gradient(
        120deg,
        transparent 25%,
        rgba(255,255,255,.32) 48%,
        transparent 65%
    );
    transform: translateX(-120%);
    animation: sghLoaderSweep 2.1s ease-in-out .9s 2;
    pointer-events: none;
}

.sgh-loader-title {
    margin: 0;
    font-size: clamp(2rem, 8vw, 3.35rem);
    line-height: 1;
    font-weight: 800;
    letter-spacing: -.055em;
    background: linear-gradient(110deg, #fff 18%, #bae6fd 48%, #60a5fa 82%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 28px rgba(56,189,248,.12);
}

.sgh-loader-tagline {
    margin: 10px 0 0;
    color: rgba(226,232,240,.78);
    font-size: clamp(.82rem, 2.7vw, .98rem);
    letter-spacing: .13em;
    text-transform: uppercase;
    font-weight: 600;
}

.sgh-loader-status {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 30px;
    padding: 10px 15px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 999px;
    background: rgba(255,255,255,.045);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    backdrop-filter: blur(12px);
    color: rgba(226,232,240,.72);
    font-size: .78rem;
    letter-spacing: .06em;
}

.sgh-loader-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 14px rgba(56,189,248,.9);
    animation: sghLoaderDot .8s ease-in-out infinite;
}

.sgh-loader-karabo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
    padding: 8px 13px 8px 8px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 999px;
    background: rgba(255,255,255,.035);
    backdrop-filter: blur(12px);
    color: rgba(255,255,255,.82);
    font-size: .8rem;
    font-weight: 600;
}

.sgh-loader-karabo img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 16px rgba(56,189,248,.28);
}

.sgh-loader-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    overflow: hidden;
    background: rgba(255,255,255,.04);
    z-index: 4;
}

.sgh-loader-progress::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 35%;
    background: linear-gradient(90deg, transparent, #38bdf8, #60a5fa, transparent);
    box-shadow: 0 0 16px rgba(56,189,248,.7);
    animation: sghLoaderProgress 1.05s ease-in-out infinite;
}

/* Level-19 hand-off: make the moment after the native PWA splash unmistakable. */
.sgh-loader-energy {
    position: absolute;
    width: min(96vw, 720px);
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid rgba(125,211,252,.08);
    box-shadow:
        0 0 80px rgba(56,189,248,.08),
        0 0 180px rgba(59,130,246,.06),
        inset 0 0 100px rgba(56,189,248,.05);
    opacity: 0;
    animation: sghLoaderEnergyIn 1.4s ease-out .05s forwards, sghLoaderEnergyPulse 2.2s ease-in-out 1.25s infinite;
}

.sgh-loader-energy::before,
.sgh-loader-energy::after {
    content: "";
    position: absolute;
    inset: 12%;
    border-radius: 50%;
    border: 1px solid rgba(56,189,248,.12);
}

.sgh-loader-energy::before {
    animation: sghLoaderRingSpin 3.8s linear infinite;
}

.sgh-loader-energy::after {
    inset: 28%;
    border-color: rgba(147,197,253,.10);
    animation: sghLoaderRingSpinReverse 2.8s linear infinite;
}

.sgh-loader-flare {
    position: absolute;
    width: min(58vw, 360px);
    height: min(58vw, 360px);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56,189,248,.24) 0%, rgba(59,130,246,.10) 28%, transparent 68%);
    filter: blur(3px);
    opacity: 0;
    animation: sghLoaderFlareIn 1.25s ease-out .15s forwards, sghLoaderFlarePulse 2.6s ease-in-out 1.4s infinite;
}

.sgh-loader-content > * {
    opacity: 0;
}

.sgh-loader-brand {
    animation: sghLoaderBrandIn 1.1s cubic-bezier(.16,1,.3,1) .28s forwards;
}

.sgh-loader-title {
    animation: sghLoaderTitleIn .9s cubic-bezier(.16,1,.3,1) .82s forwards;
}

.sgh-loader-tagline {
    animation: sghLoaderTextIn .75s ease-out 1.05s forwards;
}

.sgh-loader-status {
    animation: sghLoaderTextIn .7s ease-out 1.25s forwards;
}

.sgh-loader-karabo {
    animation: sghLoaderTextIn .7s ease-out 1.48s forwards;
}

.sgh-loader-brand::before {
    animation: sghLoaderLogoGlow 1.8s ease-in-out infinite, sghLoaderHaloBurst 1.2s ease-out .35s both;
}

@keyframes sghLoaderEnergyIn {
    from { opacity: 0; transform: scale(.35); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes sghLoaderEnergyPulse {
    0%,100% { transform: scale(.96); opacity: .65; }
    50% { transform: scale(1.02); opacity: 1; }
}

@keyframes sghLoaderFlareIn {
    from { opacity: 0; transform: scale(.25); }
    to { opacity: .9; transform: scale(1); }
}

@keyframes sghLoaderFlarePulse {
    0%,100% { transform: scale(.92); opacity: .55; }
    50% { transform: scale(1.08); opacity: .9; }
}

@keyframes sghLoaderRingSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes sghLoaderRingSpinReverse {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

@keyframes sghLoaderBrandIn {
    0% { opacity: 0; transform: scale(.45) rotate(-10deg); filter: brightness(.65); }
    58% { opacity: 1; transform: scale(1.12) rotate(2deg); filter: brightness(1.3); }
    100% { opacity: 1; transform: scale(1) rotate(0); filter: brightness(1); }
}

@keyframes sghLoaderTitleIn {
    from { opacity: 0; transform: translateY(22px) scale(.82); letter-spacing: .12em; }
    to { opacity: 1; transform: translateY(0) scale(1); letter-spacing: -.055em; }
}

@keyframes sghLoaderTextIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes sghLoaderHaloBurst {
    0% { box-shadow: 0 0 0 rgba(56,189,248,0), inset 0 0 0 rgba(255,255,255,0); }
    45% { box-shadow: 0 0 75px rgba(56,189,248,.65), inset 0 0 40px rgba(255,255,255,.12); }
    100% { box-shadow: 0 0 38px rgba(29,155,240,.22), inset 0 0 30px rgba(255,255,255,.04); }
}

body.sgh-app-loading {
    overflow: hidden !important;
}

@keyframes sghLoaderContentIn {
    from { opacity: 0; transform: translateY(18px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sghLoaderLogoIn {
    from { opacity: 0; transform: scale(.72) rotate(-5deg); }
    to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes sghLoaderLogoGlow {
    0%, 100% { transform: scale(.98); opacity: .78; }
    50% { transform: scale(1.04); opacity: 1; }
}

@keyframes sghLoaderSweep {
    0%, 35% { transform: translateX(-120%); }
    65%, 100% { transform: translateX(120%); }
}

@keyframes sghLoaderDrift {
    from { transform: translate3d(0,0,0) rotate(-8deg); }
    to { transform: translate3d(34px,24px,0) rotate(-8deg); }
}

@keyframes sghLoaderPulse {
    0%, 100% { transform: scale(.94); opacity: .55; }
    50% { transform: scale(1.04); opacity: 1; }
}

@keyframes sghLoaderSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes sghLoaderDot {
    0%, 100% { transform: scale(.75); opacity: .55; }
    50% { transform: scale(1.2); opacity: 1; }
}

@keyframes sghLoaderProgress {
    from { transform: translateX(-130%); }
    to { transform: translateX(310%); }
}

@media (max-width: 480px) {
    .sgh-loader-brand {
        width: 112px;
        height: 112px;
    }

    .sgh-loader-brand img {
        width: 80px;
        height: 80px;
    }

    .sgh-loader-tagline {
        letter-spacing: .09em;
    }

    .sgh-loader-status {
        margin-top: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #sgh-app-loader .sgh-loader-content > *,
    #sgh-app-loader .sgh-loader-brand {
        opacity: 1 !important;
        transform: none !important;
    }

    #sgh-app-loader *,
    #sgh-app-loader::before,
    #sgh-app-loader::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }

    #sgh-app-loader {
        transition-duration: .2s;
    }
}
