/* ==========================================
   Modern Error Page — EMPAT Design System
   Cardless Immersive + Atmospheric Aurora
   Consistent with BO-EMPAT & Login Page
   ========================================== */

/* ── 0. FORCE HIDE TOPBAR & FOOTER ── */
.error-page-wrapper ~ footer.footer,
.error-page-wrapper ~ .footer,
.modern-topbar,
.content-header,
header.content-header {
    display: none !important;
}

/* ── 1. FULL-PAGE IMMERSIVE WRAPPER ── */
.error-page-wrapper {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8edf5 40%, #dfe6f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 9999;
}

/* Subtle background dot grid pattern */
.error-page-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(15, 35, 87, 0.03) 1px, transparent 0);
    background-size: 32px 32px;
    pointer-events: none;
    z-index: 0;
}

/* ── 2. ANIMATED AMBIENT ORB BLOBS ── */
.error-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    will-change: transform, opacity;
    animation: orbFadeIn 1.2s ease-out forwards, orbFloat 12s ease-in-out infinite;
}

.error-orb.orb-1 {
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.30) 0%, rgba(37, 99, 235, 0) 70%);
    top: -12%;
    left: 5%;
    animation-delay: 0s, 0s;
}

.error-orb.orb-2 {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.25) 0%, rgba(14, 165, 233, 0) 70%);
    bottom: -8%;
    right: 3%;
    animation-delay: 0.3s, -4s;
}

.error-orb.orb-3 {
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.20) 0%, rgba(99, 102, 241, 0) 70%);
    top: 30%;
    right: 18%;
    animation-delay: 0.6s, -7s;
}

@keyframes orbFadeIn {
    0%   { opacity: 0; transform: scale(0.7); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0px, 0px) scale(1); }
    25%      { transform: translate(20px, -25px) scale(1.05); }
    50%      { transform: translate(-15px, 15px) scale(0.98); }
    75%      { transform: translate(25px, 10px) scale(1.03); }
}

/* ── 3. CARDLESS CONTENT AREA ── */
.error-content-area {
    position: relative;
    z-index: 2;
    max-width: 520px;
    width: 100%;
    text-align: center;

    /* Entrance animation for the whole block */
    opacity: 0;
    transform: translateY(28px);
    animation: contentEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

@keyframes contentEntrance {
    0%   { opacity: 0; transform: translateY(28px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ── 4. GIANT FLOATING ERROR CODE NUMBER ── */
.error-number-wrapper {
    position: relative;
    margin-bottom: 0.5rem;

    /* Staggered entrance */
    opacity: 0;
    transform: translateY(20px);
    animation: fadeSlideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.45s forwards;
}

.error-number-display {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: clamp(6rem, 16vw, 10rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -5px;
    margin: 0;
    padding: 0;
    display: inline-block;

    /* Gradient text fill */
    background: linear-gradient(135deg, #0f2357 0%, #2563eb 45%, #0ea5e9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;

    /* Subtle glow shadow */
    filter: drop-shadow(0 10px 30px rgba(37, 99, 235, 0.20));

    /* Floating animation */
    animation: floatUpDown 5s ease-in-out infinite;
}

/* Shadow reflection beneath the number */
.error-number-shadow {
    width: 140px;
    height: 14px;
    margin: 0.5rem auto 0;
    background: radial-gradient(ellipse, rgba(15, 35, 87, 0.07) 0%, transparent 70%);
    border-radius: 50%;
    animation: shadowPulse 5s ease-in-out infinite;
}

@keyframes floatUpDown {
    0%, 100% { transform: translateY(0px); }
    50%      { transform: translateY(-16px); }
}

@keyframes shadowPulse {
    0%, 100% { transform: scaleX(1);   opacity: 1; }
    50%      { transform: scaleX(0.75); opacity: 0.4; }
}

/* ── 5. TITLE & DESCRIPTION TEXT ── */
.error-title {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.03em;
    margin: 0.75rem 0 0.6rem;

    /* Staggered entrance */
    opacity: 0;
    transform: translateY(16px);
    animation: fadeSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
}

.error-description {
    font-size: 0.925rem;
    font-weight: 450;
    line-height: 1.7;
    color: #64748b;
    max-width: 440px;
    margin: 0 auto;

    /* Staggered entrance */
    opacity: 0;
    transform: translateY(16px);
    animation: fadeSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.75s forwards;
}

@keyframes fadeSlideUp {
    0%   { opacity: 0; transform: translateY(16px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ── 6. DUAL ACTION BUTTONS ── */
.error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.85rem;
    margin-top: 2.25rem;

    /* Staggered entrance */
    opacity: 0;
    transform: translateY(16px);
    animation: fadeSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.9s forwards;
}

/* Primary Button — Gradient Royal Blue */
.error-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.75rem;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 650;
    color: #ffffff !important;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%) !important;
    border: none !important;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.28);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none !important;
    white-space: nowrap;
}

.error-btn-primary:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%) !important;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.38);
    transform: translateY(-3px);
    color: #ffffff !important;
}

.error-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.error-btn-primary svg,
.error-btn-primary i {
    width: 16px;
    height: 16px;
}

/* Secondary / Ghost Button — Frosted Outline */
.error-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.75rem;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155 !important;
    background: rgba(255, 255, 255, 0.55) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px solid rgba(203, 213, 225, 0.7) !important;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none !important;
    white-space: nowrap;
}

.error-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.85) !important;
    border-color: #94a3b8 !important;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
    transform: translateY(-3px);
    color: #0f172a !important;
}

.error-btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.error-btn-secondary svg,
.error-btn-secondary i {
    width: 16px;
    height: 16px;
}

/* ── 7. DECORATIVE SVG ILLUSTRATION ── */
.error-illustration {
    margin-bottom: 0.25rem;

    /* Staggered entrance */
    opacity: 0;
    transform: translateY(16px) scale(0.95);
    animation: fadeSlideUp 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.25s forwards;
}

.error-illustration svg {
    width: 100%;
    max-width: 180px;
    height: auto;
}

/* ── 8. RESPONSIVE DESIGN ── */
@media (max-width: 576px) {
    .error-page-wrapper {
        padding: 1.5rem 1rem;
    }

    .error-content-area {
        max-width: 100%;
    }

    .error-number-display {
        font-size: clamp(4.5rem, 22vw, 7rem);
        letter-spacing: -3px;
    }

    .error-title {
        font-size: 1.3rem;
    }

    .error-description {
        font-size: 0.85rem;
        padding: 0 0.5rem;
    }

    .error-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }

    .error-btn-primary,
    .error-btn-secondary {
        justify-content: center;
        padding: 0.85rem 1.25rem;
        width: 100%;
    }

    .error-orb.orb-1 { width: 280px; height: 280px; }
    .error-orb.orb-2 { width: 220px; height: 220px; }
    .error-orb.orb-3 { display: none; }

    .error-illustration svg {
        max-width: 140px;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .error-content-area {
        max-width: 460px;
    }

    .error-number-display {
        font-size: 7.5rem;
    }
}

/* ── 9. REDUCED MOTION ACCESSIBILITY ── */
@media (prefers-reduced-motion: reduce) {
    .error-orb,
    .error-number-display,
    .error-number-shadow,
    .error-content-area,
    .error-number-wrapper,
    .error-title,
    .error-description,
    .error-actions,
    .error-illustration {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}
