/**
 * DIDO merchant dashboard — unified shell, sidebar, typography, main column.
 * Include after merchant-sidebar-icons.css. Body: class="merchant-dashboard dash-shell"
 */
@import url("https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&family=Tajawal:wght@400;500;600;700;800&display=swap");
@import url("global-admin.css");

:root {
    --md-font-body: "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
    --md-font-nav: "Tajawal", "Cairo", system-ui, sans-serif;
    --md-base-font-size: 1rem;
    --md-nav-item-nudge: 3px;
}

/* --- Shell / page chrome --- (التخطيط والارتفاع في global-admin.css) */
body.merchant-dashboard {
    font-family: var(--md-font-body);
    font-size: var(--md-base-font-size);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.merchant-dashboard.dash-shell {
    position: relative;
    background: linear-gradient(168deg, #eef2ff 0%, #f8fafc 42%, #f0f9ff 100%);
}

body.merchant-dashboard.dash-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 85% 55% at 100% -15%, rgba(99, 102, 241, 0.14), transparent 55%),
        radial-gradient(ellipse 70% 45% at -5% 105%, rgba(37, 99, 235, 0.1), transparent 50%),
        radial-gradient(ellipse 50% 35% at 50% 100%, rgba(14, 165, 233, 0.06), transparent 45%);
}

.dash-z {
    position: relative;
    z-index: 1;
}

/* أيقونات المحتوى فقط (ليس الشريط) — نفس انتقال main.html */
body.merchant-dashboard.dash-shell .merchant-dash-main i[class*="fa-"],
body.merchant-dashboard.dash-shell .dash-main i[class*="fa-"] {
    transition: transform 0.28s ease, opacity 0.28s ease, -webkit-text-fill-color 0.28s ease, color 0.28s ease, filter 0.28s ease;
}

/* بدون حركة translate عند التحميل — كانت تُسبب إحساس «اهتزاز» عند التنقل */
.dash-main {
    animation: none;
}

/* Main column: التمرير والـ padding في global-admin.css */
body.merchant-dashboard .merchant-dash-main {
    position: relative;
    z-index: 1;
}

/* Optional: admin form width cap without affecting sidebar */
body.merchant-dashboard .merchant-dash-main.merchant-dash-main--narrow {
    max-width: 56rem;
}

/* --- Sidebar column (fixed width, sticky) --- */
body.merchant-dashboard aside.dash-sidebar,
body.merchant-dashboard aside.sidebar,
body.merchant-dashboard div.sidebar {
    box-sizing: border-box;
    position: relative;
    align-self: stretch;
    flex: 0 0 var(--md-sidebar-w);
    width: var(--md-sidebar-w);
    min-width: var(--md-sidebar-w);
    max-width: var(--md-sidebar-w);
    overflow-y: auto;
    overflow-x: clip;
    overscroll-behavior: contain;
    isolation: isolate;
    padding: 1.5rem;
    font-family: var(--md-font-nav);
    -webkit-font-smoothing: antialiased;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.94) 38%, rgba(238, 242, 255, 0.93) 100%);
    border-inline-start: 1px solid rgba(255, 255, 255, 0.92);
    box-shadow:
        8px 0 40px -12px rgba(15, 23, 42, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

body.merchant-dashboard aside.dash-sidebar::before,
body.merchant-dashboard aside.sidebar::before,
body.merchant-dashboard div.sidebar::before {
    content: "";
    position: absolute;
    inset: -35% auto auto -30%;
    width: 140%;
    aspect-ratio: 1;
    max-width: 420px;
    background:
        radial-gradient(circle at 70% 30%, rgba(59, 130, 246, 0.16), transparent 55%),
        radial-gradient(circle at 25% 70%, rgba(99, 102, 241, 0.11), transparent 50%);
    pointer-events: none;
    z-index: 0;
}

body.merchant-dashboard aside.dash-sidebar::after,
body.merchant-dashboard aside.sidebar::after,
body.merchant-dashboard div.sidebar::after {
    content: "";
    position: absolute;
    inset-inline-end: 0;
    top: 1rem;
    bottom: 1rem;
    width: 4px;
    border-radius: 999px;
    background: linear-gradient(180deg, #2563eb, #6366f1, #7c3aed);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    z-index: 1;
    pointer-events: none;
}

body.merchant-dashboard aside.dash-sidebar > *,
body.merchant-dashboard aside.sidebar > *,
body.merchant-dashboard div.sidebar > * {
    position: relative;
    z-index: 2;
}

/* more-options: stacked header + menu */
body.merchant-dashboard div.sidebar {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

body.merchant-dashboard div.sidebar .sidebar-header {
    flex-shrink: 0;
    padding: 1.25rem 1.5rem;
    font-size: 1.125rem;
    font-weight: 900;
    color: #1d4ed8;
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
    font-family: var(--md-font-nav);
    background: rgba(255, 255, 255, 0.5);
}

body.merchant-dashboard div.sidebar .sidebar-menu {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: clip;
    padding: 0.75rem 1rem;
}

/* Brand block (optional, matches main.html) */
body.merchant-dashboard .dash-sidebar-brand {
    font-family: var(--md-font-nav);
    letter-spacing: -0.02em;
}

body.merchant-dashboard .dash-sidebar-brand-sub {
    font-family: var(--md-font-nav);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6366f1;
    opacity: 0.9;
}

/* Section labels in nav */
body.merchant-dashboard .dash-sidebar .nav-group-label,
body.merchant-dashboard aside.sidebar .nav-group-label,
body.merchant-dashboard div.sidebar .nav-group-label,
body.merchant-dashboard div.sidebar .menu-label {
    font-family: var(--md-font-nav);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #94a3b8;
}

/* Nav links */
body.merchant-dashboard .dash-sidebar .nav-item,
body.merchant-dashboard aside.sidebar .nav-item,
body.merchant-dashboard div.sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    color: #475569;
    border-radius: 0.9rem;
    transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
    margin-bottom: 0.35rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.35;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
}

body.merchant-dashboard .dash-sidebar .nav-item i,
body.merchant-dashboard aside.sidebar .nav-item i,
body.merchant-dashboard div.sidebar .nav-item i {
    opacity: 0.88;
}

body.merchant-dashboard .dash-sidebar .nav-item:hover,
body.merchant-dashboard aside.sidebar .nav-item:hover,
body.merchant-dashboard div.sidebar .nav-item:hover {
    background: rgba(255, 255, 255, 0.72);
    color: #1d4ed8;
    transform: translateX(calc(-1 * var(--md-nav-item-nudge)));
    box-shadow: 0 6px 22px rgba(37, 99, 235, 0.08);
    border-color: rgba(191, 219, 254, 0.5);
}

html[dir="ltr"] body.merchant-dashboard .dash-sidebar .nav-item:hover,
html[dir="ltr"] body.merchant-dashboard aside.sidebar .nav-item:hover,
html[dir="ltr"] body.merchant-dashboard div.sidebar .nav-item:hover {
    transform: translateX(var(--md-nav-item-nudge));
}

body.merchant-dashboard .dash-sidebar .nav-item.active,
body.merchant-dashboard aside.sidebar .nav-item.active,
body.merchant-dashboard div.sidebar .nav-item.active {
    background: linear-gradient(105deg, rgba(239, 246, 255, 0.95) 0%, rgba(219, 234, 254, 0.88) 100%);
    color: #1e40af;
    font-weight: 700;
    border-color: rgba(147, 197, 253, 0.55);
    box-shadow: 0 6px 24px rgba(37, 99, 235, 0.12);
    border-inline-start: 4px solid #2563eb;
}

@media (max-width: 1024px) {
    /* نفس نموذج التمرير: body ثابت الارتفاع، التمرير داخل main والشريط */
    body.merchant-dashboard aside.dash-sidebar,
    body.merchant-dashboard aside.sidebar,
    body.merchant-dashboard div.sidebar {
        flex: 0 0 260px;
        width: 260px;
        min-width: 260px;
        max-width: 260px;
    }
}
