/* accessibility.css */

/* --- A11y Global Overrides --- */
html.font-size-md { font-size: 110% !important; }
html.font-size-lg { font-size: 125% !important; }
html.font-size-xl { font-size: 150% !important; }

html.high-contrast,
html.high-contrast body,
html.high-contrast div:not(#a11y-widget):not(#a11y-widget *):not(#tts-indicator):not(#tts-indicator *),
html.high-contrast span:not(#a11y-widget *):not(#tts-indicator *),
html.high-contrast p,
html.high-contrast h1, html.high-contrast h2, html.high-contrast h3, html.high-contrast h4, html.high-contrast h5, html.high-contrast h6,
html.high-contrast a,
html.high-contrast button:not(#a11y-widget *),
html.high-contrast input:not(#a11y-widget *),
html.high-contrast textarea,
html.high-contrast select,
html.high-contrast li,
html.high-contrast label:not(#a11y-widget *),
html.high-contrast i:not(#a11y-widget *) {
    background-color: #000000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
    outline-color: #ffff00 !important;
}

html.high-contrast svg {
    fill: #ffff00 !important;
    stroke: #ffff00 !important;
}

html.dyslexia-font,
html.dyslexia-font body,
html.dyslexia-font p,
html.dyslexia-font h1, html.dyslexia-font h2, html.dyslexia-font h3, html.dyslexia-font h4, html.dyslexia-font h5, html.dyslexia-font h6,
html.dyslexia-font span, html.dyslexia-font a, html.dyslexia-font div, html.dyslexia-font li, html.dyslexia-font button, html.dyslexia-font input, html.dyslexia-font textarea {
    font-family: Arial, "Helvetica Neue", Verdana, sans-serif !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.12em !important;
    line-height: 1.6 !important;
}

html.underline-links a {
    text-decoration: underline !important;
    text-underline-offset: 3px !important;
}

html.tts-active, html.tts-active * {
    cursor: cell !important;
}

/* --- A11y Widget UI Styling (Theme-matched) --- */
#a11y-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: 'Inter', sans-serif;
}

#a11y-button {
    background-color: var(--primary-active, #2F6BFA);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background-color 0.2s;
}

#a11y-button:hover {
    transform: scale(1.1);
    background-color: var(--primary-dark, #1A2E70);
}

#a11y-panel {
    display: none;
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 320px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border: 1px solid var(--border, #E5E7EB);
    flex-direction: column;
    overflow: hidden;
}

#a11y-panel.open {
    display: flex;
}

.a11y-header {
    background: var(--bg-hover, #F1F5F9);
    padding: 16px;
    border-bottom: 1px solid var(--border, #E5E7EB);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.a11y-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-dark, #1A2E70);
    display: flex;
    align-items: center;
    gap: 8px;
}

.a11y-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary, #6B7280);
    cursor: pointer;
    transition: color 0.2s;
}

.a11y-close:hover {
    color: var(--primary-dark, #1A2E70);
}

.a11y-body {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.a11y-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1A2E70);
    margin-bottom: 10px;
    display: block;
}

.a11y-btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.a11y-btn {
    flex: 1;
    padding: 8px 4px;
    background: var(--bg-hover, #F1F5F9);
    border: 1px solid var(--border, #E5E7EB);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary, #6B7280);
    cursor: pointer;
    transition: all 0.2s;
}

.a11y-btn.active, .a11y-btn:hover {
    background: var(--primary-active, #2F6BFA);
    color: #ffffff;
    border-color: var(--primary-active, #2F6BFA);
}

.a11y-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg, #F8F9FA);
    border: 1px solid var(--border, #E5E7EB);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.a11y-toggle:hover {
    background: var(--bg-hover, #F1F5F9);
}

.a11y-toggle-text {
    font-size: 14px;
    color: var(--text-primary, #1A2E70);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}
.a11y-toggle-text i {
    width: 20px;
    text-align: center;
    color: var(--text-secondary, #6B7280);
}

/* Switch styling */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #CBD5E1;
  transition: .3s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
input:checked + .slider {
  background-color: var(--success, #10b981);
}
input:checked + .slider:before {
  transform: translateX(20px);
}

/* TTS Indicator */
#tts-indicator {
    position: fixed;
    top: 24px;
    right: 24px;
    background: var(--primary-active, #2F6BFA);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    z-index: 999999;
    display: none;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    font-family: 'Inter', sans-serif;
}
#tts-indicator.active {
    display: flex;
    animation: a11y-pulse 2s infinite;
}

@keyframes a11y-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
