/* ===== CSS Variables ===== */
:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #dbeafe;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --success-light: #d1fae5;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --warning-light: #fef3c7;
    --info-color: #06b6d4;
    --info-light: #cffafe;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-focus: #3b82f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

[data-theme="dark"] {
    --primary-color: #60a5fa;
    --primary-hover: #3b82f6;
    --primary-light: #1e3a8a;
    --success-color: #34d399;
    --success-light: #064e3b;
    --error-color: #f87171;
    --warning-color: #fbbf24;
    --warning-light: #78350f;
    --info-color: #22d3ee;
    --info-light: #164e63;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

/* ===== Global Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-size: 14px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
}

.dashboard-container {
    max-width: 1800px;
}

/* ===== Header ===== */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(50%, -50%);
}

.header-content {
    position: relative;
    z-index: 1;
}

.header-content h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-content p {
    opacity: 0.9;
    font-size: 1rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
    margin-bottom: 1rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-4px);
}

/* ===== Theme Switcher ===== */
.theme-switcher {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.theme-switcher i {
    font-size: 1.25rem;
    opacity: 0.9;
}

.switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    transition: 0.3s;
    border-radius: 30px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

input:checked + .slider {
    background: rgba(255, 255, 255, 0.4);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* ===== Content Area ===== */
.content {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

/* ===== Status Indicator ===== */
.status-indicator {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    border-left: 4px solid;
}

.status-indicator.loading {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.status-indicator.success {
    background: var(--success-light);
    color: var(--success-color);
    border-color: var(--success-color);
}

.status-indicator.error {
    background: #fee2e2;
    color: var(--error-color);
    border-color: var(--error-color);
}

/* ===== Quick Statistics ===== */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card:hover::before {
    width: 100%;
    opacity: 0.05;
}

[data-theme="dark"] .stat-card {
    background: var(--bg-tertiary);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-primary .stat-icon {
    background: var(--primary-light);
    color: var(--primary-color);
}

.stat-info .stat-icon {
    background: var(--info-light);
    color: var(--info-color);
}

.stat-success .stat-icon {
    background: var(--success-light);
    color: var(--success-color);
}

.stat-warning .stat-icon {
    background: var(--warning-light);
    color: var(--warning-color);
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-content p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== Filter Controls ===== */
.filter-controls {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.filter-controls p {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.date-range-filter {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.date-range-filter input {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-family: inherit;
}

.date-range-filter input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.button-secondary {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.button-secondary:hover {
    background: var(--text-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===== Advanced Filter Panel ===== */
.advanced-filter-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: 1001;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.panel-header h3 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.close-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
    transform: rotate(90deg);
}

.panel-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.filter-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.filter-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    min-height: 120px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-hint {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.panel-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    background: var(--bg-tertiary);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.btn-apply,
.btn-clear {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-apply {
    background: var(--primary-color);
    color: white;
}

.btn-apply:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-clear {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.btn-clear:hover {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

/* ===== Column Selector Panel ===== */
.column-selector-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: 1001;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.panel-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.btn-small {
    flex: 1;
    padding: 0.625rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.column-checkbox-list,
.checkbox-item {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-item {
    flex-direction: row;
    align-items: center;
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.checkbox-item:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-label {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}

.toggle-icon {
    color: var(--text-muted);
    font-size: 1rem;
}

/* ===== Column Filters ===== */
.column-filter {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-family: inherit;
}

.column-filter:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.column-filter::placeholder {
    color: var(--text-muted);
}

/* ===== DataTables Styling ===== */
.table-controls-wrapper {
    background: var(--bg-tertiary);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.left-controls,
.right-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.dt-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-custom {
    background: var(--primary-color) !important;
    color: white !important;
    border: none !important;
    padding: 0.75rem 1.25rem !important;
    border-radius: var(--radius-md) !important;
    cursor: pointer !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    transition: all 0.3s ease !important;
    box-shadow: var(--shadow-sm) !important;
    font-family: inherit !important;
}

.btn-custom:hover {
    background: var(--primary-hover) !important;
    transform: translateY(-2px) !important;
    box-shadow: var(--shadow-md) !important;
}

.btn-copy {
    background: var(--success-color) !important;
}

.btn-copy:hover {
    background: #059669 !important;
}

.btn-export {
    background: var(--info-color) !important;
}

.btn-export:hover {
    background: #0891b2 !important;
}

.btn-filter {
    background: var(--warning-color) !important;
}

.btn-filter:hover {
    background: #d97706 !important;
}

.btn-help {
    background: var(--secondary-color) !important;
    padding: 0.75rem !important;
}

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

#sheetData {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
}

#sheetData thead th {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    font-weight: 600;
    text-align: left;
    border-bottom: 2px solid var(--primary-hover);
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

#sheetData thead th:first-child {
    border-radius: var(--radius-lg) 0 0 0;
}

#sheetData thead th:last-child {
    border-radius: 0 var(--radius-lg) 0 0;
}

#sheetData tfoot th {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-top: 2px solid var(--border-color);
}

#sheetData tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

#sheetData tbody tr:hover {
    background: var(--bg-secondary);
    box-shadow: inset 0 0 0 1px var(--primary-color);
}

#sheetData tbody tr.selected {
    background: var(--primary-light);
    box-shadow: inset 0 0 0 2px var(--primary-color);
}

#sheetData tbody td {
    padding: 1rem;
    color: var(--text-primary);
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-primary);
    margin: 5% auto;
    border-radius: var(--radius-xl);
    max-width: 700px;
    box-shadow: var(--shadow-xl);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header h2 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.close-button {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    background: var(--bg-primary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.close-button:hover {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

#modalDetailsList {
    list-style: none;
}

.detail-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    transition: background 0.2s ease;
}

.detail-item:hover {
    background: var(--bg-secondary);
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 150px;
}

.detail-value {
    color: var(--text-secondary);
    flex: 1;
    text-align: right;
}

/* ===== Toast Notification ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 2000;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    border: 1px solid;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    background: var(--success-color);
    color: white;
    border-color: #059669;
}

.toast.error {
    background: var(--error-color);
    color: white;
    border-color: #dc2626;
}

.toast.info {
    background: var(--info-color);
    color: white;
    border-color: #0891b2;
}

.toast.warning {
    background: var(--warning-color);
    color: white;
    border-color: #d97706;
}

/* ===== DataTables Pagination & Info ===== */
.dataTables_wrapper .dataTables_paginate {
    padding-top: 1.5rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.625rem 1rem;
    margin: 0 0.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary) !important;
    transition: all 0.3s ease;
    font-weight: 500;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color);
}

.dataTables_wrapper .dataTables_info {
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding-top: 1.5rem;
}

.dataTables_wrapper .dataTables_length label {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.dataTables_wrapper .dataTables_length select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    margin: 0 0.5rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
}

.dataTables_wrapper .dataTables_length select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dataTables_wrapper .dataTables_filter label {
    font-weight: 500;
    color: var(--text-secondary);
}

.dataTables_wrapper .dataTables_filter input {
    padding: 0.625rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    margin-left: 0.5rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== Category Groups (Dashboard) ===== */
.category-group {
    margin-bottom: 2rem;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.category-title {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 1.5rem 1.75rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 600;
    transition: all 0.3s ease;
    user-select: none;
}

.category-title:hover {
    background: linear-gradient(135deg, var(--primary-hover), #1e40af);
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.category-content {
    padding: 1.75rem;
    background: var(--bg-secondary);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.card-body h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.card-body p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.card-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.card-footer span {
    color: var(--primary-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .header-content h1 {
        font-size: 1.5rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .left-controls,
    .right-controls {
        width: 100%;
        justify-content: center;
    }

    .dt-buttons {
        justify-content: center;
    }

    .date-range-filter {
        grid-template-columns: 1fr;
    }

    .quick-stats {
        grid-template-columns: 1fr;
    }

    .advanced-filter-panel,
    .column-selector-panel {
        width: 95%;
        max-height: 90vh;
    }
    
    .panel-footer {
        flex-direction: column;
    }
    
    .stat-content h3 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }
    
    .content {
        padding: 1.25rem;
    }
    
    .btn-custom {
        padding: 0.625rem 1rem !important;
        font-size: 0.8rem !important;
    }
    
    .toast {
        right: 1rem;
        left: 1rem;
        min-width: auto;
    }
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ===== Loading Animation ===== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.fa-spin {
    animation: spin 1s linear infinite;
}