/* ========================================
   Accessibility Toolbar — סרגל נגישות
   ======================================== */

/* Toggle Button */
.a11y-toggle {
    position: fixed;
    bottom: 90px;
    left: 24px;
    right: auto;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #1565C0;
    color: white;
    border: none;
    cursor: pointer;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(21, 101, 192, 0.35);
    transition: all 0.3s;
}

.a11y-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(21, 101, 192, 0.45);
    background: #0D47A1;
}

.a11y-toggle:focus {
    outline: 3px solid #BBDEFB;
    outline-offset: 3px;
}

/* Prevent zoom from affecting toolbar */
#a11y-toolbar {
    zoom: 1 !important;
}

#a11y-toolbar .a11y-toggle,
#a11y-toolbar .a11y-panel-header,
#a11y-toolbar .a11y-panel-body,
#a11y-toolbar .a11y-panel-body * {
    zoom: 1 !important;
}

/* Panel — side drawer with overlay */
.a11y-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 340px;
    max-width: 88vw;
    height: 100vh;
    background: #fff;
    z-index: 10001;
    border-radius: 0;
    box-shadow: 4px 0 40px rgba(0, 0, 0, 0.2);
    flex-direction: column;
    overflow: hidden;
    direction: rtl;
}

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

/* Overlay behind panel */
.a11y-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    cursor: pointer;
}

.a11y-overlay.open {
    display: block;
}

/* Panel Header */
.a11y-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: #1565C0;
    color: white;
    flex-shrink: 0;
}

.a11y-panel-header h3 {
    font-family: 'Assistant', sans-serif;
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.a11y-panel-header h3::before {
    content: '';
    display: inline-block;
    width: 22px;
    height: 22px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Ccircle cx='12' cy='4' r='2'/%3E%3Cpath d='M19 13v-2c-1.54.02-3.09-.75-4.07-1.83l-1.29-1.43c-.17-.19-.38-.34-.61-.45-.01 0-.01-.01-.02-.01H13c-.35-.2-.75-.3-1.19-.26C10.76 7.11 10 8.04 10 9.09V15c0 1.1.9 2 2 2h5v5h2v-5.5c0-1.1-.9-2-2-2h-3v-3.45c1.29 1.07 3.25 1.94 5 1.95zm-6.17 5c-.41 1.16-1.52 2-2.83 2-1.66 0-3-1.34-3-3 0-1.31.84-2.41 2-2.83V12.1c-2.28.46-4 2.48-4 4.9 0 2.76 2.24 5 5 5 2.42 0 4.44-1.72 4.9-4h-2.07z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    flex-shrink: 0;
}

.a11y-close {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.5);
    color: white;
    font-size: 26px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
    flex-shrink: 0;
}

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

/* Panel Body */
.a11y-panel-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

/* Sections */
.a11y-section {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid #ECEFF1;
}

.a11y-section:last-of-type {
    border-bottom: none;
}

.a11y-section h4 {
    font-family: 'Assistant', sans-serif;
    font-size: 13px;
    font-weight: 800;
    color: #546E7A;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Font Size Controls */
.a11y-font-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 12px;
}

.a11y-btn-round {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #1565C0;
    background: white;
    color: #1565C0;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.a11y-btn-round:hover {
    background: #1565C0;
    color: white;
}

.a11y-font-size {
    font-size: 22px;
    font-weight: 800;
    color: #1565C0;
    min-width: 60px;
    text-align: center;
}

/* Font Presets */
.a11y-font-presets {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.a11y-preset {
    padding: 6px 14px;
    border: 1.5px solid #CFD8DC;
    border-radius: 20px;
    background: white;
    color: #546E7A;
    font-family: 'Assistant', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.a11y-preset:hover {
    border-color: #1565C0;
    color: #1565C0;
}

.a11y-preset.active {
    background: #1565C0;
    color: white;
    border-color: #1565C0;
}

/* Option Buttons */
.a11y-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.a11y-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1.5px solid #E0E0E0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    font-family: 'Assistant', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #37474F;
    transition: all 0.2s;
    text-align: right;
}

.a11y-option:hover {
    border-color: #1565C0;
    background: #E3F2FD;
}

.a11y-option.active {
    border-color: #1565C0;
    background: #E3F2FD;
    color: #1565C0;
}

.a11y-option-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #ECEFF1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    flex-shrink: 0;
}

/* Text Align */
.a11y-align-options {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.a11y-align {
    width: 48px;
    height: 42px;
    border: 1.5px solid #E0E0E0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #546E7A;
    transition: all 0.2s;
}

.a11y-align:hover {
    border-color: #1565C0;
    color: #1565C0;
}

.a11y-align.active {
    background: #1565C0;
    color: white;
    border-color: #1565C0;
}

/* Reset Button */
.a11y-reset-section {
    border-bottom: none;
    padding-bottom: 0;
}

.a11y-reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border: 1.5px solid #EF5350;
    border-radius: 10px;
    background: white;
    color: #EF5350;
    font-family: 'Assistant', sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.a11y-reset-btn:hover {
    background: #EF5350;
    color: white;
}

.a11y-reset-btn svg {
    flex-shrink: 0;
}

/* Declaration Link */
.a11y-declaration {
    text-align: center;
    padding-top: 12px;
}

.a11y-declaration a {
    font-size: 12px;
    color: #90A4AE;
    text-decoration: underline;
}

.a11y-declaration a:hover {
    color: #1565C0;
}

/* ========================================
   Accessibility Styles Applied to Page
   ======================================== */

/* High Contrast */
.a11y-contrast-high,
.a11y-contrast-high * {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}

.a11y-contrast-high img {
    filter: contrast(1.2) !important;
}

.a11y-contrast-high .a11y-panel,
.a11y-contrast-high .a11y-panel *,
.a11y-contrast-high .a11y-toggle {
    background-color: revert !important;
    color: revert !important;
    border-color: revert !important;
}

/* Inverted */
.a11y-contrast-inverted {
    filter: invert(1) hue-rotate(180deg);
}

.a11y-contrast-inverted img,
.a11y-contrast-inverted video {
    filter: invert(1) hue-rotate(180deg);
}

.a11y-contrast-inverted .a11y-panel,
.a11y-contrast-inverted .a11y-toggle {
    filter: invert(1) hue-rotate(180deg);
}

/* Grayscale */
.a11y-grayscale {
    filter: grayscale(100%);
}

.a11y-grayscale .a11y-panel,
.a11y-grayscale .a11y-toggle {
    filter: grayscale(0);
}

/* Highlight Links */
.a11y-highlight-links a {
    outline: 2px solid #FFEB3B !important;
    outline-offset: 2px;
    background-color: rgba(255, 235, 59, 0.15) !important;
    text-decoration: underline !important;
}

.a11y-highlight-links .a11y-panel a {
    outline: none !important;
    background-color: transparent !important;
}

/* Readable Font */
.a11y-readable-font,
.a11y-readable-font * {
    font-family: Arial, Helvetica, sans-serif !important;
    letter-spacing: 0.5px !important;
    word-spacing: 2px !important;
}

.a11y-readable-font .a11y-panel,
.a11y-readable-font .a11y-panel * {
    font-family: 'Assistant', sans-serif !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
}

/* Big Cursor */
.a11y-big-cursor,
.a11y-big-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M5 2l18 14h-11l6 12-4 2-6-12-3 8z' fill='black' stroke='white' stroke-width='1'/%3E%3C/svg%3E") 4 2, auto !important;
}

/* Line Height */
.a11y-line-height,
.a11y-line-height * {
    line-height: 2.2 !important;
}

.a11y-line-height .a11y-panel,
.a11y-line-height .a11y-panel * {
    line-height: 1.5 !important;
}

/* Text Align */
.a11y-align-right * { text-align: right !important; }
.a11y-align-center * { text-align: center !important; }
.a11y-align-left * { text-align: left !important; }

.a11y-align-right .a11y-panel *,
.a11y-align-center .a11y-panel *,
.a11y-align-left .a11y-panel * {
    text-align: revert !important;
}

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

@media (max-width: 480px) {
    .a11y-panel {
        width: 100%;
        max-width: 100vw;
        border-radius: 16px 16px 0 0;
    }

    .a11y-options {
        grid-template-columns: 1fr;
    }

    .a11y-toggle {
        bottom: 80px;
        left: 16px;
        width: 44px;
        height: 44px;
    }

    .a11y-toggle svg {
        width: 22px;
        height: 22px;
    }
}
