/* Accessibility Widget Styles */

/* Screen Reader Only - for ARIA live regions */
.a11y-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

:root {
    /* Accessibility Widget Colors - Complementary to Chat Widget */
    --a11y-primary: #28A745;       /* Green for accessibility */
    --a11y-secondary: #20C997;      /* Teal accent */
    --a11y-accent: #17A2B8;         /* Info blue */
    --a11y-hover: #218838;          /* Darker green on hover */
    --a11y-shadow: rgba(40, 167, 69, 0.3); /* Green shadow */
    --a11y-text-light: #ffffff;
    --a11y-text-dark: #2d3748;
    --a11y-bg: #ffffff;
    --a11y-input-bg: #F7F7FC;
    --a11y-border: #E8E8E8;
}

/* Floating Accessibility Widget Container */
.a11y-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--a11y-text-dark);
}

/* Position Classes */
.a11y-widget[data-position="bottom-left"] {
    bottom: 24px;
    left: 24px;
}

.a11y-widget[data-position="bottom-right"] {
    bottom: 24px;
    right: 24px;
}

.a11y-widget[data-position="top-right"] {
    top: 24px;
    right: 24px;
}

.a11y-widget[data-position="top-left"] {
    top: 24px;
    left: 24px;
}

/* Trigger Button - Circular Design */
.a11y-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28A745 0%, #20C997 100%);
    color: white;
    border: 3px solid white;
    box-shadow: 0 4px 16px var(--a11y-shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0;
}

.a11y-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px var(--a11y-shadow);
}

.a11y-trigger:focus {
    outline: 3px solid var(--a11y-primary);
    outline-offset: 2px;
}

.a11y-trigger[aria-expanded="true"] {
    transform: rotate(0deg) scale(0.95);
}

.a11y-icon {
    flex-shrink: 0;
}

/* Panel Container */
.a11y-panel {
    position: absolute;
    width: 380px;
    max-height: 600px;
    background: var(--a11y-bg);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: none; /* Hidden by default */
    flex-direction: column;
    animation: slideInLeft 0.3s ease;
}

/* Show panel when not hidden */
.a11y-panel:not([hidden]) {
    display: flex;
}

/* Panel positioning based on widget position */
.a11y-widget[data-position="bottom-left"] .a11y-panel {
    bottom: 75px;
    left: 0;
}

.a11y-widget[data-position="bottom-right"] .a11y-panel {
    bottom: 75px;
    right: 0;
}

.a11y-widget[data-position="top-right"] .a11y-panel {
    top: 75px;
    right: 0;
}

.a11y-widget[data-position="top-left"] .a11y-panel {
    top: 75px;
    left: 0;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Panel Header */
.a11y-panel-header {
    background: linear-gradient(135deg, #28A745 0%, #20C997 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.a11y-panel-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.a11y-icon-inline {
    flex-shrink: 0;
}

.a11y-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.a11y-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Quick Actions Bar */
.a11y-quick-actions {
    background: #F7F8FA;
    padding: 16px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--a11y-border);
}

.a11y-quick-btn {
    flex: 1;
    padding: 10px;
    background: white;
    border: 2px solid var(--a11y-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--a11y-text-dark);
}

.a11y-quick-btn:hover {
    background: #E8F5E9;
    border-color: var(--a11y-primary);
    transform: translateY(-2px);
}

.a11y-quick-btn.active {
    background: var(--a11y-primary);
    color: white;
    border-color: var(--a11y-primary);
}

.a11y-quick-label {
    white-space: nowrap;
}

/* Panel Body */
.a11y-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    min-height: 0;
}

/* Sections */
.a11y-section {
    border-bottom: 1px solid var(--a11y-border);
}

.a11y-section-header {
    padding: 16px 20px;
    background: #F7F8FA;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: var(--a11y-text-dark);
    border: none;
    width: 100%;
    text-align: left;
    transition: background 0.2s;
}

.a11y-section-header:hover {
    background: #E8F5E9;
}

.a11y-chevron {
    transition: transform 0.3s;
}

details[open] .a11y-chevron {
    transform: rotate(180deg);
}

.a11y-section-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Controls */
.a11y-control {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.a11y-control label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: var(--a11y-text-dark);
}

.a11y-label-text {
    font-size: 14px;
}

.a11y-label-value {
    font-size: 12px;
    color: #718096;
    font-weight: 400;
}

/* Slider Controls */
.a11y-slider-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.a11y-slider-dec,
.a11y-slider-inc {
    width: 36px;
    height: 36px;
    border: 2px solid var(--a11y-border);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--a11y-text-dark);
    transition: all 0.2s;
    font-weight: 600;
}

.a11y-slider-dec:hover,
.a11y-slider-inc:hover {
    background: #E8F5E9;
    border-color: var(--a11y-primary);
}

input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #E8E8E8;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--a11y-primary);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 12px rgba(40, 167, 69, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--a11y-primary);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

/* Select Controls */
.a11y-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--a11y-border);
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: var(--a11y-text-dark);
    cursor: pointer;
    transition: all 0.2s;
}

.a11y-select:hover {
    border-color: var(--a11y-primary);
}

.a11y-select:focus {
    outline: none;
    border-color: var(--a11y-primary);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* Button Groups */
.a11y-button-group {
    display: flex;
    gap: 6px;
    background: #F7F8FA;
    padding: 4px;
    border-radius: 8px;
}

.a11y-mode-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--a11y-text-dark);
    transition: all 0.2s;
}

.a11y-mode-btn:hover {
    background: rgba(40, 167, 69, 0.1);
}

.a11y-mode-btn.active {
    background: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    color: var(--a11y-primary);
    font-weight: 600;
}

/* Toggle Switches */
.a11y-toggle-input {
    display: none;
}

.a11y-toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.a11y-toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
    background: #C1C7D0;
    border-radius: 14px;
    transition: background 0.3s;
    flex-shrink: 0;
}

.a11y-toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.a11y-toggle-input:checked + .a11y-toggle-label .a11y-toggle-switch {
    background: var(--a11y-primary);
}

.a11y-toggle-input:checked + .a11y-toggle-label .a11y-toggle-switch::after {
    transform: translateX(24px);
}

.a11y-toggle-text {
    font-size: 14px;
    color: var(--a11y-text-dark);
}

/* Buttons */
.a11y-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.a11y-btn-primary {
    background: var(--a11y-primary);
    color: white;
}

.a11y-btn-primary:hover {
    background: var(--a11y-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--a11y-shadow);
}

.a11y-btn-text {
    background: transparent;
    color: #718096;
    padding: 10px;
}

.a11y-btn-text:hover {
    color: var(--a11y-primary);
}

/* Panel Footer */
.a11y-panel-footer {
    padding: 16px 20px;
    background: #F7F8FA;
    border-top: 1px solid var(--a11y-border);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Scrollbar Styling */
.a11y-panel-body::-webkit-scrollbar {
    width: 6px;
}

.a11y-panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.a11y-panel-body::-webkit-scrollbar-thumb {
    background: var(--a11y-secondary);
    border-radius: 3px;
}

.a11y-panel-body::-webkit-scrollbar-thumb:hover {
    background: var(--a11y-primary);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .a11y-widget {
        bottom: 16px;
        left: 16px;
    }

    .a11y-trigger {
        width: 56px;
        height: 56px;
    }

    /* Full screen panel on mobile */
    .a11y-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        animation: slideUpMobile 0.3s ease;
    }

    @keyframes slideUpMobile {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }

    .a11y-widget[data-position="bottom-left"] .a11y-panel,
    .a11y-widget[data-position="bottom-right"] .a11y-panel,
    .a11y-widget[data-position="top-left"] .a11y-panel,
    .a11y-widget[data-position="top-right"] .a11y-panel {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }

    .a11y-quick-label {
        font-size: 11px;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .a11y-panel {
        width: 360px;
        max-height: 560px;
    }
}

/* Focus Styles */
.a11y-widget *:focus {
    outline: 2px solid var(--a11y-primary);
    outline-offset: 2px;
}

/* High Contrast Mode Overrides */
body.a11y-high-contrast {
    background: white !important;
    color: black !important;
}

body.a11y-high-contrast * {
    background: white !important;
    color: black !important;
    border-color: black !important;
}

body.a11y-high-contrast a {
    color: blue !important;
    text-decoration: underline !important;
}

body.a11y-high-contrast button {
    border: 2px solid black !important;
}

body.a11y-high-contrast .a11y-widget,
body.a11y-high-contrast .a11y-widget * {
    background: white !important;
    color: black !important;
}

body.a11y-high-contrast .a11y-trigger {
    background: black !important;
    color: white !important;
}

body.a11y-high-contrast .a11y-panel {
    border: 3px solid black !important;
}

/* Dark Mode Overrides */
body.a11y-dark {
    background: #1a1a1a !important;
    color: #e0e0e0 !important;
}

body.a11y-dark * {
    background: #1a1a1a !important;
    color: #e0e0e0 !important;
}

body.a11y-dark .a11y-panel {
    background: #2a2a2a !important;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7);
}

body.a11y-dark .a11y-panel-header {
    background: #333 !important;
}

body.a11y-dark .a11y-quick-actions,
body.a11y-dark .a11y-section-header,
body.a11y-dark .a11y-panel-footer {
    background: #2a2a2a !important;
}

body.a11y-dark .a11y-quick-btn,
body.a11y-dark .a11y-slider-dec,
body.a11y-dark .a11y-slider-inc,
body.a11y-dark .a11y-select {
    background: #333 !important;
    border-color: #444 !important;
}

body.a11y-dark input[type="range"] {
    background: #444 !important;
}
