/* :root {
    --primary: #001BB7;
    --secondary: #0046FF;
    --accent: #FF8040;
    --light: #F5F1DC;
    --purple: #53629E;
    --teal: #87BAC3;
    --mint: #D6F4ED;
} */

:root {
    --primary: #33C7A9;
    /* سماوي مائل للأخضر */
    --secondary: #3A8DDE;
    /* أزرق فاتح */
    --accent: #5363D8;
    /* أزرق بنفسجي */
    --light: #EAFBFF;
    /* سماوي فاتح جدًا */
    --dark-green: #1C8F8A;
    /* لون أغمق للزر أو الهوفر */
    --gold: #26D0C9;
    /* أخذناه من بداية التدرج */
    --white: #FFFFFF;
    --purple: #5363D8;
    /* نفس البنفسجي في الأطراف */
    --teal: #33C7A9;
    /* تركواز */
    --mint: #D6F4ED;
    /* نعناع فاتح جداً */
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Open Sans', sans-serif;
    background: #f8f9fa;
    width: 100%;
    overflow-x: hidden;
}


[data-theme="dark"] {
    --primary: #2BA392;
    --secondary: #3274C4;
    --accent: #4552B2;
    --light: #101418;
    --dark-green: #176D67;
    --gold: #22B8B3;
    background-color: #0a0e0f !important;
    color: #e2e2e2 !important;
}

[data-theme="dark"] body {
    background: #0a0e0f !important;
}


.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0, 27, 183, 0.1);
}

html[dir="rtl"] .sidebar {
    left: auto;
    right: 0 !important;
    box-shadow: -4px 0 20px rgba(0, 27, 183, 0.1);
}

[data-theme="dark"] .sidebar {
    background: #131417;
}

html[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: 280px;
}

html[dir="rtl"] .main-content.expanded {
    margin-right: 120px;
}

.sidebar.collapsed {
    width: 120px;
}

.sidebar.collapsed .menu-icon {
    font-size: 1.5rem;
    width: 24px;
}

.sidebar-header {
    padding: 21.5px 20px;
    /* background: rgba(255, 255, 255, 0.1); */
    /* border-bottom: 1px solid rgba(255, 255, 255, 0.1); */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

[data-theme="dark"] .sidebar-header {
    background: #1c1f26;
}

.sidebar-brand {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.sidebar.collapsed .brand-text {
    display: none;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1px 8px;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

.sidebar-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.25);
}




.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    margin: 0;
}

.menu-item {
    margin: 5px 15px;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s;
    gap: 12px;
    font-weight: 500;
}

.menu-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(5px);
}

.menu-link.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 128, 64, 0.3);
}

.menu-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.collapsed .menu-text {
    display: none;
}

.menu-badge {
    margin-left: auto;
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.sidebar.collapsed .menu-badge {
    display: none;
}

.sidebar.collapsed .menu-link {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .menu-icon {
    margin: 0;
}

.sidebar.collapsed .menu-text {
    display: none;
}

.sidebar.collapsed .menu-badge {
    margin-left: auto;
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.collapsed .menu-badge {
    display: none;
}

.main-content {
    margin-left: 280px;
    transition: all 0.3s ease;
    min-height: 100vh;
}

.main-content.expanded {
    margin-left: 120px;
}

.top-navbar {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: sticky;
    top: 0;
    z-index: 999;
}

[data-theme="dark"] .top-navbar {
    background: #1c1f26;
}

.search-box {
    position: relative;
    width: 400px;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 45px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(0, 70, 255, 0.1);
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.top-navbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.navbar-icon {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.navbar-icon:hover {
    background: var(--mint);
    color: var(--secondary);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 25px;
    transition: all 0.3s;
    position: relative;
}

.user-profile:hover {
    background: #f8f9fa;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    margin-top: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    z-index: 1000;
}

/* RTL Support for user dropdown */
html[dir="rtl"] .user-dropdown {
    right: auto;
    left: 0;
}

.user-profile.active .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: #f8f9fa;
    color: var(--secondary);
}

.mobile-toggle {
    display: none;
    background: var(--secondary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 1.2rem;
    cursor: pointer;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), var(--teal));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.content-wrapper {
    padding: 30px;
}

.page-header {
    margin-bottom: 30px;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
}

[data-theme="dark"] .page-title {
    color: var(--accent);
}

.page-subtitle {
    color: #6c757d;
    font-size: 0.95rem;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    border: 2px solid transparent;
}

[data-theme="dark"] .stat-card {
    background: #3a3a3a;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--secondary);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    margin-bottom: 15px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 5px;
}

[data-theme="dark"] .stat-value {
    color: white;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9rem;
}

[data-theme="dark"] .stat-label {
    color: #a8a8a8;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 10px;
    padding: 4px 10px;
    border-radius: 20px;
}

.stat-change.positive {
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.stat-change.negative {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.card-header {
    background: white;
    border-bottom: 2px solid #f8f9fa;
    padding: 20px 25px;
    border-radius: 15px 15px 0 0;
}

[data-theme="dark"] .card-header {
    background-color: #1c1f26 !important;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
}

[data-theme="dark"] .card-title {
    color: #a8a8a8;
}

.btn-primary {
    background: var(--secondary);
    border: none;
    padding: 2px 10px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 70, 255, 0.3);
}

.btn-accent {
    background: var(--accent);
    border: none;
    color: white;
    padding: 10px 25px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-accent:hover {
    background: #ff6b2c;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 128, 64, 0.3);
}

@media (max-width: 768px) {
    .sidebar {
        left: -280px;
        z-index: 9999;
        /* Ensure sidebar is above all content on mobile */
    }

    .sidebar.show {
        left: 0;
    }

    .main-content {
        margin-left: 0 !important;
    }

    /* RTL Support */
    html[dir="rtl"] .sidebar {
        left: auto;
        right: -280px !important;
        z-index: 9999;
        /* Ensure sidebar is above all content on mobile */
    }

    html[dir="rtl"] .sidebar.show {
        right: 0 !important;
    }

    html[dir="rtl"] .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .top-navbar {
        justify-content: space-between;
    }

    .search-box {
        width: 200px;
    }

    .content-wrapper {
        padding: 20px 15px;
    }

    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .page-title {
        font-size: 1.5rem;
    }

}


@media (max-width: 576px) {
    .search-box {
        display: none;
    }

    .navbar-icon {
        width: 35px;
        height: 35px;
    }

    .user-avatar {
        width: 35px;
        height: 35px;
    }

    .top-navbar {
        padding: 10px 15px;
    }

    .page-title {
        font-size: 1.25rem;
    }
}

/* Add these additional styles to fix remaining issues */

/* Smooth sidebar transitions */
.sidebar {
    transition: left 0.3s ease, right 0.3s ease, width 0.3s ease;
}

.main-content {
    transition: margin-left 0.3s ease;
    will-change: margin-left;
}

/* Fix sidebar overlay on mobile */
/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 9998;
    /* Just below sidebar (9999) */
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Stat card improvements for mobile */
@media (max-width: 576px) {
    .stat-card {
        padding: 20px 15px;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
        margin-bottom: 10px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .stat-change {
        font-size: 0.75rem;
        padding: 3px 8px;
    }
}

/* Fix table responsiveness */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }

    .btn-group-sm .btn {
        padding: 0.25rem 0.5rem;
    }
}

/* Improve card spacing on mobile */
@media (max-width: 576px) {
    .card {
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 15px 20px;
    }

    .card-body {
        padding: 15px;
    }
}

/* Fix dropdown positioning */
.user-dropdown {
    border: 1px solid #e0e0e0;
}

.dropdown-item:first-child {
    border-radius: 10px 10px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 10px 10px;
}

/* Improve button responsiveness */
@media (max-width: 576px) {
    .btn {
        font-size: 0.875rem;
        padding: 8px 16px;
    }

    .btn-sm {
        font-size: 0.75rem;
        padding: 4px 10px;
    }
}

/* Fix modal on mobile */
@media (max-width: 576px) {
    .modal-lg {
        max-width: 95%;
        margin: 0.5rem auto;
    }

    .modal-body {
        padding: 1rem;
    }
}

/* Sidebar menu item tooltip for collapsed state */
.sidebar.collapsed .menu-item {
    position: relative;
}

.sidebar.collapsed .menu-link:hover::after {
    content: attr(data-title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
    margin-left: 15px;
    font-size: 0.875rem;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.sidebar.collapsed .menu-link:hover::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 8px;
    border: 6px solid transparent;
    border-right-color: #333;
}

/* Loading state for cards */
.card.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Improve focus states for accessibility */
.form-control:focus,
.form-select:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 0.2rem rgba(0, 70, 255, 0.15);
}

.btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 70, 255, 0.25);
}

/* Fix notification badge position on mobile */
@media (max-width: 576px) {
    .notification-badge {
        width: 16px;
        height: 16px;
        font-size: 0.65rem;
        top: -3px;
        right: -3px;
    }
}

/* Smooth page transitions */
.content-wrapper>* {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fix pagination on mobile */
@media (max-width: 576px) {
    .pagination {
        font-size: 0.875rem;
    }

    .page-link {
        padding: 0.375rem 0.625rem;
    }
}


.theme-toggle {
    cursor: pointer;
    font-size: 1.2rem;
    padding: 2px 6px;
}