/* 
 * WCAG 2.1 AA Accessibility Enhancements
 * Voor Stadjerspas Project
 */

/* ========================================
   FOCUS MANAGEMENT & KEYBOARD NAVIGATION
   ======================================== */

/* High-contrast focus indicators */
*:focus-visible {
    outline: 2px solid #0066cc !important;
    outline-offset: 2px !important;
    border-radius: 2px;
}

/* Enhanced focus for interactive elements */
a:focus-visible,
button:focus-visible,
.btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.3) !important;
}

/* Skip links styling */
.skip-link {
    position: absolute;
    top: -40px;
    left: 8px;
    background: #000;
    color: #fff;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10000;
    font-weight: 600;
    font-size: 14px;
    transition: top 0.2s;
}

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

/* ========================================
   COLOR CONTRAST IMPROVEMENTS
   ======================================== */

/* Ensure sufficient contrast for muted text - improved from #6c757d to meet WCAG AA */
.text-muted {
    color: #495057 !important;
    /* Ensures 7.0:1 contrast ratio on white background */
}

/* Improve card text contrast */
.card-text.text-muted {
    color: #495057 !important;
}

/* Price display contrast improvements */
.price-display .regular-price {
    color: #495057 !important; /* Improved from secondary color */
}

/* Age group indicators contrast */
.age-group {
    color: #495057 !important; /* Improved from secondary color */
}

/* Improve badge contrast */
.badge.bg-secondary {
    background-color: #343a40 !important; /* Darker for better contrast */
    color: #fff !important;
}

/* Category badges - ensure all have sufficient contrast */
.category-badge {
    font-weight: 700 !important; /* Bold for better readability */
}

/* Specific category contrast improvements */
.category-1 { background-color: #bbdefb; color: #0d47a1; } /* Improved contrast */
.category-2 { background-color: #c8e6c9; color: #1b5e20; } /* Improved contrast */
.category-3 { background-color: #ffcc80; color: #b71c1c; } /* Erop uit - activiteiten - improved contrast from orange/red */
.category-4 { background-color: #e1bee7; color: #4a148c; } /* Improved contrast */
.category-5 { background-color: #b2dfdb; color: #004d40; } /* Improved contrast */
.category-6 { background-color: #fff59d; color: #b71c1c; } /* Eten & drinken - improved contrast from yellow/red */
.category-7 { background-color: #f8bbd9; color: #880e4f; } /* Improved contrast */
.category-8 { background-color: #b3e5fc; color: #01579b; } /* Improved contrast */
.category-9 { background-color: #dcedc8; color: #33691e; } /* Improved contrast */
.category-10 { background-color: #e0e0e0; color: #212121; } /* Improved contrast */

/* Alert improvements */
.alert {
    border-left: 4px solid;
}

.alert-info {
    border-left-color: #0dcaf0;
}

.alert-success {
    border-left-color: #198754;
}

.alert-warning {
    border-left-color: #ffc107;
}

.alert-danger {
    border-left-color: #dc3545;
}

/* ========================================
   FORM ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* Required field indicators */
label:has(+ input[required]),
label:has(+ select[required]),
label:has(+ textarea[required]) {
    position: relative;
}

label:has(+ input[required])::after,
label:has(+ select[required])::after,
label:has(+ textarea[required])::after {
    content: "*";
    color: #dc3545;
    margin-left: 4px;
    font-weight: bold;
}

/* Error state improvements */
.form-control:invalid,
.form-select:invalid {
    border-color: #dc3545;
}

.invalid-feedback {
    font-weight: 500;
}

/* Form help text improvements */
.form-text {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ========================================
   BUTTON & INTERACTIVE ELEMENT IMPROVEMENTS
   ======================================== */

/* Minimum touch target size (44x44px) */
.btn,
.navbar-toggler,
.dropdown-toggle {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Navbar improvements */
.navbar-toggler {
    border: 2px solid transparent;
}

.navbar-toggler:focus {
    border-color: rgba(255, 255, 255, 0.5);
}

/* ========================================
   MOTION & ANIMATION PREFERENCES
   ======================================== */

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========================================
   HIGH CONTRAST MODE SUPPORT
   ======================================== */

/* Windows High Contrast mode support */
@media (prefers-contrast: high) {
    .btn-outline-primary,
    .btn-outline-secondary {
        border-width: 2px;
    }
    
    .card {
        border-width: 2px;
    }
    
    .navbar-brand {
        font-weight: 700;
    }
}

/* ========================================
   SCREEN READER IMPROVEMENTS
   ======================================== */

/* Visually hidden but accessible to screen readers */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Show on focus for keyboard users */
.visually-hidden:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* ========================================
   TABLE ACCESSIBILITY
   ======================================== */

/* Better table accessibility */
.table th {
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.03);
}

/* ========================================
   PRINT ACCESSIBILITY
   ======================================== */

@media print {
    /* Ensure links are visible in print */
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
    
    /* Hide navigation in print */
    .navbar,
    .skip-link {
        display: none !important;
    }
    
    /* Ensure adequate contrast in print */
    * {
        color: #000 !important;
        background: #fff !important;
    }
}

/* ========================================
   RESPONSIVE TEXT SCALING
   ======================================== */

/* Support for browser zoom up to 200% */
@media (min-resolution: 192dpi) {
    body {
        font-size: 16px;
        line-height: 1.6;
    }
}

/* Ensure proper heading sizing after hierarchy fixes */
.filters-section h2#filters-heading {
    font-size: 1.5rem;
    font-weight: 600;
}

.acties-grid h2 {
    font-size: 1.75rem;
    font-weight: 600;
}

.card-title {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
}

/* ========================================
   ERROR AND STATUS MESSAGE IMPROVEMENTS
   ======================================== */

/* Live regions for dynamic content */
[aria-live="polite"],
[aria-live="assertive"] {
    position: relative;
}

/* Status messages styling */
.status-message {
    padding: 12px;
    border-radius: 4px;
    margin: 16px 0;
    font-weight: 500;
}

.status-message--success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.status-message--error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.status-message--warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.status-message--info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}
