/* ==========================================================================
   elTutors Accessibility & Vision Control Floating Widget Stylesheet
   Color: Deep Luxury Black (#0f172a)
   Opposite to the Chatbot Launcher in both RTL and LTR
   ========================================================================== */

/* 1. Floating Launcher Button (Black, Opposite to Chatbot) */
.bh-a11y-launcher {
    position: fixed !important;
    bottom: 24px !important;
    left: 24px !important;
    right: auto !important;
    width: 58px !important;
    height: 58px !important;
    border-radius: 50% !important;
    background: #0f172a !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.45), 0 0 0 2px rgba(255, 255, 255, 0.15) inset !important;
    cursor: pointer !important;
    z-index: 999999 !important;
    pointer-events: auto !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: none !important;
    outline: none !important;
    text-decoration: none !important;
}

[dir="rtl"] .bh-a11y-launcher {
    left: 24px !important;
    right: auto !important;
}

.bh-a11y-launcher:hover {
    transform: scale(1.08) translateY(-2px) !important;
    background: #020617 !important;
    color: #facc15 !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.65), 0 0 0 2px rgba(250, 204, 21, 0.4) inset !important;
}

.bh-a11y-launcher:focus-visible {
    outline: 3px solid #facc15 !important;
    outline-offset: 3px !important;
}

.bh-a11y-launcher .bh-a11y-icon {
    font-size: 26px !important;
    line-height: 1 !important;
    transition: transform 0.25s ease !important;
    pointer-events: none !important;
}

.bh-a11y-launcher:hover .bh-a11y-icon {
    transform: rotate(15deg) !important;
}

.bh-a11y-launcher-badge {
    position: absolute !important;
    top: -2px !important;
    right: -2px !important;
    width: 16px !important;
    height: 16px !important;
    background: #10b981 !important;
    border: 2px solid #ffffff !important;
    border-radius: 50% !important;
    display: none !important;
    pointer-events: none !important;
}

[dir="rtl"] .bh-a11y-launcher-badge {
    right: auto !important;
    left: -2px !important;
}

.bh-a11y-launcher.has-active .bh-a11y-launcher-badge {
    display: block !important;
}

/* 2. Floating Panel (Accessibility Drawer) */
.bh-a11y-panel {
    position: fixed !important;
    bottom: 92px !important;
    left: 24px !important;
    right: auto !important;
    width: 370px !important;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(100vh - 120px) !important;
    background: #ffffff !important;
    border-radius: 20px !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.08) !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 999999 !important;
    pointer-events: auto !important;
    overflow: hidden !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    transform-origin: bottom left !important;
    color: #1e293b !important;
    font-family: inherit !important;
}

[dir="rtl"] .bh-a11y-panel {
    left: 24px !important;
    right: auto !important;
    transform-origin: bottom left !important;
}

.bh-a11y-panel.d-none {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: scale(0.85) translateY(20px) !important;
    pointer-events: none !important;
}

.bh-a11y-panel:not(.d-none) {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: scale(1) translateY(0) !important;
    pointer-events: auto !important;
}

/* Panel Header */
.bh-a11y-header {
    background: #0f172a;
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.bh-a11y-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1rem;
    margin: 0;
    color: #ffffff;
}

.bh-a11y-header-title i {
    color: #facc15;
    font-size: 1.3rem;
}

.bh-a11y-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.bh-a11y-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #f87171;
}

/* Panel Body */
.bh-a11y-body {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.bh-a11y-body::-webkit-scrollbar {
    width: 6px;
}
.bh-a11y-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}

.bh-a11y-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Grid of options */
.bh-a11y-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.bh-a11y-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

/* Action button in panel */
.bh-a11y-card-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    color: #1e293b;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    gap: 6px;
    width: 100%;
}

.bh-a11y-card-btn i {
    font-size: 1.25rem;
    color: #0f172a;
    transition: color 0.2s ease;
}

.bh-a11y-card-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.bh-a11y-card-btn.active {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.bh-a11y-card-btn.active i {
    color: #facc15;
}

/* Text Size Stepper */
.bh-a11y-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 6px 8px;
}

.bh-a11y-stepper-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bh-a11y-stepper-btn:hover:not(:disabled) {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
}

.bh-a11y-stepper-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.bh-a11y-stepper-value {
    font-weight: 700;
    font-size: 0.95rem;
    color: #0f172a;
}

/* Panel Footer */
.bh-a11y-footer {
    padding: 14px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}

.bh-a11y-reset-btn {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bh-a11y-reset-btn:hover {
    background: #fecaca;
    color: #7f1d1d;
}

/* ==========================================================================
   3. GLOBAL ACCESSIBILITY MODIFIER CLASSES APPLIED TO <html>
   ========================================================================== */

/* A. Text Scaling */
html.a11y-text-110 { font-size: 110% !important; }
html.a11y-text-120 { font-size: 120% !important; }
html.a11y-text-130 { font-size: 130% !important; }

/* B. High Contrast Dark Mode */
html.a11y-high-contrast {
    filter: contrast(140%) !important;
}
html.a11y-high-contrast body {
    background-color: #000000 !important;
    color: #ffffff !important;
}
html.a11y-high-contrast .bg-white,
html.a11y-high-contrast .bg-light,
html.a11y-high-contrast .card,
html.a11y-high-contrast .modal-content,
html.a11y-high-contrast .accordion-item,
html.a11y-high-contrast .accordion-button {
    background-color: #0a0a0a !important;
    color: #ffffff !important;
    border-color: #334155 !important;
}
html.a11y-high-contrast .text-muted,
html.a11y-high-contrast .text-secondary {
    color: #cbd5e1 !important;
}
html.a11y-high-contrast .text-dark {
    color: #ffffff !important;
}

/* C. Yellow on Black (Medical Grade for low vision / light sensitivity) */
html.a11y-yellow-black,
html.a11y-yellow-black body {
    background-color: #000000 !important;
    color: #ffff00 !important;
}
html.a11y-yellow-black *:not(.bh-a11y-panel):not(.bh-a11y-panel *):not(.bh-a11y-launcher):not(.bh-a11y-launcher *) {
    background-color: #000000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

/* D. Monochrome / Grayscale */
html.a11y-grayscale {
    filter: grayscale(100%) !important;
}

/* E. Invert Colors */
html.a11y-invert {
    filter: invert(100%) hue-rotate(180deg) !important;
}
html.a11y-invert img,
html.a11y-invert video,
html.a11y-invert picture,
html.a11y-invert canvas,
html.a11y-invert .bh-a11y-launcher,
html.a11y-invert .bh-a11y-panel {
    filter: invert(100%) hue-rotate(180deg) !important;
}

/* F. Highlight Links */
html.a11y-highlight-links a:not(.bh-a11y-card-btn):not(.bh-a11y-launcher) {
    background-color: #fef08a !important;
    color: #854d0e !important;
    text-decoration: underline 2px solid #854d0e !important;
    font-weight: 700 !important;
    padding: 1px 4px !important;
    border-radius: 4px !important;
}

/* G. Dyslexia Friendly Font */
html.a11y-dyslexia-font,
html.a11y-dyslexia-font *:not(.bi) {
    font-family: 'OpenDyslexic', 'Comic Sans MS', 'Verdana', sans-serif !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.1em !important;
}

/* H. Enhanced Line Height */
html.a11y-line-spacing p,
html.a11y-line-spacing span,
html.a11y-line-spacing li,
html.a11y-line-spacing div {
    line-height: 2.1 !important;
}

/* I. Big Cursor */
html.a11y-big-cursor,
html.a11y-big-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 24 24' fill='%230f172a' stroke='%23ffffff' stroke-width='1.5'%3E%3Cpath d='M3 3l7 18 3-7 7-3L3 3z'/%3E%3C/svg%3E"), auto !important;
}

/* J. Pause Animations */
html.a11y-pause-animations *,
html.a11y-pause-animations *::before,
html.a11y-pause-animations *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
}

/* K. Reading Guide Line */
#bhA11yReadingGuide {
    position: fixed;
    left: 0;
    width: 100vw;
    height: 42px;
    background: rgba(254, 240, 138, 0.35);
    border-top: 2px dashed #ca8a04;
    border-bottom: 2px dashed #ca8a04;
    pointer-events: none;
    z-index: 99999;
    transform: translateY(-50%);
    display: none;
    transition: top 0.06s linear;
}
html.a11y-reading-guide #bhA11yReadingGuide {
    display: block;
}
