/**
 * Accessibility (a11y) Stylesheet
 * Provides focus-visible styles, reduced-motion, high-contrast, and skip navigation.
 * Include in main layout or header.
 */

/* === Skip to Content === */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--primary, #6366f1);
    color: #fff;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 700;
    z-index: 100000;
    border-radius: 0 0 12px 0;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-to-content:focus {
    top: 0;
}

/* === Focus Visible === */
*:focus-visible {
    outline: 2px solid var(--primary, #6366f1);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Remove default outline for non-keyboard focus */
*:focus:not(:focus-visible) {
    outline: none;
}

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

    .livechat__window,
    .cookie-consent,
    .ai-welcome__orb-ring,
    .ai-hero__glow {
        animation: none !important;
    }
}

/* === High Contrast === */
@media (prefers-contrast: more) {
    :root {
        --primary: #4338ca;
        --text: #000000;
        --text-secondary: #1e293b;
        --bg-secondary: #f8fafc;
        --border: #94a3b8;
        --card-bg: #ffffff;
    }

    .btn,
    button,
    a {
        text-decoration-thickness: 2px;
    }

    .status-badge,
    .notif-toggle-track,
    .ai-toolbar__bar-fill {
        border: 1px solid currentColor;
    }
}

/* === Forced Colors (Windows High Contrast) === */
@media (forced-colors: active) {

    .btn,
    button {
        border: 1px solid ButtonText;
    }

    .skip-to-content {
        background: Highlight;
        color: HighlightText;
    }
}

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

/* === Focus Trap for Modals === */
.um-modal[aria-hidden="false"] {
    z-index: 99997;
}

.um-modal .um-modal__dialog:focus {
    outline: 2px solid var(--primary, #6366f1);
    outline-offset: -2px;
}

/* === AI Usage Progress Bar === */
.ai-hero__usage-bar {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-hero__usage-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ai-hero__usage-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-hero__usage-count {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

.ai-hero__progress {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.ai-hero__progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease, background 0.3s ease;
    min-width: 2px;
}