* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --danger-color: #ef4444;
    --dark-bg: #1e293b;
    --dark-sidebar: #0f172a;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    --gradient-warning: linear-gradient(135deg, #fbc2eb 0%, #a6c1ee 100%);
    --gradient-info: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

body {
    font-family: 'Segoe UI', 'Cairo', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    direction: rtl;
    color: var(--text-primary);
    min-height: 100vh;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: var(--primary-color);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 10px;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.mobile-menu-toggle:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* Sidebar */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--dark-sidebar);
    color: white;
    z-index: 1000;
    box-shadow: var(--shadow-xl);
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 2rem;
    color: var(--primary-light);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-close {
    display: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 25px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    border-right: 4px solid transparent;
    margin: 5px 0;
    position: relative;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    flex-wrap: nowrap;
}

.nav-item::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1));
    transition: width 0.3s ease;
}

.nav-item:hover::before {
    width: 100%;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border-right-color: var(--primary-light);
    transform: translateX(-5px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), transparent);
    color: white;
    border-right-color: var(--primary-color);
    box-shadow: inset 0 0 20px rgba(99, 102, 241, 0.1);
}

.nav-icon-wrapper {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.nav-item.active .nav-icon-wrapper {
    background: var(--primary-color);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item span {
    font-weight: 500;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.badge-notification {
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    margin-right: auto;
    flex-shrink: 0;
    min-width: 20px;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 15px 0;
}

/* Main Content */
.main-content {
    margin-right: 280px;
    min-height: 100vh;
    transition: margin-right 0.3s ease;
}

.top-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 25px 40px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-search {
    position: relative;
    min-width: 250px;
}

.header-search i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    z-index: 1;
}

.header-search input {
    padding-right: 40px;
    border-radius: 25px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.header-search input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.header-icon-btn {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    border: none;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.header-icon-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.notification-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    border: 2px solid white;
}

.notification-menu {
    min-width: 350px;
    max-height: 400px;
    overflow-y: auto;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    border: none;
    padding: 10px;
}

.notification-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-radius: 10px;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.notification-item:hover {
    background: rgba(99, 102, 241, 0.05);
}

.notification-icon {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-content strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.notification-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.notification-content small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.notification-list {
    max-height: 600px;
    overflow-y: auto;
}

.notification-item-full {
    display: flex;
    gap: 15px;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.notification-item-full:hover {
    background: rgba(99, 102, 241, 0.05);
}

.notification-item-full.unread {
    background: rgba(99, 102, 241, 0.08);
    border-right: 4px solid var(--primary-color);
}

.notification-content-full {
    flex: 1;
}

.user-menu {
    min-width: 200px;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    border: none;
    padding: 10px;
}

.user-menu .dropdown-item {
    padding: 12px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-menu .dropdown-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.user-menu .dropdown-item i {
    width: 20px;
}

.page-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.75rem;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: 12px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-badge:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.user-badge i {
    font-size: 1.5rem;
}

.user-badge .dropdown-toggle::after {
    display: none;
}

.content-area {
    padding: 0 40px 40px;
}

.page-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stat Cards */
.stat-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 35px;
    display: flex;
    align-items: center;
    gap: 25px;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    min-height: 150px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

/* Force 2 cards per row on large screens */
.stats-row {
    display: flex !important;
    flex-wrap: wrap !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.stats-row > [class*="col-"] {
    display: flex !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    margin-bottom: 1rem;
}

.stats-row > [class*="col-"] > .stat-card {
    width: 100%;
}

/* Override Bootstrap grid for stats cards */
.stats-row > .col-lg-6,
.stats-row > .col-md-6 {
    flex: 0 0 auto !important;
    width: calc(50% - 0.75rem) !important;
    max-width: calc(50% - 0.75rem) !important;
}

.stats-row > .col-sm-12 {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Large screens - 2 cards per row */
@media (min-width: 992px) {
    .stats-row > .col-lg-6 {
        width: calc(50% - 0.75rem) !important;
        max-width: calc(50% - 0.75rem) !important;
    }
}

/* Medium screens - 2 cards per row */
@media (min-width: 768px) and (max-width: 991px) {
    .stats-row > .col-md-6 {
        width: calc(50% - 0.75rem) !important;
        max-width: calc(50% - 0.75rem) !important;
    }
}

/* Small screens - 1 card per row */
@media (max-width: 767px) {
    .stats-row > .col-sm-12 {
        width: 100% !important;
        max-width: 100% !important;
    }
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    opacity: 0.1;
    transform: translate(30%, -30%);
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.stat-card-primary::before {
    background: var(--primary-color);
}

.stat-card-success::before {
    background: var(--success-color);
}

.stat-card-warning::before {
    background: var(--warning-color);
}

.stat-card-info::before {
    background: var(--info-color);
}

.stat-icon-wrapper {
    flex-shrink: 0;
    min-width: 70px;
}

.stat-icon {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8rem;
    box-shadow: var(--shadow-md);
}

.stat-card-primary .stat-icon {
    background: var(--gradient-primary);
}

.stat-card-success .stat-icon {
    background: var(--gradient-success);
}

.stat-card-warning .stat-icon {
    background: var(--gradient-warning);
}

.stat-card-info .stat-icon {
    background: var(--gradient-info);
}

.stat-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--success-color);
    font-size: 0.85rem;
    font-weight: 600;
    flex-wrap: wrap;
    margin-top: 8px;
}

.stat-trend i {
    font-size: 0.9rem;
    flex-shrink: 0;
}

.stat-trend span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chart Cards */
.chart-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    height: 100%;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.chart-card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-5px);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.chart-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.25rem;
    margin: 0;
}

.chart-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    padding: 10px;
    border-radius: 10px;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-container canvas {
    max-height: 300px !important;
}

/* Tables */
.card {
    border: none;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.card-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
    border-bottom: 2px solid var(--border-color);
    padding: 25px 30px;
}

.card-header h5 {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.3rem;
}

@media (max-width: 992px) {
    .card-header {
        padding: 20px 25px;
    }
    
    .card-header h5 {
        font-size: 1.2rem;
    }
}

.table {
    margin-bottom: 0;
    width: 100%;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-bottom: 2px solid var(--border-color);
    font-weight: 700;
    color: var(--text-primary);
    padding: 18px;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody td {
    padding: 18px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    word-wrap: break-word;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 992px) {
    .table thead th {
        padding: 15px 12px;
        font-size: 0.8rem;
        position: relative;
    }
    
    .table tbody td {
        padding: 15px 12px;
        font-size: 0.85rem;
        max-width: 150px;
    }
    
    .table-responsive {
        border: 1px solid var(--border-color);
        border-radius: 10px;
        overflow: hidden;
    }
}

.table-hover tbody tr {
    transition: all 0.2s ease;
}

.table-hover tbody tr:hover {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.05), transparent);
}

@media (hover: hover) {
    .table-hover tbody tr:hover {
        transform: scale(1.01);
    }
}

/* Badges */
.badge {
    padding: 8px 16px;
    font-weight: 600;
    border-radius: 8px;
    font-size: 0.85rem;
}

.status-completed {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.status-pending {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.status-cancelled {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.status-active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.status-inactive {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
}

/* Buttons */
.btn {
    border-radius: 10px;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, var(--success-color));
}

@media (max-width: 768px) {
    .btn {
        font-size: 0.9rem;
        padding: 9px 18px;
    }
    
    .btn-sm {
        font-size: 0.85rem;
        padding: 7px 14px;
    }
}

@media (max-width: 576px) {
    .btn {
        font-size: 0.85rem;
        padding: 8px 16px;
    }
    
    .btn-sm {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .btn i {
        font-size: 0.9em;
    }
}

/* Additional responsive utilities */
.w-md-auto {
    width: auto;
}

@media (max-width: 768px) {
    .w-md-auto {
        width: 100%;
    }
}

/* Gap utilities for better spacing */
.g-3 {
    gap: 1rem;
}

@media (max-width: 768px) {
    .g-3 {
        gap: 0.75rem;
    }
}

/* Table responsive improvements */
@media (max-width: 992px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 800px;
    }
}

@media (max-width: 768px) {
    .table {
        min-width: 700px;
    }
}

@media (max-width: 576px) {
    .table {
        min-width: 600px;
    }
}

/* Card body padding responsive */
.card-body {
    padding: 25px 30px;
}

@media (max-width: 992px) {
    .card-body {
        padding: 20px 25px;
    }
}

@media (max-width: 768px) {
    .card-body {
        padding: 18px 20px;
    }
}

@media (max-width: 576px) {
    .card-body {
        padding: 15px;
    }
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-outline-danger {
    border: 2px solid var(--danger-color);
    color: var(--danger-color);
    background: transparent;
}

.btn-outline-danger:hover {
    background: var(--danger-color);
    color: white;
}

/* Form Controls */
.form-control,
.form-select {
    border-radius: 10px;
    border: 2px solid var(--border-color);
    padding: 12px 18px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    width: 100%;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    outline: none;
}

@media (max-width: 768px) {
    .form-control,
    .form-select {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Responsive Design - Comprehensive */

/* Extra Extra Large Screens (1600px and above) */
@media (min-width: 1600px) {
    .sidebar {
        width: 320px;
    }
    
    .main-content {
        margin-right: 320px;
    }
    
    .content-area {
        padding: 0 60px 60px;
    }
    
    .stat-card {
        padding: 40px;
        min-height: 160px;
    }
    
    .stat-value {
        font-size: 2.8rem;
    }
    
    .chart-container {
        height: 350px;
    }
    
    .chart-container canvas {
        max-height: 350px !important;
    }
}

/* Extra Large Screens (1400px - 1599px) */
@media (min-width: 1400px) and (max-width: 1599px) {
    .sidebar {
        width: 300px;
    }
    
    .main-content {
        margin-right: 300px;
    }
    
    .content-area {
        padding: 0 50px 50px;
    }
    
    .stat-card {
        padding: 35px;
        min-height: 150px;
    }
    
    .stat-value {
        font-size: 2.5rem;
    }
    
    .chart-container {
        height: 320px;
    }
    
    .chart-container canvas {
        max-height: 320px !important;
    }
}

/* Large Screens (1200px - 1399px) */
@media (min-width: 1200px) and (max-width: 1399px) {
    .content-area {
        padding: 0 40px 40px;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .chart-container {
        height: 300px;
    }
    
    .chart-container canvas {
        max-height: 300px !important;
    }
}

/* Medium Large Screens (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .content-area {
        padding: 0 30px 30px;
    }
    
    .stat-value {
        font-size: 1.9rem;
    }
    
    .stat-card {
        padding: 28px;
        min-height: 140px;
    }
    
    .chart-container {
        height: 280px;
    }
    
    .chart-container canvas {
        max-height: 280px !important;
    }
    
    .card-header {
        padding: 20px 25px;
    }
    
    .card-body {
        padding: 20px 25px;
    }
}

@media (max-width: 992px) {
    .main-content {
        margin-right: 0;
    }

    .sidebar {
        transform: translateX(100%);
        width: 280px;
    }

    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar-overlay.active {
        display: block;
    }

    .mobile-menu-toggle {
        display: flex;
    }
    
    .header-search {
        order: 3;
        width: 100%;
        margin-top: 10px;
    }

    .sidebar-close {
        display: block;
    }

    .content-area {
        padding: 0 20px 20px;
    }

    .top-header {
        padding: 20px 25px;
    }

    .stat-card {
        flex-direction: row;
        text-align: right;
        padding: 25px;
        min-height: 120px;
    }

    .stat-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        flex-shrink: 0;
    }

    .stat-value {
        font-size: 1.8rem;
    }
    
    .stat-info {
        flex: 1;
        min-width: 0;
    }
    
    .nav-item {
        padding: 14px 20px;
    }
    
    .nav-item span {
        font-size: 0.95rem;
    }
}

@media (max-width: 768px) {
    .top-header {
        padding: 15px 20px;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .user-badge {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .user-badge span {
        display: none;
    }

    .content-area {
        padding: 0 15px 15px;
    }

    .stat-card {
        padding: 20px;
        flex-direction: row;
        text-align: right;
        min-height: 110px;
        gap: 15px;
    }
    
    .stat-icon-wrapper {
        min-width: 55px;
    }

    .stat-icon {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }

    .stat-value {
        font-size: 1.6rem;
    }
    
    .stat-label {
        font-size: 0.85rem;
    }
    
    .stat-trend {
        font-size: 0.8rem;
    }

    .chart-card {
        padding: 20px;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .chart-title {
        font-size: 1.1rem;
    }

    .chart-container {
        height: 250px;
    }

    .chart-container canvas {
        max-height: 250px !important;
    }

    .card-header {
        padding: 20px;
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .card-header h5 {
        font-size: 1.1rem;
    }
    
    .card-header .d-flex {
        width: 100%;
    }
    
    .card-header input,
    .card-header select,
    .card-header .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .card-header .btn:last-child {
        margin-bottom: 0;
    }

    .table {
        font-size: 0.85rem;
    }

    .table thead th,
    .table tbody td {
        padding: 10px 6px;
        font-size: 0.85rem;
    }
    
    .table thead th {
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .table-responsive {
        border: 1px solid var(--border-color);
        border-radius: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
        width: 100%;
    }
    
    .table-responsive .table {
        margin-bottom: 0;
        width: 100%;
        min-width: 600px;
    }
    
    .btn-sm {
        padding: 5px 8px;
        font-size: 0.8rem;
    }
    
    .btn-sm i {
        font-size: 0.9rem;
    }
    
    .pagination-info {
        font-size: 0.85rem;
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }
    
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .page-link {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    /* Settings Page */
    .settings-card {
        margin-bottom: 20px;
    }
    
    .form-label {
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .sidebar {
        width: 100%;
    }
    
    .sidebar-header {
        padding: 20px 15px;
    }
    
    .sidebar-header h3 {
        font-size: 1.3rem;
    }
    
    .nav-item {
        padding: 14px 20px;
    }
    
    .nav-item span {
        font-size: 0.95rem;
    }

    .top-header {
        padding: 12px 15px;
    }
    
    .page-title {
        font-size: 1.3rem;
    }
    
    .user-badge {
        padding: 6px 12px;
    }
    
    .user-badge i {
        font-size: 1.2rem;
    }

    .content-area {
        padding: 0 10px 10px;
    }

    .stat-card {
        padding: 18px;
        margin-bottom: 15px;
        flex-direction: row;
        text-align: right;
        min-height: 100px;
        gap: 12px;
    }
    
    .stat-icon-wrapper {
        min-width: 50px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .stat-value {
        font-size: 1.4rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .stat-trend {
        font-size: 0.75rem;
    }
    
    .stat-trend span {
        display: inline;
    }

    .chart-card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .chart-title {
        font-size: 1rem;
    }
    
    .chart-icon {
        font-size: 1.2rem;
        padding: 8px;
    }

    .chart-container {
        height: 200px;
    }

    .chart-container canvas {
        max-height: 200px !important;
    }
    
    .card {
        border-radius: 15px;
    }
    
    .card-header {
        padding: 15px;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
    
    .card-body {
        padding: 15px;
    }

    .table {
        font-size: 0.75rem;
    }
    
    .table thead th {
        font-size: 0.7rem;
        padding: 8px 4px;
    }
    
    .table tbody td {
        padding: 8px 4px;
        font-size: 0.75rem;
    }
    
    /* Hide some columns on very small screens */
    .table thead th:nth-child(4),
    .table tbody td:nth-child(4) {
        display: none;
    }
    
    /* For orders table - hide more columns */
    #ordersTable thead th:nth-child(5),
    #ordersTable tbody td:nth-child(5),
    #ordersTable thead th:nth-child(6),
    #ordersTable tbody td:nth-child(6) {
        display: none;
    }

    .btn-sm {
        padding: 5px 8px;
        font-size: 0.75rem;
    }
    
    .btn-sm i {
        font-size: 0.85rem;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .form-control,
    .form-select {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .pagination-info {
        font-size: 0.8rem;
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }
    
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
        gap: 3px;
    }
    
    .page-item {
        margin: 0 1px;
    }
    
    .page-link {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    /* Settings Page */
    .settings-card .card-body {
        padding: 15px;
    }
    
    .form-label {
        font-size: 0.85rem;
    }
    
    .form-check-label {
        font-size: 0.85rem;
    }
}

/* Extra small devices (less than 400px) */
@media (max-width: 400px) {
    .mobile-menu-toggle {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .stat-value {
        font-size: 1.3rem;
    }
    
    .chart-container {
        height: 180px;
    }
    
    .chart-container canvas {
        max-height: 180px !important;
    }
    
    .table {
        font-size: 0.7rem;
    }
    
    .page-link {
        padding: 5px 8px;
        font-size: 0.75rem;
    }
    
    /* Hide more columns */
    .table thead th:nth-child(3),
    .table tbody td:nth-child(3) {
        display: none;
    }
}

/* Landscape orientation for tablets */
@media (max-width: 1024px) and (orientation: landscape) {
    .stat-card {
        min-height: 100px;
        padding: 20px;
    }
    
    .stat-value {
        font-size: 1.7rem;
    }
    
    .chart-container {
        height: 220px;
    }
    
    .chart-container canvas {
        max-height: 220px !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .page-link,
    .nav-item {
        min-height: 44px;
        min-width: 44px;
    }
    
    .btn-sm {
        min-height: 36px;
        min-width: 36px;
    }
    
    .header-icon-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .table tbody td {
        padding: 12px 8px;
    }
    
    .card-header input,
    .card-header select,
    .card-header .btn {
        min-height: 44px;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .mobile-menu-toggle,
    .top-header,
    .btn,
    .pagination {
        display: none !important;
    }
    
    .main-content {
        margin-right: 0 !important;
    }
    
    .page-content {
        display: block !important;
    }
    
    .card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .stat-icon,
    .chart-icon,
    .nav-item i {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Header responsive improvements */
@media (max-width: 992px) {
    .header-search {
        order: 3;
        width: 100%;
        margin-top: 10px;
    }
    
    .top-header .d-flex {
        flex-wrap: wrap;
    }
    
    .header-actions {
        order: 2;
    }
}

@media (max-width: 768px) {
    .header-search {
        min-width: 100%;
    }
    
    .header-search input {
        width: 100%;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .header-icon-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .user-badge {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
}

/* Table responsive improvements */
@media (max-width: 992px) {
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        border: 1px solid var(--border-color);
        border-radius: 10px;
    }
}

/* Chart responsive improvements */
@media (max-width: 768px) {
    .chart-card {
        margin-bottom: 20px;
    }
    
    .chart-header {
        margin-bottom: 15px;
        padding-bottom: 15px;
    }
}

/* Notification menu responsive */
@media (max-width: 576px) {
    .notification-menu {
        min-width: calc(100vw - 40px) !important;
        max-width: calc(100vw - 40px) !important;
        right: 20px !important;
        left: 20px !important;
    }
    
    .user-menu {
        min-width: calc(100vw - 40px) !important;
        right: 20px !important;
        left: 20px !important;
    }
}

/* Sidebar responsive improvements */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@media (max-width: 992px) {
    .sidebar {
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.active {
        box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
    }
}

/* Stats row responsive */
@media (max-width: 576px) {
    .stats-row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }
    
    .stats-row > [class*="col-"] {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Profile page responsive */
@media (max-width: 768px) {
    .profile-avatar {
        width: 100px;
        height: 100px;
        font-size: 3rem;
    }
}

/* Analytics page responsive */
@media (max-width: 768px) {
    .analytics-metric {
        padding: 20px;
        margin-bottom: 15px;
    }
    
    .analytics-metric i {
        font-size: 2rem;
    }
    
    .analytics-metric h4 {
        font-size: 1.6rem;
    }
}

/* Help page responsive */
@media (max-width: 768px) {
    .accordion-button {
        font-size: 0.9rem;
        padding: 12px 15px;
    }
    
    .accordion-body {
        font-size: 0.85rem;
        padding: 15px;
    }
}

/* Settings page responsive */
@media (max-width: 576px) {
    .system-info-item {
        flex-direction: column;
        align-items: flex-start;
        text-align: right;
    }
}

/* Products page responsive */
@media (max-width: 768px) {
    .product-image-placeholder {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Pagination */
.pagination {
    gap: 5px;
    display: flex;
    flex-wrap: wrap;
}

.page-item {
    margin: 0 2px;
}

.page-link {
    color: var(--primary-color);
    background-color: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
    min-width: 40px;
    text-align: center;
}

.page-link:hover:not(.disabled) {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.page-item.disabled .page-link {
    color: #9ca3af;
    background-color: #f3f4f6;
    border-color: #e5e7eb;
    cursor: not-allowed;
    opacity: 0.6;
}

.page-item.disabled .page-link:hover {
    transform: none;
    box-shadow: none;
}

.pagination-info {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 0;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .pagination-info {
        white-space: normal;
    }
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Profile Page */
.profile-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: white;
    box-shadow: var(--shadow-lg);
}

/* Analytics Metrics */
.analytics-metric {
    text-align: center;
    padding: 25px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
    border-radius: 15px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.analytics-metric:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.analytics-metric i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.analytics-metric h4 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 10px 0;
}

.analytics-metric p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

/* Dark Mode */
body.dark-mode {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #e2e8f0;
}

body.dark-mode .top-header {
    background: rgba(30, 41, 59, 0.95);
    border-bottom-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

body.dark-mode .page-title {
    color: #e2e8f0 !important;
}

body.dark-mode .card,
body.dark-mode .stat-card,
body.dark-mode .chart-card {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

body.dark-mode .card-header {
    background: rgba(15, 23, 42, 0.5) !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0 !important;
}

body.dark-mode .card-header h5,
body.dark-mode .card-header h6 {
    color: #e2e8f0 !important;
}

body.dark-mode .stat-label {
    color: #94a3b8 !important;
}

body.dark-mode .stat-value {
    color: #ffffff !important;
}

body.dark-mode .stat-trend {
    color: #10b981 !important;
}

body.dark-mode .stat-trend span {
    color: #10b981 !important;
}

body.dark-mode .chart-title {
    color: #e2e8f0 !important;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

body.dark-mode .form-control::placeholder,
body.dark-mode .form-select::placeholder {
    color: #64748b !important;
}

body.dark-mode .form-label {
    color: #cbd5e1 !important;
}

body.dark-mode .table {
    color: #e2e8f0;
    background: #1e293b !important;
}

body.dark-mode .table thead th {
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0 !important;
}

body.dark-mode .table tbody {
    background: #1e293b !important;
}

body.dark-mode .table tbody td {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0 !important;
}

body.dark-mode .table tbody td strong {
    color: #ffffff !important;
}

body.dark-mode .table-hover tbody tr:hover {
    background: rgba(99, 102, 241, 0.15) !important;
}

body.dark-mode .table tbody tr {
    background: #1e293b !important;
}

body.dark-mode .text-muted {
    color: #94a3b8 !important;
}

body.dark-mode .pagination-info {
    color: #94a3b8 !important;
}

body.dark-mode .page-link {
    background-color: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0 !important;
}

body.dark-mode .page-link:hover {
    background-color: #6366f1 !important;
    color: white !important;
    border-color: #6366f1 !important;
}

body.dark-mode .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}

body.dark-mode .page-item.disabled .page-link {
    background-color: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #64748b !important;
}

body.dark-mode .badge {
    color: white !important;
}

body.dark-mode .btn-outline-primary {
    border-color: #6366f1 !important;
    color: #6366f1 !important;
}

body.dark-mode .btn-outline-primary:hover {
    background-color: #6366f1 !important;
    color: white !important;
}

body.dark-mode .btn-outline-danger {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}

body.dark-mode .btn-outline-danger:hover {
    background-color: #ef4444 !important;
    color: white !important;
}

body.dark-mode .dropdown-menu {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode .dropdown-item {
    color: #e2e8f0 !important;
}

body.dark-mode .dropdown-item:hover {
    background: rgba(99, 102, 241, 0.2) !important;
    color: #ffffff !important;
}

body.dark-mode .dropdown-header {
    color: #94a3b8 !important;
}

body.dark-mode .notification-content strong {
    color: #ffffff !important;
}

body.dark-mode .notification-content p {
    color: #cbd5e1 !important;
}

body.dark-mode .notification-content small {
    color: #94a3b8 !important;
}

body.dark-mode .system-info-item {
    background: rgba(15, 23, 42, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode .system-info-item strong {
    color: #e2e8f0 !important;
}

body.dark-mode .system-info-item span {
    color: #cbd5e1 !important;
}

body.dark-mode .accordion-item {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode .accordion-button {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}

body.dark-mode .accordion-button:not(.collapsed) {
    background: rgba(15, 23, 42, 0.5) !important;
    color: #ffffff !important;
}

body.dark-mode .accordion-body {
    background: #1e293b !important;
    color: #cbd5e1 !important;
}

body.dark-mode .product-image-placeholder {
    background: rgba(99, 102, 241, 0.2) !important;
    color: #818cf8 !important;
}

/* Analytics Page Dark Mode */
body.dark-mode .analytics-metric {
    background: rgba(15, 23, 42, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode .analytics-metric i {
    color: #818cf8 !important;
}

body.dark-mode .analytics-metric h4 {
    color: #ffffff !important;
}

body.dark-mode .analytics-metric p {
    color: #94a3b8 !important;
}

/* Card body dark mode */
body.dark-mode .card-body {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}

body.dark-mode .card-body p,
body.dark-mode .card-body strong {
    color: #e2e8f0 !important;
}

body.dark-mode .card-body a {
    color: #818cf8 !important;
}

body.dark-mode .card-body a:hover {
    color: #a5b4fc !important;
}

/* Product Image Placeholder */
.product-image-placeholder {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.5rem;
}

@media (max-width: 768px) {
    .header-search {
        min-width: 200px;
    }
    
    .notification-menu {
        min-width: 300px;
    }
}

@media (max-width: 576px) {
    .header-search {
        min-width: 150px;
    }
    
    .header-search input {
        font-size: 0.85rem;
        padding: 8px 35px 8px 12px;
    }
    
    .notification-menu {
        min-width: 280px;
        max-height: 350px;
    }
    
    .user-menu {
        min-width: 180px;
    }
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
