/* ========================================
   نظام جرد قطع الغيار - Jard Tesla Alkhlij
   Blazor Theme - Modern & Clean RTL
   ======================================== */

/* ===== CSS Variables (الألوان الرئيسية) ===== */
:root {
    /* Primary Colors - أزرق داكن احترافي */
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    
    /* Secondary Colors - أخضر للنجاح */
    --success-color: #10b981;
    --success-dark: #059669;
    
    /* Accent Colors */
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    
    /* Neutral Colors */
    --dark-color: #1e293b;
    --gray-800: #334155;
    --gray-600: #64748b;
    --gray-400: #94a3b8;
    --gray-300: #cbd5e1;
    --gray-200: #e2e8f0;
    --gray-100: #f1f5f9;
    --gray-50: #f8fafc;
    --light-color: #f8fafc;
    --white: #ffffff;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    
    /* Sidebar */
    --sidebar-width: 260px;
}

/* ===== Global Styles ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Remove resize handles and focus outlines globally */
*:focus {
    outline: none;
}

textarea, div, section {
    resize: none;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--gray-100);
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
    direction: rtl;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== Admin Layout ===== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: var(--white);
    position: fixed;
    height: 100vh;
    right: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-header i {
    font-size: 2rem;
    color: var(--primary-light);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    margin: 0;
    color: var(--white);
}

.sidebar-header p {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin: 0;
}

.sidebar-close {
    display: none;
    margin-right: auto;
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
}

.sidebar-menu li a,
.sidebar-menu .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: var(--gray-400);
    text-decoration: none;
    transition: all 0.2s ease;
    border-right: 3px solid transparent;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active,
.sidebar-menu .nav-link:hover,
.sidebar-menu .nav-link.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    border-right-color: var(--primary-color);
    text-decoration: none;
}

.sidebar-menu li a i,
.sidebar-menu .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1.125rem;
}

/* Disabled Links & Coming Soon Badge */
.sidebar-menu .nav-link.disabled-link {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.coming-soon-badge {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-right: auto;
    margin-left: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.sidebar-menu .menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.75rem 1.5rem;
}

.admin-main {
    flex: 1;
    margin-right: var(--sidebar-width);
    background: var(--gray-100);
    min-height: 100vh;
}

.admin-header {
    background: var(--white);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header h1 {
    font-size: 1.25rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-content {
    padding: 1.5rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark-color);
}

/* ===== Login Page ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 1rem;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo i {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: block;
}

.login-logo h1 {
    color: var(--dark-color);
    font-size: 1.5rem;
}

.login-logo p {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* ===== Form Styles ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    background-color: var(--white);
    color: var(--dark-color);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.form-control-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.input-group {
    position: relative;
}

.input-group .form-control {
    padding-right: 3rem;
}

.input-group-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--success-dark) 100%);
    color: var(--white);
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--success-dark) 0%, var(--success-color) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn-warning {
    background: var(--warning-color);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary-color);
    color: var(--white);
}

.btn-outline-secondary {
    background: transparent;
    border: 2px solid var(--gray-300);
    color: var(--gray-600);
}

.btn-outline-secondary:hover:not(:disabled) {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-icon {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background 0.2s ease;
    color: var(--gray-600);
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--dark-color);
}

/* ===== Cards ===== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: none;
    overflow: visible; /* Changed from hidden to show dashed borders properly */
    resize: none; /* Prevent resize handles */
}

.card-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
}

.card-header > i:last-child {
    margin-right: auto; /* Push chevron to the left in RTL */
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* ===== Stats Cards ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-card .stat-icon.primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.stat-card .stat-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-card .stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-card .stat-icon.info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
}

.stat-card .stat-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.stat-card .stat-info {
    flex: 1;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-color);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* ===== Tables ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.875rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.875rem;
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== DataTable Toolbar ===== */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    flex-wrap: wrap;
    gap: 1rem;
}

.toolbar-start {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Delete All Button */
.delete-all-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

.delete-all-btn .spinner-border-sm {
    width: 0.875rem;
    height: 0.875rem;
}

/* Export Dropdown */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

.export-btn .spinner-border-sm {
    width: 0.875rem;
    height: 0.875rem;
}

.export-btn .bi-chevron-down {
    margin-right: 0.25rem;
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.export-dropdown.open .export-btn .bi-chevron-down {
    transform: rotate(180deg);
}

.export-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}

.export-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    text-align: right;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s;
}

.export-option:hover {
    background: var(--bg-secondary);
}

.export-option i {
    color: var(--success);
}

.toolbar-end {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.table-toolbar .search-box {
    min-width: 250px;
}

.table-toolbar .search-box .btn-clear {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
}

.table-toolbar .search-box .btn-clear:hover {
    color: var(--gray-600);
}

.page-size-select {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-size-select .form-select {
    width: auto;
    padding: 0.375rem 2rem 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.items-info {
    color: var(--gray-600);
    font-size: 0.875rem;
    white-space: nowrap;
}

/* ===== Sort Button ===== */
.sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: none;
    border: none;
    font-weight: 600;
    color: var(--gray-800);
    cursor: pointer;
    padding: 0;
    font-size: inherit;
    white-space: nowrap;
}

.sort-btn:hover {
    color: var(--primary-color);
}

.sort-btn i {
    font-size: 0.75rem;
}

.sort-icon-inactive {
    opacity: 0.3;
}

/* ===== Empty State in Table ===== */
.data-table .empty-state {
    text-align: center;
    padding: 3rem 1rem !important;
    color: var(--gray-500);
}

.data-table .empty-state i {
    font-size: 3rem;
    opacity: 0.5;
    margin-bottom: 1rem;
    display: block;
}

.data-table .empty-state p {
    margin: 0;
}

.data-table .empty-state .spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

/* ===== Import Section ===== */
.import-info-box {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.import-info-box .info-icon {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.import-info-box .info-content h4 {
    margin: 0 0 0.75rem 0;
    color: var(--gray-800);
    font-size: 1rem;
}

.import-info-box .info-content ol {
    margin: 0;
    padding-right: 1.25rem;
    color: var(--gray-600);
    font-size: 0.9rem;
    line-height: 1.8;
}

.import-info-box .info-content ol li {
    margin-bottom: 0.25rem;
}

.import-info-box kbd {
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.8rem;
    font-family: monospace;
}

/* Simple Import Hint */
.import-hint {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.import-hint i {
    color: var(--primary-color);
    font-size: 1rem;
}

.import-hint strong {
    color: var(--gray-800);
}

.import-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.paste-area {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    transition: all 0.3s ease;
    line-height: 1.6;
}

.paste-area:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.paste-area::placeholder {
    color: var(--gray-500);
    line-height: 1.8;
}

.preview-section {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: 1rem;
    border: 1px solid var(--gray-200);
}

.preview-section h4 {
    color: var(--gray-800);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== Table Pagination ===== */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 1rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    color: var(--gray-700);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled):not(.active) {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.pagination-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-color: transparent;
    color: white;
    font-weight: 600;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 0 0.5rem;
    color: var(--gray-500);
}

/* ===== Action Bar ===== */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* ===== Toggle Switch ===== */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--gray-300);
    border-radius: 26px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--success-color) 0%, #16a34a 100%);
}

.toggle-input:checked + .toggle-slider::before {
    right: calc(100% - 23px);
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--gray-700);
}

/* ===== Modal ===== */
/* Modal Backdrop - Blazor Style */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Legacy Modal Overlay Style */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 1rem;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-400);
    line-height: 1;
}

.modal-close:hover {
    color: var(--dark-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ===== Alerts ===== */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-dark);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    color: #0e7490;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.badge-primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.badge-info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
}

.empty-state h3 {
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--gray-400);
    margin: 0;
}

/* ===== Filter Bar ===== */
.filter-bar {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-bottom: 0.25rem;
}

/* ===== User Menu ===== */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.user-info {
    text-align: right;
}

.user-info .user-name {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.875rem;
}

.user-info .user-role {
    font-size: 0.75rem;
    color: var(--gray-600);
}

/* ===== Sidebar Overlay (Mobile) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* ===== Loading Spinner ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        right: -100%;
        width: 280px;
        transition: right 0.3s ease;
    }
    
    .admin-sidebar.active {
        right: 0;
    }
    
    .admin-main {
        margin-right: 0 !important;
        width: 100%;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .admin-header {
        padding: 0.75rem 1rem;
    }
    
    .admin-header h1 {
        font-size: 1rem;
    }
    
    .admin-content {
        padding: 1rem;
    }
    
    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .data-table th,
    .data-table td {
        padding: 0.625rem 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Table Toolbar Mobile */
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .toolbar-start,
    .toolbar-end {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .toolbar-start {
        flex-direction: column;
    }
    
    .table-toolbar .search-box {
        min-width: 100%;
        width: 100%;
    }
    
    .delete-all-btn,
    .export-btn {
        width: 100%;
        justify-content: center;
    }
    
    .items-info {
        display: none;
    }
    
    .page-size-select {
        width: 100%;
        justify-content: center;
    }
    
    /* Pagination Mobile */
    .table-pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .pagination-btn {
        min-width: 32px;
        height: 32px;
        font-size: 0.8125rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .hide-mobile {
        display: none !important;
    }
    
    .sidebar-close {
        display: block !important;
    }
    
    .login-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-lg {
        padding: 0.875rem 1.5rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
}

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-muted { color: var(--gray-600); }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.my-3 { margin-top: 1rem; margin-bottom: 1rem; }
.my-4 { margin-top: 1.5rem; margin-bottom: 1.5rem; }

.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }

.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* ===== Blazor Specific ===== */
#blazor-error-ui {
    background: var(--danger-color);
    color: var(--white);
    padding: 1rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: none;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.valid.modified:not([type=checkbox]) {
    border-color: var(--success-color);
}

.invalid {
    border-color: var(--danger-color);
}

.validation-message {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Remove Blazor default nav styles override */
.nav-link {
    color: inherit;
}

/* ========================================
   Shared Components Styles
   (مشترك بين جميع الصفحات)
   ======================================== */

/* ===== Data Table Code Style ===== */
.data-table code {
    background: var(--gray-200);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
}

/* ===== Action Buttons ===== */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary-light {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.btn-primary-light:hover {
    background: rgba(37, 99, 235, 0.2);
}

.btn-danger-light {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.btn-danger-light:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-success-light {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.btn-success-light:hover {
    background: rgba(16, 185, 129, 0.2);
}

.btn-warning-light {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.btn-warning-light:hover {
    background: rgba(245, 158, 11, 0.2);
}

/* ===== Toggle Switch ===== */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--gray-200);
    border-radius: 13px;
    transition: all 200ms ease;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    background: var(--white);
    border-radius: 50%;
    transition: all 200ms ease;
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--success-dark) 100%);
}

.toggle-switch input:checked + .toggle-slider::after {
    right: calc(100% - 23px);
}

.toggle-label {
    font-weight: 500;
    color: var(--gray-800);
}

/* ===== Import Section ===== */
.import-info-box {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #93c5fd;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    animation: fadeIn 0.3s ease;
}

.info-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.info-content h4 {
    color: #1e40af;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
}

.info-content ol {
    margin: 0;
    padding-right: 1.25rem;
    color: #1e3a8a;
    font-size: 0.9rem;
    line-height: 1.8;
}

.info-content kbd {
    background: var(--white);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    border: 1px solid #93c5fd;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #1e40af;
    box-shadow: var(--shadow-sm);
}

.paste-area {
    font-family: 'Tajawal', monospace;
    resize: vertical;
    min-height: 120px;
}

.preview-section {
    border-top: 1px dashed var(--gray-200);
    padding-top: 1.5rem;
}

/* ===== Excel Import Section ===== */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--gray-50);
    box-sizing: border-box;
    display: block; /* Ensure it's a block element */
    outline: none; /* Remove focus outline */
}

.upload-area:focus,
.upload-area:focus-visible {
    outline: none;
    border-color: var(--primary-color);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.upload-area i {
    font-size: 3rem;
    color: var(--primary-color);
    display: block;
    margin-bottom: 1rem;
}

.upload-area h4 {
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.upload-area p {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin: 0;
}

/* Column Mapping */
.column-mapping-section h4 {
    color: var(--gray-800);
    margin: 0;
}

.mapping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.mapping-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mapping-row .form-label {
    font-weight: 600;
    color: var(--gray-700);
    margin: 0;
}

.mapping-row .form-label .required {
    color: var(--danger-color);
}

/* Preview Table */
.preview-table {
    font-size: 0.875rem;
}

.preview-table th,
.preview-table td {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
}

.preview-table input[type="text"],
.preview-table input[type="number"] {
    padding: 0.375rem 0.5rem;
    font-size: 0.85rem;
}

.preview-table .row-error {
    background-color: #fef2f2;
}

.preview-table .row-warning {
    background-color: #fefce8;
}

.preview-stats {
    display: flex;
    gap: 0.5rem;
}

/* Preview Pagination */
.preview-pagination-info {
    font-size: 0.875rem;
}

.preview-pagination {
    display: flex;
    justify-content: center;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-controls .btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.page-indicator {
    background: var(--primary);
    color: white;
    padding: 0.375rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    min-width: 80px;
    text-align: center;
}

/* Preview Action Buttons */
.preview-table .action-buttons {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
}

.preview-table .btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-table .btn-icon.btn-edit {
    background: #dbeafe;
    color: #1d4ed8;
}

.preview-table .btn-icon.btn-edit:hover {
    background: #1d4ed8;
    color: white;
}

.preview-table .btn-icon.btn-delete {
    background: #fee2e2;
    color: #dc2626;
}

.preview-table .btn-icon.btn-delete:hover {
    background: #dc2626;
    color: white;
}

/* Small Modal */
.modal.modal-sm {
    max-width: 400px;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.status-badge.status-success {
    background: #dcfce7;
    color: #166534;
}

.status-badge.status-warning {
    background: #fef9c3;
    color: #854d0e;
}

.status-badge.status-error {
    background: #fef2f2;
    color: #991b1b;
}

/* Progress Bar */
.progress-container {
    text-align: center;
}

.progress-bar-wrapper {
    background: var(--gray-200);
    border-radius: var(--radius-full);
    height: 8px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.progress-bar-animated {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light), var(--primary-color));
    background-size: 200% 100%;
    animation: progressAnimation 1.5s linear infinite;
}

@keyframes progressAnimation {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.progress-text {
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* Import Actions */
.import-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Form Control Small */
.form-control-sm {
    padding: 0.375rem 0.5rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

/* ===== Responsive Action Buttons ===== */
@media (max-width: 768px) {
    .action-buttons {
        gap: 0.375rem;
    }
    
    .btn-icon {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
    
    .data-table code {
        font-size: 0.75rem;
        padding: 0.125rem 0.375rem;
    }
    
    .import-info-box {
        flex-direction: column;
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .info-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-area i {
        font-size: 2rem;
    }
    
    .mapping-grid {
        grid-template-columns: 1fr;
    }
    
    .preview-table {
        font-size: 0.75rem;
    }
    
    .preview-table th,
    .preview-table td {
        padding: 0.375rem 0.5rem;
    }
}

@media (max-width: 400px) {
    .btn-icon {
        width: 28px;
        height: 28px;
    }
}

/* ===== Import Jobs Panel (عمليات الاستيراد) ===== */
.import-jobs-panel {
    border: 1px solid var(--info-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.import-jobs-panel .card-header {
    background: linear-gradient(135deg, var(--info-color), #0284c7);
    color: white;
    border: none;
}

.import-jobs-panel .card-header:hover {
    background: linear-gradient(135deg, #0284c7, var(--info-color));
}

.spin-animation {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.job-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    transition: background-color var(--transition-fast);
}

.job-item:last-child {
    border-bottom: none;
}

.job-item:hover {
    background-color: var(--gray-50);
}

/* Job Status Borders */
.job-pending {
    border-right: 4px solid var(--gray-400);
}

.job-processing {
    border-right: 4px solid var(--primary-color);
    background-color: rgba(37, 99, 235, 0.03);
}

.job-completed {
    border-right: 4px solid var(--success-color);
    background-color: rgba(16, 185, 129, 0.03);
}

.job-failed {
    border-right: 4px solid var(--danger-color);
    background-color: rgba(239, 68, 68, 0.03);
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.job-id {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.job-time {
    font-size: 0.8rem;
    color: var(--gray-600);
    background: var(--gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.job-progress {
    margin-bottom: 0.75rem;
}

.job-progress .job-progress-bar-wrapper {
    height: 12px;
    background: #e2e8f0 !important;
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 0.375rem;
}

.job-progress .job-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa) !important;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.job-progress .job-progress-bar.job-bar-success {
    background: linear-gradient(90deg, #10b981, #34d399) !important;
}

.job-progress .job-progress-bar.job-bar-danger {
    background: linear-gradient(90deg, #ef4444, #f87171) !important;
}

/* Processing animation */
.job-processing .job-progress .job-progress-bar {
    background: linear-gradient(90deg, #3b82f6, #60a5fa) !important;
    animation: progress-pulse 1.5s ease-in-out infinite;
}

@keyframes progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.job-progress .progress-text {
    font-size: 0.8rem;
    color: var(--gray-600);
    text-align: left;
    direction: ltr;
}

.job-details {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.job-details .badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
}

.job-message {
    font-size: 0.85rem;
    color: var(--gray-700);
    padding: 0.5rem 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border-right: 3px solid var(--gray-300);
}

/* Job Status Colors */
.job-completed .job-message {
    border-right-color: var(--success-color);
    background: rgba(16, 185, 129, 0.05);
}

.job-failed .job-message {
    border-right-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.05);
}

/* Badge in Import Header */
.import-jobs-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

/* ========================================
   Enhanced Mobile Responsive Styles
   ======================================== */

/* ===== Tablet (max-width: 992px) ===== */
@media (max-width: 992px) {
    :root {
        --sidebar-width: 240px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal {
        width: 90%;
        max-width: 500px;
    }
}

/* ===== Mobile (max-width: 768px) - Enhanced ===== */
@media (max-width: 768px) {
    /* Sidebar Overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Mobile Sidebar */
    .admin-sidebar {
        width: 85%;
        max-width: 300px;
        right: -100%;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3);
    }
    
    .admin-sidebar.active {
        right: 0;
    }
    
    .sidebar-close {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
    }
    
    /* Mobile Header */
    .admin-header {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    
    .admin-header h1 {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 45%;
    }
    
    .admin-header h1 i {
        display: none;
    }
    
    .menu-toggle {
        display: flex !important;
        width: 40px;
        height: 40px;
        min-width: 40px;
    }
    
    /* User Menu Mobile */
    .user-menu {
        gap: 0.5rem;
    }
    
    .user-info {
        display: none;
    }
    
    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }
    
    /* Content Area */
    .admin-content {
        padding: 0.75rem;
    }
    
    /* Cards */
    .card {
        border-radius: var(--radius-md);
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 0.875rem;
    }
    
    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.375rem;
    }
    
    .stat-card .stat-label {
        font-size: 0.75rem;
    }
    
    /* Actions Bar */
    .actions-bar {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .actions-bar .search-box {
        width: 100%;
        order: 1;
    }
    
    .actions-bar .btn {
        width: 100%;
        justify-content: center;
        order: 2;
    }
    
    /* Tables - Horizontal Scroll */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
    }
    
    .data-table {
        min-width: 600px;
        font-size: 0.825rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.625rem 0.5rem;
        white-space: nowrap;
    }
    
    /* Removed sticky first column - was causing overlap issues */
    
    /* Action Buttons in Table */
    .action-buttons {
        gap: 0.25rem;
    }
    
    .action-buttons .btn-icon {
        width: 30px;
        height: 30px;
        min-width: 30px;
    }
    
    /* Pagination */
    .table-pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.375rem;
        padding: 0.75rem;
    }
    
    .pagination-btn {
        min-width: 34px;
        height: 34px;
        font-size: 0.8125rem;
    }
    
    .pagination-btn span {
        display: none;
    }
    
    .pagination-btn i {
        margin: 0 !important;
    }
    
    /* Modal */
    .modal-backdrop {
        padding: 0.5rem;
        align-items: flex-end;
    }
    
    .modal {
        width: 100%;
        max-width: none;
        max-height: 90vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        margin: 0;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: calc(90vh - 140px);
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 1rem;
        flex-direction: column-reverse;
        gap: 0.5rem;
    }
    
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    .form-label {
        font-size: 0.875rem;
        margin-bottom: 0.375rem;
    }
    
    .form-control {
        padding: 0.625rem 0.75rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Search Box */
    .search-box {
        min-width: unset;
        width: 100%;
    }
    
    .search-box input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Buttons */
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    .btn i {
        font-size: 1rem;
    }
    
    /* Empty State */
    .empty-state i {
        font-size: 3rem;
    }
    
    .empty-state p {
        font-size: 0.9rem;
    }
    
    /* Import Section */
    .upload-area {
        padding: 1.5rem 1rem;
    }
    
    .upload-area i {
        font-size: 2.5rem;
    }
    
    .upload-area h4 {
        font-size: 0.95rem;
    }
    
    /* Column Mapping */
    .mapping-grid {
        grid-template-columns: 1fr;
    }
    
    .mapping-row {
        flex-direction: column;
        gap: 0.375rem;
    }
    
    /* Import Actions */
    .import-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .import-actions .btn {
        width: 100%;
    }
    
    /* Jobs Panel */
    .job-item {
        padding: 0.75rem;
    }
    
    .job-header {
        font-size: 0.8rem;
    }
    
    .job-details .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* Toggle Switch */
    .toggle-switch {
        flex-wrap: wrap;
    }
    
    /* Badges */
    .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Loading Overlay */
    .loading-overlay .loading-content p {
        font-size: 0.9rem;
    }
}

/* ===== Small Mobile (max-width: 480px) - Enhanced ===== */
@media (max-width: 480px) {
    /* Stats Single Column */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    /* Header Title Hidden */
    .admin-header h1 {
        font-size: 0.875rem;
        max-width: 35%;
    }
    
    /* Smaller Cards */
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.25rem;
    }
    
    /* Table Font Size */
    .data-table {
        font-size: 0.75rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.375rem;
    }
    
    /* Compact Action Buttons */
    .action-buttons .btn-icon {
        width: 28px;
        height: 28px;
        min-width: 28px;
    }
    
    .action-buttons .btn-icon i {
        font-size: 0.75rem;
    }
    
    /* Modal Full Width */
    .modal {
        max-height: 95vh;
    }
    
    .modal-body {
        max-height: calc(95vh - 130px);
    }
    
    /* Card Header */
    .card-header {
        padding: 0.625rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .card-header .badge {
        font-size: 0.65rem;
    }
    
    /* Preview Table */
    .preview-table {
        min-width: 500px;
    }
}

/* ===== Extra Small (max-width: 360px) ===== */
@media (max-width: 360px) {
    .admin-content {
        padding: 0.5rem;
    }
    
    .card-body {
        padding: 0.5rem;
    }
    
    .admin-header h1 {
        display: none;
    }
    
    .stat-card .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1.125rem;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
}

/* ===== Touch Device Optimizations ===== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn,
    .pagination-btn,
    .action-buttons .btn-icon {
        min-height: 44px;
        min-width: 44px;
    }
    
    .form-control,
    .search-box input {
        min-height: 44px;
    }
    
    /* Remove hover effects */
    .btn:hover,
    .card:hover {
        transform: none;
    }
    
    /* Active states for touch */
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    /* Disable text selection on interactive elements */
    .btn,
    .pagination-btn,
    .nav-link {
        -webkit-user-select: none;
        user-select: none;
    }
}

/* ===== Landscape Mobile ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .modal {
        max-height: 85vh;
        border-radius: var(--radius-lg);
    }
    
    .modal-body {
        max-height: calc(85vh - 140px);
    }
    
    .admin-sidebar {
        max-width: 260px;
    }
}

/* ===== Safe Area Support (Notch devices) ===== */
@supports (padding: max(0px)) {
    .admin-header {
        padding-top: max(0.75rem, env(safe-area-inset-top));
    }
    
    .admin-sidebar {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    .modal-footer {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* ===== Print Styles (Hide unnecessary elements) ===== */
@media print {
    .admin-sidebar,
    .admin-header,
    .menu-toggle,
    .action-buttons,
    .actions-bar,
    .table-pagination,
    .modal-backdrop {
        display: none !important;
    }
    
    .admin-main {
        margin: 0 !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

