/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

/* Skip Navigation Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    font-weight: bold;
    z-index: 10000;
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #ffd700;
    outline-offset: 2px;
}

/* Enhanced Focus Indicators */
button:focus,
input:focus,
a:focus,
[tabindex]:focus {
    outline: 3px solid #ffd700;
    outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #ffd700;
    outline-offset: 2px;
}

/* High contrast focus for buttons */
button:focus {
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.5);
}

/* Focus within containers */
.playback-toolbar:focus-within {
    background-color: rgba(255, 215, 0, 0.1);
}

/* Improve button contrast - preserve existing styles */
button {
    min-width: 44px;
    min-height: 44px;
    cursor: pointer;
}

/* Preserve existing hover effects, just add transform */
button:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

button:active {
    transform: scale(0.95);
}

/* Dialog accessibility */
.dialog[role='dialog'] {
    position: fixed;
    z-index: 9999;
}

/* Focus trapping handled in accessibility.js */

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: 2px solid currentColor;
    color: inherit;
    font-size: 24px;
    line-height: 1;
    padding: 4px 8px;
    min-width: 44px;
    min-height: 44px;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.close-btn:focus {
    outline: 3px solid #ffd700;
    outline-offset: 2px;
}

/* Screen reader only text */
.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;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Improved heading visibility - preserve theme colors */
h1.app-title {
    font-size: 1.5em;
    margin: 0;
    padding: 0;
    /* Color defined in theme.css */
}

h2#dialog-title {
    margin-top: 0;
    /* Color inherited from theme */
}

/* List items accessibility - preserve theme colors */
#songlist [role='option'] {
    cursor: pointer;
    padding: 8px 12px;
    min-height: 44px;
    display: flex;
    align-items: center;
    /* Background and text colors from theme */
}

#songlist [role='option']:focus {
    outline: 3px solid #ffd700;
    outline-offset: -3px;
    background-color: rgba(255, 215, 0, 0.2);
}

#songlist [role='option'][aria-selected='true'] {
    background-color: rgba(0, 100, 200, 0.3);
    font-weight: bold;
}

#songlist [role='option']:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Improved time display - inherit color from theme */
#time {
    font-weight: bold;
    padding: 4px 8px;
    /* Color inherited from theme */
}

/* Range slider accessibility */
input[type='range'] {
    cursor: pointer;
}

input[type='range']:focus {
    outline: 3px solid #ffd700;
    outline-offset: 2px;
}

/* 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;
    }

    button:hover {
        transform: none;
    }

    button:active {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: more) {
    button {
        border: 2px solid currentColor;
    }

    .skip-link {
        border: 2px solid #fff;
    }

    :focus {
        outline-width: 4px;
    }
}

/* Print styles - hide interactive elements */
@media print {
    .toolbar,
    .footer,
    .skip-link,
    #songs {
        display: none;
    }

    #karaoke {
        font-size: 16pt;
    }
}
