/* Accessibility Enhancements (2026 Standards) */
/* WCAG 2.2 AA Compliance */

/* ==========================================================================
   Skip Link - For keyboard users to bypass navigation
   ========================================================================== */

.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--parking-primary, #0066cc);
    color: white;
    padding: 12px 24px;
    border-radius: var(--parking-radius, 8px);
    font-weight: var(--font-weight-semibold, 600);
    text-decoration: none;
    z-index: 10000;
    transition: top 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.skip-link:focus {
    top: 16px;
    outline: 3px solid var(--parking-primary-dark, #004499);
    outline-offset: 2px;
}

/* ==========================================================================
   Screen Reader Only Content
   ========================================================================== */

.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;
}

/* Make sr-only content visible on focus (for skip links) */
.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: inherit;
}

/* ==========================================================================
   Focus Indicators - Enhanced for 2026
   ========================================================================== */

/* Global focus styles */
*:focus-visible {
    outline: 3px solid var(--parking-primary, #0066cc);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Enhanced focus for keyboard users */
.using-keyboard *:focus-visible {
    outline: 3px solid var(--parking-primary, #0066cc);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px var(--parking-focus-ring, rgba(0, 102, 204, 0.3));
}

/* Focus within for interactive containers */
.card:focus-within,
.city-card:focus-within {
    box-shadow: 0 0 0 3px var(--parking-focus-ring, rgba(0, 102, 204, 0.3)),
                var(--parking-shadow-lg);
}

/* ==========================================================================
   Reduced Motion Support
   ========================================================================== */

.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

/* ==========================================================================
   High Contrast Mode Support
   ========================================================================== */

.high-contrast {
    --parking-border: currentColor;
    --parking-text-muted: var(--parking-text-secondary);
}

.high-contrast .city-card,
.high-contrast .card {
    border-width: 3px;
}

.high-contrast a {
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

.high-contrast button,
.high-contrast .btn {
    border: 2px solid currentColor;
}

/* ==========================================================================
   Accessible Modal Dialog
   ========================================================================== */

.accessible-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal, 500);
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--parking-card-bg);
    border-radius: var(--parking-radius-lg);
    padding: var(--parking-spacing-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--parking-shadow-2xl);
    z-index: 1;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--parking-spacing);
    gap: 16px;
}

.modal-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--parking-text-primary);
    margin: 0;
    flex: 1;
}

.modal-close {
    background: transparent;
    border: 2px solid var(--parking-border);
    border-radius: var(--parking-radius);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--parking-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--parking-hover-overlay);
    color: var(--parking-text-primary);
    border-color: var(--parking-primary);
}

.modal-close:focus-visible {
    outline: 3px solid var(--parking-primary);
    outline-offset: 2px;
}

.modal-body {
    color: var(--parking-text-secondary);
    line-height: var(--line-height-normal);
}

/* Prevent body scroll when modal is open */
.modal-open {
    overflow: hidden;
}

/* ==========================================================================
   Accessible Tooltip
   ========================================================================== */

.accessible-tooltip {
    position: absolute;
    background: var(--parking-text-primary);
    color: var(--parking-card-bg);
    padding: 8px 12px;
    border-radius: var(--parking-radius-sm);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    max-width: 250px;
    z-index: var(--z-tooltip, 700);
    box-shadow: var(--parking-shadow-md);
}

.accessible-tooltip::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--parking-text-primary);
    transform: rotate(45deg);
}

/* Tooltip positioning variants */
.accessible-tooltip[data-position='top']::after {
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
}

.accessible-tooltip[data-position='bottom']::after {
    top: -4px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
}

/* ==========================================================================
   Live Announcer (Screen Reader Updates)
   ========================================================================== */

#live-announcer {
    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 Sizes (WCAG 2.2 - Minimum 44x44px)
   ========================================================================== */

@media (pointer: coarse) {
    button,
    .btn,
    input[type='button'],
    input[type='submit'],
    input[type='checkbox'],
    input[type='radio'],
    select,
    [role='button'] {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ==========================================================================
   Text Spacing (WCAG 2.1 - Support for 200% line height)
   ========================================================================== */

@media (min-width: 768px) {
    :root {
        --line-height-normal: 1.6;
    }
}

/* ==========================================================================
   Print Accessibility
   ========================================================================== */

@media print {
    .skip-link,
    .accessible-modal,
    .accessible-tooltip {
        display: none !important;
    }

    /* Ensure links are identifiable in print */
    a[href]::after {
        content: ' [' attr(href) ']';
        font-size: 0.8em;
        color: #666;
    }

    /* Remove interactive states */
    *:focus {
        outline: none;
    }
}

/* ==========================================================================
   Dark Mode Accessibility
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .skip-link {
        background: var(--parking-primary-light, #4d94ff);
        box-shadow: 0 4px 12px rgba(77, 148, 255, 0.4);
    }

    .skip-link:focus {
        outline-color: var(--parking-primary-light, #4d94ff);
    }

    .modal-overlay {
        background: rgba(0, 0, 0, 0.8);
    }
}

/* ==========================================================================
   Error State Accessibility
   ========================================================================== */

.input-error {
    border-color: var(--parking-error, #ef4444) !important;
}

.input-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

/* Error message styling */
.error-message {
    color: var(--parking-error, #ef4444);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.error-message::before {
    content: '⚠️';
    font-size: 14px;
}

/* ==========================================================================
   Success State Accessibility
   ========================================================================== */

.success-message {
    color: var(--parking-success, #10b981);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.success-message::before {
    content: '✓';
    font-size: 16px;
    font-weight: bold;
}
