﻿/* Layout: sidebar on right */
.layout {
    display: grid;
    grid-template-columns: 1fr 260px; /* content | sidebar */
    gap: 16px;
    align-items: start;
    padding: 16px;
}

.content {
    min-height: 70vh;
}

.sidebar {
    position: sticky;
    top: 16px;
    align-self: start;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
}

    .sidebar .nav ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .sidebar .nav li {
        margin: 6px 0;
    }

    .sidebar .nav a {
        text-decoration: none;
        display: block;
        padding: 8px 10px;
        border-radius: 8px;
    }

        .sidebar .nav a.active {
            background: #e0f2fe;
            font-weight: 600;
        }

body {
    font-family: Vazirmatn, sans-serif;
    background: #f3f6fb;
    margin: 0;
}

/* Blazor Server reconnect UI. The framework toggles the components-reconnect-*
   classes. A short disconnect stays invisible; a longer one gets a compact,
   localized notice instead of Blazor's full-page English default dialog. */
#components-reconnect-modal.apexa-reconnect {
    position: fixed;
    right: 50%;
    bottom: max(1rem, env(safe-area-inset-bottom));
    z-index: 2147483647;
    display: flex;
    width: min(calc(100vw - 2rem), 32rem);
    box-sizing: border-box;
    align-items: center;
    gap: .8rem;
    padding: .9rem 1rem;
    direction: rtl;
    color: #172033;
    background: rgba(255, 255, 255, .97);
    border: 1px solid rgba(148, 163, 184, .45);
    border-radius: 1rem;
    box-shadow: 0 14px 40px rgba(15, 23, 42, .2);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(50%, .75rem);
    transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-retrying {
    opacity: 1;
    visibility: visible;
    transform: translate(50%, 0);
    transition-delay: 1.2s;
}

#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(50%, 0);
    transition-delay: 0s;
}

.apexa-reconnect__spinner {
    flex: 0 0 auto;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #cbd5e1;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: apexa-reconnect-spin .8s linear infinite;
}

.apexa-reconnect strong,
.apexa-reconnect span {
    display: block;
}

.apexa-reconnect__waiting,
.apexa-reconnect__hint,
#apexa-reconnect-now {
    display: none !important;
}

.components-reconnect-failed .apexa-reconnect__connecting,
.components-reconnect-rejected .apexa-reconnect__connecting {
    display: none;
}

.components-reconnect-failed .apexa-reconnect__waiting,
.components-reconnect-rejected .apexa-reconnect__waiting,
.components-reconnect-failed .apexa-reconnect__hint,
.components-reconnect-rejected .apexa-reconnect__hint,
.components-reconnect-failed #apexa-reconnect-now,
.components-reconnect-rejected #apexa-reconnect-now {
    display: block !important;
}

.apexa-reconnect__hint {
    margin-top: .2rem;
    color: #64748b;
    font-size: .82rem;
}

#apexa-reconnect-now {
    flex: 0 0 auto;
    padding: .5rem .75rem;
    color: #fff;
    font: inherit;
    font-size: .85rem;
    border: 0;
    border-radius: .65rem;
    background: #2563eb;
    cursor: pointer;
}

@keyframes apexa-reconnect-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    #components-reconnect-modal.apexa-reconnect { transition: none; }
    .apexa-reconnect__spinner { animation: none; }
}

.route-error {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    max-width: 44rem;
    margin: 4rem auto;
    padding: 1.25rem;
    color: #172033;
    background: #fff;
    border: 1px solid #fecaca;
    border-radius: 1rem;
    box-shadow: 0 12px 35px rgba(15, 23, 42, .08);
}

.route-error__icon {
    display: grid;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    color: #b91c1c;
    background: #fee2e2;
    border-radius: .75rem;
    font-weight: 900;
}

.route-error h1 {
    margin: 0 0 .35rem;
    font-size: 1.1rem;
}

.route-error p {
    margin: 0 0 1rem;
    color: #64748b;
    line-height: 1.8;
}

.route-error__retry {
    padding: .55rem .9rem;
    color: #fff;
    font: inherit;
    border: 0;
    border-radius: .65rem;
    background: #2563eb;
    cursor: pointer;
}

.mud-paper {
    border-radius: 16px !important;
}

.mud-nav-link {
    border-radius: 12px;
    margin-bottom: 8px;
}

.auth-shell { padding: 24px; }
.auth-card, .landing-card { width: min(100%, 560px); background:#fff; padding:32px; border-radius:22px; box-shadow:0 18px 60px rgba(15,23,42,.12); direction:rtl; }
.landing-card { text-align:center; width:min(100%,720px); }
.landing-card h1 { font-size:clamp(1.8rem,4vw,3rem); line-height:1.45; margin:18px 0; color:#0f172a; }
.landing-card p, .muted { color:#64748b; }
.landing-badge { display:inline-block; color:#1d4ed8; background:#dbeafe; padding:6px 12px; border-radius:999px; font-weight:700; }
.landing-actions { display:flex; gap:12px; justify-content:center; margin-top:28px; flex-wrap:wrap; }
.form-grid { display:grid; gap:9px; }
.alert { padding:12px 14px; border-radius:10px; margin:14px 0; }
.alert-success { color:#166534; background:#dcfce7; }
.alert-error { color:#991b1b; background:#fee2e2; }
.dashboard-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:18px; }
.dashboard-card { display:grid; gap:8px; padding:24px; border-radius:16px; background:#fff; color:#0f172a; text-decoration:none; box-shadow:0 7px 25px rgba(15,23,42,.07); }
.dashboard-card strong { font-size:1.15rem; }
.dashboard-card span { color:#64748b; }
.table-wrap { overflow:auto; background:#fff; border-radius:14px; }
.table { width:100%; border-collapse:collapse; }
.table th,.table td { padding:12px; border-bottom:1px solid #e2e8f0; text-align:right; white-space:nowrap; }
.nav-logout { width:100%; border:0; background:transparent; color:#b91c1c; padding:12px; text-align:right; cursor:pointer; font:inherit; border-radius:10px; }
.nav-logout:hover { background:#fee2e2; }
