/**
 * Accessibility Widget — Styled to match site design
 * Frosted-glass aesthetic, primary blue (#35b8f9) palette
 * Fully responsive across all screen sizes
 */

/* ============================================
   CSS Variables — Matching site palette
   ============================================ */
:root {
    --aw-primary: #35b8f9;
    --aw-primary-dark: #0ea1e8;
    --aw-primary-light: #dff3fe;
    --aw-primary-50: #f0f9ff;
    --aw-secondary: #0049af;
    --aw-text-900: #111827;
    --aw-text-700: #374151;
    --aw-text-500: #6b7280;
    --aw-text-400: #9ca3af;
    --aw-text-300: #d1d5db;
    --aw-border: rgba(0, 0, 0, 0.08);
    --aw-bg: rgba(255, 255, 255, 0.92);
    --aw-bg-solid: #ffffff;
    --aw-surface: #f9fafb;
    --aw-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --aw-shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
    --aw-radius: 16px;
    --aw-radius-sm: 12px;
    --aw-radius-xs: 8px;
    --aw-font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --aw-ease: cubic-bezier(0.32, 0.72, 0, 1);
}

/* ============================================
   Toggle Button — Removed (now in React Header)
   The .acc-widget-btn class is no longer created
   ============================================ */

/* ============================================
   Overlay — Frosted backdrop
   ============================================ */
.acc-widget-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.acc-widget-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   Panel — Frosted glass slide panel
   ============================================ */
.acc-widget-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 340px;
    max-width: 92vw;
    height: 100dvh;
    background: var(--aw-bg);
    -webkit-backdrop-filter: blur(20px) saturate(1.8);
    backdrop-filter: blur(20px) saturate(1.8);
    border-inline-end: 1px solid var(--aw-border);
    box-shadow: var(--aw-shadow-lg);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--aw-font);
    transform: translateX(100%);
    transition: transform 0.45s var(--aw-ease);
    -webkit-overflow-scrolling: touch;
}

.acc-widget-panel.rtl {
    right: 0;
    left: auto;
    transform: translateX(100%);
    direction: rtl;
}

.acc-widget-panel.ltr {
    right: 0;
    left: auto;
    transform: translateX(100%);
    direction: ltr;
}

.acc-widget-panel.open {
    transform: translateX(0);
}

/* ============================================
   Panel Header — Clean, minimal
   ============================================ */
.acc-widget-header {
    background: var(--aw-bg-solid);
    border-bottom: 1px solid var(--aw-border);
    padding: 14px 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

.acc-widget-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--aw-text-900);
    letter-spacing: 0.01em;
}

.acc-widget-close {
    position: absolute;
    left: 12px;
    background: transparent;
    border: none;
    color: var(--aw-text-400);
    width: 30px;
    height: 30px;
    border-radius: var(--aw-radius-xs);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
    padding: 0;
}

.acc-widget-panel.rtl .acc-widget-close {
    left: 12px;
    right: auto;
}

.acc-widget-panel.ltr .acc-widget-close {
    right: 12px;
    left: auto;
}

.acc-widget-close:hover {
    background: var(--aw-surface);
    color: var(--aw-text-700);
}

.acc-widget-close:focus-visible {
    outline: 2px solid var(--aw-primary);
    outline-offset: 1px;
}

.acc-widget-close svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* ============================================
   Scrollable Body
   ============================================ */
.acc-widget-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px;
    min-height: 0;
}

.acc-widget-body::-webkit-scrollbar {
    width: 4px;
}

.acc-widget-body::-webkit-scrollbar-track {
    background: transparent;
}

.acc-widget-body::-webkit-scrollbar-thumb {
    background: var(--aw-text-300);
    border-radius: 2px;
}

/* ============================================
   Toggle Grid — 3 columns, fluid
   ============================================ */
.acc-widget-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

/* ============================================
   Toggle Buttons — Card style
   ============================================ */
.acc-widget-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 4px;
    background: var(--aw-bg-solid);
    border: 1.5px solid var(--aw-border);
    border-radius: var(--aw-radius-sm);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    aspect-ratio: 1 / 1;
    min-height: 0;
    min-width: 0;
    width: 100%;
    font-family: var(--aw-font);
}

.acc-widget-toggle:hover {
    border-color: var(--aw-primary);
    background: var(--aw-primary-50);
}

.acc-widget-toggle:focus-visible {
    outline: 2px solid var(--aw-primary);
    outline-offset: 1px;
}

.acc-widget-toggle.active {
    background: var(--aw-primary);
    border-color: var(--aw-primary);
    box-shadow: 0 2px 8px rgba(53, 184, 249, 0.3);
}

.acc-widget-toggle-icon {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.acc-widget-toggle-icon svg {
    width: 22px;
    height: 22px;
    fill: var(--aw-primary-dark);
    transition: fill 0.15s ease;
}

.acc-widget-toggle:hover .acc-widget-toggle-icon svg {
    fill: var(--aw-primary-dark);
}

.acc-widget-toggle.active .acc-widget-toggle-icon svg {
    fill: #ffffff;
}

.acc-widget-toggle-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--aw-text-700);
    text-align: center;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    max-height: 2.5em;
}

.acc-widget-toggle.active .acc-widget-toggle-label {
    color: #ffffff;
}

/* ============================================
   Reset Button
   ============================================ */
.acc-widget-reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    margin-top: 14px;
    background: var(--aw-surface);
    border: 1.5px solid var(--aw-border);
    border-radius: var(--aw-radius-sm);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    font-family: var(--aw-font);
}

.acc-widget-reset-btn .acc-widget-toggle-icon {
    width: 20px;
    height: 20px;
}

.acc-widget-reset-btn .acc-widget-toggle-icon svg {
    fill: var(--aw-text-500);
    width: 18px;
    height: 18px;
}

.acc-widget-reset-btn .acc-widget-toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--aw-text-700);
    max-height: none;
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

.acc-widget-reset-btn:hover {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.25);
}

.acc-widget-reset-btn:hover .acc-widget-toggle-icon svg {
    fill: #ef4444;
}

.acc-widget-reset-btn:hover .acc-widget-toggle-label {
    color: #ef4444;
}

/* ============================================
   Slider Sections
   ============================================ */
.acc-widget-slider-section {
    background: var(--aw-bg-solid);
    border: 1.5px solid var(--aw-border);
    border-radius: var(--aw-radius-sm);
    padding: 12px 14px;
    margin-bottom: 14px;
}

.acc-widget-slider-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--aw-text-700);
    text-align: center;
    margin-bottom: 10px;
}

.acc-widget-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    direction: ltr;
}

.acc-widget-slider-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border: 1.5px solid var(--aw-primary-light);
    background: var(--aw-primary-50);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease;
    padding: 0;
}

.acc-widget-slider-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--aw-primary-dark);
}

.acc-widget-slider-btn:hover {
    background: var(--aw-primary);
    border-color: var(--aw-primary);
}

.acc-widget-slider-btn:hover svg {
    fill: #ffffff;
}

.acc-widget-slider-btn:focus-visible {
    outline: 2px solid var(--aw-primary);
    outline-offset: 1px;
}

.acc-widget-slider-track {
    flex: 1;
    height: 6px;
    background: var(--aw-primary-light);
    border-radius: 3px;
    position: relative;
    overflow: visible;
}

.acc-widget-slider-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--aw-primary), var(--aw-primary-dark));
    border-radius: 3px;
    width: 50%;
    transition: width 0.2s ease;
}

.acc-widget-slider-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 700;
    color: var(--aw-primary-dark);
    background: var(--aw-bg-solid);
    padding: 1px 7px;
    border-radius: 8px;
    box-shadow: var(--aw-shadow-sm);
    white-space: nowrap;
    z-index: 1;
}

.acc-widget-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 9px;
    color: var(--aw-text-400);
    direction: ltr;
}

/* ============================================
   Footer
   ============================================ */
.acc-widget-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--aw-border);
    background: var(--aw-bg-solid);
    flex-shrink: 0;
}

.acc-widget-credit {
    text-align: center;
    font-size: 10px;
    color: var(--aw-text-400);
    font-weight: 500;
}

/* ============================================
   Reading Guide
   ============================================ */
.acc-reading-guide {
    position: fixed;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(to bottom,
            rgba(53, 184, 249, 0) 0%,
            rgba(53, 184, 249, 0.12) 20%,
            rgba(53, 184, 249, 0.12) 80%,
            rgba(53, 184, 249, 0) 100%);
    pointer-events: none;
    z-index: 999997;
    border-top: 2px solid rgba(53, 184, 249, 0.4);
    border-bottom: 2px solid rgba(53, 184, 249, 0.4);
    display: none;
}

.acc-reading-guide.active {
    display: block;
}

/* ============================================
   Screen Mask
   ============================================ */
.acc-screen-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    pointer-events: none;
    z-index: 999996;
    display: none;
}

.acc-screen-mask.active {
    display: block;
}

.acc-screen-mask-window {
    position: absolute;
    left: 0;
    right: 0;
    height: 150px;
    background: transparent;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.85);
    border-top: 2px solid var(--aw-primary);
    border-bottom: 2px solid var(--aw-primary);
}

/* ============================================
   Line Mask
   ============================================ */
.acc-line-mask {
    position: fixed;
    left: 0;
    right: 0;
    height: 30px;
    background: rgba(53, 184, 249, 0.15);
    pointer-events: none;
    z-index: 999995;
    border-top: 2px solid rgba(53, 184, 249, 0.4);
    border-bottom: 2px solid rgba(53, 184, 249, 0.4);
    display: none;
}

.acc-line-mask.active {
    display: block;
}

/* ============================================
   Magnifier
   ============================================ */
.acc-magnifier {
    position: fixed;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 3px solid var(--aw-primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 999994;
    display: none;
    overflow: hidden;
    background: #fff;
}

.acc-magnifier.active {
    display: block;
}

.acc-magnifier-content {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 50%;
}

body.acc-magnifier-active {
    cursor: default;
}

/* ============================================
   Applied Accessibility Effects on Content
   ============================================ */
.acc-night-mode #acc-content-wrapper {
    filter: invert(1) hue-rotate(180deg) !important;
}

.acc-night-mode #acc-content-wrapper img,
.acc-night-mode #acc-content-wrapper video,
.acc-night-mode #acc-content-wrapper iframe {
    filter: invert(1) hue-rotate(180deg) !important;
}

.acc-high-contrast #acc-content-wrapper,
.acc-high-contrast #acc-content-wrapper * {
    background-color: #000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
}

.acc-high-contrast #acc-content-wrapper a {
    color: #00ffff !important;
}

.acc-high-contrast #acc-content-wrapper img {
    filter: contrast(1.2) !important;
}

.acc-light-background #acc-content-wrapper {
    background-color: #ffffff !important;
    color: #000000 !important;
}

.acc-light-background #acc-content-wrapper * {
    background-color: #ffffff !important;
    color: #000000 !important;
}

.acc-highlight-links #acc-content-wrapper a {
    background: rgba(53, 184, 249, 0.15) !important;
    color: var(--aw-secondary) !important;
    text-decoration: underline !important;
    padding: 1px 3px !important;
    border-radius: 3px !important;
    font-weight: 600 !important;
}

.acc-readable-font #acc-content-wrapper,
.acc-readable-font #acc-content-wrapper * {
    font-family: Arial, Helvetica, sans-serif !important;
}

.acc-stop-animations #acc-content-wrapper,
.acc-stop-animations #acc-content-wrapper * {
    animation: none !important;
    transition: none !important;
}

.acc-big-cursor-light #acc-content-wrapper,
.acc-big-cursor-light #acc-content-wrapper * {
    cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path fill="%23fff" stroke="%23000" stroke-width="1.5" d="M5 3l14 9-7 2-4 7-3-18z"/></svg>') 4 4, auto !important;
}

.acc-big-cursor-dark #acc-content-wrapper,
.acc-big-cursor-dark #acc-content-wrapper * {
    cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path fill="%23000" stroke="%23fff" stroke-width="1.5" d="M5 3l14 9-7 2-4 7-3-18z"/></svg>') 4 4, auto !important;
}

.acc-keyboard-nav #acc-content-wrapper *:focus {
    outline: 3px solid var(--aw-primary) !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px rgba(53, 184, 249, 0.2) !important;
}

.acc-highlight-headings #acc-content-wrapper h1,
.acc-highlight-headings #acc-content-wrapper h2,
.acc-highlight-headings #acc-content-wrapper h3,
.acc-highlight-headings #acc-content-wrapper h4,
.acc-highlight-headings #acc-content-wrapper h5,
.acc-highlight-headings #acc-content-wrapper h6 {
    background: var(--aw-primary-light) !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    border-right: 3px solid var(--aw-primary) !important;
}

.acc-line-height #acc-content-wrapper,
.acc-line-height #acc-content-wrapper * {
    line-height: 2 !important;
}

.acc-monochrome #acc-content-wrapper {
    filter: grayscale(1) !important;
}

/* Invert Colors */
.acc-invert-colors #acc-content-wrapper {
    filter: invert(1) !important;
}

.acc-invert-colors #acc-content-wrapper img,
.acc-invert-colors #acc-content-wrapper video,
.acc-invert-colors #acc-content-wrapper iframe {
    filter: invert(1) !important;
}

/* Low Saturation */
.acc-low-saturation #acc-content-wrapper {
    filter: saturate(0.3) !important;
}

/* Focus Highlight */
.acc-focus-highlight #acc-content-wrapper *:focus {
    outline: 3px solid #ef4444 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.2) !important;
}

/* Form Highlight */
.acc-form-highlight #acc-content-wrapper input,
.acc-form-highlight #acc-content-wrapper textarea,
.acc-form-highlight #acc-content-wrapper select,
.acc-form-highlight #acc-content-wrapper button[type="submit"] {
    border: 2px solid var(--aw-primary) !important;
    background: var(--aw-primary-light) !important;
    box-shadow: 0 0 0 3px rgba(53, 184, 249, 0.15) !important;
}

.acc-form-highlight #acc-content-wrapper label {
    color: var(--aw-primary-dark) !important;
    font-weight: 700 !important;
}

/* Hide Images */
.acc-hide-images #acc-content-wrapper img,
.acc-hide-images #acc-content-wrapper svg:not(.acc-widget-toggle-icon svg),
.acc-hide-images #acc-content-wrapper picture,
.acc-hide-images #acc-content-wrapper [style*="background-image"] {
    visibility: hidden !important;
}

/* Underline Links */
.acc-underline-links #acc-content-wrapper a {
    text-decoration: underline !important;
    text-underline-offset: 3px !important;
    text-decoration-thickness: 2px !important;
    text-decoration-color: currentColor !important;
}

/* Text Cursor */
.acc-text-cursor #acc-content-wrapper,
.acc-text-cursor #acc-content-wrapper * {
    caret-color: var(--aw-primary) !important;
}

.acc-text-cursor #acc-content-wrapper input,
.acc-text-cursor #acc-content-wrapper textarea {
    font-size: 1.2em !important;
}

/* Align Center */
.acc-align-center #acc-content-wrapper * {
    text-align: center !important;
}

/* Align Left */
.acc-align-left #acc-content-wrapper * {
    text-align: left !important;
}

/* Align Right */
.acc-align-right #acc-content-wrapper * {
    text-align: right !important;
}

/* ============================================
   Responsive
   ============================================ */

/* Mobile */
@media (max-width: 640px) {
    .acc-widget-panel {
        width: 100vw;
        max-width: 100vw;
        border-radius: 0;
        border-inline-end: none;
    }

    .acc-widget-panel.rtl,
    .acc-widget-panel.ltr {
        left: 0;
        right: 0;
    }

    .acc-widget-panel.rtl {
        transform: translateX(100%);
    }

    .acc-widget-panel.ltr {
        transform: translateX(100%);
    }

    .acc-widget-panel.open {
        transform: translateX(0);
    }

    .acc-widget-toggle-label {
        font-size: 9px;
    }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1024px) {}

/* Desktop */
@media (min-width: 1025px) {}