/**
 * Auth cinematic layer — login / logout first impression.
 * Ilmgah SMS — adapted from POS auth-experience.css
 */

/* ── Login: shell entrance ───────────────────────────────────────── */
@keyframes authShellReveal {
    from { opacity: 0; filter: blur(10px); }
    to   { opacity: 1; filter: blur(0); }
}

@keyframes authBrandSlide {
    from { opacity: 0; transform: translateX(-28px) scale(0.98); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes authFormSlide {
    from { opacity: 0; transform: translateX(36px) scale(0.98); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes authCardLift {
    from {
        opacity: 0;
        transform: translateY(28px) rotateX(6deg);
        box-shadow: 0 4px 28px rgba(15,23,42,0.04);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0);
        box-shadow: 0 4px 28px rgba(15,23,42,0.09), 0 32px 64px rgba(15,23,42,0.07);
    }
}

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

@keyframes authShimmer {
    0%   { transform: translateX(-120%) skewX(-12deg); opacity: 0; }
    15%  { opacity: 1; }
    100% { transform: translateX(220%) skewX(-12deg); opacity: 0; }
}

@keyframes authMeshShift {
    0%, 100% { opacity: 0.55; transform: scale(1) translate(0, 0); }
    50%       { opacity: 0.85; transform: scale(1.08) translate(4%, -3%); }
}

.auth-experience .auth-shell {
    animation: authShellReveal 0.85s cubic-bezier(0.22,1,0.36,1) both;
}
.auth-experience .auth-brand {
    animation: authBrandSlide 0.9s cubic-bezier(0.22,1,0.36,1) 0.06s both;
}
.auth-experience .auth-form-wrap {
    animation: authFormSlide 0.9s cubic-bezier(0.22,1,0.36,1) 0.1s both;
}
.auth-experience .auth-card {
    animation: authCardLift 0.95s cubic-bezier(0.22,1,0.36,1) 0.14s both;
    position: relative;
    overflow: hidden;
}
.auth-experience .auth-card::after {
    content: "";
    position: absolute;
    inset: -40% -40%;
    width: 45%;
    background: linear-gradient(
        105deg,
        transparent 0%,
        rgba(255,255,255,0.22) 45%,
        rgba(255,255,255,0.55) 50%,
        rgba(255,255,255,0.22) 55%,
        transparent 100%
    );
    animation: authShimmer 1.35s cubic-bezier(0.4,0,0.2,1) 0.55s forwards;
    pointer-events: none;
    z-index: 2;
}

.auth-experience .auth-brand-inner > .auth-brand-top {
    animation: authFieldRise 0.65s cubic-bezier(0.22,1,0.36,1) 0.2s both;
}
.auth-experience .auth-brand-inner > .tagline {
    animation: authFieldRise 0.65s cubic-bezier(0.22,1,0.36,1) 0.28s both;
}
.auth-experience .auth-brand-inner > .school-scene {
    animation: authFieldRise 0.75s cubic-bezier(0.22,1,0.36,1) 0.36s both;
}
.auth-experience .auth-card > h2 {
    animation: authFieldRise 0.55s cubic-bezier(0.22,1,0.36,1) 0.22s both;
}
.auth-experience .auth-card > .sub {
    animation: authFieldRise 0.55s cubic-bezier(0.22,1,0.36,1) 0.28s both;
}
.auth-experience .auth-card form > .field:first-of-type {
    animation: authFieldRise 0.55s cubic-bezier(0.22,1,0.36,1) 0.34s both;
}
.auth-experience .auth-card form > .field:last-of-type {
    animation: authFieldRise 0.55s cubic-bezier(0.22,1,0.36,1) 0.40s both;
}
.auth-experience .auth-card form > .row-between {
    animation: authFieldRise 0.55s cubic-bezier(0.22,1,0.36,1) 0.46s both;
}
.auth-experience .auth-card form > .btn-primary {
    animation: authFieldRise 0.55s cubic-bezier(0.22,1,0.36,1) 0.52s both;
}
.auth-experience .auth-card .demo-box {
    animation: authFieldRise 0.55s cubic-bezier(0.22,1,0.36,1) 0.58s both;
}
.auth-experience .auth-card .foot-note,
.auth-experience .auth-card .auth-credit {
    animation: authFieldRise 0.55s cubic-bezier(0.22,1,0.36,1) 0.66s both;
}

.auth-experience .auth-form-wrap {
    position: relative;
}
.auth-experience .auth-form-wrap::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 70% 20%, rgba(16,185,129,0.08), transparent 55%),
        radial-gradient(ellipse 60% 40% at 20% 80%, rgba(5,150,105,0.06), transparent 50%);
    animation: authMeshShift 18s ease-in-out infinite;
    pointer-events: none;
}

.auth-experience .btn-primary {
    position: relative;
    overflow: hidden;
}
.auth-experience .btn-primary.is-loading {
    pointer-events: none;
    opacity: 0.95;
    font-size: 0;
}
.auth-experience .btn-primary.is-loading i { display: none; }
.auth-experience .btn-primary.is-loading::after {
    content: "";
    width: 1.35rem;
    height: 1.35rem;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authSpin 0.65s linear infinite;
    display: inline-block;
    vertical-align: middle;
    font-size: 1rem;
}
@keyframes authSpin {
    to { transform: rotate(360deg); }
}

/* ── Logout bridge (full screen) ───────────────────────────────── */
.logout-bridge-body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    color: #fff;
    overflow: hidden;
    background: #050d1f;
}

.logout-bridge-bg {
    position: fixed;
    inset: 0;
    background: linear-gradient(155deg, #03180a 0%, #064e3b 42%, #065f46 100%);
    z-index: 0;
}
.logout-bridge-bg::before {
    content: "";
    position: absolute;
    width: min(120vw, 900px);
    height: min(120vw, 900px);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(52,211,153,0.35) 0%, transparent 62%);
    top: -35%; right: -25%;
    animation: lbOrbA 14s ease-in-out infinite;
}
.logout-bridge-bg::after {
    content: "";
    position: absolute;
    width: min(100vw, 700px);
    height: min(100vw, 700px);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(110,231,183,0.28) 0%, transparent 65%);
    bottom: -30%; left: -20%;
    animation: lbOrbB 18s ease-in-out infinite;
}

@keyframes lbOrbA {
    0%, 100% { transform: translate(0,0) scale(1); opacity: 0.9; }
    50%       { transform: translate(-6%,8%) scale(1.12); opacity: 1; }
}
@keyframes lbOrbB {
    0%, 100% { transform: translate(0,0) scale(1); }
    50%       { transform: translate(8%,-6%) scale(1.08); }
}

.logout-bridge-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, black 20%, transparent 75%);
    z-index: 1;
    pointer-events: none;
    animation: lbGridPulse 4s ease-in-out infinite;
}
@keyframes lbGridPulse {
    0%, 100% { opacity: 0.4; }
    50%       { opacity: 0.75; }
}

.logout-bridge-main {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    text-align: center;
}

@keyframes lbContentIn {
    from { opacity: 0; transform: translateY(24px) scale(0.94); filter: blur(8px); }
    to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.logout-bridge-card {
    max-width: 420px;
    animation: lbContentIn 0.75s cubic-bezier(0.22,1,0.36,1) both;
}

.logout-bridge-mark {
    width: 88px;
    height: 88px;
    margin: 0 auto 1.5rem;
    border-radius: 22px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.22);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.35rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
    position: relative;
    z-index: 1;
    animation: lbMarkFloat 3s ease-in-out infinite;
}
@keyframes lbMarkFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}

.logout-bridge-rings {
    position: absolute;
    inset: -12px;
    border-radius: 28px;
    pointer-events: none;
}
.logout-bridge-rings span {
    position: absolute;
    inset: 0;
    border-radius: 22px;
    border: 2px solid transparent;
    border-top-color: rgba(52,211,153,0.65);
    border-right-color: rgba(110,231,183,0.35);
    animation: lbRing 1.8s linear infinite;
}
.logout-bridge-rings span:nth-child(2) {
    inset: 8px;
    animation-duration: 2.4s;
    animation-direction: reverse;
    border-top-color: rgba(110,231,183,0.5);
}
.logout-bridge-rings span:nth-child(3) {
    inset: 16px;
    animation-duration: 3.1s;
    border-top-color: rgba(52,211,153,0.4);
}
@keyframes lbRing {
    to { transform: rotate(360deg); }
}

.logout-bridge-title {
    font-size: clamp(1.35rem, 4vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0 0 0.5rem;
    background: linear-gradient(120deg, #fff 0%, #6ee7b7 45%, #a7f3d0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.logout-bridge-sub {
    margin: 0 0 2rem;
    font-size: 0.95rem;
    color: rgba(226,232,240,0.78);
    line-height: 1.5;
}

.logout-bridge-dots {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
    justify-content: center;
    margin-top: 0.25rem;
}
.logout-bridge-dots i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6ee7b7, #34d399);
    animation: lbDot 1.1s ease-in-out infinite both;
    box-shadow: 0 0 12px rgba(52,211,153,0.6);
}
.logout-bridge-dots i:nth-child(2) { animation-delay: 0.15s; }
.logout-bridge-dots i:nth-child(3) { animation-delay: 0.30s; }
@keyframes lbDot {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.45; }
    50%       { transform: translateY(-6px) scale(1.15); opacity: 1; }
}

.logout-bridge-bar {
    height: 3px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    overflow: hidden;
    margin-top: 1.75rem;
}
.logout-bridge-bar > span {
    display: block;
    height: 100%;
    width: 35%;
    border-radius: inherit;
    background: linear-gradient(90deg, #34d399, #6ee7b7, #a7f3d0);
    animation: lbBar 1.15s ease-in-out infinite;
    box-shadow: 0 0 16px rgba(52,211,153,0.55);
}
@keyframes lbBar {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(380%); }
}

/* ── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .auth-experience .auth-shell,
    .auth-experience .auth-brand,
    .auth-experience .auth-form-wrap,
    .auth-experience .auth-card,
    .auth-experience .auth-card::after,
    .auth-experience .auth-brand-inner > .auth-brand-top,
    .auth-experience .auth-brand-inner > .tagline,
    .auth-experience .auth-brand-inner > .school-scene,
    .auth-experience .auth-card > h2,
    .auth-experience .auth-card > .sub,
    .auth-experience .auth-card form > .field:first-of-type,
    .auth-experience .auth-card form > .field:last-of-type,
    .auth-experience .auth-card form > .row-between,
    .auth-experience .auth-card form > .btn-primary,
    .auth-experience .auth-card .demo-box,
    .auth-experience .auth-card .foot-note,
    .auth-experience .auth-card .auth-credit,
    .auth-experience .auth-form-wrap::before,
    .logout-bridge-bg::before,
    .logout-bridge-bg::after,
    .logout-bridge-grid,
    .logout-bridge-card,
    .logout-bridge-mark,
    .logout-bridge-rings span,
    .logout-bridge-dots i,
    .logout-bridge-bar > span {
        animation: none !important;
    }
    .auth-experience .auth-shell,
    .auth-experience .auth-brand,
    .auth-experience .auth-form-wrap,
    .auth-experience .auth-card,
    .logout-bridge-card {
        opacity: 1;
        transform: none;
        filter: none;
    }
    .auth-experience .auth-card::after { display: none; }
}
