/* ==================== ACCESSIBILITY WIDGET ==================== */

/* Widget Toggle Container */
.accessibility-toggle-container {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

/* Hide Button (X) */
.accessibility-hide-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1;
}

.accessibility-toggle-container:hover .accessibility-hide-btn {
    opacity: 1;
    visibility: visible;
}

.accessibility-hide-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Widget Toggle Button */
.accessibility-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2b9b8a 0%, #1e40af 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(43, 155, 138, 0.4);
    transition: all 0.3s ease;
}

.accessibility-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(43, 155, 138, 0.5);
}

.accessibility-toggle svg {
    width: 32px;
    height: 32px;
    fill: white;
}

.accessibility-toggle-label {
    position: absolute;
    right: 70px;
    background: #1a2e35;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.accessibility-toggle:hover .accessibility-toggle-label {
    opacity: 1;
    visibility: visible;
}

/* Widget Panel */
.accessibility-panel {
    position: fixed;
    left: 20px;
    bottom: 100px;
    width: 320px;
    max-height: 80vh;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    overflow: hidden;
    direction: rtl;
}

.accessibility-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Panel Header */
.accessibility-header {
    background: linear-gradient(135deg, #2b9b8a 0%, #1e40af 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accessibility-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.accessibility-header h3 svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.accessibility-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.accessibility-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Panel Body */
.accessibility-body {
    padding: 20px;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
}

/* Reset Button */
.accessibility-reset {
    width: 100%;
    padding: 12px;
    background: #f1f5f9;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.accessibility-reset:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #ef4444;
}

/* Section Title */
.accessibility-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

/* Options Grid */
.accessibility-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

/* Option Button */
.accessibility-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 10px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 8px;
}

.accessibility-option:hover {
    background: #f1f5f9;
    border-color: #2b9b8a;
}

.accessibility-option.active {
    background: #e8f7f4;
    border-color: #2b9b8a;
}

.accessibility-option.active .accessibility-option-icon {
    background: #2b9b8a;
    color: white;
}

.accessibility-option-icon {
    width: 44px;
    height: 44px;
    background: #e2e8f0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
}

.accessibility-option-label {
    font-size: 11px;
    font-weight: 500;
    color: #475569;
    text-align: center;
    line-height: 1.3;
}

/* Slider Controls */
.accessibility-slider-group {
    margin-bottom: 20px;
}

.accessibility-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.accessibility-slider-label {
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}

.accessibility-slider-value {
    background: #2b9b8a;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.accessibility-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
}

.accessibility-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #2b9b8a 0%, #1e40af 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(43, 155, 138, 0.4);
}

.accessibility-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #2b9b8a 0%, #1e40af 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 10px rgba(43, 155, 138, 0.4);
}

/* Footer */
.accessibility-footer {
    padding: 15px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.accessibility-footer p {
    margin: 0;
    font-size: 11px;
    color: #94a3b8;
}

.accessibility-footer a {
    color: #2b9b8a;
    text-decoration: none;
}

/* ==================== ACCESSIBILITY EFFECTS ==================== */

/* High Contrast */
body.acc-high-contrast,
#acc-content-wrapper.acc-high-contrast {
    filter: contrast(1.4) !important;
}

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

/* Invert Colors */
body.acc-invert,
#acc-content-wrapper.acc-invert {
    filter: invert(1) hue-rotate(180deg) !important;
}

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

/* Grayscale */
body.acc-grayscale,
#acc-content-wrapper.acc-grayscale {
    filter: grayscale(1) !important;
}

/* Light Background */
body.acc-light-bg {
    background: #ffffff !important;
}

body.acc-light-bg *:not(.accessibility-toggle):not(.accessibility-panel):not(.accessibility-panel *):not(.accessibility-toggle-container):not(.accessibility-toggle-container *) {
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* Dark Background */
body.acc-dark-bg {
    background: #1a1a2e !important;
}

body.acc-dark-bg *:not(.accessibility-toggle):not(.accessibility-panel):not(.accessibility-panel *):not(.accessibility-toggle-container):not(.accessibility-toggle-container *) {
    background-color: #1a1a2e !important;
    color: #ffffff !important;
}

/* Link Highlight */
body.acc-links-highlight a {
    background: #ffff00 !important;
    color: #000000 !important;
    padding: 2px 4px !important;
    text-decoration: underline !important;
    outline: 2px solid #ff6600 !important;
}

/* Headers Highlight */
body.acc-headers-highlight h1,
body.acc-headers-highlight h2,
body.acc-headers-highlight h3,
body.acc-headers-highlight h4,
body.acc-headers-highlight h5,
body.acc-headers-highlight h6 {
    background: #fef08a !important;
    padding: 5px 10px !important;
    border-right: 4px solid #eab308 !important;
}

/* Big Cursor */
body.acc-big-cursor,
body.acc-big-cursor * {
    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" d="M4 0l16 12.279-6.951 1.17 4.325 8.817-3.596 1.734-4.35-8.879-5.428 4.702z"/></svg>') 0 0, auto !important;
}

/* Reading Guide */
.acc-reading-guide {
    position: fixed;
    left: 0;
    right: 0;
    height: 40px;
    background: rgba(43, 155, 138, 0.2);
    border-top: 2px solid #2b9b8a;
    border-bottom: 2px solid #2b9b8a;
    pointer-events: none;
    z-index: 99990;
    display: none;
}

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

/* Stop Animations */
body.acc-stop-animations *,
body.acc-stop-animations *::before,
body.acc-stop-animations *::after {
    animation: none !important;
    transition: none !important;
}

/* Dyslexia Font */
body.acc-dyslexia-font,
body.acc-dyslexia-font * {
    font-family: 'OpenDyslexic', 'Comic Sans MS', sans-serif !important;
    letter-spacing: 0.1em !important;
    word-spacing: 0.2em !important;
}

/* Text Spacing */
body.acc-text-spacing-1 * {
    letter-spacing: 0.1em !important;
    word-spacing: 0.15em !important;
    line-height: 1.8 !important;
}

body.acc-text-spacing-2 * {
    letter-spacing: 0.15em !important;
    word-spacing: 0.25em !important;
    line-height: 2 !important;
}

body.acc-text-spacing-3 * {
    letter-spacing: 0.2em !important;
    word-spacing: 0.35em !important;
    line-height: 2.2 !important;
}

/* Font Size */
body.acc-font-size-1 * { font-size: 110% !important; }
body.acc-font-size-2 * { font-size: 120% !important; }
body.acc-font-size-3 * { font-size: 130% !important; }
body.acc-font-size-4 * { font-size: 140% !important; }
body.acc-font-size-5 * { font-size: 150% !important; }

/* Focus Highlight */
body.acc-focus-highlight *:focus {
    outline: 4px solid #ff6600 !important;
    outline-offset: 2px !important;
}

/* Images Hide */
body.acc-hide-images img {
    visibility: hidden !important;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .accessibility-toggle-container {
        left: 15px;
        bottom: 15px;
    }

    .accessibility-toggle {
        width: 50px;
        height: 50px;
    }

    .accessibility-toggle svg {
        width: 26px;
        height: 26px;
    }

    .accessibility-hide-btn {
        width: 20px;
        height: 20px;
        font-size: 14px;
        top: -6px;
        right: -6px;
    }

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

    .accessibility-options {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==================== WIDGET ISOLATION FROM EFFECTS ==================== */
body.acc-light-bg .accessibility-toggle-container,
body.acc-dark-bg .accessibility-toggle-container {
    background: transparent !important;
}

body.acc-light-bg .accessibility-hide-btn,
body.acc-dark-bg .accessibility-hide-btn {
    background: #ef4444 !important;
    color: white !important;
    border-color: white !important;
}

body.acc-light-bg .accessibility-toggle,
body.acc-dark-bg .accessibility-toggle {
    background: linear-gradient(135deg, #2b9b8a 0%, #1e40af 100%) !important;
}

body.acc-light-bg .accessibility-toggle svg,
body.acc-dark-bg .accessibility-toggle svg {
    fill: white !important;
}

body.acc-light-bg .accessibility-panel,
body.acc-dark-bg .accessibility-panel {
    background: #ffffff !important;
}

body.acc-light-bg .accessibility-header,
body.acc-dark-bg .accessibility-header {
    background: linear-gradient(135deg, #2b9b8a 0%, #1e40af 100%) !important;
    color: white !important;
}

body.acc-light-bg .accessibility-header h3,
body.acc-dark-bg .accessibility-header h3 {
    color: white !important;
}

body.acc-light-bg .accessibility-body,
body.acc-dark-bg .accessibility-body {
    background: #ffffff !important;
}

body.acc-light-bg .accessibility-option,
body.acc-dark-bg .accessibility-option {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

body.acc-light-bg .accessibility-option-label,
body.acc-dark-bg .accessibility-option-label {
    color: #475569 !important;
}

body.acc-light-bg .accessibility-section-title,
body.acc-dark-bg .accessibility-section-title {
    color: #64748b !important;
}

body.acc-light-bg .accessibility-reset,
body.acc-dark-bg .accessibility-reset {
    background: #f1f5f9 !important;
    color: #64748b !important;
}

body.acc-light-bg .accessibility-footer,
body.acc-dark-bg .accessibility-footer {
    background: #f8fafc !important;
}

body.acc-light-bg .accessibility-footer p,
body.acc-dark-bg .accessibility-footer p {
    color: #94a3b8 !important;
}
