@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
    --primary: #4361ee;
    --dark-blue: #1e293b;
    --sidebar-w: 260px;
    --mobile-header-height: 65px;
    --mobile-sidebar-width: 300px;
}

/* ریست پایه */
* { 
    font-family: 'Vazirmatn', sans-serif !important;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.admin-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: #f4f6f9;
    position: relative;
    font-size: 14px;
    text-align: right;
    direction: rtl;
}

/* دسکتاپ */
@media (min-width: 992px) {
    body.admin-body {
        display: flex;
        flex-direction: row-reverse;
    }
    
    .sidebar {
        width: var(--sidebar-w);
        min-width: var(--sidebar-w);
        height: 100vh;
        position: fixed;
        right: 0;
        top: 0;
        background-color: var(--dark-blue);
        z-index: 1000;
        overflow-y: auto;
        overflow-x: hidden; /* جلوگیری از اسکرول افقی */
        left: auto !important;
        display: flex;
        flex-direction: column;
    }
    
    .main-content {
        flex-grow: 1;
        margin-right: var(--sidebar-w);
        width: calc(100% - var(--sidebar-w));
        padding: 20px;
        min-height: 100vh;
    }
    
    /* منوی دسکتاپ - یک ستون عمودی */
    .sidebar .nav {
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
    }
    
    .sidebar .nav-item {
        width: 100% !important;
        flex: 0 0 auto !important;
        display: block !important;
        float: none !important;
        margin-bottom: 5px;
    }
    
    .sidebar .nav-link {
        width: 100% !important;
        display: flex !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* جلوگیری از چیدمان افقی */
    .sidebar .row {
        flex-direction: column !important;
        margin: 0 !important;
    }
    
    .sidebar .col,
    .sidebar [class*="col-"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding: 0 !important;
    }
}

/* موبایل و تبلت */
@media (max-width: 991px) {
    body.admin-body {
        display: block;
        padding-top: var(--mobile-header-height);
        padding-left: 0 !important;
    }
    
    /* هدر موبایل */
    .mobile-header {
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        height: var(--mobile-header-height);
        background: linear-gradient(135deg, #1e293b, #0f172a);
        z-index: 1100;
        display: flex;
        align-items: center;
        padding: 0 15px;
        box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
        direction: rtl;
        text-align: right;
    }
    
    .mobile-header .brand {
        color: white;
        font-weight: 600;
        font-size: 0.95rem;
        display: flex;
        align-items: center;
        gap: 8px;
        flex-grow: 1;
        justify-content: center;
        order: 2;
    }
    
    .mobile-header .admin-info {
        color: #94a3b8;
        font-size: 0.75rem;
        text-align: left;
        flex-grow: 0;
        order: 3;
        margin-right: auto;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
    
    .hamburger-btn {
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.3rem;
        transition: all 0.3s ease;
        order: 1;
        margin-left: 0;
        margin-right: auto;
    }
    
    .hamburger-btn:hover {
        background: rgba(255, 255, 255, 0.2);
    }
    
    .sidebar {
        display: none;
    }
    
    .main-content {
        width: 100% !important;
        margin: 0 !important;
        padding: 15px;
        padding-top: 15px !important;
    }
}

/* آف‌کنواس راست‌چین سفارشی */
.mobile-sidebar {
    position: fixed;
    top: 0;
    right: -310px;
    width: var(--mobile-sidebar-width);
    height: 100%;
    background: #1e293b;
    z-index: 1200;
    transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow-y: auto;
    overflow-x: hidden;
    direction: rtl;
    text-align: right;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.2);
}

.mobile-sidebar.show {
    right: 0;
}

.mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1199;
    display: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-sidebar-overlay.show {
    display: block;
    opacity: 1;
}


/* منوی موبایل - لینک‌ها در یک ستون */
.mobile-sidebar .nav,
.mobile-sidebar .d-flex.flex-column {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
}

.mobile-sidebar .nav-item,
.mobile-sidebar a.nav-link {
    width: 100% !important;
    flex: 0 0 auto !important;
    display: block !important;
    float: none !important;
}

.mobile-sidebar .nav-link {
    width: 100% !important;
    display: flex !important;
    white-space: nowrap;
}

/* غیرفعال کردن آف‌کنواس پیش‌فرض بوت‌استرپ */
.offcanvas {
    display: none !important;
}

/* استایل‌های مشترک */
.main-content {
    background-color: #f4f6f9;
}

/* بهبود کارت‌های آمار */
.stat-card {
    border-radius: 12px;
    border: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    min-height: 110px;
    display: flex;
    align-items: center;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12) !important;
}

/* موبایل - کارت‌ها */
@media (max-width: 768px) {
    .stat-card {
        padding: 15px !important;
        margin-bottom: 10px;
    }
    
    .stat-card h2 {
        font-size: 1.6rem !important;
    }
    
    .stat-card i {
        font-size: 1.8rem !important;
    }
    
    .quick-access-btn {
        padding: 15px 8px !important;
        font-size: 0.85rem;
    }
    
    .quick-access-btn i {
        font-size: 1.6rem !important;
    }
    
    /* منوی موبایل برای دستگاه‌های کوچک */
    .mobile-sidebar {
        width: 280px;
    }
    
    .mobile-sidebar .nav-link {
        padding: 12px 15px !important;
        font-size: 0.9rem;
    }
}

/* اسکرول بار سفارشی */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

/* سایدبار دسکتاپ */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

/* برای موبایل‌های بسیار کوچک */
@media (max-width: 360px) {
    .mobile-sidebar {
        width: 85vw;
        right: -85vw;
    }
}

/* جلوگیری از اسکرول بدن هنگام باز بودن منو */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}