/* =========================================================
   sidebar.css – ملف القائمة الجانبية (نهائي ومستقر)
========================================================= */

/* ===========================
   Reset أساسي
=========================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Tajawal', system-ui, sans-serif;
    background: #f1f5f9;
    direction: rtl;
}

/* ===========================
   CSS Variables
=========================== */
:root {
    --primary-color: #2563eb;
    --secondary-color: #0ea5e9;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #8b5cf6;
    --light-bg: #f8fafc;
    --dark-text: #1e293b;
    --border-color: #e2e8f0;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-width: 280px;
}

/* ===========================
   Sidebar
=========================== */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 20px 0;
    overflow-y: auto;
    z-index: 1000;
}

/* Header */
.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid #334155;
    margin-bottom: 20px;
}

.sidebar-header h2 {
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.sidebar-header p {
    font-size: 13px;
    opacity: 0.7;
    margin: 4px 0 0;
}

/* Menu */
.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-right: 3px solid transparent;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-right-color: var(--primary-color);
}

/* ===========================
   Layout
=========================== */
.main-layout {
    display: block; /* لا نستخدم flex لأن القائمة fixed */
}

/* ===========================
   Main Content (الحل هنا)
=========================== */
.main-content {
    margin-right: var(--sidebar-width); /* المسافة الصحيحة */
    padding: 24px;
    min-height: 100vh;
    background: #f1f5f9;
    transition: margin-right 0.3s ease;
}

/* ===========================
   Responsive
=========================== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
    }
}
