/* ============================================
   MODERN DASHBOARD CSS - Clean & Professional
   ============================================ */

/* ============================================
   1. CSS VARIABLES & DESIGN SYSTEM
   ============================================ */
:root {
    /* Primary Color Palette - Professional Blue/Gray */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;

    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Semantic Colors */
    --success-50: #f0fdf4;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --success-700: #15803d;

    --danger-50: #fef2f2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --danger-700: #b91c1c;

    --warning-50: #fffbeb;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --warning-700: #b45309;

    --info-50: #eff6ff;
    --info-500: #06b6d4;
    --info-600: #0891b2;
    --info-700: #0e7490;

    /* Spacing System */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --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);

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   DARK MODE VARIABLES
   ============================================ */
[data-theme="dark"] {
    /* Dark Mode Background Colors */
    --gray-50: #18181b;
    --gray-100: #27272a;
    --gray-200: #3f3f46;
    --gray-300: #52525b;
    --gray-400: #71717a;
    --gray-500: #a1a1aa;
    --gray-600: #d4d4d8;
    --gray-700: #e4e4e7;
    --gray-800: #f4f4f5;
    --gray-900: #fafafa;

    /* Dark Mode Primary Colors - Lighter for better contrast */
    --primary-50: #1e293b;
    --primary-100: #1e3a8a;
    --primary-200: #1d4ed8;
    --primary-300: #2563eb;
    --primary-400: #3b82f6;
    --primary-500: #60a5fa;
    --primary-600: #93c5fd;
    --primary-700: #bfdbfe;
    --primary-800: #dbeafe;
    --primary-900: #eff6ff;

    /* Dark Mode Semantic Colors */
    --success-50: #14532d;
    --success-500: #22c55e;
    --success-600: #4ade80;
    --success-700: #86efac;

    --danger-50: #7f1d1d;
    --danger-500: #ef4444;
    --danger-600: #f87171;
    --danger-700: #fca5a5;

    --warning-50: #78350f;
    --warning-500: #f59e0b;
    --warning-600: #fbbf24;
    --warning-700: #fcd34d;

    --info-50: #164e63;
    --info-500: #06b6d4;
    --info-600: #22d3ee;
    --info-700: #67e8f9;

    /* Dark Mode Shadows - Lighter for visibility */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* ============================================
   2. GLOBAL RESETS & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   3. NAVIGATION BAR
   ============================================ */
.modern-navbar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: var(--spacing-md) var(--spacing-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    text-decoration: none;
    color: var(--gray-900);
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar-brand:hover {
    color: var(--primary-600);
}

.navbar-logo {
    height: 36px;
    width: auto;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    list-style: none;
}

.navbar-menu a {
    text-decoration: none;
    color: var(--gray-700);
    font-weight: 500;
    transition: color var(--transition-base);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
}

.navbar-menu a:hover {
    color: var(--primary-600);
    background-color: var(--primary-50);
}

.navbar-menu a.active {
    color: var(--primary-600);
    background-color: var(--primary-50);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: transform var(--transition-base);
}

.user-avatar:hover {
    transform: scale(1.05);
}

.user-info-nav {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name-nav {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 0.875rem;
}

.user-email-nav {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* ============================================
   4. CONTAINER & LAYOUT
   ============================================ */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-2xl) var(--spacing-xl);
}

.page-header {
    margin-bottom: var(--spacing-2xl);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--spacing-sm);
}

.page-subtitle {
    font-size: 1rem;
    color: var(--gray-600);
}

/* ============================================
   5. STAT CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    border: 1px solid var(--gray-200);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
    transform: scaleX(0);
    transition: transform var(--transition-base);
    transform-origin: left;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-md);
}

.stat-card-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card-icon.primary {
    background: var(--primary-100);
    color: var(--primary-600);
}

.stat-card-icon.success {
    background: var(--success-50);
    color: var(--success-600);
}

.stat-card-icon.warning {
    background: var(--warning-50);
    color: var(--warning-600);
}

.stat-card-icon.info {
    background: var(--info-50);
    color: var(--info-600);
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--spacing-xs);
}

.stat-card-footer {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* ============================================
   6. MODERN TABLE
   ============================================ */
.table-container {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.table-actions {
    display: flex;
    gap: var(--spacing-md);
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
}

.modern-table thead {
    background-color: var(--gray-50);
}

.modern-table th {
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-200);
}

.modern-table tbody tr {
    border-bottom: 1px solid var(--gray-200);
    transition: background-color var(--transition-fast);
}

.modern-table tbody tr:hover {
    background-color: var(--gray-50);
}

.modern-table tbody tr:last-child {
    border-bottom: none;
}

.modern-table td {
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--gray-700);
    font-size: 0.875rem;
}

/* ============================================
   7. BADGES & STATUS INDICATORS
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    white-space: nowrap;
}

.badge-success {
    background-color: var(--success-50);
    color: var(--success-700);
    border: 1px solid var(--success-200);
}

.badge-danger {
    background-color: var(--danger-50);
    color: var(--danger-700);
    border: 1px solid var(--danger-200);
}

.badge-warning {
    background-color: var(--warning-50);
    color: var(--warning-700);
    border: 1px solid var(--warning-200);
}

.badge-info {
    background-color: var(--info-50);
    color: var(--info-700);
    border: 1px solid var(--info-200);
}

.badge-primary {
    background-color: var(--primary-50);
    color: var(--primary-700);
    border: 1px solid var(--primary-200);
}

.badge-gray {
    background-color: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

/* Status with pulse animation */
.badge-processing {
    position: relative;
}

.badge-processing::before {
    content: '';
    position: absolute;
    left: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ============================================
   8. BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
    font-family: var(--font-sans);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary-600);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-700);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--success-600);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: var(--success-700);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--danger-600);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--danger-700);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-outline {
    background-color: white;
    color: var(--primary-600);
    border: 1px solid var(--primary-600);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--primary-50);
}

.btn-ghost {
    background-color: transparent;
    color: var(--gray-700);
}

.btn-ghost:hover:not(:disabled) {
    background-color: var(--gray-100);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.625rem;
    width: 2.5rem;
    height: 2.5rem;
}

/* ============================================
   9. FORMS & INPUTS
   ============================================ */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--spacing-sm);
}

.form-label.required::after {
    content: '*';
    color: var(--danger-500);
    margin-left: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background-color: white;
    color: var(--gray-900);
    transition: all var(--transition-base);
    font-family: var(--font-sans);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-error {
    display: block;
    font-size: 0.75rem;
    color: var(--danger-600);
    margin-top: var(--spacing-xs);
}

.form-help {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: var(--spacing-xs);
}

/* File upload area */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    text-align: center;
    background-color: var(--gray-50);
    transition: all var(--transition-base);
    cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-500);
    background-color: var(--primary-50);
}

.upload-icon {
    font-size: 1.75rem;
    color: var(--gray-400);
    margin-bottom: 0.25rem;
}

.upload-text {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 0.125rem;
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: var(--transition-base);
    border-radius: var(--radius-full);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-base);
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-600);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px var(--primary-100);
}

/* ============================================
   10. CARDS
   ============================================ */
.card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--transition-base);
}

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

.card-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--gray-200);
    background-color: var(--gray-50);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.card-body {
    padding: var(--spacing-lg);
}

.card-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--gray-200);
    background-color: var(--gray-50);
}

/* ============================================
   11. MODALS
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
    animation: fadeIn var(--transition-base);
}

.modal-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal {
    background: white;
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp var(--transition-slow);
}

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

.modal-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-500);
    cursor: pointer;
    padding: var(--spacing-sm);
    line-height: 1;
    transition: color var(--transition-base);
}

.modal-close:hover {
    color: var(--gray-900);
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
}

/* ============================================
   12. ALERTS & NOTIFICATIONS
   ============================================ */
.alert {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 1px solid;
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.alert-success {
    background-color: var(--success-50);
    border-color: var(--success-200);
    color: var(--success-800);
}

.alert-danger {
    background-color: var(--danger-50);
    border-color: var(--danger-200);
    color: var(--danger-800);
}

.alert-warning {
    background-color: var(--warning-50);
    border-color: var(--warning-200);
    color: var(--warning-800);
}

.alert-info {
    background-color: var(--info-50);
    border-color: var(--info-200);
    color: var(--info-800);
}

.alert-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-message {
    font-size: 0.875rem;
}

/* ============================================
   13. LOADING STATES
   ============================================ */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    border-top-color: var(--primary-600);
    animation: spin 0.8s linear infinite;
}

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

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

/* ============================================
   14. UTILITIES
   ============================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--gray-500);
}

.text-primary {
    color: var(--primary-600);
}

.text-success {
    color: var(--success-600);
}

.text-danger {
    color: var(--danger-600);
}

.text-warning {
    color: var(--warning-600);
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: var(--spacing-sm);
}

.gap-4 {
    gap: var(--spacing-md);
}

.mt-2 {
    margin-top: var(--spacing-sm);
}

.mt-4 {
    margin-top: var(--spacing-md);
}

.mb-2 {
    margin-bottom: var(--spacing-sm);
}

.mb-4 {
    margin-bottom: var(--spacing-md);
}

/* ============================================
   15. RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .modern-navbar {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .navbar-menu {
        flex-direction: column;
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-container {
        padding: var(--spacing-md);
    }

    .table-container {
        overflow-x: auto;
    }

    .modal {
        width: 95%;
    }

    .user-info-nav {
        display: none;
    }

    /* Access code dashboard header - stack on mobile */
    .access-header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    /* Table header - stack vertically */
    .table-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: var(--spacing-md);
    }

    .table-title {
        text-align: center;
        font-size: 1rem;
    }

    /* Table actions - wrap and center */
    .table-actions {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    /* Slots badge */
    .slots-badge {
        width: 100%;
        justify-content: center;
    }

    /* Toggle container - full width */
    .table-actions > div {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    /* Submit button - full width on mobile */
    .table-actions .btn-primary {
        width: 100%;
        justify-content: center;
    }

    /* Pagination - better for touch */
    #paginationControls {
        padding: 1rem;
    }

    #paginationControls > div {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    #paginationControls .btn {
        padding: 0.5rem 1rem;
        min-height: 44px;
    }

    #pageNumbers {
        flex-wrap: wrap;
        justify-content: center;
    }

    #pageNumbers button {
        min-width: 44px;
        min-height: 44px;
    }

    /* Table - horizontal scroll indicator */
    .modern-table {
        min-width: 600px;
    }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {
    .dashboard-container {
        padding: var(--spacing-sm);
    }

    /* Hide toggle labels on very small screens */
    .table-actions label span,
    .table-actions label:not(:has(.toggle-switch)) {
        font-size: 0.75rem;
    }

    /* Smaller table title */
    .table-title {
        font-size: 0.9rem;
    }

    /* Stack pagination buttons */
    #paginationControls > div > div:last-child {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ============================================
   16. PROFILE PAGE SPECIFIC
   ============================================ */
.profile-header {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    padding: var(--spacing-2xl);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-xl);
    color: white;
    text-align: center;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-full);
    background: white;
    color: var(--primary-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 auto var(--spacing-md);
    border: 4px solid rgba(255, 255, 255, 0.3);
}

.profile-name {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.profile-email {
    font-size: 1rem;
    opacity: 0.9;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-xl);
}

/* ============================================
   17. EMPTY STATES
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--spacing-3xl) var(--spacing-xl);
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--gray-300);
    margin-bottom: var(--spacing-md);
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--spacing-sm);
}

.empty-state-description {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: var(--spacing-lg);
}

/* ============================================
   18. SCORE DISPLAYS
   ============================================ */
.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.score-value.good {
    color: var(--success-600);
}

.score-value.medium {
    color: var(--warning-600);
}

.score-value.bad {
    color: var(--danger-600);
}

.score-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   19. DARK MODE TOGGLE
   ============================================ */
.theme-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    padding: 0.375rem;
    cursor: pointer;
    transition: all var(--transition-base);
}

.theme-toggle:hover {
    background: var(--gray-200);
}

.theme-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    transition: all var(--transition-base);
    font-size: 1rem;
}

.theme-toggle-icon.active {
    background: white;
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .theme-toggle {
    background: var(--gray-200);
}

[data-theme="dark"] .theme-toggle:hover {
    background: var(--gray-300);
}

[data-theme="dark"] .theme-toggle-icon.active {
    background: var(--gray-100);
}

.theme-toggle .sun-icon {
    color: var(--warning-600);
}

.theme-toggle .moon-icon {
    color: var(--info-600);
}

/* ============================================
   20. DARK MODE OVERRIDES
   ============================================ */
/* Navigation */
[data-theme="dark"] .modern-navbar {
    background: var(--gray-100);
}

/* Stat Cards */
[data-theme="dark"] .stat-card {
    background: var(--gray-100);
}

/* Table Container & Rows */
[data-theme="dark"] .table-container {
    background: var(--gray-100);
}

[data-theme="dark"] .modern-table tbody tr {
    background-color: var(--gray-100);
}

[data-theme="dark"] .modern-table tbody tr:hover {
    background-color: var(--gray-200);
}

/* Cards */
[data-theme="dark"] .card {
    background: var(--gray-100);
}

/* Modals */
[data-theme="dark"] .modal {
    background: var(--gray-100);
}

/* Form Inputs */
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea {
    background-color: var(--gray-100);
    border-color: var(--gray-300);
}

/* Outline Button */
[data-theme="dark"] .btn-outline {
    background-color: var(--gray-100);
}

/* Status Refunded Badge */
.status-refunded {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c6cb;
}

[data-theme="dark"] .status-refunded {
    background-color: #4a1d24;
    color: #fca5a5;
    border-color: #7f1d1d;
}

/* Primary text color - brighter for dark mode */
[data-theme="dark"] .text-primary {
    color: #60a5fa;
}

[data-theme="dark"] .font-semibold.text-primary {
    color: #60a5fa;
}

/* Toggle labels and general label text - brighter for dark mode */
[data-theme="dark"] label {
    color: #f4f4f5 !important;
}

/* Table header text */
[data-theme="dark"] .table-header {
    color: var(--gray-900);
}

[data-theme="dark"] .table-title {
    color: var(--gray-900);
}

/* Pagination text - brighter for dark mode */
[data-theme="dark"] #paginationControls {
    color: #f4f4f5;
}

[data-theme="dark"] #paginationControls span {
    color: #f4f4f5;
}

[data-theme="dark"] .btn-outline {
    color: #f4f4f5;
    border-color: var(--gray-400);
}

/* Page number buttons */
[data-theme="dark"] #pageNumbers button {
    color: #f4f4f5;
}

/* Primary button - vibrant blue in dark mode */
[data-theme="dark"] .btn-primary {
    background-color: #2563EB;
}

[data-theme="dark"] .btn-primary:hover:not(:disabled) {
    background-color: #1d4ed8;
}

/* Toggle switch - match primary button color in dark mode */
[data-theme="dark"] .toggle-switch input:checked + .toggle-slider {
    background-color: #2563EB;
}

/* Download/Success button - softer green in dark mode */
[data-theme="dark"] .btn-success {
    background-color: #059669;
}

[data-theme="dark"] .btn-success:hover:not(:disabled) {
    background-color: #047857;
}
