/* ==========================================================================
   Modul de Accesibilitate - SABIF / ASAR
   Conform standardelor WCAG 2.1 și cerințelor de accesibilitate web
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Izolarea widget-ului de accesibilitate
   -------------------------------------------------------------------------- */
#a11y-widget-root {
    position: relative !important;
    z-index: 2147483647 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    text-transform: none !important;
}

#a11y-widget-root * {
    box-sizing: border-box !important;
}

/* --------------------------------------------------------------------------
   2. Scalare Font (Font Size)
   -------------------------------------------------------------------------- */
html.a11y-font-125 body,
html.a11y-font-125 p,
html.a11y-font-125 span:not(#a11y-widget-root *),
html.a11y-font-125 a:not(#a11y-widget-root *),
html.a11y-font-125 li,
html.a11y-font-125 td,
html.a11y-font-125 th,
html.a11y-font-125 label,
html.a11y-font-125 input,
html.a11y-font-125 button:not(#a11y-widget-root *),
html.a11y-font-125 div:not(#a11y-widget-root, #a11y-widget-root *) {
    font-size: 1.25rem !important;
}

html.a11y-font-125 h1 { font-size: 2.5rem !important; }
html.a11y-font-125 h2 { font-size: 2.1rem !important; }
html.a11y-font-125 h3 { font-size: 1.8rem !important; }
html.a11y-font-125 h4 { font-size: 1.5rem !important; }
html.a11y-font-125 h5 { font-size: 1.3rem !important; }
html.a11y-font-125 h6 { font-size: 1.25rem !important; }

html.a11y-font-150 body,
html.a11y-font-150 p,
html.a11y-font-150 span:not(#a11y-widget-root *),
html.a11y-font-150 a:not(#a11y-widget-root *),
html.a11y-font-150 li,
html.a11y-font-150 td,
html.a11y-font-150 th,
html.a11y-font-150 label,
html.a11y-font-150 input,
html.a11y-font-150 button:not(#a11y-widget-root *),
html.a11y-font-150 div:not(#a11y-widget-root, #a11y-widget-root *) {
    font-size: 1.5rem !important;
}

html.a11y-font-150 h1 { font-size: 3rem !important; }
html.a11y-font-150 h2 { font-size: 2.5rem !important; }
html.a11y-font-150 h3 { font-size: 2.1rem !important; }
html.a11y-font-150 h4 { font-size: 1.8rem !important; }
html.a11y-font-150 h5 { font-size: 1.6rem !important; }
html.a11y-font-150 h6 { font-size: 1.5rem !important; }

html.a11y-font-175 body,
html.a11y-font-175 p,
html.a11y-font-175 span:not(#a11y-widget-root *),
html.a11y-font-175 a:not(#a11y-widget-root *),
html.a11y-font-175 li,
html.a11y-font-175 td,
html.a11y-font-175 th,
html.a11y-font-175 label,
html.a11y-font-175 input,
html.a11y-font-175 button:not(#a11y-widget-root *),
html.a11y-font-175 div:not(#a11y-widget-root, #a11y-widget-root *) {
    font-size: 1.75rem !important;
}

html.a11y-font-175 h1 { font-size: 3.3rem !important; }
html.a11y-font-175 h2 { font-size: 2.8rem !important; }
html.a11y-font-175 h3 { font-size: 2.4rem !important; }
html.a11y-font-175 h4 { font-size: 2rem !important; }
html.a11y-font-175 h5 { font-size: 1.85rem !important; }
html.a11y-font-175 h6 { font-size: 1.75rem !important; }

/* Font +100% (200% / dublu) cu important pe toate elementele din pagină */
html.a11y-font-200 body,
html.a11y-font-200 p,
html.a11y-font-200 span:not(#a11y-widget-root *),
html.a11y-font-200 a:not(#a11y-widget-root *),
html.a11y-font-200 li,
html.a11y-font-200 td,
html.a11y-font-200 th,
html.a11y-font-200 label,
html.a11y-font-200 input,
html.a11y-font-200 select,
html.a11y-font-200 textarea,
html.a11y-font-200 button:not(#a11y-widget-root *),
html.a11y-font-200 div:not(#a11y-widget-root, #a11y-widget-root *) {
    font-size: 2rem !important;
    line-height: 1.6 !important;
}

html.a11y-font-200 h1 { font-size: 3.8rem !important; line-height: 1.3 !important; }
html.a11y-font-200 h2 { font-size: 3.2rem !important; line-height: 1.3 !important; }
html.a11y-font-200 h3 { font-size: 2.7rem !important; line-height: 1.4 !important; }
html.a11y-font-200 h4 { font-size: 2.3rem !important; line-height: 1.4 !important; }
html.a11y-font-200 h5 { font-size: 2.1rem !important; }
html.a11y-font-200 h6 { font-size: 2rem !important; }

/* --------------------------------------------------------------------------
   3. Moduri de Contrast și Culori
   -------------------------------------------------------------------------- */

/* Contrast Ridicat (Galben pe Negru) */
html.a11y-contrast-high,
html.a11y-contrast-high body {
    background-color: #000000 !important;
    color: #ffffff !important;
}

html.a11y-contrast-high body *:not(#a11y-widget-root, #a11y-widget-root *) {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #ffff00 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

html.a11y-contrast-high a:not(#a11y-widget-root a),
html.a11y-contrast-high a:not(#a11y-widget-root a) *,
html.a11y-contrast-high button:not(#a11y-widget-root button),
html.a11y-contrast-high button:not(#a11y-widget-root button) *,
html.a11y-contrast-high h1,
html.a11y-contrast-high h2,
html.a11y-contrast-high h3,
html.a11y-contrast-high h4,
html.a11y-contrast-high h5,
html.a11y-contrast-high h6 {
    color: #ffff00 !important;
}

html.a11y-contrast-high img,
html.a11y-contrast-high svg:not(#a11y-widget-root svg) {
    filter: contrast(130%) brightness(110%);
}


/* Contrast Deschis (Light High Contrast: Negru pe Alb curat) */
html.a11y-contrast-light,
html.a11y-contrast-light body {
    background-color: #ffffff !important;
    color: #000000 !important;
}

html.a11y-contrast-light body *:not(#a11y-widget-root, #a11y-widget-root *) {
    background-color: #ffffff !important;
    color: #000000 !important;
    background-image: none !important;
    box-shadow: none !important;
    border-color: #000000 !important;
}

html.a11y-contrast-light a:not(#a11y-widget-root a),
html.a11y-contrast-light a:not(#a11y-widget-root a) * {
    color: #0000cc !important;
    text-decoration: underline !important;
}

/* Mod Monocrom (Grayscale) */
html.a11y-contrast-grayscale {
    filter: grayscale(100%) !important;
}

/* --------------------------------------------------------------------------
   4. Lizibilitate și Spațiere Text
   -------------------------------------------------------------------------- */
html.a11y-spacing-expanded body *:not(#a11y-widget-root, #a11y-widget-root *) {
    line-height: 1.9 !important;
    letter-spacing: 0.12em !important;
    word-spacing: 0.16em !important;
}

html.a11y-font-dyslexic body *:not(#a11y-widget-root, #a11y-widget-root *) {
    font-family: 'OpenDyslexic', 'Comic Sans MS', Arial, sans-serif !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.08em !important;
}

/* --------------------------------------------------------------------------
   5. Evidențiere Link-uri
   -------------------------------------------------------------------------- */
html.a11y-highlight-links a:not(#a11y-widget-root a) {
    text-decoration: underline !important;
    text-decoration-thickness: 3px !important;
    text-decoration-color: #ed7d31 !important;
    font-weight: 700 !important;
}

/* --------------------------------------------------------------------------
   6. Focus Vizual Îmbunătățit
   -------------------------------------------------------------------------- */
html.a11y-focus-outline *:focus,
html.a11y-focus-outline *:focus-visible {
    outline: 4px solid #ed7d31 !important;
    outline-offset: 3px !important;
}

/* --------------------------------------------------------------------------
   7. Oprire Animații
   -------------------------------------------------------------------------- */
html.a11y-pause-animations *,
html.a11y-pause-animations *::before,
html.a11y-pause-animations *::after {
    animation-duration: 0.0001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.0001s !important;
    scroll-behavior: auto !important;
}

/* --------------------------------------------------------------------------
   8. Cursor Mărit
   -------------------------------------------------------------------------- */
html.a11y-large-cursor,
html.a11y-large-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 24 24' fill='%23ed7d31' stroke='%23ffffff' stroke-width='1.5'%3E%3Cpath d='M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z'/%3E%3C/svg%3E"), auto !important;
}

/* --------------------------------------------------------------------------
   9. Ghidaj de Citire (Reading Guide Line)
   -------------------------------------------------------------------------- */
.a11y-reading-guide-line {
    display: none;
    position: fixed;
    left: 0;
    width: 100vw;
    height: 6px;
    background-color: rgba(237, 125, 49, 0.9);
    box-shadow: 0 0 12px rgba(237, 125, 49, 0.7);
    pointer-events: none;
    z-index: 2147483640 !important;
    transform: translateY(-50%);
    transition: top 0.04s ease-out;
}

html.a11y-reading-guide-active .a11y-reading-guide-line {
    display: block;
}

/* --------------------------------------------------------------------------
   10. Stiluri Interfață Widget (Panou Accesibilitate)
   -------------------------------------------------------------------------- */
.a11y-trigger-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2147483642 !important;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-color: #ed7d31;
    color: #ffffff;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    padding: 0;
}

.a11y-trigger-btn:hover {
    transform: scale(1.08);
    background-color: #d86820;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.a11y-trigger-btn:focus-visible {
    outline: 3px solid #000000;
    outline-offset: 3px;
}

.a11y-trigger-btn svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

/* Backdrop */
.a11y-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2147483646 !important;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.a11y-backdrop.a11y-open {
    display: block;
    opacity: 1;
}

/* Panou Modal */
.a11y-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 92%;
    max-width: 540px;
    max-height: 90vh;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4) !important;
    z-index: 2147483647 !important;
    overflow-y: auto;
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

.a11y-modal.a11y-open {
    display: block;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Modal Header */
.a11y-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    position: sticky;
    top: 0;
    z-index: 2;
}

.a11y-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
}

.a11y-title svg {
    width: 24px;
    height: 24px;
    fill: #ed7d31;
}

.a11y-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease;
    padding: 0;
}

.a11y-close-btn:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

/* Modal Body */
.a11y-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.a11y-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.a11y-section-title {
    font-size: 13px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: #64748b !important;
    margin: 0 !important;
}

.a11y-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (max-width: 480px) {
    .a11y-grid-2 {
        grid-template-columns: 1fr;
    }
}

.a11y-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

@media (max-width: 480px) {
    .a11y-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Option Buttons & Cards */
.a11y-btn-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    background-color: #ffffff;
    color: #1e293b;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    width: 100%;
}

.a11y-btn-card:hover {
    border-color: #ed7d31;
    background-color: #fffaf5;
}

.a11y-btn-card.a11y-active {
    border-color: #ed7d31;
    background-color: #fff2e8;
    color: #c25008;
    font-weight: 600;
}

.a11y-btn-card svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: currentColor;
}

.a11y-btn-card-text {
    font-size: 13px !important;
    flex: 1;
}

/* Font scale buttons */
.a11y-font-btn {
    padding: 10px 8px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    background-color: #ffffff;
    color: #1e293b;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px !important;
    text-align: center;
    transition: all 0.15s ease;
}

.a11y-font-btn:hover {
    border-color: #ed7d31;
    background-color: #fffaf5;
}

.a11y-font-btn.a11y-active {
    border-color: #ed7d31;
    background-color: #fff2e8;
    color: #c25008;
}

/* Modal Footer */
.a11y-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    background-color: #f8fafc;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
    position: sticky;
    bottom: 0;
    z-index: 3;
    gap: 12px;
}

.a11y-reset-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background-color: #ffffff;
    color: #475569;
    font-weight: 600;
    font-size: 13px !important;
    cursor: pointer;
    transition: all 0.15s ease;
}

.a11y-reset-btn:hover {
    background-color: #fee2e2;
    border-color: #f87171;
    color: #b91c1c;
}

.a11y-done-btn {
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    background-color: #ed7d31;
    color: #ffffff;
    font-weight: 600;
    font-size: 13px !important;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.a11y-done-btn:hover {
    background-color: #d86820;
}
