/* Accessibility Global Classes */

/* High Contrast Mode */
body.a11y-high-contrast {
    background-color: #000000 !important;
    color: #ffffff !important;
}

body.a11y-high-contrast :not(.a11y-widget-container):not(.a11y-panel):not(.a11y-panel *):not(.a11y-toggle-btn) {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}

body.a11y-high-contrast img,
body.a11y-high-contrast svg {
    filter: contrast(2) grayscale(1) !important;
}

body.a11y-high-contrast a {
    color: #ffff00 !important;
    text-decoration: underline !important;
}

/* Ensure the accessibility widget remains fully usable and pristine in high contrast mode */
body.a11y-high-contrast .a11y-panel {
    background-color: #000000 !important;
    border: 2px solid #ffffff !important;
}

body.a11y-high-contrast .a11y-panel-header,
body.a11y-high-contrast .a11y-option {
    border-bottom: 1px solid #ffffff !important;
}

body.a11y-high-contrast .a11y-option.active {
    background-color: #ffff00 !important;
    color: #000000 !important;
}

body.a11y-high-contrast .a11y-option.active * {
    color: #000000 !important;
}

body.a11y-high-contrast .a11y-font-btn,
body.a11y-high-contrast .a11y-reset-btn {
    border: 2px solid #ffffff !important;
    background-color: #000000 !important;
    color: #ffffff !important;
}

body.a11y-high-contrast .a11y-font-btn:hover,
body.a11y-high-contrast .a11y-reset-btn:hover {
    background-color: #ffffff !important;
    color: #000000 !important;
}

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

/* Dyslexia Friendly Font */
body.a11y-dyslexia * {
    font-family: "OpenDyslexic", "Comic Sans MS", Arial, sans-serif !important;
    letter-spacing: 0.1em !important;
    word-spacing: 0.2em !important;
    line-height: 1.5 !important;
}

/* Highlight Links */
body.a11y-highlight-links a {
    background-color: #ffff00 !important;
    color: #000000 !important;
    text-decoration: underline !important;
    padding: 2px 4px !important;
}

/* Accessibility Widget Styling */
.a11y-widget-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 9999;
}

.a11y-toggle-btn {
    width: 60px;
    height: 60px;
    background-color: #0d6efd; /* Bootstrap primary */
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease;
    border: 3px solid #ffffff;
}

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

.a11y-panel {
    position: absolute;
    bottom: 75px;
    left: 0;
    width: 320px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.a11y-panel.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.a11y-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.a11y-panel-header h5 {
    margin: 0;
    font-weight: 700;
    color: #333;
    font-size: 1.1rem;
}

.a11y-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.a11y-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 10px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.a11y-option:hover {
    background: #f8f9fa;
}

.a11y-option.active {
    background: #e7f1ff;
    color: #0d6efd;
    font-weight: 600;
}

.a11y-option-icon {
    font-size: 1.2rem;
    margin-right: 15px;
    color: #555;
    width: 24px;
    text-align: center;
}

.a11y-option.active .a11y-option-icon {
    color: #0d6efd;
}

.a11y-option-text {
    flex-grow: 1;
    font-size: 0.95rem;
    color: #444;
}

.a11y-option.active .a11y-option-text {
    color: #0d6efd;
}

/* Font size controls */
.a11y-font-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.a11y-font-btn {
    background: #ffffff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    color: #333;
    transition: all 0.2s;
}

.a11y-font-btn:hover {
    background: #e9ecef;
}

.a11y-reset-btn {
    width: 100%;
    margin-top: 15px;
    padding: 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.a11y-reset-btn:hover {
    background: #c82333;
}

/* Text Size scaling logic using rem override - we will scale html tag font-size */
html.a11y-text-110 { font-size: 110% !important; }
html.a11y-text-120 { font-size: 120% !important; }
html.a11y-text-130 { font-size: 130% !important; }
html.a11y-text-140 { font-size: 140% !important; }
html.a11y-text-150 { font-size: 150% !important; }
