/* ============================================
   نظام الصيانة والضمان - الأنماط الرئيسية
   Modern Maintenance & Guarantee System
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');

/* ============= CSS Variables ============= */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --topbar-height: 60px;

    /* Premium Color Palette */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    /* Sidebar Colors */
    --sidebar-bg: linear-gradient(180deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    --sidebar-text: #c7d2fe;
    --sidebar-text-hover: #ffffff;
    --sidebar-active-bg: rgba(99, 102, 241, 0.3);
    --sidebar-active-border: #818cf8;

    /* Content Area */
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.1);

    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Borders */
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============= Reset & Base ============= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
    direction: rtl;
    text-align: right;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ============= Sidebar ============= */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    transition: var(--transition);
    overflow-x: hidden;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Sidebar Brand */
.sidebar-brand {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 8px;
}

.sidebar-brand .brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.sidebar-brand .brand-text {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
}

.sidebar-brand .brand-subtitle {
    color: var(--sidebar-text);
    font-size: 0.75rem;
    font-weight: 400;
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 0 12px;
    list-style: none;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.sidebar-nav .nav-section {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 16px 8px;
    margin-top: 4px;
}

.sidebar-nav .nav-item {
    margin-bottom: 2px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--sidebar-text);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    position: relative;
    text-decoration: none;
}

.sidebar-nav .nav-link:hover {
    color: var(--sidebar-text-hover);
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-nav .nav-link.active {
    color: var(--sidebar-text-hover);
    background: var(--sidebar-active-bg);
    border-right: 3px solid var(--sidebar-active-border);
    font-weight: 600;
}

.sidebar-nav .nav-link .nav-icon {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.85;
}

.sidebar-nav .nav-link.active .nav-icon {
    opacity: 1;
}

/* Sidebar User Box */
.sidebar-user {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.sidebar-user .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--info));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user .user-name {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

.sidebar-user .user-role {
    color: var(--sidebar-text);
    font-size: 0.7rem;
}

.sidebar-user .logout-btn {
    color: var(--sidebar-text);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
    margin-right: auto;
    margin-left: 0;
}

.sidebar-user .logout-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
}

/* ============= Content Area ============= */
.main-content {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.topbar .page-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.topbar .breadcrumb {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.topbar .sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    display: none;
}

.topbar .sidebar-toggle:hover {
    background: var(--body-bg);
    color: var(--primary);
}

/* Content Container */
.content-container {
    padding: 24px;
}

/* ============= Cards ============= */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
}

.card-header h5,
.card-header h6 {
    margin: 0;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

/* Stat Cards (Dashboard) */
.stat-card {
    border-radius: var(--border-radius);
    padding: 20px;
    color: #fff;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -30%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: scale(1);
    transition: var(--transition);
}

.stat-card:hover::before {
    transform: scale(2);
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.3;
    position: absolute;
    top: 12px;
    left: 16px;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    opacity: 0.85;
    font-weight: 500;
}

.stat-primary { background: linear-gradient(135deg, #6366f1, #818cf8); }
.stat-success { background: linear-gradient(135deg, #10b981, #34d399); }
.stat-warning { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.stat-info { background: linear-gradient(135deg, #0ea5e9, #38bdf8); }
.stat-danger { background: linear-gradient(135deg, #ef4444, #f87171); }
.stat-secondary { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }

/* ============= Buttons ============= */
.btn {
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    padding: 8px 20px;
    font-size: 0.85rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #4338ca);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
    color: #fff;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
    color: #fff;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: #fff;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
    color: #fff;
}

.btn-info {
    background: linear-gradient(135deg, var(--info), #0891b2);
    color: #fff;
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 1rem;
}

/* ============= Forms ============= */
.form-control,
.form-select {
    font-family: 'Cairo', sans-serif;
    border-radius: var(--border-radius-sm);
    border: 1.5px solid var(--border-color);
    padding: 8px 14px;
    font-size: 0.9rem;
    transition: var(--transition);
    background: var(--card-bg);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    outline: none;
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group {
    margin-bottom: 16px;
}

/* ============= Tables ============= */
.table-container {
    overflow-x: auto;
}

table.dataTable {
    width: 100% !important;
    border-collapse: collapse;
}

table.dataTable thead th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

table.dataTable tbody td {
    padding: 10px 16px;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

table.dataTable tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

table.dataTable tbody tr.selected {
    background: rgba(99, 102, 241, 0.08) !important;
}

/* DataTables RTL fixes */
div.dataTables_wrapper div.dataTables_length,
div.dataTables_wrapper div.dataTables_filter,
div.dataTables_wrapper div.dataTables_info,
div.dataTables_wrapper div.dataTables_paginate {
    text-align: right;
}

div.dataTables_wrapper div.dataTables_filter input {
    margin-right: 8px;
    margin-left: 0;
}

/* ============= Modal ============= */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
}

.modal-header .modal-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 12px 20px;
}

/* ============= Badge ============= */
.badge {
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
}

/* ============= Login Page ============= */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4f46e5 100%);
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3), transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.2), transparent 70%);
    bottom: -80px;
    left: -80px;
    border-radius: 50%;
    animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-30px); }
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-card .login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 12px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.login-card .login-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-card .login-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.login-card .form-control {
    padding: 12px 16px;
    font-size: 0.95rem;
}

.login-card .btn-login {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 700;
}

/* ============= Responsive ============= */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
    }

    .topbar .sidebar-toggle {
        display: block;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 576px) {
    .content-container {
        padding: 16px;
    }

    .card-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }
}

/* ============= Animations ============= */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

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

.slide-in {
    animation: slideIn 0.4s ease forwards;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============= Select2 RTL Custom ============= */
.select2-container--default .select2-selection--single {
    border-radius: var(--border-radius-sm) !important;
    border: 1.5px solid var(--border-color) !important;
    height: 38px !important;
    padding: 4px 8px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 28px !important;
    padding-right: 8px !important;
    font-family: 'Cairo', sans-serif;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px !important;
    left: 4px;
    right: auto !important;
}

.select2-dropdown {
    border-radius: var(--border-radius-sm) !important;
    border: 1.5px solid var(--border-color) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
}

.select2-results__option--highlighted {
    background-color: var(--primary) !important;
}

/* ============= SweetAlert2 RTL ============= */
.swal2-rtl .swal2-title {
    font-family: 'Cairo', sans-serif;
}

.swal2-rtl .swal2-html-container {
    font-family: 'Cairo', sans-serif;
}

/* ============= Toastr RTL ============= */
.toast-top-left {
    top: 12px;
    left: 12px;
}

/* ============= Loading Overlay ============= */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============= Utilities ============= */
.text-primary-custom { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-primary-soft { background: rgba(99, 102, 241, 0.1); }
.bg-success-soft { background: rgba(16, 185, 129, 0.1); }
.bg-warning-soft { background: rgba(245, 158, 11, 0.1); }
.bg-danger-soft { background: rgba(239, 68, 68, 0.1); }
.bg-info-soft { background: rgba(6, 182, 212, 0.1); }

.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ============= Enhanced Print Styles ============= */
@media print {
    .sidebar,
    .topbar,
    .no-print,
    .sidebar-overlay,
    .btn,
    .dataTables_filter,
    .dataTables_length,
    .dataTables_paginate,
    .dataTables_info,
    .alert,
    .select2-container,
    .card-header .btn {
        display: none !important;
    }

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

    .content-container {
        padding: 0 !important;
    }

    body {
        background: #fff !important;
        font-size: 12px !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .card {
        border: none !important;
        box-shadow: none !important;
        break-inside: avoid;
    }

    .card-header {
        background: #f5f5f5 !important;
        border-bottom: 2px solid #333 !important;
        padding: 8px 12px !important;
    }

    .card-header h5,
    .card-header h6 {
        font-size: 14px !important;
    }

    .card-body {
        padding: 8px !important;
    }

    table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 11px !important;
    }

    table th,
    table td {
        padding: 4px 6px !important;
        border: 1px solid #ccc !important;
    }

    table thead th {
        background: #e9ecef !important;
        font-weight: 700 !important;
    }

    .table-dark th,
    .table-dark td {
        background: #333 !important;
        color: #fff !important;
    }

    .badge {
        border: 1px solid #333 !important;
        padding: 1px 6px !important;
    }

    a[href]:after {
        content: none !important;
    }

    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    /* Show print-only header for reports */
    .print-report-header {
        display: block !important;
        text-align: center;
        margin-bottom: 10px;
        padding-bottom: 8px;
        border-bottom: 3px double #333;
    }

    .print-report-header h3 {
        margin: 0;
        font-size: 18px;
    }

    .print-report-header .date {
        font-size: 11px;
        color: #666;
    }
}

/* Print-only elements (hidden on screen) */
.print-report-header {
    display: none;
}

/* ============= Enhanced Responsive ============= */

/* Table horizontal scroll hint */
.table-container,
.table-responsive {
    position: relative;
}

.table-container::after,
.table-responsive::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.03));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.table-container.scrolled::after,
.table-responsive.scrolled::after {
    opacity: 1;
}

/* Medium screens */
@media (max-width: 992px) {
    .content-container {
        padding: 16px;
    }

    .stat-card {
        padding: 16px;
    }

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

    .modal-dialog {
        margin: 16px;
    }

    /* Stack form fields better */
    .row > [class*="col-md-2"],
    .row > [class*="col-md-3"] {
        margin-bottom: 8px;
    }
}

/* Small screens */
@media (max-width: 576px) {
    .content-container {
        padding: 12px;
    }

    .card-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .card-header .btn {
        width: 100%;
        justify-content: center;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    .stat-card .stat-icon {
        font-size: 2rem;
    }

    .topbar {
        padding: 0 12px;
    }

    .topbar .page-title {
        font-size: 1rem;
    }

    /* Better table display on small screens */
    table.dataTable thead th {
        font-size: 0.72rem;
        padding: 8px 6px;
    }

    table.dataTable tbody td {
        font-size: 0.8rem;
        padding: 6px;
    }

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

    /* Modal full-width on mobile */
    .modal-dialog {
        margin: 8px;
        max-width: calc(100% - 16px);
    }

    .modal-body {
        padding: 12px;
    }

    /* Info tables in modals */
    .modal-body .info-table th,
    .modal-body .info-table td {
        display: block;
        width: 100%;
    }

    /* Action buttons wrap */
    .d-flex.gap-2 {
        flex-wrap: wrap;
    }
}

/* ============= Error \u0026 Empty States ============= */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state .empty-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.empty-state .empty-desc {
    font-size: 0.85rem;
}

/* Error toast custom */
.toast-error {
    background-color: var(--danger) !important;
}

/* Loading button state */
.btn.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.75;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
}

/* Form validation feedback */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: var(--success) !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

.invalid-feedback {
    font-size: 0.78rem;
    color: var(--danger);
    font-weight: 500;
}

/* Skeleton loading placeholder */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Connection error banner */
.connection-error {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--danger);
    color: #fff;
    text-align: center;
    padding: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 10000;
    display: none;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ============= Accessibility ============= */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Skip to content (accessibility) */
.skip-link {
    position: absolute;
    top: -100px;
    right: 0;
    background: var(--primary);
    color: #fff;
    padding: 8px 16px;
    z-index: 10000;
    border-radius: 0 0 0 8px;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
    color: #fff;
}
