/* صفحة الصيانة — HTML fallback + blazor-error-ui */

#maintenance-overlay,
#blazor-error-ui {
    --m-primary: #6F3AFA;
    --m-text: #18181b;
    --m-muted: #71717a;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    overflow: hidden;
    text-align: center;
    font-family: 'ExpoArabic', 'Noto Kufi Arabic', 'Roboto', sans-serif;
    background: radial-gradient(ellipse 90% 70% at 50% -10%, rgba(111, 58, 250, 0.16) 0%, transparent 55%),
                linear-gradient(180deg, #fafafa 0%, #f8f7fc 100%);
    box-shadow: none;
    width: 100%;
    height: 100%;
    color: var(--m-text);
}

#maintenance-overlay {
    display: none;
}

#maintenance-overlay.is-visible {
    display: flex;
}

#blazor-error-ui {
    display: none;
}

#blazor-error-ui[style*="display: block"],
#blazor-error-ui[style*="display:block"] {
    display: flex !important;
}

.maintenance-fallback-glow,
.maintenance-fallback-orb {
    position: absolute;
    pointer-events: none;
}

.maintenance-fallback-glow {
    width: 480px;
    height: 480px;
    border-radius: 50%;
    top: -8%;
    left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(111, 58, 250, 0.2) 0%, transparent 68%);
    animation: maintenance-glow-pulse 4s ease-in-out infinite;
}

.maintenance-fallback-orb {
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(111, 58, 250, 0.18), rgba(111, 58, 250, 0.04));
}

.maintenance-fallback-orb--1 {
    width: 120px;
    height: 120px;
    top: 18%;
    inset-inline-start: 12%;
    animation: maintenance-orb-float 7s ease-in-out infinite;
}

.maintenance-fallback-orb--2 {
    width: 72px;
    height: 72px;
    bottom: 22%;
    inset-inline-end: 14%;
    animation: maintenance-orb-float 5.5s ease-in-out infinite reverse;
}

#maintenance-overlay__card,
#blazor-error-ui .blazor-error-ui__card {
    position: relative;
    z-index: 1;
    max-width: 460px;
    width: 100%;
    padding: 2.25rem 2rem 2rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(111, 58, 250, 0.1);
    box-shadow: 0 24px 64px rgba(111, 58, 250, 0.1), 0 4px 16px rgba(24, 24, 27, 0.04);
    backdrop-filter: blur(12px);
    animation: maintenance-card-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#maintenance-overlay__logo {
    width: 148px;
    height: auto;
    margin-bottom: 1.5rem;
    animation: maintenance-logo-float 3.2s ease-in-out infinite, maintenance-fade-up 0.6s ease both;
}

.maintenance-fallback-icon-wrap {
    position: relative;
    width: 104px;
    height: 104px;
    margin: 0 auto 1.5rem;
    animation: maintenance-fade-up 0.65s ease 0.1s both;
}

.maintenance-fallback-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(111, 58, 250, 0.35);
    animation: maintenance-ring-ping 2.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.maintenance-fallback-ring--2 {
    animation-delay: 1.2s;
}

#maintenance-overlay__icon,
#blazor-error-ui .blazor-error-ui__icon {
    position: absolute;
    inset: 10px;
    width: auto;
    height: auto;
    margin: 0;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(111, 58, 250, 0.14), rgba(111, 58, 250, 0.06));
    color: var(--m-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.1rem;
}

.maintenance-fallback-wrench {
    display: inline-block;
    transform-origin: 50% 80%;
    animation: maintenance-wrench-rock 2.2s ease-in-out infinite;
}

#maintenance-overlay h1,
#blazor-error-ui h1 {
    margin: 0 0 0.65rem;
    font-size: 1.45rem;
    font-weight: 700;
    animation: maintenance-fade-up 0.65s ease 0.2s both;
}

#maintenance-overlay p,
#blazor-error-ui p {
    margin: 0 0 1.25rem;
    color: var(--m-muted);
    line-height: 1.75;
    font-size: 0.95rem;
    animation: maintenance-fade-up 0.65s ease 0.3s both;
}

.maintenance-fallback-dots {
    display: flex;
    justify-content: center;
    gap: 0.45rem;
    margin-bottom: 1.5rem;
    animation: maintenance-fade-up 0.65s ease 0.4s both;
}

.maintenance-fallback-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--m-primary);
    opacity: 0.55;
    animation: maintenance-dot-bounce 1.2s ease-in-out infinite;
}

.maintenance-fallback-dots span:nth-child(2) { animation-delay: 0.15s; }
.maintenance-fallback-dots span:nth-child(3) { animation-delay: 0.3s; }

#maintenance-overlay-retry,
#blazor-error-ui .reload {
    display: inline-block;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.75rem;
    font-size: 0.95rem;
    cursor: pointer;
    background: var(--m-primary);
    color: #fff !important;
    text-decoration: none;
    font-family: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: maintenance-fade-up 0.65s ease 0.5s both;
}

#maintenance-overlay-retry:hover,
#blazor-error-ui .reload:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(111, 58, 250, 0.28);
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 1rem;
    inset-inline-end: 1rem;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--m-muted);
    text-decoration: none;
}

@keyframes maintenance-glow-pulse {
    0%, 100% { opacity: 0.65; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.06); }
}

@keyframes maintenance-orb-float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(12px, -18px); }
}

@keyframes maintenance-ring-ping {
    0% { transform: scale(0.92); opacity: 0.7; }
    70%, 100% { transform: scale(1.35); opacity: 0; }
}

@keyframes maintenance-wrench-rock {
    0%, 100% { transform: rotate(-14deg); }
    50% { transform: rotate(14deg); }
}

@keyframes maintenance-fade-up {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes maintenance-card-in {
    from { opacity: 0; transform: translateY(28px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes maintenance-logo-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes maintenance-dot-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
    40% { transform: translateY(-7px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .maintenance-fallback-glow,
    .maintenance-fallback-orb,
    .maintenance-fallback-ring,
    .maintenance-fallback-wrench,
    .maintenance-fallback-dots span,
    #maintenance-overlay__logo,
    #maintenance-overlay__card,
    #blazor-error-ui .blazor-error-ui__card {
        animation: none !important;
    }
}
