:root {
    /* ULTRATHINK "Avant-Garde" Palette */
    --primary-color: #205de9;
    /* Electric Blue - Primary Action */
    --secondary-color: #6AD2FF;
    /* Light Blue - Accents */
    --sidebar-bg: #1c2537;
    /* Deep Navy - Sidebar Background */
    --sidebar-bg-gradient: linear-gradient(180deg, #11c2537 0%, #0f1225 100%);
    /* Gradient Background */
    --sidebar-text: #ffffff;
    /* White - Sidebar Text */
    --sidebar-text-muted: #d4c4c4;
    /* Muted Text */
    --body-bg: #F4F7FE;
    /* Very Light Blue-Grey - Main Background */
    --card-bg: #ffffff;
    /* White - Card Background */
    --text-dark: #2B3674;
    /* Deep Blue - Headings (High Contrast) */
    --text-gray: #A3AED0;
    /* Soft Gray - Secondary Text */
    --success-color: #05CD99;
    /* Vibrant Green - Success */
    --warning-color: #FFCE20;
    /* Sunny Yellow - Warning */
    --danger-color: #EE5D50;
    /* Soft Red - Danger */

    /* "Invisible" UX Dimensions */
    --sidebar-width: 280px;
    /* Wide, generous sidebar */
    --sidebar-collapsed-width: 80px;
    /* Collapsed sidebar width */
    --header-height: 80px;
    --card-radius: 20px;
    /* Soft, modern corners */
    --btn-radius: 16px;
    /* Rounded buttons */
    --shadow-sm: 0px 18px 40px rgba(112, 144, 176, 0.12);
    /* Ultra-soft diffuse shadow */
    --shadow-hover: 0px 25px 50px rgba(112, 144, 176, 0.20);
}

/* ============================================
   THEME COLORS (General Customization)
   ============================================ */
/* Default theme is already defined in :root above */

/* Theme: Midnight Indigo */
[data-theme="indigo"] {
    --primary-color: #4f46e5;
}

[data-bs-theme="dark"][data-theme="indigo"] {
    --primary-color: #818cf8;
    /* Lighter indigo for contrast */
}

/* Theme: Emerald Green */
[data-theme="emerald"] {
    --primary-color: #059669;
}

[data-bs-theme="dark"][data-theme="emerald"] {
    --primary-color: #34d399;
    /* Lighter emerald for contrast */
}

/* Theme: Sunset Orange */
[data-theme="sunset"] {
    --primary-color: #ea580c;
}

[data-bs-theme="dark"][data-theme="sunset"] {
    --primary-color: #fb923c;
    /* Lighter orange for contrast */
}

/* Theme: Royal Purple */
[data-theme="purple"] {
    --primary-color: #7c3aed;
}

[data-bs-theme="dark"][data-theme="purple"] {
    --primary-color: #a78bfa;
    /* Lighter purple for contrast */
}

/* Remove button shadows and glow globally */
.btn {
    box-shadow: none !important;
}

.btn:focus,
.btn:active {
    box-shadow: none !important;
    outline: none !important;
}

/* ============================================
   DARK MODE OVERRIDES
   ============================================ */
[data-bs-theme="dark"] {
    --body-bg: #13131A;
    /* Very Dark Background */
    --card-bg: #1C1C26;
    /* Slightly Lighter Card Background */
    --text-dark: #FFFFFF;
    /* Bright White for Headings */
    --text-gray: #A0A0A0;
    /* Soft Gray for secondary text */
    --sidebar-text-muted: #8b9bb4;
    --primary-color: #2f62ff;
    /* Neon Blue Accent */
    --success-color: #05CD99;
    /* Vibrant Green */
    --danger-color: #EE5D50;
    /* Soft Red */
    --warning-color: #FFC107;
    /* Warning Yellow */
    --sidebar-bg: #13131A;
    /* Match body background */
}

/* Sidebar Dark Mode Overrides */
[data-bs-theme="dark"] #sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    /* Soft border instead of shadow */
    box-shadow: none;
}

[data-bs-theme="dark"] .sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
}

[data-bs-theme="dark"] .nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

[data-bs-theme="dark"] .nav-link.active {
    background: transparent;
    color: var(--primary-color);
    box-shadow: none;
    position: relative;
}

[data-bs-theme="dark"] .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 4px;
    background-color: var(--primary-color);
    border-radius: 0 4px 4px 0;
}

[data-bs-theme="dark"] .nav-link.active .nav-icon {
    color: var(--primary-color);
}


[data-bs-theme="dark"] .card {
    --bs-card-bg: var(--card-bg) !important;
    background-color: var(--card-bg) !important;
}

[data-bs-theme="dark"] .navbar {
    background-color: var(--card-bg) !important;
    border: none !important;
    box-shadow: none !important;
}

[data-bs-theme="dark"] .navbar .text-dark {
    color: var(--text-dark) !important;
}

/* Adjust the server clock and date bar in dark mode */
[data-bs-theme="dark"] .bg-secondary {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Stat Cards Dark Mode Overrides */
[data-bs-theme="dark"] .stat-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: none;
}

[data-bs-theme="dark"] .stat-card::before {
    display: none;
    /* Remove background gradient graphic */
}

[data-bs-theme="dark"] .stat-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .stat-icon {
    background-color: rgba(255, 255, 255, 0.03) !important;
    box-shadow: none !important;
}

[data-bs-theme="dark"] .stat-icon.text-primary,
[data-bs-theme="dark"] .stat-icon {
    color: var(--primary-color) !important;
}

[data-bs-theme="dark"] .stat-icon.success,
[data-bs-theme="dark"] .stat-icon.text-success {
    color: var(--success-color) !important;
}

[data-bs-theme="dark"] .stat-icon.warning,
[data-bs-theme="dark"] .stat-icon.text-warning {
    color: var(--warning-color) !important;
}

[data-bs-theme="dark"] .stat-icon.danger,
[data-bs-theme="dark"] .stat-icon.text-danger {
    color: var(--danger-color) !important;
}


[data-bs-theme="dark"] .table,
[data-bs-theme="dark"] .table-hover {
    --bs-table-bg: var(--card-bg) !important;
    --bs-table-color: var(--text-dark) !important;
    --bs-table-hover-bg: rgba(255, 255, 255, 0.03) !important;
    --bs-table-hover-color: var(--text-dark) !important;
    background-color: var(--card-bg) !important;
}

[data-bs-theme="dark"] .table tbody tr,
[data-bs-theme="dark"] .table thead tr {
    background-color: var(--card-bg) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

[data-bs-theme="dark"] .table tbody td,
[data-bs-theme="dark"] .table tbody th,
[data-bs-theme="dark"] .table thead th {
    background-color: var(--card-bg) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: var(--text-dark) !important;
}

[data-bs-theme="dark"] .stat-icon {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

[data-bs-theme="dark"] .table tbody tr:hover,
[data-bs-theme="dark"] .table tbody tr:hover td,
[data-bs-theme="dark"] .table tbody tr:hover th {
    background-color: rgba(255, 255, 255, 0.03) !important;
    color: var(--text-dark) !important;
}

[data-bs-theme="dark"] .table-light {
    --bs-table-bg: rgba(255, 255, 255, 0.02) !important;
    --bs-table-color: var(--text-gray) !important;
}

[data-bs-theme="dark"] .table thead th {
    background-color: rgba(255, 255, 255, 0.02) !important;
    color: var(--text-gray) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

[data-bs-theme="dark"] .table td,
[data-bs-theme="dark"] .table th {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .text-dark {
    color: var(--text-dark) !important;
}

/* Ensure global text readability in Dark Mode */
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6,
[data-bs-theme="dark"] .h1,
[data-bs-theme="dark"] .h2,
[data-bs-theme="dark"] .h3,
[data-bs-theme="dark"] .h4,
[data-bs-theme="dark"] .h5,
[data-bs-theme="dark"] .h6 {
    color: var(--text-dark);
}

[data-bs-theme="dark"] p,
[data-bs-theme="dark"] .text-muted {
    color: var(--text-gray) !important;
}

/* Fix outline buttons in dark mode */
[data-bs-theme="dark"] .btn-outline-dark {
    color: var(--text-gray);
    border-color: rgba(255, 255, 255, 0.2);
}

[data-bs-theme="dark"] .btn-outline-dark:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

[data-bs-theme="dark"] select,
[data-bs-theme="dark"] input[type="text"],
[data-bs-theme="dark"] input[type="date"],
[data-bs-theme="dark"] input[type="number"],
[data-bs-theme="dark"] input[type="email"],
[data-bs-theme="dark"] input[type="password"] {
    background-color: rgba(255, 255, 255, 0.05);
    /* Slightly lighter background for contrast */
    border: 1px solid rgba(255, 255, 255, 0.15);
    /* More visible border */
    color: white;
    transition: all 0.3s ease;
}

[data-bs-theme="dark"] select::placeholder,
[data-bs-theme="dark"] input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Fix option elements inside select dropping white background in some browsers */
[data-bs-theme="dark"] select option {
    background-color: var(--card-bg);
    /* Use solid dark background */
    color: white;
}

/* Fix Labels for dark mode */
[data-bs-theme="dark"] label,
[data-bs-theme="dark"] .form-label {
    color: var(--text-gray) !important;
}

[data-bs-theme="dark"] .input-group-text {
    background-color: #1A1A24 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: var(--text-gray) !important;
}

[data-bs-theme="dark"] select:focus,
[data-bs-theme="dark"] input:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(var(--primary-color-rgb), 0.25);
    color: white;
}

/* Premium Filter Card Styling */
.filter-card {
    background: linear-gradient(145deg, var(--card-bg), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    overflow: hidden;
}

[data-bs-theme="dark"] .filter-card {
    background: linear-gradient(145deg, rgba(20, 20, 30, 0.6), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.filter-card .card-body {
    padding: 1.5rem;
}

.filter-card .form-control,
.filter-card .form-select {
    border-radius: 10px;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.filter-card .btn-primary {
    border-radius: 10px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.3);
    transition: all 0.3s ease;
}

.filter-card .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(var(--primary-color-rgb), 0.4);
}

.filter-card .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

[data-bs-theme="dark"] .modal-content {
    background-color: var(--card-bg);
    color: var(--text-dark);
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    border-color: rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: var(--card-bg);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .dropdown-item {
    color: var(--text-dark);
}

[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

[data-bs-theme="dark"] .text-muted {
    color: var(--sidebar-text-muted) !important;
}

[data-bs-theme="dark"] .bg-light {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

body {
    font-family: 'DM Sans', 'Cairo', sans-serif;
    /* DM Sans for numbers/English, Cairo for Arabic */
    background-color: var(--body-bg);
    color: var(--text-dark);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Import DM Sans */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;500;700&display=swap');

/* ============================================
   MODERN SIDEBAR STYLING ("Kretya Studio" Inspired)
   ============================================ */

/* Sidebar Container */
#sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    /* Fallback for older browsers */
    height: 100dvh;
    /* Modern mobile browser dynamic viewport height */
    background: var(--sidebar-bg);
    /* Deep solid color for cleaner look */
    position: fixed;
    top: 0;
    right: 0;
    /* RTL Alignment */
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* Smooth Apple-like easing */
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

/* Sidebar Gradient Overlay (Optional Depth) */
#sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
    pointer-events: none;
}

/* Sidebar Header (Logo) */
.sidebar-header {
    padding: 30px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    /* Prevent spill on collapse */
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: white;
    width: 100%;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    flex-shrink: 0;

    /* Prevent shrinking */
    box-shadow: 0 8px 20px rgba(67, 24, 255, 0.3);
    transition: all 0.3s ease;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateX(0);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 16px;
    scrollbar-width: none;
    /* Firefox */
}

.sidebar-nav::-webkit-scrollbar {
    width: 0;
    /* Hide scrollbar for cleaner look */
}

/* Navigation Sections */
.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    padding: 0 16px;
    margin-bottom: 12px;
    color: var(--sidebar-text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    white-space: nowrap;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.6;
}

/* Navigation Links */
.nav-item {
    margin-bottom: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    color: var(--sidebar-text-muted);
    text-decoration: none;
    border-radius: 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 15px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

/* Hover State */
.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.04);
}

.nav-link:hover .nav-icon {
    color: white;
    transform: scale(1.1);
}

/* Active State - "Kretya" Pill Style */
.nav-link.active {
    background: var(--primary-color);
    color: white;
    box-shadow: none !important;
    /* Removed glow */
}

.nav-link.active .nav-icon {
    color: white;
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    /* Keep icon sizing constant */
    transition: transform 0.3s ease;
}

.nav-text {
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* Sidebar Footer (User & Toggle) */
.sidebar-footer {
    padding: 20px;
    margin-top: auto;
    /* Push to bottom */
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.1);
    /* Subtle contrast */
    display: flex;
    align-items: center;
    /* Expanded: Center vertically */
    justify-content: space-between;
    /* Expanded: Space between profile and toggle */
    gap: 12px;
    overflow: hidden;
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    /* Take available space */
    min-width: 0;
    /* Allow flex shrinking */
    transition: all 0.3s ease;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    /* Prevent squishing */
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    /* Hide overflow text */
    transition: opacity 0.2s ease, width 0.2s ease;
}

.user-name {
    color: white;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    color: var(--sidebar-text-muted);
    font-size: 12px;
}

/* Profile Link */
.profile-link {
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: var(--sidebar-text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
}

.profile-link:hover {
    background: var(--primary-color);
    color: white;
}

.profile-link i {
    font-size: 12px;
}

/* Toggle Button */
.sidebar-toggle {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    /* Never shrink */
}

.sidebar-toggle:hover {
    background: white;
    color: var(--primary-color);
}

/* ============================================
   COLLAPSED STATE LOGIC - ENHANCED
   ============================================ */

#sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    /* 80px */
}

/* Logo: Center and hide text */
#sidebar.collapsed .sidebar-header {
    padding: 20px 0;
    justify-content: center;
}

#sidebar.collapsed .sidebar-logo {
    justify-content: center;
    padding: 0;
}

#sidebar.collapsed .logo-text {
    opacity: 0;
    width: 0;
    pointer-events: none;
    display: none;
}

#sidebar.collapsed .logo-icon {

    box-shadow: 0 8px 20px rgba(67, 24, 255, 0.3);
    margin: 0 auto;
}

/* Navigation: Center icons, hide text */
#sidebar.collapsed .sidebar-nav {
    padding: 10px 8px;
}

#sidebar.collapsed .nav-section-title {
    justify-content: center;
    padding: 8px 4px;
}

#sidebar.collapsed .nav-section-title span {
    display: none;
}

#sidebar.collapsed .nav-section-title i {
    margin: 0;
}

#sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
    position: relative;
}

#sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    display: none;
}

#sidebar.collapsed .nav-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    transition: all 0.2s ease;
}

#sidebar.collapsed .nav-link:hover .nav-icon {
    background: rgba(255, 255, 255, 0.1);
}

#sidebar.collapsed .nav-link.active .nav-icon {
    background: rgba(255, 255, 255, 0.2);
}

#sidebar.collapsed .nav-item {
    display: flex;
    justify-content: center;
}

/* Tooltip for collapsed sidebar */
#sidebar.collapsed .nav-link::after {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--sidebar-bg);
    color: white;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    pointer-events: none;
}

#sidebar.collapsed .nav-link:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Footer: Reorient for vertical flow */
#sidebar.collapsed .sidebar-footer {
    flex-direction: column;
    padding: 16px 8px;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

#sidebar.collapsed .user-profile {
    justify-content: center;
    flex: 0;
    width: auto;
    padding: 0;
}

#sidebar.collapsed .user-info {
    display: none;
}

#sidebar.collapsed .user-avatar {
    width: 40px;
    height: 40px;
    border: 2px solid var(--primary-color);
    border-radius: 12px;
}

#sidebar.collapsed .profile-link {
    display: none;
}

#sidebar.collapsed .sidebar-toggle {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--sidebar-text-muted);
    border-radius: 10px;
}

#sidebar.collapsed .sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

#sidebar.collapsed .sidebar-toggle .toggle-icon {
    transform: rotate(180deg);
}

/* Main Content Area */
.main-content {
    margin-right: var(--sidebar-width);
    padding: 20px;
    min-height: 100vh;
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.expanded {
    margin-right: var(--sidebar-collapsed-width);
}

/* Header/Navbar */
.navbar {
    background-color: #ffffff !important;
    backdrop-filter: none;
    box-shadow: var(--shadow-sm) !important;
    padding: 10px 20px;
    border-radius: var(--card-radius);
    margin-bottom: 20px;
    margin-right: var(--sidebar-width);
    position: sticky;
    top: 10px;
    z-index: 900;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar.expanded {
    margin-right: var(--sidebar-collapsed-width);
}

.navbar .navbar-brand {
    color: var(--text-dark) !important;
    font-weight: 700;
}

/* Hide old toggle button styles - using new .sidebar-toggle instead */
.navbar .btn-dark {
    display: none;
}

/* Cards & Widgets */
.card {
    background-color: var(--card-bg);
    border: none;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.card-header {
    background-color: transparent;
    border-bottom: none;
    padding: 24px 30px;
    font-weight: 700;
    color: var(--text-dark);
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 0 30px 30px 30px;
}

/* Premium Stat Cards (Dashboard) */
.stat-card {
    display: flex;
    align-items: flex-start;
    padding: 20px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-left: 18px;
    /* RTL */
    background: #F4F7FE;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.stat-card:hover .stat-icon {
    background: var(--primary-color);
    color: white;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.2;
}

.stat-label {
    color: var(--text-gray);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
}

.stat-trend {
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    margin-top: 5px;
}

.stat-trend.positive {
    color: var(--success-color);
}

.stat-trend.negative {
    color: var(--danger-color);
}

/* Tables */
.table {
    border-collapse: separate;
    border-spacing: 0 0;
}

.table thead th {
    border-bottom: 1px solid #E9EDF7;
    color: var(--text-gray);
    font-weight: 500;
    font-size: 14px;
    padding: 15px 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr {
    background-color: transparent;
    box-shadow: none;
    border-bottom: 1px solid #E9EDF7;
    transition: background 0.2s;
}

.table tbody tr:hover {
    background-color: #F9FAFC;
}

.table tbody td {
    border-bottom: 1px solid #F4F7FE;
    padding: 20px;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 14px;
    vertical-align: middle;
}

.table tbody td:first-child {
    border-radius: 0;
}

.table tbody td:last-child {
    border-radius: 0;
}


/* ============================================
   AVATAR STYLES
   ============================================ */

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366f1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color) 0%, #5a2fff 100%);
    color: white;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 12px;
    transition: all 0.2s ease;

    box-shadow: 0 4px 12px rgba(67, 24, 255, 0.3);
}

.mobile-menu-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(67, 24, 255, 0.4);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-menu-toggle i {
    font-size: 1.25rem;
}

/* Tablet & Mobile */
@media (max-width: 992px) {
    :root {
        --sidebar-width: 280px;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    #sidebar {
        margin-right: calc(-1 * var(--sidebar-width));
        width: var(--sidebar-width);
    }

    #sidebar.active {
        margin-right: 0;
    }

    #sidebar.collapsed {
        width: var(--sidebar-width);
        margin-right: calc(-1 * var(--sidebar-width));
    }

    .main-content {
        margin-right: 0;
    }

    .main-content.expanded {
        margin-right: 0;
    }

    .navbar {
        margin-right: 0;
    }

    .navbar.expanded {
        margin-right: 0;
    }
}

/* Mobile */
@media (max-width: 768px) {
    #sidebar {
        width: var(--sidebar-width);
        margin-right: calc(-1 * var(--sidebar-width));
    }

    #sidebar.active {
        margin-right: 0;
    }

    #sidebar.collapsed {
        width: var(--sidebar-width);
        margin-right: calc(-1 * var(--sidebar-width));
    }

    .sidebar-toggle {
        width: 36px;
        height: 36px;
    }

    /* Prevent mobile cutoff at bottom edge */
    #sidebar .sidebar-footer {
        padding-bottom: env(safe-area-inset-bottom, 30px);
    }

    .main-content {
        margin-right: 0;
        padding: 15px;
    }

    .main-content.expanded {
        margin-right: 0;
    }

    .navbar {
        margin-right: 0;
    }

    .navbar.expanded {
        margin-right: 0;
    }

    /* Overlay for mobile */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    :root {
        --sidebar-width: 100%;
    }

    #sidebar {
        width: 100%;
        margin-right: -100%;
    }

    #sidebar.active {
        margin-right: 0;
    }

    .sidebar-toggle {
        width: 36px;
        height: 36px;
    }
}