/**
 * EAA Accessibility Auto-Fixer — Visitor widget styles
 * (c) DataFirefly Limited
 */

/* ---------- Toggle button ---------- */
.eaa-aaf-widget-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99998;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #1e40af;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
    font-size: 28px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease, background .2s ease;
}

.eaa-aaf-widget-toggle:hover,
.eaa-aaf-widget-toggle:focus-visible {
    background: #1e3a8a;
    transform: scale(1.05);
    outline: 3px solid #93c5fd;
    outline-offset: 2px;
}

.eaa-aaf-widget-toggle .eaa-aaf-icon {
    display: block;
    line-height: 1;
}

/* ---------- Panel ---------- */
.eaa-aaf-widget-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 99999;
    width: 320px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: #fff;
    color: #1f2937;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .2);
    padding: 20px;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.eaa-aaf-widget-panel.is-open {
    display: block;
}

.eaa-aaf-widget-panel h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 16px;
    color: #1e40af;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.eaa-aaf-widget-close {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.eaa-aaf-widget-close:hover,
.eaa-aaf-widget-close:focus-visible {
    color: #1f2937;
    outline: 2px solid #93c5fd;
    border-radius: 4px;
}

/* ---------- Toggles & controls ---------- */
.eaa-aaf-widget-section {
    margin-bottom: 18px;
}

.eaa-aaf-widget-section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6b7280;
    font-weight: 600;
    margin: 0 0 8px;
}

.eaa-aaf-widget-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

.eaa-aaf-widget-toggle-row:last-child {
    border-bottom: none;
}

.eaa-aaf-widget-toggle-row label {
    flex: 1;
    cursor: pointer;
    user-select: none;
    color: #1f2937;
    font-size: 14px;
}

.eaa-aaf-widget-switch {
    position: relative;
    width: 40px;
    height: 22px;
    background: #d1d5db;
    border-radius: 11px;
    cursor: pointer;
    transition: background .2s ease;
    flex-shrink: 0;
}

.eaa-aaf-widget-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.eaa-aaf-widget-switch.is-on {
    background: #1e40af;
}

.eaa-aaf-widget-switch.is-on::after {
    transform: translateX(18px);
}

.eaa-aaf-widget-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

/* ---------- Text size buttons ---------- */
.eaa-aaf-widget-stepper {
    display: flex;
    gap: 6px;
    align-items: center;
}

.eaa-aaf-widget-stepper button {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #1f2937;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
}

.eaa-aaf-widget-stepper button:hover,
.eaa-aaf-widget-stepper button:focus-visible {
    background: #f3f4f6;
    outline: 2px solid #93c5fd;
}

.eaa-aaf-widget-stepper-value {
    min-width: 48px;
    text-align: center;
    font-weight: 600;
    color: #1f2937;
}

/* ---------- Reset button ---------- */
.eaa-aaf-widget-reset {
    width: 100%;
    padding: 10px 12px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #1f2937;
    margin-top: 8px;
}

.eaa-aaf-widget-reset:hover,
.eaa-aaf-widget-reset:focus-visible {
    background: #e5e7eb;
    outline: 2px solid #93c5fd;
}

/* ---------- Skip link ---------- */
.eaa-aaf-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100000;
    padding: 12px 20px;
    background: #1e40af;
    color: #fff !important;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 6px 0;
}

.eaa-aaf-skip-link:focus {
    left: 0;
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

/* ---------- Visitor preference modes (applied to <html>) ---------- */
html[data-eaa-text-size="110"]  { font-size: 110% !important; }
html[data-eaa-text-size="125"]  { font-size: 125% !important; }
html[data-eaa-text-size="150"]  { font-size: 150% !important; }
html[data-eaa-text-size="175"]  { font-size: 175% !important; }
html[data-eaa-text-size="200"]  { font-size: 200% !important; }

html[data-eaa-high-contrast="1"] body,
html[data-eaa-high-contrast="1"] body * {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}
html[data-eaa-high-contrast="1"] a,
html[data-eaa-high-contrast="1"] a * {
    color: #ffff00 !important;
}
html[data-eaa-high-contrast="1"] img,
html[data-eaa-high-contrast="1"] video {
    filter: grayscale(40%) contrast(1.1);
}
html[data-eaa-high-contrast="1"] .eaa-aaf-widget-panel,
html[data-eaa-high-contrast="1"] .eaa-aaf-widget-panel * {
    background-color: #000 !important;
    color: #fff !important;
}

html[data-eaa-dyslexia-font="1"] body,
html[data-eaa-dyslexia-font="1"] body * {
    font-family: "Open Dyslexic", "Comic Sans MS", Verdana, Tahoma, sans-serif !important;
    letter-spacing: .04em !important;
    word-spacing: .12em !important;
    line-height: 1.7 !important;
}

html[data-eaa-large-cursor="1"],
html[data-eaa-large-cursor="1"] * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path fill="black" stroke="white" stroke-width="1.5" d="M3 2l7 18 2.5-7L20 10z"/></svg>') 4 4, auto !important;
}

html[data-eaa-reduce-motion="1"] *,
html[data-eaa-reduce-motion="1"] *::before,
html[data-eaa-reduce-motion="1"] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

html[data-eaa-underline-links="1"] a {
    text-decoration: underline !important;
}

html[data-eaa-readable-spacing="1"] p,
html[data-eaa-readable-spacing="1"] li,
html[data-eaa-readable-spacing="1"] h1,
html[data-eaa-readable-spacing="1"] h2,
html[data-eaa-readable-spacing="1"] h3 {
    line-height: 1.8 !important;
    letter-spacing: .04em !important;
    word-spacing: .12em !important;
}

/* ---------- Reduced overall motion respected automatically ---------- */
@media (prefers-reduced-motion: reduce) {
    .eaa-aaf-widget-toggle,
    .eaa-aaf-widget-switch,
    .eaa-aaf-widget-switch::after {
        transition: none !important;
    }
}

/* ---------- Focus ring injected by auto-fixer ---------- */
:focus-visible {
    outline: 3px solid #fbbf24 !important;
    outline-offset: 2px !important;
}
