/* ============================================
   SPLASH SCREEN / LOADING OVERLAY
   ============================================ */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f0ff 0%, #e8e6ff 50%, #f5f0ff 100%);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.splash-screen.fade-out { opacity: 0; transform: scale(1.05); pointer-events: none; }

/* ===== Courier Chase — CSS Character Animation ===== */
.chase-scene {
    position: relative;
    width: 300px;
    height: 80px;
    margin-bottom: 20px;
    overflow: hidden;
}

/* ── Ground ── */
.chase-ground {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #a5b4fc 15%, #818cf8 50%, #a5b4fc 85%, transparent);
}
.chase-ground::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 0; right: 0;
    height: 1px;
    background: repeating-linear-gradient(90deg, #c7d2fe 0 5px, transparent 5px 13px);
    animation: gScroll .7s linear infinite;
}
@keyframes gScroll { to { background-position: -13px 0; } }

/* ── Character Base ── */
.runner { position: absolute; bottom: 4px; }
.r-body {
    position: relative;
    width: 28px;
    height: 48px;
}

/* Head */
.r-head {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #fbbf24;
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

/* Eyes */
.r-eye {
    width: 2.5px; height: 3px;
    border-radius: 50%;
    background: #1e293b;
    position: absolute;
    top: 6px;
}
.r-el { left: 4px; }
.r-er { right: 4px; }

/* Courier: determined grin */
.r-mouth-grit {
    width: 5px; height: 2px;
    border-bottom: 1.5px solid #92400e;
    border-radius: 0 0 3px 3px;
    position: absolute;
    bottom: 3px; left: 50%;
    transform: translateX(-50%);
}

/* Customer: panicked O-mouth */
.r-mouth-panic {
    width: 4px; height: 5px;
    border: 1.5px solid #92400e;
    border-radius: 50%;
    background: #fde68a;
    position: absolute;
    bottom: 2px; left: 50%;
    transform: translateX(-50%);
}

/* Courier cap */
.r-cap {
    position: absolute;
    top: -3px; left: -2px; right: -2px;
    height: 9px;
    background: #1e3a5f;
    border-radius: 8px 8px 2px 2px;
    z-index: 4;
}
.r-cap::after {
    content: '';
    position: absolute;
    bottom: 0; left: -3px;
    width: 22px; height: 3px;
    background: #1e3a5f;
    border-radius: 2px;
}

/* Customer hair */
.r-hair {
    position: absolute;
    top: -2px; left: 1px; right: 1px;
    height: 7px;
    background: #78350f;
    border-radius: 7px 7px 0 0;
    z-index: 4;
}

/* Customer sweat drop */
.r-sweatdrop {
    position: absolute;
    top: 2px; right: -6px;
    width: 3px; height: 5px;
    background: #93c5fd;
    border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%;
    animation: sweatFly 1s ease-out infinite;
    z-index: 5;
}
@keyframes sweatFly {
    0%   { opacity: .9; transform: translate(0,0) scale(1); }
    100% { opacity: 0; transform: translate(6px,-8px) scale(.4); }
}

/* Torso */
.r-torso {
    width: 14px; height: 14px;
    border-radius: 4px;
    position: absolute;
    top: 15px; left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.r-tc { background: #1e3a5f; } /* courier uniform */
.r-tu { background: #6366f1; } /* customer shirt */

/* Arms */
.r-arm {
    width: 4px; height: 13px;
    border-radius: 3px;
    position: absolute;
    top: 16px; z-index: 1;
    transform-origin: top center;
}
.r-al { left: 2px; }
.r-ar { right: 2px; }
.r-ac { background: #2d4a6f; } /* courier arm darker uniform */
.r-au { background: #818cf8; } /* customer arm lighter indigo */

/* Legs */
.r-leg {
    width: 5px; height: 15px;
    border-radius: 3px;
    position: absolute;
    top: 28px; z-index: 1;
    transform-origin: top center;
}
.r-ll { left: 5px; }
.r-lr { right: 5px; }
.r-lc { background: #0f172a; } /* courier legs dark */
.r-lu { background: #475569; } /* customer legs gray */

/* ═══ Courier: positioning & running ═══ */
.r-courier { left: 40px; }
.r-courier .r-body { animation: bounce .35s ease-in-out infinite; }
.r-courier .r-al   { animation: armL .35s ease-in-out infinite; }
.r-courier .r-ar   { animation: armR .35s ease-in-out infinite; }
.r-courier .r-ll   { animation: legL .35s ease-in-out infinite; }
.r-courier .r-lr   { animation: legR .35s ease-in-out infinite; }

/* ═══ Customer: positioning & running (mirrored = looks back) ═══ */
.r-customer { right: 32px; transform: scaleX(-1); }
.r-customer .r-body { animation: bounce .3s ease-in-out infinite; }
.r-customer .r-al   { animation: armL .3s ease-in-out infinite; }
.r-customer .r-ar   { animation: armR .3s ease-in-out infinite; }
.r-customer .r-ll   { animation: legL .3s ease-in-out infinite; }
.r-customer .r-lr   { animation: legR .3s ease-in-out infinite; }

/* ── Running Keyframes ── */
@keyframes bounce {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(-4px); }
}
@keyframes legL {
    0%      { transform: rotate(-30deg); }
    50%     { transform: rotate(30deg); }
    100%    { transform: rotate(-30deg); }
}
@keyframes legR {
    0%      { transform: rotate(30deg); }
    50%     { transform: rotate(-30deg); }
    100%    { transform: rotate(30deg); }
}
@keyframes armL {
    0%      { transform: rotate(25deg); }
    50%     { transform: rotate(-25deg); }
    100%    { transform: rotate(25deg); }
}
@keyframes armR {
    0%      { transform: rotate(-25deg); }
    50%     { transform: rotate(25deg); }
    100%    { transform: rotate(-25deg); }
}

/* ═══ Package throw arc ═══ */
.pkg-arc {
    position: absolute;
    bottom: 38px; left: 62px;
    font-size: 13px;
    color: #d97706;
    z-index: 10;
    animation: throwArc 3s cubic-bezier(.25,.46,.45,.94) infinite;
}
@keyframes throwArc {
    0%     { transform: translate(0,0) rotate(0); opacity: 0; }
    10%    { transform: translate(0,0) rotate(0); opacity: 1; }
    50%    { transform: translate(88px,-28px) rotate(200deg); opacity: 1; }
    78%    { transform: translate(168px,4px) rotate(380deg); opacity: 1; }
    82%    { transform: translate(168px,4px) rotate(380deg); opacity: 0; }
    100%   { opacity: 0; }
}

/* ═══ Dust trail behind courier ═══ */
.c-dust {
    position: absolute;
    bottom: 8px;
    border-radius: 50%;
    background: #c7d2fe;
    opacity: 0;
    animation: dustOut 1s ease-out infinite;
}
.cd1 { left: 36px; width: 5px; height: 5px; animation-delay: 0s; }
.cd2 { left: 28px; width: 4px; height: 4px; bottom: 12px; animation-delay: .3s; }
.cd3 { left: 22px; width: 3px; height: 3px; bottom: 6px; animation-delay: .6s; }
@keyframes dustOut {
    0%   { opacity: .5; transform: translate(0,0) scale(1); }
    100% { opacity: 0; transform: translate(-14px,-5px) scale(.15); }
}

.splash-status { font-size: 12px; color: #94a3b8; margin-top: 8px; letter-spacing: 2px; text-transform: uppercase; animation: statusPulse 1.5s ease-in-out infinite; }
@keyframes statusPulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }


/* ============================================
   LOGIN — CENTERED PREMIUM COSMIC
   ============================================ */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f7ff 0%, #eef0ff 40%, #f0edff 70%, #f5f3ff 100%);
    overflow: hidden;
    padding: 20px;
}
.login-overlay.hidden { display: none; }

/* ===== ANIMATED BACKGROUND ===== */
.login-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Subtle grid */
.login-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(99,102,241,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99,102,241,0.05) 1px, transparent 1px);
    background-size: 52px 52px;
}

/* Mesh gradient blobs */
.mesh-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
}
.mesh-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(99,102,241,0.1), transparent 70%);
    top: -15%; left: -8%;
    animation: meshFloat1 14s ease-in-out infinite;
}
.mesh-2 {
    width: 420px; height: 420px;
    background: radial-gradient(circle, rgba(168,85,247,0.08), transparent 70%);
    bottom: -10%; right: -5%;
    animation: meshFloat2 18s ease-in-out infinite;
}
.mesh-3 {
    width: 320px; height: 320px;
    background: radial-gradient(circle, rgba(14,165,233,0.06), transparent 70%);
    top: 50%; left: 55%;
    animation: meshFloat3 20s ease-in-out infinite;
}
@keyframes meshFloat1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(40px,30px) scale(1.12); } }
@keyframes meshFloat2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-35px,-40px) scale(1.08); } }
@keyframes meshFloat3 { 0%,100% { transform: translate(0,0) scale(0.9); } 50% { transform: translate(20px,-25px) scale(1.05); } }

/* Orbital rings */
.orbit-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(99,102,241,0.08);
    pointer-events: none;
    top: 50%; left: 50%;
}
.orbit-dot {
    position: absolute;
    width: 5px; height: 5px;
    border-radius: 50%;
    top: -2.5px; left: 50%;
}
.orbit-1 {
    width: 340px; height: 340px;
    transform: translate(-50%,-50%);
    animation: orbitSpin 22s linear infinite;
}
.orbit-1 .orbit-dot { background: #818cf8; box-shadow: 0 0 10px rgba(129,140,248,0.5); }
.orbit-2 {
    width: 500px; height: 500px;
    transform: translate(-50%,-50%);
    animation: orbitSpin 35s linear infinite reverse;
    border-color: rgba(168,85,247,0.08);
}
.orbit-2 .orbit-dot { background: #a78bfa; box-shadow: 0 0 10px rgba(167,139,250,0.4); }
.orbit-3 {
    width: 660px; height: 660px;
    transform: translate(-50%,-50%);
    animation: orbitSpin 48s linear infinite;
    border-style: dashed;
    border-color: rgba(14,165,233,0.06);
}
.orbit-3 .orbit-dot { background: #38bdf8; box-shadow: 0 0 8px rgba(56,189,248,0.3); width: 4px; height: 4px; top: -2px; }
@keyframes orbitSpin { to { transform: translate(-50%,-50%) rotate(360deg); } }

/* ===== Floating Icons — JS-driven big-bang animation ===== */
.login-float-icon {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1;
    pointer-events: none;
    /* Start from center — JS will animate outward */
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: box-shadow 0.3s;
    will-change: transform, opacity;
}


/* ===== LOGIN CARD — Centered Glass ===== */
.login-card {
    position: relative;
    z-index: 10;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(99,102,241,0.1);
    border-radius: 28px;
    padding: 48px 44px;
    width: 100%;
    max-width: 420px;
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.7) inset,
        0 24px 64px rgba(99,102,241,0.1),
        0 8px 24px rgba(0,0,0,0.04);
    animation: cardAppear 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Animated rainbow accent line */
.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 32px; right: 32px;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #a78bfa, #ec4899, #f59e0b, #10b981, #6366f1);
    background-size: 300% 100%;
    border-radius: 0 0 3px 3px;
    animation: rainbowSlide 6s linear infinite;
}

/* Conic glow behind card */
.card-glow {
    position: absolute;
    inset: -3px;
    border-radius: 31px;
    background: conic-gradient(from 0deg, rgba(99,102,241,0.08), rgba(168,85,247,0.06), rgba(236,72,153,0.04), rgba(99,102,241,0.08));
    z-index: -1;
    filter: blur(20px);
    opacity: 0.5;
    animation: glowRotate 10s linear infinite;
}

@keyframes rainbowSlide { to { background-position: 300% 0; } }
@keyframes glowRotate { to { transform: rotate(360deg); } }
@keyframes cardAppear {
    from { opacity: 0; transform: translateY(32px) scale(0.96); filter: blur(6px); }
    to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* Logo area */
.login-logo {
    text-align: center;
    margin-bottom: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.login-logo .logo-icon {
    width: 56px !important;
    height: 56px !important;
    border-radius: 18px;
    box-shadow: 0 8px 28px rgba(99,102,241,0.3);
    animation: logoPulse 3s ease-in-out infinite;
}
@keyframes logoPulse {
    0%,100% { box-shadow: 0 8px 28px rgba(99,102,241,0.3); }
    50% { box-shadow: 0 12px 44px rgba(99,102,241,0.45); }
}
.login-logo h1 {
    margin: 0;
    font-size: 28px;
    color: #1e293b;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.login-logo h1 span { color: #6366f1; }
.login-logo p {
    color: #94a3b8;
    font-size: 13px;
    margin: 0;
    letter-spacing: 0.5px;
}

/* Form fields */
.login-field { margin-bottom: 20px; }
.login-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.login-field label i {
    color: #818cf8;
    margin-right: 4px;
    font-size: 10px;
}

.input-wrapper { position: relative; }

.login-field input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255,255,255,0.8);
    color: #1e293b;
    outline: none;
}
.login-field input[type="password"] { padding-right: 48px; }
.login-field input::placeholder { color: #94a3b8; }
.login-field input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(99,102,241,0.08), 0 4px 12px rgba(99,102,241,0.06);
    background: #fff;
}

.input-focus-ring {
    position: absolute;
    inset: -2px;
    border-radius: 16px;
    border: 2px solid transparent;
    pointer-events: none;
    transition: all 0.3s;
}
.login-field input:focus ~ .input-focus-ring {
    border-color: rgba(99,102,241,0.15);
}

/* Password toggle */
.pw-toggle {
    position: absolute;
    right: 4px; top: 50%;
    transform: translateY(-50%);
    width: 40px; height: 40px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 14px;
}
.pw-toggle:hover { color: #818cf8; background: rgba(99,102,241,0.08); }

/* Login button */
.login-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 50%, #6366f1 100%);
    background-size: 200% 100%;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 8px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 24px rgba(99,102,241,0.3);
}
.login-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 30%, rgba(255,255,255,0.12) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: btnShimmer 3s ease-in-out infinite;
}
@keyframes btnShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 36px rgba(99,102,241,0.4);
    background-position: 100% 0;
}
.login-btn:active { transform: translateY(0); }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-content, .btn-loader { position: relative; z-index: 1; }

/* Security badges */
.login-security {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
}
.login-security span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #94a3b8;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.login-security i { font-size: 10px; color: #10b981; }

/* Error message */
#login-error {
    color: #ef4444;
    background: rgba(239,68,68,0.06);
    border: 1px solid rgba(239,68,68,0.12);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    animation: shakeError 0.4s ease-in-out;
}
@keyframes shakeError {
    0%,100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Footer */
.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 11px;
    color: #94a3b8;
    letter-spacing: 0.3px;
}
.login-footer a {
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}
.login-footer a:hover { color: #4f46e5; }


/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .login-float-icon { opacity: 0.4 !important; }
    .orbit-ring { opacity: 0.5; }
}
@media (max-width: 480px) {
    .login-card { padding: 36px 28px; border-radius: 24px; max-width: 360px; }
    .login-logo h1 { font-size: 24px; }
    .login-float-icon { display: none !important; }
    .orbit-ring { display: none; }
}