
/* =====================================
   ACCESSIBILITY WIDGET
===================================== */

:root {
    --a11y-primary: #009acd;
}

#a11y-widget {
    font-family: Arial, sans-serif;
    position: relative;
    z-index: 99999;
}

/* Floating button */
.a11y-float {
    position: fixed;
    right: 20px;
    bottom: 25px;
    width: 54px;
    height: 54px;
    border: none;
    border-radius: 50%;
    background: var(--a11y-primary);
    color: #fff;
    font-size: 27px;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(0,0,0,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.a11y-float:hover {
    background: #007da8;
}

/* Panel */
.a11y-panel {
    position: fixed;
    right: 20px;
    bottom: 90px;
    width: 340px;
    max-width: calc(100vw - 30px);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: #fff;
    color: #222;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,.22);
    z-index: 99999;
    display: none;
}

.a11y-panel.open {
    display: block;
}

.a11y-header {
    background: var(--a11y-primary);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    border-radius: 11px 11px 0 0;
}

.a11y-close {
    background: transparent;
    color: #fff;
    border: none;
    font-size: 23px;
    cursor: pointer;
}

.a11y-content {
    padding: 15px;
}

.a11y-section {
    margin-bottom: 17px;
}

.a11y-title {
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 9px;
    display: block;
}

.a11y-divider {
    border-top: 1px solid #eee;
    margin: 14px 0;
}

.a11y-btn {
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    padding: 9px 8px;
    border-radius: 7px;
    font-size: 12px;
    cursor: pointer;
    width: 100%;
}

.a11y-btn:hover,
.a11y-btn.active {
    background: var(--a11y-primary);
    color: #fff;
    border-color: var(--a11y-primary);
}

.a11y-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.a11y-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.a11y-reader-status {
    background: #f2f7fa;
    padding: 9px;
    border-radius: 7px;
    font-size: 12px;
    color: #333;
    margin: 9px 0;
    overflow-wrap: anywhere;
}

.a11y-reader-status:empty {
    display: none;
}

.a11y-select,
.a11y-range {
    width: 100%;
}

.a11y-select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    color: #222;
}

.a11y-label {
    display: block;
    font-size: 12px;
    margin: 10px 0 5px;
}

.a11y-reset {
    width: 100%;
    padding: 10px;
    background: #f3f3f3;
    border: 1px solid #ddd;
    border-radius: 7px;
    cursor: pointer;
    font-weight: bold;
}

/* Accessibility modes */

body.a11y-high-contrast {
    background: #000 !important;
    color: #fff !important;
}

body.a11y-high-contrast,
body.a11y-high-contrast * {
    color: #fff !important;
}

body.a11y-high-contrast a {
    color: #ffff00 !important;
    text-decoration: underline !important;
}

body.a11y-high-contrast button,
body.a11y-high-contrast input,
body.a11y-high-contrast select,
body.a11y-high-contrast textarea {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}

body.a11y-grayscale {
    filter: grayscale(100%);
}

body.a11y-highlight-links a {
    background: #ffeb3b !important;
    color: #000 !important;
    outline: 2px solid #000 !important;
}

body.a11y-underline-links a {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
}

body.a11y-highlight-focus *:focus-visible {
    outline: 3px solid #ff9800 !important;
    outline-offset: 3px !important;
}

/* Mobile */
@media (max-width: 480px) {
    .a11y-float {
        right: 14px;
        bottom: 18px;
        width: 48px;
        height: 48px;
    }

    .a11y-panel {
        right: 10px;
        bottom: 76px;
        max-height: calc(100vh - 95px);
    }
}

/* Text spacing */
body.a11y-text-spacing {
    letter-spacing: 0.08em !important;
    line-height: 1.8 !important;
    word-spacing: 0.12em !important;
}

body.a11y-text-spacing p,
body.a11y-text-spacing li,
body.a11y-text-spacing td,
body.a11y-text-spacing th {
    line-height: 1.8 !important;
    letter-spacing: 0.08em !important;
}

/* High contrast improvement */
body.a11y-high-contrast {
    background: #000 !important;
    color: #fff !important;
}

body.a11y-high-contrast * {
    color: #fff !important;
    border-color: #fff !important;
}

body.a11y-high-contrast a {
    color: #ffff00 !important;
    text-decoration: underline !important;
}

body.a11y-high-contrast img {
    filter: none !important;
}
