/**
 * WCAG 2.1 Level AA Accessibility Compliance
 * Phase 04: Mobile & Accessibility
 * Compatible with Dark OLED Luxury Theme
 */

/* ============================================
   HIGH CONTRAST COLORS - DARK THEME
   ============================================ */
/* Note: These variables are defined in luxury-dashboard.css
   and should NOT be overridden here.
   Dark theme achieves contrast through bright text on dark bg.

   --text-primary: #ffffff (white on black = 21:1)
   --text-secondary: rgba(255,255,255,0.7) (7:1+ on black)
   --text-muted: rgba(255,255,255,0.35) (4.5:1+ on black)
*/

/* ============================================
   TEXT STYLING (Dark Theme Compatible)
   ============================================ */
.text-xs {
    font-size: 0.8rem !important; /* Increased from 0.7rem for readability */
}

/* Note: .kpi-title styling is handled by luxury-dashboard.css */

/* ============================================
   FOCUS INDICATORS (Keyboard Navigation)
   ============================================ */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 3px solid #007bff;
    outline-offset: 2px;
    border-radius: 4px;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid #007bff;
    outline-offset: 3px;
}

.form-control:focus-visible,
.form-select:focus-visible {
    outline: 3px solid #007bff;
    outline-offset: 0;
    border-color: #80bdff;
}

/* Focus indicator for cards */
.card:focus-visible,
.kpi-card:focus-visible {
    outline: 3px solid #007bff;
    outline-offset: 2px;
}

/* ============================================
   SKIP NAVIGATION LINK
   ============================================ */
.skip-navigation {
    position: absolute;
    top: -50px;
    left: 0;
    background: #007bff;
    color: #fff;
    padding: 12px 20px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 8px 0;
    font-weight: 600;
    transition: top 0.3s ease;
}

.skip-navigation:focus {
    top: 0;
    outline: 3px solid #fff;
}

/* ============================================
   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;
}

.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ============================================
   ARIA LIVE REGIONS
   ============================================ */
[aria-live="polite"],
[aria-live="assertive"] {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Visible announcements (optional) */
.aria-announcement-visible {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.875rem;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.aria-announcement-visible.show {
    opacity: 1;
}

/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */
@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;
    }

    .skeleton,
    .loading-overlay::after {
        animation: none !important;
    }

    /* Disable hover transformations */
    .card-lift:hover,
    .kpi-card:hover {
        transform: none !important;
    }
}

/* ============================================
   HIGH CONTRAST MODE SUPPORT (Dark Theme)
   ============================================ */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid rgba(255, 255, 255, 0.5) !important;
    }

    .btn {
        border: 2px solid currentColor !important;
    }

    .kpi-icon {
        opacity: 0.5 !important;
    }

    .badge {
        border: 1px solid currentColor;
    }

    /* Increase text contrast on dark background */
    body {
        color: #fff;
    }

    .text-muted {
        color: rgba(255, 255, 255, 0.6) !important;
    }
}

/* ============================================
   COLOR BLIND FRIENDLY ADJUSTMENTS (Dark Theme)
   ============================================ */
/* Note: Trend badge styles are in luxury-dashboard.css.
   These patterns (shapes/borders) supplement color for accessibility */
.trend-badge.trend-up {
    border-left: 4px solid var(--accent-emerald, #10b981);
}

.trend-badge.trend-down {
    border-left: 4px solid var(--accent-rose, #f43f5e);
}

/* Badge Status Icons - Add symbols for colorblind users */
.badge.bg-success::before {
    content: '\2713 '; /* Checkmark */
}

.badge.bg-danger::before {
    content: '\2717 '; /* X mark */
}

.badge.bg-warning::before {
    content: '\26A0 '; /* Warning symbol */
}

.badge.bg-info::before {
    content: '\2139 '; /* Info symbol */
}

/* ============================================
   LINK UNDERLINES (Low Vision Support)
   ============================================ */
a:not(.btn):not(.nav-link):not(.navbar-brand) {
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:not(.btn):not(.nav-link):not(.navbar-brand):hover {
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

/* ============================================
   IMPROVED TABLE ACCESSIBILITY
   ============================================ */
.table th {
    font-weight: 700 !important;
}

/* Note: Table colors handled by luxury-dashboard.css */

/* Ensure row selection is visible */
.table tbody tr:focus-within {
    outline: 2px solid #007bff;
    outline-offset: -2px;
}

/* ============================================
   CHART ACCESSIBILITY
   ============================================ */
.chart-container {
    position: relative;
}

/* Hidden table alternative for screen readers */
.chart-data-table {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Chart keyboard focus */
canvas:focus-visible {
    outline: 3px solid #007bff;
    outline-offset: 4px;
}

/* ============================================
   FORM ACCESSIBILITY
   ============================================ */
label {
    font-weight: 500;
}

/* Note: Label colors handled by luxury-dashboard.css */

/* Error state visibility */
.is-invalid {
    border-color: var(--accent-rose, #f43f5e) !important;
    border-width: 2px !important;
}

.invalid-feedback {
    color: var(--accent-rose, #f43f5e);
    font-weight: 500;
}

/* Required field indicator */
.required::after {
    content: ' *';
    color: var(--accent-rose, #f43f5e);
    font-weight: bold;
}

/* ============================================
   ICON ACCESSIBILITY
   ============================================ */
/* Ensure icons are hidden from screen readers when decorative */
[aria-hidden="true"] {
    pointer-events: none;
}

/* Icons with meaning should have sr-only text */
.icon-with-text .bi {
    margin-right: 0.5rem;
}

/* ============================================
   BUTTON STATES
   ============================================ */
.btn:disabled,
.btn.disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn:disabled:focus,
.btn.disabled:focus {
    outline: 2px dashed #6c757d;
}

/* ============================================
   LOADING STATE ACCESSIBILITY
   ============================================ */
[aria-busy="true"] {
    cursor: wait;
}

/* Spinner should be visible but not announced repeatedly */
.spinner-border {
    /* Let aria-label on parent handle announcement */
}

/* ============================================
   DARK MODE CONTRAST
   ============================================ */
/* Note: The luxury-dashboard.css provides a dark OLED theme by default.
   No media query overrides needed - dark mode is always active.
   Text colors are:
   --text-primary: #ffffff
   --text-secondary: rgba(255,255,255,0.7)
   --text-muted: rgba(255,255,255,0.35)
*/
