/* === Accessibility Widget === */

.a11y-toggle {
    position: fixed;
    bottom: 95px;
    left: 25px;
    z-index: 9990;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #1565c0;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(21,101,192,0.4);
    transition: all 0.3s ease;
    font-size: 22px;
}

.a11y-toggle:hover {
    transform: scale(1.1);
    background: #0d47a1;
}

.a11y-panel {
    display: none;
    position: fixed;
    bottom: 155px;
    left: 25px;
    z-index: 9991;
    width: 300px;
    max-height: 80vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
    direction: rtl;
    font-family: 'Heebo', sans-serif;
}

.a11y-panel.open {
    display: block;
    animation: a11ySlideUp 0.3s ease;
}

@keyframes a11ySlideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.a11y-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #1565c0;
    color: #fff;
    border-radius: 16px 16px 0 0;
}

.a11y-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.a11y-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

.a11y-body {
    padding: 16px 20px;
}

.a11y-section {
    margin-bottom: 16px;
}

.a11y-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
}

.a11y-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-family: 'Heebo', sans-serif;
    font-size: 14px;
    color: #334155;
    transition: all 0.2s ease;
    text-align: right;
    margin-bottom: 8px;
}

.a11y-btn:hover {
    border-color: #1565c0;
    background: #f0f7ff;
}

.a11y-btn.active {
    border-color: #1565c0;
    background: #e3f2fd;
    color: #1565c0;
    font-weight: 600;
}

.a11y-btn i {
    width: 22px;
    font-size: 16px;
    color: #1565c0;
    text-align: center;
    flex-shrink: 0;
}

.a11y-font-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.a11y-font-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-family: 'Heebo', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    transition: all 0.2s;
    text-align: center;
}

.a11y-font-btn:hover {
    border-color: #1565c0;
    background: #f0f7ff;
}

.a11y-font-btn.active {
    border-color: #1565c0;
    background: #e3f2fd;
    color: #1565c0;
}

.a11y-reset {
    display: block;
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 10px;
    background: #fef2f2;
    color: #dc2626;
    font-family: 'Heebo', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
    margin-top: 8px;
}

.a11y-reset:hover {
    background: #fee2e2;
}

/* === Accessibility Modes Applied to Body === */

body.a11y-big-cursor,
body.a11y-big-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M5 2 L5 30 L12 23 L20 35 L25 32 L17 20 L27 20 Z' fill='black' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 5 2, auto !important;
}

body.a11y-high-contrast {
    filter: contrast(1.4);
}

body.a11y-grayscale {
    filter: grayscale(1);
}

body.a11y-high-contrast.a11y-grayscale {
    filter: contrast(1.4) grayscale(1);
}

body.a11y-invert {
    filter: invert(1) hue-rotate(180deg);
}

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

body.a11y-highlight-links a {
    outline: 3px solid #ff0 !important;
    outline-offset: 2px;
    text-decoration: underline !important;
}

body.a11y-readable-font,
body.a11y-readable-font * {
    font-family: Arial, Helvetica, sans-serif !important;
    letter-spacing: 0.5px;
}

body.a11y-line-height,
body.a11y-line-height * {
    line-height: 2 !important;
}

body.a11y-letter-spacing,
body.a11y-letter-spacing * {
    letter-spacing: 2px !important;
    word-spacing: 4px !important;
}

body.a11y-stop-animations,
body.a11y-stop-animations * {
    animation: none !important;
    transition: none !important;
}

body.a11y-reading-guide .a11y-guide-bar {
    display: block;
}

.a11y-guide-bar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    height: 12px;
    background: rgba(255, 235, 59, 0.35);
    border-top: 2px solid rgba(255, 235, 59, 0.7);
    border-bottom: 2px solid rgba(255, 235, 59, 0.7);
    z-index: 99999;
    pointer-events: none;
}

/* Font size overrides */
body.a11y-font-1 { font-size: 18px !important; }
body.a11y-font-2 { font-size: 20px !important; }
body.a11y-font-3 { font-size: 22px !important; }

/* Responsive */
@media (max-width: 768px) {
    .a11y-toggle {
        bottom: 80px;
        left: 15px;
        width: 44px;
        height: 44px;
        font-size: 19px;
    }

    .a11y-panel {
        left: 10px;
        right: 10px;
        bottom: 135px;
        width: auto;
        max-height: 70vh;
    }
}
