/* ============================================
   ACCESSIBILITY STYLES & UTILITIES
   ============================================ */

/* 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-width: 0;
}

/* ============================================
   ACCESSIBILITY PANEL
   ============================================ */

.accessibility-panel-wrapper {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
}

.accessibility-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
}

.accessibility-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.accessibility-toggle-btn:focus {
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.3);
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* Accessibility Panel */
.accessibility-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    max-height: 80vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10000;
}

.accessibility-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Dark Mode - Accessibility Panel */
[data-theme="dark"] .accessibility-panel,
.dark-mode .accessibility-panel {
    background: #16213e;
    color: #ffffff;
}

/* Panel Header */
.accessibility-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
}

[data-theme="dark"] .accessibility-panel-header,
.dark-mode .accessibility-panel-header {
    border-bottom-color: #2d3748;
}

.accessibility-panel-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

.close-panel-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s;
}

.close-panel-btn:hover,
.close-panel-btn:focus {
    background: rgba(102, 126, 234, 0.1);
}

/* Panel Content */
.accessibility-panel-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

/* Accessibility Setting */
.accessibility-setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.accessibility-setting-full-width {
    justify-content: center;
}

.setting-label {
    flex: 1;
}

.setting-title {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    color: inherit;
}

.setting-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
    background: #cbd5e0;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s;
    outline: none;
    padding: 0;
}

.toggle-switch:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.toggle-switch.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toggle-inner {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active .toggle-inner {
    transform: translateX(22px);
}

/* Font Size Control */
.font-size-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
}

.font-size-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #cbd5e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.font-size-btn:hover,
.font-size-btn:focus {
    background: #f1f5f9;
    border-color: #667eea;
}

.font-size-value {
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.reset-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

/* Accessibility Select */
.accessibility-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.accessibility-select:hover,
.accessibility-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

/* Reset All Button */
.reset-all-btn {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.reset-all-btn:hover,
.reset-all-btn:focus {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* Shortcuts Help */
.accessibility-shortcuts {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    margin-top: 1rem;
}

[data-theme="dark"] .accessibility-shortcuts,
.dark-mode .accessibility-shortcuts {
    border-top-color: #2d3748;
}

.accessibility-shortcuts details {
    cursor: pointer;
}

.accessibility-shortcuts summary {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s;
}

.accessibility-shortcuts summary:hover,
.accessibility-shortcuts summary:focus {
    background: rgba(102, 126, 234, 0.1);
}

.accessibility-shortcuts ul {
    list-style: none;
    padding: 0.8rem 0 0 0;
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.8;
}

.accessibility-shortcuts li {
    padding: 0.3rem 0;
}

.accessibility-shortcuts kbd {
    background: #f1f5f9;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.8rem;
    border: 1px solid #cbd5e0;
}

/* ============================================
   ACCESSIBILITY MODES
   ============================================ */

/* High Contrast Mode */
.high-contrast-mode {
    --text-primary: #000000;
    --text-secondary: #000000;
    --bg-primary: #ffffff;
    --bg-secondary: #ffffff;
    --border-color: #000000;
    --shadow-sm: 0 0 0 2px #000000;
    --shadow-md: 0 0 0 3px #000000;
}

.high-contrast-mode * {
    border-color: #000000 !important;
}

.high-contrast-mode button,
.high-contrast-mode a {
    border: 2px solid #000000 !important;
}

/* Enhanced Focus Indicators */
.enhanced-focus *:focus {
    outline: 3px solid #667eea !important;
    outline-offset: 2px !important;
}

/* Reduce Animations */
.reduce-animations,
.reduce-animations * {
    animation: none !important;
    transition: none !important;
}

/* Dyslexia Friendly Font */
.dyslexia-friendly {
    font-family: 'OpenDyslexic', 'Comic Sans MS', cursive, sans-serif;
    font-size: 1.1em;
    letter-spacing: 0.15em;
    word-spacing: 0.1em;
    line-height: 1.8;
}

/* Text Spacing Modes */
.text-spacing-loose {
    line-height: 1.8;
    letter-spacing: 0.08em;
    word-spacing: 0.12em;
    padding: 0.5em;
}

.text-spacing-extra-loose {
    line-height: 2.2;
    letter-spacing: 0.12em;
    word-spacing: 0.16em;
    padding: 0.75em;
}

/* ============================================
   DARK MODE STYLES
   ============================================ */

[data-theme="dark"],
.dark-mode {
    --bg-primary: #0f0f1e;
    --bg-secondary: #1a1a2e;
    --text-primary: #ffffff;
    --text-secondary: #cbd5e0;
}

[data-theme="dark"] .accessibility-panel,
.dark-mode .accessibility-panel {
    background: #16213e;
}

[data-theme="dark"] .font-size-btn,
.dark-mode .font-size-btn {
    background: #16213e;
    border-color: #2d3748;
    color: #ffffff;
}

[data-theme="dark"] .font-size-btn:hover,
.dark-mode .font-size-btn:hover {
    background: #1e293b;
}

[data-theme="dark"] .accessibility-select,
.dark-mode .accessibility-select {
    background: #16213e;
    color: #ffffff;
    border-color: #2d3748;
}

[data-theme="dark"] .accessibility-select:hover,
.dark-mode .accessibility-select:hover {
    border-color: #667eea;
}

[data-theme="dark"] .accessibility-shortcuts kbd,
.dark-mode .accessibility-shortcuts kbd {
    background: #1e293b;
    border-color: #2d3748;
    color: #ffffff;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .accessibility-panel-wrapper {
        bottom: 1rem;
        right: 1rem;
    }

    .accessibility-panel {
        width: calc(100vw - 2rem);
        max-width: 380px;
        bottom: 70px;
    }

    .accessibility-toggle-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .accessibility-setting {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .setting-control {
        width: 100%;
        justify-content: flex-end;
    }

    .font-size-control {
        justify-content: space-between;
    }
}

/* ============================================
   KEYBOARD NAVIGATION
   ============================================ */

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* Skip to Main Content Link */
.skip-to-main {
    position: fixed;
    top: -40px;
    left: 0;
    background: #667eea;
    color: white;
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    z-index: 100;
    border-radius: 0 0 10px 0;
    font-weight: 600;
}

.skip-to-main:focus {
    top: 0;
    outline: 3px solid white;
    outline-offset: 2px;
}

/* ============================================
   PAGE-WIDE TEXT SIZE ADJUSTMENTS
   ============================================ */

html.text-size-110 {
    font-size: 110%;
}

html.text-size-120 {
    font-size: 120%;
}

html.text-size-130 {
    font-size: 130%;
}

html.text-size-140 {
    font-size: 140%;
}

html.text-size-150 {
    font-size: 150%;
}
