/* Accessibility Styles for Cinefilosos */

/* Skip Links */
.skip-links {
    position: absolute;
    top: -1000px;
    left: -1000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link {
    position: absolute;
    top: -1000px;
    left: -1000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    background: var(--magenta);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    z-index: 10001;
    transition: all 0.3s ease;
}

.skip-link:focus {
    position: fixed !important;
    top: 10px !important;
    left: 10px !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip: auto !important;
}

/* Screen Reader Only Content */
.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;
}

/* Accessibility Controls Panel */
.accessibility-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--magenta);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(244, 4, 156, 0.3);
}

.accessibility-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(244, 4, 156, 0.4);
}

.accessibility-toggle:focus {
    outline: 3px solid white;
    outline-offset: 2px;
}

.a11y-icon {
    display: block;
    line-height: 1;
}

.accessibility-controls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.a11y-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.a11y-panel {
    position: relative;
    background: var(--black);
    border: 2px solid var(--magenta);
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 10001;
}

.a11y-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.a11y-header h2 {
    margin: 0;
    color: var(--white);
    font-size: 1.3rem;
}

.a11y-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 28px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.a11y-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.a11y-close:focus {
    outline: 2px solid var(--magenta);
    outline-offset: 2px;
}

.a11y-content {
    padding: 20px;
}

.a11y-group {
    margin-bottom: 25px;
    border: none;
    padding: 0;
}

.a11y-group legend {
    color: var(--white);
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1rem;
}

.a11y-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.a11y-btn {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: var(--white);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    min-width: 60px;
}

.a11y-btn:hover {
    background: rgba(244, 4, 156, 0.2);
    border-color: var(--magenta);
}

.a11y-btn:focus {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}

.a11y-btn[aria-pressed="true"],
.a11y-btn.active {
    background: var(--magenta);
    border-color: var(--magenta);
    color: white;
}

.a11y-btn[data-value="small"] {
    font-size: 12px;
}

.a11y-btn[data-value="large"] {
    font-size: 16px;
}

.a11y-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.a11y-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--magenta);
}

.a11y-toggle label {
    color: var(--white);
    cursor: pointer;
    user-select: none;
}

.a11y-reset {
    width: 100%;
    padding: 15px;
    background: transparent;
    border: 2px solid var(--cyan);
    border-radius: 8px;
    color: var(--cyan);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.a11y-reset:hover {
    background: var(--cyan);
    color: var(--black);
}

.a11y-reset:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Font Size Variations */
.font-small {
    font-size: 14px;
}

.font-small h1 { font-size: 1.8rem; }
.font-small h2 { font-size: 1.5rem; }
.font-small h3 { font-size: 1.3rem; }
.font-small h4 { font-size: 1.1rem; }
.font-small .episode-card h3 { font-size: 1.1rem; }
.font-small .episode-card p { font-size: 0.85rem; }

.font-large {
    font-size: 18px;
}

.font-large h1 { font-size: 2.8rem; }
.font-large h2 { font-size: 2.3rem; }
.font-large h3 { font-size: 2rem; }
.font-large h4 { font-size: 1.7rem; }
.font-large .episode-card h3 { font-size: 1.5rem; }
.font-large .episode-card p { font-size: 1.1rem; }
.font-large .control-btn { width: 55px; height: 55px; font-size: 18px; }

/* High Contrast Mode */
.contrast-high {
    --black: #000000;
    --white: #ffffff;
    --magenta: #ff00ff;
    --cyan: #00ffff;
    --gray: #808080;
}

.contrast-high * {
    text-shadow: none !important;
    box-shadow: none !important;
}

.contrast-high .enhanced-player::before,
.contrast-high .episode-card::before {
    display: none;
}

.contrast-high button,
.contrast-high .platform-btn,
.contrast-high .episode-card {
    border: 2px solid currentcolor !important;
}

.contrast-high .progress-bar {
    background: #000000 !important;
    border: 1px solid #ffffff !important;
}

.contrast-high .progress-played {
    background: #ffffff !important;
}

/* Dark Mode */
.contrast-dark {
    --black: #000000;
    --white: #ffffff;
    --magenta: #ff1493;
    --cyan: #00bcd4;
    --gray: #666666;
}

.contrast-dark body {
    background: #000000 !important;
    color: #ffffff !important;
}

.contrast-dark .enhanced-player,
.contrast-dark .episode-card {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 20, 147, 0.3) !important;
}

/* Reduced Motion */
.reduce-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

.reduce-motion .enhanced-player::before {
    animation: none !important;
}

.reduce-motion .loader-bubbles .bubble {
    animation: none !important;
}

/* Screen Reader Mode */
.screen-reader-mode .enhanced-player::before,
.screen-reader-mode .episode-card::before,
.screen-reader-mode .shimmer {
    display: none !important;
}

.screen-reader-mode * {
    animation: none !important;
    transition: none !important;
}

.screen-reader-mode img:not([alt]) {
    border: 2px solid red !important;
}

.screen-reader-mode img[alt=""] {
    border: 2px solid orange !important;
}

/* Focus Enhancements */
.focused {
    outline: 3px solid var(--cyan) !important;
    outline-offset: 2px !important;
}

*:focus-visible {
    outline: 2px solid var(--magenta) !important;
    outline-offset: 2px !important;
}

button:focus-visible,
.platform-btn:focus-visible,
.episode-card:focus-visible {
    box-shadow: 0 0 0 3px rgba(244, 4, 156, 0.5) !important;
}

/* Improve button accessibility */
button,
.platform-btn,
.share-btn,
.control-btn {
    min-height: 44px;
    min-width: 44px;
}

/* Enhance form accessibility */
input,
select,
textarea {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 10px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--magenta);
    outline: none;
    box-shadow: 0 0 0 2px rgba(244, 4, 156, 0.3);
}

input:invalid {
    border-color: #ff4444;
}

input:invalid:focus {
    box-shadow: 0 0 0 2px rgba(255, 68, 68, 0.3);
}

/* Error states */
.error {
    color: #ff4444;
    border-color: #ff4444 !important;
}

.error:focus {
    box-shadow: 0 0 0 2px rgba(255, 68, 68, 0.3) !important;
}

/* Success states */
.success {
    color: #44ff44;
    border-color: #44ff44 !important;
}

/* Loading states for screen readers */
.loading {
    position: relative;
}

.loading::after {
    content: 'Cargando...';
    position: absolute;
    left: -9999px;
    top: -9999px;
}

/* Table accessibility */
table {
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px;
    text-align: left;
}

th {
    background: rgba(244, 4, 156, 0.2);
    font-weight: 600;
}

/* List accessibility */
ul,
ol {
    padding-left: 1.5em;
}

li {
    margin-bottom: 0.5em;
}

/* Link accessibility */
a {
    color: var(--cyan);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

a:hover {
    text-decoration-thickness: 3px;
}

a:focus {
    outline: 2px solid var(--magenta);
    outline-offset: 2px;
    text-decoration: none;
}

/* Improve content readability */
p {
    line-height: 1.6;
    margin-bottom: 1em;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    margin-bottom: 0.5em;
}

/* Media query for high contrast preference */
@media (prefers-contrast: high) {
    :root {
        --black: #000000;
        --white: #ffffff;
        --magenta: #ff00ff;
        --cyan: #00ffff;
    }
    
    * {
        border-color: currentcolor !important;
    }
}

/* Media query for 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;
    }
}

/* Print styles for accessibility */
@media print {
    .accessibility-toggle,
    .accessibility-controls,
    .skip-links {
        display: none !important;
    }
    
    * {
        background: transparent !important;
        color: black !important;
    }
    
    a {
        text-decoration: underline !important;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
    }
}

/* Mobile accessibility improvements */
@media (max-width: 768px) {
    .accessibility-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
        bottom: 15px;
        right: 15px;
    }
    
    .a11y-panel {
        width: 95%;
        max-height: 90vh;
    }
    
    .a11y-options {
        flex-direction: column;
    }
    
    .a11y-btn {
        width: 100%;
        text-align: center;
    }
    
    button,
    .platform-btn,
    .share-btn,
    .control-btn {
        min-height: 48px;
        min-width: 48px;
    }
}

/* Touch accessibility */
@media (pointer: coarse) {
    button,
    .platform-btn,
    .share-btn,
    .control-btn,
    a {
        min-height: 48px;
        min-width: 48px;
        padding: 12px;
    }
    
    .progress-area {
        min-height: 48px;
    }
    
    .chapter-marker {
        min-width: 48px;
        min-height: 48px;
    }
}

/* Keyboard navigation indicators */
.keyboard-nav *:focus {
    outline: 2px solid var(--cyan) !important;
    outline-offset: 2px !important;
}

/* Status and alert styling */
[role="status"],
[role="alert"] {
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

[role="status"] {
    background: rgba(0, 188, 212, 0.2);
    border: 1px solid var(--cyan);
    color: var(--cyan);
}

[role="alert"] {
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid #ff4444;
    color: #ff4444;
}

/* Improve landmark visibility in screen reader mode */
.screen-reader-mode [role="banner"],
.screen-reader-mode [role="navigation"],
.screen-reader-mode [role="main"],
.screen-reader-mode [role="complementary"],
.screen-reader-mode [role="contentinfo"] {
    border: 2px dashed var(--cyan);
    margin: 5px 0;
}

.screen-reader-mode [role="banner"]::before { content: "Banner: "; }
.screen-reader-mode [role="navigation"]::before { content: "Navegación: "; }
.screen-reader-mode [role="main"]::before { content: "Contenido principal: "; }
.screen-reader-mode [role="complementary"]::before { content: "Contenido complementario: "; }
.screen-reader-mode [role="contentinfo"]::before { content: "Información del sitio: "; }