/* ==========================================================================
   DAE Manager - Accessibility overrides (WCAG 2.2 AA)
   ========================================================================== */

/* 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 / forced colors mode */
@media (forced-colors: active) {
    .btn,
    .dae-card,
    .stat-card,
    .app-sidebar,
    .app-header {
        border: 1px solid CanvasText;
    }

    .btn:focus-visible,
    a:focus-visible,
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible {
        outline: 3px solid Highlight;
        outline-offset: 2px;
    }
}

/* Text spacing override support (WCAG 1.4.12) */
body {
    line-height: 1.5;
    letter-spacing: normal;
    word-spacing: normal;
}

p {
    line-height: 1.5;
    margin-bottom: 1rem;
}

/* Ensure focus is visible even when JS changes styles */
:focus-visible {
    outline: var(--focus-outline);
    outline-offset: 2px;
}

/* Dark mode support (base) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --bg-secondary: #1e293b;
        --bg-surface: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #b0bec5;
        --border-color: #334155;
        --border-light: #334155;
    }

    .app-header {
        background-color: #1e293b;
        border-bottom-color: #334155;
    }

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

    .dae-card,
    .stat-card,
    .login-card,
    .table-wrapper {
        background-color: #1e293b;
        border-color: #334155;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        background-color: #0f172a;
        color: var(--text-primary);
        border-color: #334155;
    }
}

/* Screen reader only helper */
.visually-hidden,
.sr-only {
    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;
}

/* Ensure interactive elements on dark sidebar keep visible focus */
.app-sidebar a:focus-visible,
.app-sidebar button:focus-visible {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
    background-color: rgba(255, 255, 255, 0.15);
}
