/**
 * Design System Variables
 * Centralized design tokens for consistent styling
 *
 * Usage: var(--color-primary)
 */

:root {
    /* ========================================
     * Color Palette
     * ======================================== */

    /* Primary Colors */
    --color-primary: #3498db;
    --color-primary-dark: #2980b9;
    --color-primary-light: #5dade2;
    --color-primary-bg: rgba(52, 152, 219, 0.1);
    --color-primary-border: rgba(52, 152, 219, 0.3);

    /* Secondary Colors */
    --color-secondary: #2c3e50;
    --color-secondary-dark: #1a252f;
    --color-secondary-light: #34495e;

    /* Accent Colors */
    --color-accent: #9b59b6;
    --color-accent-dark: #8e44ad;
    --color-accent-light: #a569bd;

    /* Status Colors */
    --color-success: #27ae60;
    --color-success-dark: #229954;
    --color-success-light: #2ecc71;
    --color-success-bg: rgba(39, 174, 96, 0.1);

    --color-warning: #f39c12;
    --color-warning-dark: #d68910;
    --color-warning-light: #f5b041;
    --color-warning-bg: rgba(243, 156, 18, 0.1);

    --color-error: #e74c3c;
    --color-error-dark: #c0392b;
    --color-error-light: #ec7063;
    --color-error-bg: rgba(231, 76, 60, 0.1);

    --color-info: #3498db;
    --color-info-bg: rgba(52, 152, 219, 0.1);

    /* Neutral Colors - WCAG AA compliant (4.5:1 min for normal text) */
    --color-text-primary: #2c3e50;    /* 12.6:1 on white */
    --color-text-secondary: #555555;  /* 7.5:1 on white - enhanced from #5a6c6d */
    --color-text-muted: #666666;      /* 5.7:1 on white - enhanced from #6b7b7c */
    --color-text-light: #595959;      /* 7.0:1 on white - enhanced from #666666 */

    --color-background: #f8f9fa;
    --color-background-dark: #ecf0f1;
    --color-surface: #ffffff;
    --color-surface-hover: #f5f5f5;

    --color-border: #e0e0e0;
    --color-border-light: #c7c7c7;    /* WCAG 1.4.11: 3:1 contrast for UI components (was #f0f0f0) */
    --color-border-dark: #bbb;        /* Enhanced for better visibility */

    /* Overlay */
    --color-overlay: rgba(0, 0, 0, 0.5);
    --color-overlay-light: rgba(0, 0, 0, 0.3);

    /* ========================================
     * Typography
     * ======================================== */

    /* Font Family */
    --font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-family-mono: 'SF Mono', Monaco, 'Courier New', monospace;

    /* Font Sizes */
    --font-size-xs: 0.75rem;    /* 12px */
    --font-size-sm: 0.85rem;    /* 13.6px */
    --font-size-base: 1rem;     /* 16px */
    --font-size-md: 1.1rem;     /* 17.6px */
    --font-size-lg: 1.25rem;    /* 20px */
    --font-size-xl: 1.5rem;     /* 24px */
    --font-size-2xl: 2rem;      /* 32px */
    --font-size-3xl: 3rem;      /* 48px */

    /* Font Weights */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Line Heights */
    --line-height-tight: 1.25;
    --line-height-base: 1.5;
    --line-height-relaxed: 1.75;

    /* ========================================
     * Spacing
     * ======================================== */

    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-base: 16px;
    --spacing-lg: 20px;
    --spacing-xl: 24px;
    --spacing-2xl: 32px;
    --spacing-3xl: 40px;
    --spacing-4xl: 60px;

    /* ========================================
     * Border Radius
     * ======================================== */

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* ========================================
     * Shadows
     * ======================================== */

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 10px 40px rgba(0, 0, 0, 0.15);
    --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.25);

    --shadow-primary: 0 4px 12px rgba(52, 152, 219, 0.15);
    --shadow-success: 0 4px 12px rgba(39, 174, 96, 0.15);
    --shadow-error: 0 4px 12px rgba(231, 76, 60, 0.15);

    /* ========================================
     * Transitions
     * ======================================== */

    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* ========================================
     * Z-Index
     * ======================================== */

    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 9000;
    --z-modal: 10000;
    --z-popover: 10050;
    --z-tooltip: 10075;
    --z-toast: 10100;

    /* ========================================
     * Layout
     * ======================================== */

    --container-max-width: 1400px;
    --container-narrow: 900px;
    --container-wide: 1200px;

    /* Header */
    --header-height: 64px;

    /* Sidebar */
    --sidebar-width-collapsed: 72px;
    --sidebar-width-expanded: 260px;
    --sidebar-width: var(--sidebar-width-collapsed); /* Default state */

    /* Main content offset */
    --main-offset-top: var(--header-height);
    --main-offset-left: var(--sidebar-width-collapsed);

    /* Touch targets (WCAG 2.5.5 Target Size) */
    --touch-target-min: 44px;

    /* ========================================
     * Breakpoints
     * ======================================== */

    /* Standard breakpoints - USE THESE VALUES ONLY */
    --breakpoint-mobile: 767px;   /* max-width for mobile */
    --breakpoint-tablet: 1023px;  /* max-width for tablet */
    --breakpoint-desktop: 1024px; /* min-width for desktop */

    /* Mobile: 0 - 767px */
    /* Tablet: 768px - 1023px */
    /* Desktop: 1024px+ */
}

/* ========================================
 * Dark Mode (future)
 * ======================================== */
/*
@media (prefers-color-scheme: dark) {
    :root {
        --color-background: #1a1a2e;
        --color-surface: #16213e;
        --color-text-primary: #e4e6eb;
        --color-text-secondary: #b0b3b8;
        --color-border: #3a3b3c;
    }
}
*/

/* ========================================
 * Utility Classes
 * ======================================== */

/* Text Colors */
.text-primary { color: var(--color-primary) !important; }
.text-secondary { color: var(--color-text-secondary) !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-error { color: var(--color-error) !important; }
.text-muted { color: var(--color-text-muted) !important; }

/* Background Colors */
.bg-primary { background-color: var(--color-primary-bg) !important; }
.bg-success { background-color: var(--color-success-bg) !important; }
.bg-warning { background-color: var(--color-warning-bg) !important; }
.bg-error { background-color: var(--color-error-bg) !important; }
.bg-surface { background-color: var(--color-surface) !important; }

/* Spacing Utilities */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--spacing-xs) !important; }
.mt-2 { margin-top: var(--spacing-sm) !important; }
.mt-3 { margin-top: var(--spacing-md) !important; }
.mt-4 { margin-top: var(--spacing-base) !important; }
.mt-5 { margin-top: var(--spacing-lg) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--spacing-xs) !important; }
.mb-2 { margin-bottom: var(--spacing-sm) !important; }
.mb-3 { margin-bottom: var(--spacing-md) !important; }
.mb-4 { margin-bottom: var(--spacing-base) !important; }
.mb-5 { margin-bottom: var(--spacing-lg) !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: var(--spacing-xs) !important; }
.p-2 { padding: var(--spacing-sm) !important; }
.p-3 { padding: var(--spacing-md) !important; }
.p-4 { padding: var(--spacing-base) !important; }
.p-5 { padding: var(--spacing-lg) !important; }

/* Display Utilities */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

/* Flex Utilities */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-wrap { flex-wrap: wrap !important; }
.flex-1 { flex: 1 !important; }
.gap-1 { gap: var(--spacing-xs) !important; }
.gap-2 { gap: var(--spacing-sm) !important; }
.gap-3 { gap: var(--spacing-md) !important; }
.gap-4 { gap: var(--spacing-base) !important; }

/* Text Utilities */
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.font-bold { font-weight: var(--font-weight-bold) !important; }
.font-medium { font-weight: var(--font-weight-medium) !important; }
.text-sm { font-size: var(--font-size-sm) !important; }
.text-lg { font-size: var(--font-size-lg) !important; }

/* Border Utilities */
.rounded { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

/* Shadow Utilities */
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-none { box-shadow: none !important; }

/* Transition */
.transition { transition: var(--transition-base); }
.transition-fast { transition: var(--transition-fast); }
.transition-slow { transition: var(--transition-slow); }

/* Cursor */
.cursor-pointer { cursor: pointer !important; }
.cursor-default { cursor: default !important; }

/* Visibility */
.visible { visibility: visible !important; }
.invisible { visibility: hidden !important; }
.opacity-0 { opacity: 0 !important; }
.opacity-50 { opacity: 0.5 !important; }
.opacity-100 { opacity: 1 !important; }

/* Overflow */
.overflow-hidden { overflow: hidden !important; }
.overflow-auto { overflow: auto !important; }
.overflow-scroll { overflow: scroll !important; }

/* Truncate text */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
 * Touch Target Minimum Size (WCAG 2.5.5)
 * Minimum 44x44px for all interactive elements
 * ======================================== */

/* Ensure minimum touch target size for buttons and interactive elements */
button,
[role="button"],
.btn,
.btn-primary,
.btn-secondary,
.btn-outline,
.notification-close,
.modal-close,
.chat-action-btn,
.action-btn,
.icon-btn {
    min-width: 44px;
    min-height: 44px;
}

/* Icon-only buttons that need touch target but should look smaller */
.icon-btn,
.notification-close,
.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

/* Ensure links in touch contexts have adequate size */
.touch-target {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
 * Offline Indicator
 * ======================================== */

.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--color-warning);
    color: #000;
    text-align: center;
    padding: 12px 16px;
    font-weight: 600;
    z-index: var(--z-toast);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-banner.show {
    transform: translateY(0);
}

.offline-banner.online {
    background: var(--color-success);
    color: #fff;
}

/* Push content down when offline banner is shown */
body.is-offline .main-header {
    top: 44px;
}

body.is-offline .sidebar {
    top: calc(var(--header-height) + 44px);
}

/* ========================================
 * Focus Trap Utilities for Modals
 * ======================================== */

/* Visible focus indicator for keyboard navigation */
:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* Enhanced focus for buttons */
button:focus-visible,
.btn:focus-visible,
[role="button"]:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.3);
}

/* Focus for form inputs */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 0;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* Focus for links */
a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Focus for interactive cards */
.job-card:focus-visible,
.driver-search-card:focus-visible,
[tabindex="0"]:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.2);
}

/* High contrast focus for dark backgrounds */
.btn-primary:focus-visible,
.page-header-blue a:focus-visible,
.page-header-blue button:focus-visible {
    outline-color: white;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.4);
}

/* Modal focus trap container */
.modal[aria-modal="true"] {
    /* Prevent background scrolling */
}

body.modal-open {
    overflow: hidden;
}

/* Skip to content link enhancement */
.skip-link:focus {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 10000;
    padding: 16px 24px;
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
}

/* ========================================
 * Empty State Component
 * Consistent empty states across the app
 * ======================================== */

.empty-state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    min-height: 200px;
}

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

.empty-state-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 8px 0;
}

.empty-state-message {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    margin: 0 0 24px 0;
    max-width: 320px;
    line-height: 1.5;
}

.empty-state-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.empty-state-actions .btn {
    min-width: 180px;
}

.empty-state-hint {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 16px;
}

.empty-state-hint a {
    color: var(--color-primary);
    text-decoration: none;
}

.empty-state-hint a:hover {
    text-decoration: underline;
}

/* Compact variant for smaller spaces */
.empty-state-compact {
    padding: 24px 16px;
    min-height: 120px;
}

.empty-state-compact .empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.empty-state-compact .empty-state-title {
    font-size: 1rem;
}

.empty-state-compact .empty-state-message {
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* ========================================
 * Loading States & Spinners
 * Consistent loading indicators
 * ======================================== */

/* Inline Loading Spinner - for use within components */
.loading-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

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

.loading-spinner-text {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
}

/* Size variants */
.loading-spinner.loading-sm .loading-spinner-icon {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.loading-spinner.loading-lg .loading-spinner-icon {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

/* Loading Container - centered loading state */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 200px;
    gap: 16px;
}

.loading-container .loading-spinner-icon {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

.loading-container .loading-spinner-text {
    font-size: 1rem;
}

/* Skeleton Loading - for content placeholders */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-background-dark) 25%,
        var(--color-background) 50%,
        var(--color-background-dark) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 1em;
    margin-bottom: 8px;
}

.skeleton-text.skeleton-title {
    height: 1.5em;
    width: 60%;
}

.skeleton-text.skeleton-short {
    width: 40%;
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-md);
}

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

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

/* Button Loading State */
.btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: loading-spin 0.8s linear infinite;
}

.btn-secondary.is-loading::after,
.btn-outline.is-loading::after {
    border-color: var(--color-border);
    border-top-color: var(--color-primary);
}

/* Improve global spinner visibility */
.global-spinner {
    backdrop-filter: blur(2px);
}

.global-spinner .spinner {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* ========================================
 * Form Validation States
 * Real-time validation feedback
 * ======================================== */

/* Error state */
.field-error {
    border-color: var(--color-error) !important;
    background-color: rgba(220, 53, 69, 0.05);
}

.field-error:focus {
    border-color: var(--color-error) !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15) !important;
    outline: none;
}

/* Error message */
.field-error-message {
    display: block;
    color: var(--color-error);
    font-size: 0.85rem;
    margin-top: 6px;
    padding-left: 2px;
    animation: fieldErrorAppear 0.2s ease-out;
}

.field-error-message::before {
    content: '⚠ ';
}

@keyframes fieldErrorAppear {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Success state */
.field-success {
    border-color: var(--color-success) !important;
    background-color: rgba(40, 167, 69, 0.05);
}

.field-success:focus {
    border-color: var(--color-success) !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.15) !important;
}

/* Add checkmark icon to success fields */
.form-group:has(.field-success)::after,
.field-success + .field-success-icon {
    content: '✓';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-success);
    font-weight: bold;
}

/* Form group needs relative positioning for icons */
.form-group {
    position: relative;
}

/* Adjust input padding when showing success icon */
.form-group:has(.field-success) input,
.form-group:has(.field-success) select {
    padding-right: 40px;
}

/* Validation summary for form-level errors */
.validation-summary {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid var(--color-error);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}

.validation-summary-title {
    color: var(--color-error);
    font-weight: 600;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.validation-summary-title::before {
    content: '⚠';
}

.validation-summary-list {
    margin: 0;
    padding-left: 20px;
    color: var(--color-text-primary);
}

.validation-summary-list li {
    margin-bottom: 4px;
}

/* Required field indicator */
.required-indicator {
    color: var(--color-error);
    margin-left: 4px;
}

label.required::after {
    content: ' *';
    color: var(--color-error);
}

/* Password strength indicator */
.password-strength {
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 2px;
}

.password-strength-bar.weak {
    width: 25%;
    background: var(--color-error);
}

.password-strength-bar.fair {
    width: 50%;
    background: var(--color-warning);
}

.password-strength-bar.good {
    width: 75%;
    background: #ffc107;
}

.password-strength-bar.strong {
    width: 100%;
    background: var(--color-success);
}

.password-strength-text {
    font-size: 0.8rem;
    margin-top: 4px;
    color: var(--color-text-secondary);
}

/* Character counter */
.char-counter {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-align: right;
    margin-top: 4px;
}

.char-counter.warning {
    color: var(--color-warning);
}

.char-counter.error {
    color: var(--color-error);
}

/* ========================================
 * Error State with Retry
 * For API failures and network errors
 * ======================================== */

.error-state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    min-height: 200px;
    background: rgba(220, 53, 69, 0.05);
    border: 1px solid rgba(220, 53, 69, 0.2);
    border-radius: var(--radius-md);
    margin: 16px 0;
}

.error-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.error-state-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-error);
    margin: 0 0 8px 0;
}

.error-state-message {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    margin: 0 0 20px 0;
    max-width: 400px;
    line-height: 1.5;
}

.error-state-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-retry {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-retry:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

.btn-retry:active {
    transform: translateY(0);
}

.btn-retry.is-retrying {
    pointer-events: none;
    opacity: 0.7;
}

.btn-retry.is-retrying .retry-icon {
    animation: spin 1s linear infinite;
}

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

/* Compact error state for inline use */
.error-state-compact {
    padding: 24px 16px;
    min-height: auto;
    flex-direction: row;
    gap: 16px;
}

.error-state-compact .error-state-icon {
    font-size: 2rem;
    margin-bottom: 0;
}

.error-state-compact .error-state-content {
    text-align: left;
    flex: 1;
}

.error-state-compact .error-state-title {
    font-size: 1rem;
}

.error-state-compact .error-state-message {
    font-size: 0.9rem;
    margin-bottom: 12px;
}

/* ========================================
 * Utility Classes
 * Common helpers to replace inline styles
 * ======================================== */

/* Display utilities */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-grid { display: grid !important; }

/* Visibility */
.visible { visibility: visible !important; }
.invisible { visibility: hidden !important; }

/* Flex utilities */
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.justify-start { justify-content: flex-start !important; }
.justify-end { justify-content: flex-end !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-around { justify-content: space-around !important; }
.align-start { align-items: flex-start !important; }
.align-end { align-items: flex-end !important; }
.align-center { align-items: center !important; }
.align-stretch { align-items: stretch !important; }
.flex-1 { flex: 1 !important; }
.flex-grow-0 { flex-grow: 0 !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.gap-xs { gap: 4px !important; }
.gap-sm { gap: 8px !important; }
.gap-md { gap: 12px !important; }
.gap-lg { gap: 16px !important; }
.gap-xl { gap: 24px !important; }

/* Text utilities */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-primary { color: var(--color-primary) !important; }
.text-secondary { color: var(--color-text-secondary) !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-error { color: var(--color-error) !important; }
.text-muted { color: var(--color-text-tertiary) !important; }
.text-white { color: white !important; }
.font-bold { font-weight: 600 !important; }
.font-normal { font-weight: 400 !important; }
.text-sm { font-size: 0.875rem !important; }
.text-base { font-size: 1rem !important; }
.text-lg { font-size: 1.125rem !important; }
.text-xl { font-size: 1.25rem !important; }

/* Background utilities */
.bg-primary { background-color: var(--color-primary) !important; }
.bg-secondary { background-color: var(--color-secondary) !important; }
.bg-success { background-color: var(--color-success) !important; }
.bg-warning { background-color: var(--color-warning) !important; }
.bg-error { background-color: var(--color-error) !important; }
.bg-white { background-color: white !important; }
.bg-light { background-color: var(--color-bg-secondary) !important; }
.bg-transparent { background-color: transparent !important; }

/* Spacing utilities */
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.ml-0 { margin-left: 0 !important; }
.mr-0 { margin-right: 0 !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }
.mt-sm { margin-top: 8px !important; }
.mt-md { margin-top: 12px !important; }
.mt-lg { margin-top: 16px !important; }
.mb-sm { margin-bottom: 8px !important; }
.mb-md { margin-bottom: 12px !important; }
.mb-lg { margin-bottom: 16px !important; }
.p-0 { padding: 0 !important; }
.p-sm { padding: 8px !important; }
.p-md { padding: 12px !important; }
.p-lg { padding: 16px !important; }
.px-sm { padding-left: 8px !important; padding-right: 8px !important; }
.px-md { padding-left: 12px !important; padding-right: 12px !important; }
.px-lg { padding-left: 16px !important; padding-right: 16px !important; }
.py-sm { padding-top: 8px !important; padding-bottom: 8px !important; }
.py-md { padding-top: 12px !important; padding-bottom: 12px !important; }
.py-lg { padding-top: 16px !important; padding-bottom: 16px !important; }

/* Border utilities */
.border-0 { border: none !important; }
.border { border: 1px solid var(--color-border) !important; }
.border-primary { border-color: var(--color-primary) !important; }
.rounded { border-radius: var(--radius-md) !important; }
.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-full { border-radius: 50% !important; }

/* Width/height utilities */
.w-full { width: 100% !important; }
.w-auto { width: auto !important; }
.h-full { height: 100% !important; }
.h-auto { height: auto !important; }
.min-h-0 { min-height: 0 !important; }

/* Cursor utilities */
.cursor-pointer { cursor: pointer !important; }
.cursor-default { cursor: default !important; }
.cursor-not-allowed { cursor: not-allowed !important; }

/* Overflow utilities */
.overflow-hidden { overflow: hidden !important; }
.overflow-auto { overflow: auto !important; }
.overflow-scroll { overflow: scroll !important; }
.overflow-x-auto { overflow-x: auto !important; }
.overflow-y-auto { overflow-y: auto !important; }

/* Position utilities */
.relative { position: relative !important; }
.absolute { position: absolute !important; }
.fixed { position: fixed !important; }
.sticky { position: sticky !important; }

/* Shadow utilities */
.shadow-none { box-shadow: none !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

/* Opacity utilities */
.opacity-0 { opacity: 0 !important; }
.opacity-50 { opacity: 0.5 !important; }
.opacity-75 { opacity: 0.75 !important; }
.opacity-100 { opacity: 1 !important; }

/* Transition utilities */
.transition { transition: all 0.2s ease !important; }
.transition-fast { transition: all 0.1s ease !important; }
.transition-slow { transition: all 0.3s ease !important; }

/* Tab active state classes */
.tab-active {
    background: var(--color-primary) !important;
    color: white !important;
}

.tab-inactive {
    background: transparent !important;
    color: var(--color-text-secondary) !important;
}

/* ========================================
 * Forced Colors Mode (Windows High Contrast)
 * Ensures proper visibility in high contrast mode
 * ======================================== */
@media (forced-colors: active) {
    /* Use system colors for buttons */
    .btn, button {
        border: 2px solid ButtonText !important;
        background: ButtonFace !important;
        color: ButtonText !important;
        forced-color-adjust: none;
    }

    .btn:hover, button:hover {
        background: Highlight !important;
        color: HighlightText !important;
        border-color: Highlight !important;
    }

    .btn:focus, button:focus {
        outline: 3px solid Highlight !important;
        outline-offset: 2px !important;
    }

    .btn:disabled, button:disabled {
        opacity: 0.5;
        border-color: GrayText !important;
        color: GrayText !important;
    }

    /* Links */
    a {
        color: LinkText !important;
        text-decoration: underline !important;
    }

    a:visited {
        color: VisitedText !important;
    }

    a:focus {
        outline: 3px solid Highlight !important;
        outline-offset: 2px !important;
    }

    /* Form inputs */
    input, select, textarea {
        border: 2px solid ButtonText !important;
        background: Field !important;
        color: FieldText !important;
    }

    input:focus, select:focus, textarea:focus {
        outline: 3px solid Highlight !important;
        outline-offset: 2px !important;
    }

    input:disabled, select:disabled, textarea:disabled {
        border-color: GrayText !important;
        color: GrayText !important;
    }

    /* Cards and containers */
    .card, .modal-content, .dropdown-menu {
        border: 2px solid ButtonText !important;
        background: Canvas !important;
    }

    /* Focus states */
    :focus-visible {
        outline: 3px solid Highlight !important;
        outline-offset: 2px !important;
    }

    /* Status indicators */
    .badge, .status-badge {
        border: 2px solid currentColor !important;
        forced-color-adjust: none;
    }

    /* Icons - ensure visibility */
    svg {
        forced-color-adjust: auto;
    }

    /* Skip link */
    .skip-link:focus {
        background: Highlight !important;
        color: HighlightText !important;
    }

    /* Selection */
    ::selection {
        background: Highlight !important;
        color: HighlightText !important;
    }

    /* Checkboxes and radios */
    input[type="checkbox"],
    input[type="radio"] {
        forced-color-adjust: auto;
    }

    /* Progress and loading indicators */
    .spinner, .loading-spinner-icon {
        border-color: GrayText !important;
        border-top-color: Highlight !important;
    }

    /* Notifications and alerts */
    .notification, .alert {
        border: 2px solid currentColor !important;
    }

    /* Tables */
    table, th, td {
        border: 1px solid ButtonText !important;
    }

    th {
        background: ButtonFace !important;
    }

    tr:nth-child(even) {
        background: Canvas !important;
    }

    /* Hide decorative elements */
    .decorative, [aria-hidden="true"]:not(svg) {
        forced-color-adjust: auto;
    }
}

/* ========================================
 * Focus Visible - Keyboard Navigation
 * ======================================== */

/* Global focus-visible for keyboard users */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Skip to main content link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-primary);
    color: white;
    padding: 8px 16px;
    z-index: 10000;
    text-decoration: none;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
}
