/* ========================================
   Modern Navigation & Sidebar Styles
   نظام تنقل احترافي يشبه البرامج العالمية
   ======================================== */

:root {
    --primary-color: #0D6EFD;
    --primary-dark: #0a58ca;
    --primary-light: #6ea8fe;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --white: #ffffff;
    --sidebar-width: clamp(70px, 18vw, 280px);
    --sidebar-collapsed-width: 70px;
    --header-height: 70px;
    --transition-speed: 0.3s;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.2);
}

/* ========================================
   Modern Header/Navbar
   ======================================== */

.modern-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: var(--shadow-md);
    z-index: 1201;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    transition: all var(--transition-speed) ease;
}

.modern-navbar.scrolled {
    box-shadow: var(--shadow-lg);
    height: 65px;
}

/* Logo Section */
.navbar-brand-modern {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--white);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
    transition: all var(--transition-speed) ease;
}

.navbar-brand-modern:hover {
    color: var(--white);
    transform: scale(1.02);
}

.navbar-brand-modern .logo {
    height: 45px;
    width: auto;
    transition: all var(--transition-speed) ease;
}

.navbar-brand-modern:hover .logo {
    transform: rotate(5deg);
}

/* Header improvements for professional look */
.company-info .company-name-custom {
    line-height: 1.05;
}
.company-tagline {
    opacity: 0.75;
}
.user-compact .user-avatar img,
.user-compact .user-avatar .rounded-circle {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.user-compact .fw-bold {
    font-size: 0.95rem;
}
.user-compact .small {
    font-size: 0.75rem;
}

/* Sidebar Toggle Button - زر إظهار/إخفاء القائمة الجانبية */
.sidebar-toggle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: var(--white);
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    margin-right: 1rem;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    margin-right: 0.5rem;
    position: relative;
    z-index: 1000;
    flex-shrink: 0; /* منع تصغير الزر */
}

.sidebar-toggle:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.sidebar-toggle:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.sidebar-toggle i {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

/* تدوير الأيقونة عند فتح القائمة */
.mobile-open + * .sidebar-toggle i,
body.sidebar-mobile-open .sidebar-toggle i {
    transform: rotate(90deg);
}

/* Toggle is visible on all sizes by default; sizing adjusted in smaller breakpoints */

/* Search Bar */
.navbar-search {
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
}

.search-wrapper {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: none;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    font-size: 0.95rem;
    transition: all var(--transition-speed) ease;
    backdrop-filter: blur(10px);
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
}

/* Notification Bell Improvements */
.notification-bell-wrapper {
    position: relative;
}

.navbar-action-btn {
    position: relative;
}

#notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    z-index: 10;
    border: 2px solid white;
    min-width: 18px;
}
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* تحسين عناصر الهيدر للموبايل */
.navbar-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.navbar-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* Language toggle improvements */
.lang-toggle {
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    text-decoration: none !important;
    flex-shrink: 0;
}

/* User profile button improvements */
.user-profile-btn {
    height: 40px !important;
    border-radius: 12px !important;
    padding: 0 8px !important;
    flex-shrink: 0;
}

.user-avatar {
    width: 32px !important;
    height: 32px !important;
    flex-shrink: 0;
}

.navbar-action-btn {
    position: relative;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: var(--white);
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    backdrop-filter: blur(10px);
}

.navbar-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.navbar-action-btn i {
    font-size: 1.2rem;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.4rem;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* User Profile Dropdown */
.user-profile-dropdown {
    position: relative;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1002;
}

.user-profile-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.user-profile-btn:active {
    transform: translateY(0);
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9rem;
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    opacity: 0.8;
}
    border: none;
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    backdrop-filter: blur(10px);
}

.user-profile-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Language Toggle */
.lang-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    font-weight: 600;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
}

.lang-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* ========================================
   Modern Sidebar
   ======================================== */

.modern-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--white);
    box-shadow: var(--shadow-md);
    z-index: 1200;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    padding: 1.5rem 0;
}

/* Ensure sidebar can appear above Bootstrap modals and everything when opened */
.modern-sidebar.mobile-open {
    z-index: 9999 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.sidebar-overlay.active {
    z-index: 9998 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Hide sidebar toggles while a modal is open to avoid stray controls */
body.modal-open .sidebar-arrow-toggle,
body.modal-open .sidebar-toggle-main,
body.modal-open .sidebar-toggle {
    display: none !important;
}

/* Sidebar arrow toggle is not needed in these UIs */
.sidebar-arrow-toggle {
    display: none !important;
}

/* When sidebar is open on desktop, shift Bootstrap modals so content stays visible */
@media (min-width: 769px) {
    body.sidebar-open .modal.show .modal-dialog {
        width: calc(100% - var(--sidebar-width));
        max-width: calc(100% - var(--sidebar-width));
        margin-left: var(--sidebar-width);
        margin-right: 0;
    }

    [dir="rtl"] body.sidebar-open .modal.show .modal-dialog,
    body.rtl.sidebar-open .modal.show .modal-dialog {
        margin-left: 0;
        margin-right: var(--sidebar-width);
    }
}

.modern-sidebar::-webkit-scrollbar {
    width: 6px;
}

.modern-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.modern-sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.modern-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Sidebar Collapsed State */
.modern-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* Fully collapsed (hidden) state for desktop toggle */
.modern-sidebar.fully-collapsed {
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden;
    visibility: visible;
    transition: width var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.modern-sidebar.collapsed .menu-item-text,
.modern-sidebar.collapsed .menu-badge,
.modern-sidebar.collapsed .submenu-arrow {
    opacity: 0;
    visibility: hidden;
}

.modern-sidebar.collapsed .sidebar-menu-item {
    justify-content: center;
    padding: 1rem;
}

.modern-sidebar.collapsed .sidebar-submenu {
    display: none;
}

/* Sidebar Menu */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu-item {
    position: relative;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
    color: var(--dark-color);
    text-decoration: none;
    transition: all var(--transition-speed) ease;
    position: relative;
    font-weight: 500;
    font-size: 0.95rem;
}

.sidebar-menu-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform var(--transition-speed) ease;
}

.sidebar-menu-link:hover {
    background: rgba(13, 110, 253, 0.08);
    color: var(--primary-color);
}

.sidebar-menu-link:hover::before {
    transform: scaleY(1);
}

.sidebar-menu-link.active {
    background: rgba(13, 110, 253, 0.12);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-menu-link.active::before {
    transform: scaleY(1);
}

.menu-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.menu-item-text {
    flex: 1;
    transition: all var(--transition-speed) ease;
}

.menu-badge {
    background: var(--danger-color);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    transition: all var(--transition-speed) ease;
}

.submenu-arrow {
    font-size: 0.8rem;
    transition: all var(--transition-speed) ease;
}

.sidebar-menu-item.has-submenu.open .submenu-arrow {
    transform: rotate(90deg);
}

/* Submenu */
.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-speed) ease;
}

.sidebar-menu-item.has-submenu.open .sidebar-submenu {
    max-height: 500px;
}

.sidebar-submenu-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem 0.75rem 3.5rem;
    color: var(--secondary-color);
    text-decoration: none;
    transition: all var(--transition-speed) ease;
    font-size: 0.9rem;
    position: relative;
}

.sidebar-submenu-link::before {
    content: '';
    position: absolute;
    left: 2.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--secondary-color);
    transition: all var(--transition-speed) ease;
}

.sidebar-submenu-link:hover {
    background: rgba(13, 110, 253, 0.05);
    color: var(--primary-color);
    padding-left: 3.75rem;
}

.sidebar-submenu-link:hover::before {
    background: var(--primary-color);
    transform: translateY(-50%) scale(1.3);
}

.sidebar-submenu-link.active {
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-submenu-link.active::before {
    background: var(--primary-color);
    transform: translateY(-50%) scale(1.3);
}

/* Menu Divider */
.sidebar-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    margin: 1rem 1.5rem;
}

.sidebar-section-title {
    padding: 1rem 1.5rem 0.5rem;
    color: var(--secondary-color);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   Main Content Area
   ======================================== */

.main-content {
    margin-top: var(--header-height);
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    min-height: calc(100vh - var(--header-height));
    background: var(--light-color);
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

/* When sidebar is fully collapsed, remove the left margin so content uses full width */
.main-content.sidebar-fully-collapsed {
    margin-left: 0 !important;
}

/* RTL: remove right margin when sidebar fully collapsed */
[dir="rtl"] .main-content.sidebar-fully-collapsed,
body.rtl .main-content.sidebar-fully-collapsed {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

/* Breadcrumbs */
.breadcrumb-modern {
    background: var(--white);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-modern a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
    font-size: 0.9rem;
}

.breadcrumb-modern a:hover {
    color: var(--primary-color);
}

.breadcrumb-modern .active {
    color: var(--dark-color);
    font-weight: 600;
}

.breadcrumb-separator {
    color: var(--secondary-color);
    font-size: 0.8rem;
}

/* ========================================
   Sidebar Arrow Toggle Button (Desktop)
   زر السهم الدائري لإظهار/إخفاء القائمة الجانبية
   ======================================== */

.sidebar-arrow-toggle {
    position: fixed;
    top: 50%;
    left: var(--sidebar-width);
    transform: translateY(-50%) translateX(50%);
    width: 50px;
    height: 50px;
    background: linear-gradient(145deg, #667eea, #764ba2);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1002;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    transition: left 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), 
                transform 0.3s ease, 
                box-shadow 0.3s ease;
    font-size: 1.3rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.sidebar-arrow-toggle:hover {
    background: linear-gradient(145deg, #764ba2, #667eea);
    transform: translateY(-50%) translateX(50%) scale(1.1);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.6);
}

.sidebar-arrow-toggle i {
    transition: all 0.5s ease;
}

/* لما القائمة مفتوحة - السهم يتجه للداخل (لإغلاقها) */
.modern-sidebar:not(.fully-collapsed) ~ .sidebar-arrow-toggle i {
    transform: rotate(0deg);
}

/* لما القائمة مقفولة - السهم يتجه للخارج (لفتحها) */
.modern-sidebar.fully-collapsed ~ .sidebar-arrow-toggle i {
    transform: rotate(180deg);
    animation: arrowPulse 2s ease-in-out infinite;
}

/* موضع الزر لما القائمة مقفولة */
.modern-sidebar.fully-collapsed ~ .sidebar-arrow-toggle {
    left: 25px;
    transform: translateY(-50%);
}

@keyframes arrowPulse {
    0%, 100% {
        transform: rotate(180deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.2);
    }
}

/* RTL Support for Arrow Toggle */
[dir="rtl"] .sidebar-arrow-toggle,
body.rtl .sidebar-arrow-toggle {
    left: auto;
    right: var(--sidebar-width);
    transform: translateY(-50%) translateX(-50%);
}

[dir="rtl"] .sidebar-arrow-toggle:hover,
body.rtl .sidebar-arrow-toggle:hover {
    transform: translateY(-50%) translateX(-50%) scale(1.1);
}

[dir="rtl"] .modern-sidebar.fully-collapsed ~ .sidebar-arrow-toggle,
body.rtl .modern-sidebar.fully-collapsed ~ .sidebar-arrow-toggle {
    right: 25px;
    left: auto;
    transform: translateY(-50%);
}

/* إخفاء الزر على الشاشات الصغيرة (يستخدم زر hamburger menu بدلاً منه) */
@media (max-width: 768px) {
    .sidebar-arrow-toggle {
        display: none !important;
    }
}

/* ========================================
   RTL Support
   ======================================== */

[dir="rtl"] .modern-sidebar,
body.rtl .modern-sidebar {
    left: auto;
    right: 0;
}

[dir="rtl"] .main-content,
body.rtl .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

[dir="rtl"] .main-content.sidebar-collapsed,
body.rtl .main-content.sidebar-collapsed {
    margin-left: 0;
    margin-right: var(--sidebar-collapsed-width);
}

[dir="rtl"] .sidebar-menu-link::before,
body.rtl .sidebar-menu-link::before {
    left: auto;
    right: 0;
}

[dir="rtl"] .sidebar-submenu-link,
body.rtl .sidebar-submenu-link {
    padding: 0.75rem 3.5rem 0.75rem 1.5rem;
}

[dir="rtl"] .sidebar-submenu-link::before,
body.rtl .sidebar-submenu-link::before {
    left: auto;
    right: 2.5rem;
}

[dir="rtl"] .sidebar-submenu-link:hover,
body.rtl .sidebar-submenu-link:hover {
    padding-left: 1.5rem;
    padding-right: 3.75rem;
}

[dir="rtl"] .submenu-arrow,
body.rtl .submenu-arrow {
    transform: rotate(180deg);
}

[dir="rtl"] .sidebar-menu-item.has-submenu.open .submenu-arrow,
body.rtl .sidebar-menu-item.has-submenu.open .submenu-arrow {
    transform: rotate(90deg);
}

/* إضافة دعم RTL للقوائم المنسدلة */
[dir="rtl"] .dropdown-menu-modern,
body.rtl .dropdown-menu-modern {
    right: auto;
    left: 0;
}

/* إضافة دعم RTL للبحث */
[dir="rtl"] .search-icon,
body.rtl .search-icon {
    left: auto;
    right: 1rem;
}

[dir="rtl"] .search-input,
body.rtl .search-input {
    padding: 0.75rem 3rem 0.75rem 1rem;
}

/* ========================================
   Responsive Design
   ======================================== */

/* تحسين dropdown للموبايل */
@media (max-width: 768px) {
    /* إخفاء dropdown menus بشكل افتراضي لكن نسمح بإظهارها بـ .show */
    .dropdown-menu-modern {
        display: none;
        position: fixed !important;
        top: 70px !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-width: none !important;
        max-height: calc(100vh - 90px) !important;
        overflow-y: auto !important;
        z-index: 99999 !important;
        border-radius: 12px !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
        background: white !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding: 0.5rem 0 !important;
        margin: 0 !important;
        transform: none !important;
    }
    
    .dropdown-menu-modern.show {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
    }
    
    [dir="rtl"] .dropdown-menu-modern {
        left: 8px !important;
        right: 8px !important;
    }
    
    /* التأكد من أن الشريط الجانبي هو الوحيد الظاهر */
    .modern-sidebar {
        display: block !important;
    }
    
    /* تحسين الهيدر للموبايل */
    .modern-navbar {
        height: 60px !important;
        padding: 0 8px !important;
        overflow: hidden;
    }
    
    /* إخفاء النص في ملف المستخدم */
    .user-info {
        display: none !important;
    }
    
    /* تقليل حجم الأزرار */
    .navbar-action-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 1rem;
    }
    
    .lang-toggle {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.8rem !important;
    }
    
    .user-profile-btn {
        height: 36px !important;
        padding: 0 6px !important;
    }
    
    .user-avatar {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.8rem !important;
    }
    
    /* إخفاء السهم في ملف المستخدم */
    .user-profile-btn .bi-chevron-down {
        display: none !important;
    }
    
    /* تحسين positioning للعناصر */
    .navbar-actions {
        gap: 4px !important;
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1002;
    }
    
    [dir="rtl"] .navbar-actions {
        right: auto;
        left: 8px;
    }
}

@media (max-width: 1024px) {
    .navbar-search {
        max-width: 300px;
        margin: 0 1rem;
    }

    .user-info {
        display: none;
    }
}

@media (max-width: 768px) {
    .modern-navbar {
        padding: 0 1rem;
    }

    .navbar-search {
        display: none;
    }

    /* الشريط الجانبي على الشاشات الصغيرة - SIDEBAR not dropdown menu */
    .modern-sidebar {
        position: fixed !important;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        width: 80vw;
        max-width: 320px;
        min-width: 220px;
        background: var(--white);
        transform: translateX(-100%); /* مخفي خارج الشاشة */
        z-index: 9999 !important;
        box-shadow: 2px 0 18px rgba(0,0,0,0.22);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
        border-radius: 0 12px 12px 0;
        overflow-y: auto;
        overflow-x: hidden;
        display: block !important; /* دائماً مرئي في DOM */
    }

    /* للغة العربية (RTL) */
    .rtl .modern-sidebar,
    [dir="rtl"] .modern-sidebar,
    html[lang="ar"] .modern-sidebar {
        left: auto !important;
        right: 0 !important;
        transform: translateX(100%); /* مخفي خارج الشاشة لليمين */
        border-radius: 12px 0 0 12px;
        box-shadow: -2px 0 18px rgba(0,0,0,0.22);
    }

    /* حالة عندما يُفتح الشريط (mobile-open) */
    .modern-sidebar.mobile-open {
        transform: translateX(0) !important; /* ظاهر بالكامل */
        box-shadow: 4px 0 24px rgba(0,0,0,0.3) !important;
        visibility: visible !important;
        pointer-events: auto !important;
        z-index: 9999 !important;
    }
    
    /* تأكيد الظهور للغة العربية */
    .rtl .modern-sidebar.mobile-open,
    [dir="rtl"] .modern-sidebar.mobile-open,
    html[lang="ar"] .modern-sidebar.mobile-open {
        transform: translateX(0) !important;
        box-shadow: -4px 0 24px rgba(0,0,0,0.3) !important;
        visibility: visible !important;
        pointer-events: auto !important;
        z-index: 9999 !important;
    }

    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100%;
        padding-top: calc(var(--header-height) + 1rem);
    }

    .rtl .main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    /* الخلفية الداكنة عند فتح القائمة */
    .sidebar-overlay {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        pointer-events: none; /* لا تستقبل أحداث الماوس عندما تكون مخفية */
    }

    /* الخلفية الداكنة نشطة */
    .sidebar-overlay.active {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important; /* تستقبل أحداث الماوس */
        z-index: 9998 !important;
    }
}

@media (max-width: 576px) {
    .modern-navbar {
        height: 56px !important;
        padding: 0 6px !important;
    }
    
    /* تصغير جميع عناصر الهيدر */
    .navbar-action-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.9rem !important;
    }
    
    .lang-toggle {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.7rem !important;
    }
    
    .user-profile-btn {
        height: 32px !important;
        padding: 0 4px !important;
    }
    
    .user-avatar {
        width: 24px !important;
        height: 24px !important;
        font-size: 0.7rem !important;
    }
    
    .sidebar-toggle-main {
        width: 30px !important;
        height: 30px !important;
        font-size: 1rem !important;
    }
    
    /* تحسين المساحات */
    .navbar-actions {
        gap: 2px !important;
        right: 6px !important;
    }
    
    [dir="rtl"] .navbar-actions {
        left: 6px !important;
        right: auto;
    }
    
    /* إخفاء تنبيهات الإشعارات على الشاشات الصغيرة جداً */
    #notification-badge {
        font-size: 0.6rem !important;
        width: 16px !important;
        height: 16px !important;
        top: -2px !important;
        right: -2px !important;
    }

    .navbar-brand-modern {
        font-size: 1rem;
    }

    .navbar-brand-modern .logo {
        height: 35px;
    }

    .sidebar-toggle,
    .navbar-action-btn {
        width: 42px;
        height: 42px;
    }

    .sidebar-toggle {
        margin-right: 0.25rem;
        box-shadow: 0 3px 10px rgba(102, 126, 234, 0.35);
    }
    
    .sidebar-toggle:active {
        transform: scale(0.92);
    }

    .sidebar-toggle i {
        font-size: 1.4rem;
    }

    .main-content {
        padding: 0.75rem;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100%;
        max-width: 100vw;
    }

    .modern-sidebar {
        width: 75vw;
        max-width: 280px;
    }

    .breadcrumb-modern {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
}

/* ========================================
   Animations
   ======================================== */

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-slide-in-left {
    animation: slideInLeft 0.3s ease;
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease;
}

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

/* ========================================
   Dropdown Menus
   ======================================== */

.dropdown-menu-modern {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 250px;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-speed) ease;
    z-index: 9999;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.dropdown-menu-modern.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-item-modern {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--dark-color);
    text-decoration: none;
    transition: all var(--transition-speed) ease;
    font-size: 0.9rem;
}

.dropdown-item-modern:hover {
    background: rgba(13, 110, 253, 0.08);
    color: var(--primary-color);
}

.dropdown-item-modern i {
    width: 20px;
    text-align: center;
}

.dropdown-divider-modern {
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    margin: 0.5rem 0;
}

/* ========================================
   Loading States
   ======================================== */

.skeleton-loader {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ========================================
   Centered Navbar Design - Logo & Company Name
   ======================================== */

/* زر القائمة المصغر جداً */
.sidebar-toggle-compact {
    width: 20px !important;
    height: 20px !important;
    border-radius: 4px !important;
    margin-left: 0.2rem;
    position: absolute;
    right: 0.5rem;
    z-index: 10;
    padding: 0 !important;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.25) !important;
}

[dir="ltr"] .sidebar-toggle-compact {
    left: 0.5rem;
    right: auto;
}

.sidebar-toggle-compact i {
    font-size: 0.7rem !important;
    line-height: 1;
}

/* محتوى المنتصف - Logo & Company Name */
.navbar-center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* Logo دائري كبير */
.navbar-logo-circle {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 
                0 0 0 4px rgba(255, 255, 255, 0.3),
                inset 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.navbar-logo-circle::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.navbar-logo-circle:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.3), 
                0 0 0 6px rgba(255, 255, 255, 0.4),
                inset 0 2px 8px rgba(102, 126, 234, 0.1);
}

.navbar-logo-circle:hover::before {
    opacity: 1;
}

.logo-circular {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    transition: transform 0.4s ease;
}

.navbar-logo-circle:hover .logo-circular {
    transform: rotate(5deg) scale(1.05);
}

/* معلومات الشركة - اسم زخرفي */
.company-info-center {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.company-name-fancy {
    letter-spacing: 0.5px;
    line-height: 1.2;
    text-align: center;
    position: relative;
    display: inline-block;
    animation: fadeInScale 0.6s ease-out;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.company-tagline-center {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* استجابة للشاشات الصغيرة */
@media (max-width: 768px) {
    .navbar-logo-circle {
        width: 65px;
        height: 65px;
    }
    
    .company-name-fancy {
        font-size: 1.4rem !important;
    }
    
    .company-tagline-center {
        font-size: 0.75rem;
    }
    
    .navbar-center-content {
        gap: 0.5rem;
    }
}

@media (max-width: 576px) {
    .navbar-logo-circle {
        width: 55px;
        height: 55px;
    }
    
    .company-name-fancy {
        font-size: 1.1rem !important;
    }
    
    .company-tagline-center {
        display: none;
    }
}

/* خطوط زخرفية عربية */
@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Cairo:wght@400;600;700;800&family=Tajawal:wght@400;500;700;800&family=Almarai:wght@400;700;800&display=swap');

/* خطوط إنجليزية فاخرة */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700;800&family=Cinzel:wght@400;600;700;800&family=Cormorant+Garamond:wght@400;600;700&display=swap');