/* Accessibility Widget Styles */

/* Widget Container */
.a11y-widget {
    --a11y-primary: #10b981;
    --a11y-primary-hover: #059669;
    --a11y-accent: #f59e0b;
    --a11y-bg: #ffffff;
    --a11y-bg-secondary: #f9fafb;
    --a11y-text: #1f2937;
    --a11y-text-muted: #6b7280;
    --a11y-border: #e5e7eb;
    --a11y-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --a11y-radius: 12px;
    --a11y-radius-sm: 8px;

    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    position: fixed;
    z-index: 999999;
}

.a11y-widget[data-position="bottom-left"] {
    bottom: 20px;
    left: 20px;
}

.a11y-widget[data-position="bottom-right"] {
    bottom: 20px;
    right: 20px;
}

/* Trigger Button */
.a11y-trigger {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--a11y-primary) 0%, var(--a11y-primary-hover) 100%);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--a11y-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.a11y-trigger:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 50px rgba(0, 0, 0, 0.2);
}

.a11y-trigger:focus {
    outline: 3px solid var(--a11y-accent);
    outline-offset: 3px;
}

.a11y-icon {
    width: 28px;
    height: 28px;
}

/* Panel */
.a11y-panel {
    position: absolute;
    bottom: 70px;
    left: 0;
    width: 340px;
    max-height: 80vh;
    background: var(--a11y-bg);
    border-radius: var(--a11y-radius);
    box-shadow: var(--a11y-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.a11y-widget[data-position="bottom-right"] .a11y-panel {
    left: auto;
    right: 0;
}

.a11y-panel[hidden] {
    display: none;
}

/* Panel Header */
.a11y-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--a11y-primary) 0%, var(--a11y-primary-hover) 100%);
    color: #ffffff;
}

.a11y-panel-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.a11y-icon-inline {
    opacity: 0.9;
}

.a11y-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ffffff;
    transition: background 0.2s ease;
}

.a11y-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.a11y-close:focus {
    outline: 2px solid var(--a11y-accent);
    outline-offset: 2px;
}

/* Quick Actions */
.a11y-quick-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--a11y-bg-secondary);
    border-bottom: 1px solid var(--a11y-border);
}

.a11y-quick-btn {
    flex: 1;
    padding: 8px 4px;
    border: 1px solid var(--a11y-border);
    background: var(--a11y-bg);
    border-radius: var(--a11y-radius-sm);
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    color: var(--a11y-text);
    transition: all 0.2s ease;
}

.a11y-quick-btn:hover {
    border-color: var(--a11y-primary);
    color: var(--a11y-primary);
}

.a11y-quick-btn.active {
    background: var(--a11y-primary);
    border-color: var(--a11y-primary);
    color: #ffffff;
}

.a11y-quick-btn:focus {
    outline: 2px solid var(--a11y-accent);
    outline-offset: 2px;
}

.a11y-quick-label {
    display: block;
}

/* Panel Body */
.a11y-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* Sections */
.a11y-section {
    border-bottom: 1px solid var(--a11y-border);
}

.a11y-section:last-child {
    border-bottom: none;
}

.a11y-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    color: var(--a11y-text);
    list-style: none;
}

.a11y-section-header::-webkit-details-marker {
    display: none;
}

.a11y-chevron {
    transition: transform 0.2s ease;
}

.a11y-section[open] .a11y-chevron {
    transform: rotate(180deg);
}

.a11y-section-content {
    padding: 0 16px 16px;
}

/* Controls */
.a11y-control {
    margin-bottom: 16px;
}

.a11y-control:last-child {
    margin-bottom: 0;
}

.a11y-control label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.a11y-label-text {
    font-weight: 500;
    color: var(--a11y-text);
}

.a11y-label-value {
    font-size: 12px;
    color: var(--a11y-text-muted);
    background: var(--a11y-bg-secondary);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Slider Group */
.a11y-slider-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.a11y-slider-dec,
.a11y-slider-inc {
    width: 28px;
    height: 28px;
    border: 1px solid var(--a11y-border);
    background: var(--a11y-bg);
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--a11y-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.a11y-slider-dec:hover,
.a11y-slider-inc:hover {
    background: var(--a11y-primary);
    border-color: var(--a11y-primary);
    color: #ffffff;
}

.a11y-slider-dec:focus,
.a11y-slider-inc:focus {
    outline: 2px solid var(--a11y-accent);
    outline-offset: 2px;
}

/* Range Slider */
.a11y-control input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--a11y-border);
    border-radius: 3px;
    cursor: pointer;
}

.a11y-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--a11y-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.a11y-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.a11y-control input[type="range"]:focus {
    outline: none;
}

.a11y-control input[type="range"]:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px var(--a11y-accent);
}

/* Select */
.a11y-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--a11y-border);
    border-radius: var(--a11y-radius-sm);
    background: var(--a11y-bg);
    font-size: 14px;
    color: var(--a11y-text);
    cursor: pointer;
}

.a11y-select:focus {
    outline: 2px solid var(--a11y-accent);
    outline-offset: 2px;
}

/* Button Group */
.a11y-button-group {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.a11y-mode-btn {
    flex: 1;
    padding: 10px 8px;
    border: 1px solid var(--a11y-border);
    background: var(--a11y-bg);
    border-radius: var(--a11y-radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--a11y-text);
    transition: all 0.2s ease;
}

.a11y-mode-btn:hover {
    border-color: var(--a11y-primary);
    color: var(--a11y-primary);
}

.a11y-mode-btn.active {
    background: var(--a11y-primary);
    border-color: var(--a11y-primary);
    color: #ffffff;
}

.a11y-mode-btn:focus {
    outline: 2px solid var(--a11y-accent);
    outline-offset: 2px;
}

/* Toggle Switch */
.a11y-control-toggle {
    display: flex;
    align-items: center;
}

.a11y-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.a11y-toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    width: 100%;
}

.a11y-toggle-switch {
    width: 44px;
    height: 24px;
    background: var(--a11y-border);
    border-radius: 12px;
    position: relative;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.a11y-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.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(20px);
}

.a11y-toggle-input:focus + .a11y-toggle-label .a11y-toggle-switch {
    box-shadow: 0 0 0 3px var(--a11y-accent);
}

.a11y-toggle-text {
    font-weight: 500;
    color: var(--a11y-text);
}

/* Panel Footer */
.a11y-panel-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--a11y-border);
    background: var(--a11y-bg-secondary);
}

.a11y-btn {
    padding: 10px 16px;
    border-radius: var(--a11y-radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.a11y-btn-text {
    background: transparent;
    border: none;
    color: var(--a11y-text-muted);
    width: 100%;
}

.a11y-btn-text:hover {
    color: #ef4444;
}

.a11y-btn-text:focus {
    outline: 2px solid var(--a11y-accent);
    outline-offset: 2px;
}

/* Screen Reader Only */
.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: 0;
}

/* High Contrast Mode */
body.a11y-high-contrast {
    background: #ffffff !important;
    color: #000000 !important;
}

body.a11y-high-contrast * {
    background-color: #ffffff !important;
    color: #000000 !important;
    border-color: #000000 !important;
}

body.a11y-high-contrast a {
    color: #0000ff !important;
    text-decoration: underline !important;
}

body.a11y-high-contrast img {
    filter: contrast(1.2);
}

body.a11y-high-contrast .a11y-widget,
body.a11y-high-contrast .a11y-widget * {
    background-color: revert !important;
    color: revert !important;
    border-color: revert !important;
}

/* Dark Mode */
body.a11y-dark {
    background: #1a1a2e !important;
    color: #eaeaea !important;
}

body.a11y-dark * {
    background-color: #1a1a2e !important;
    color: #eaeaea !important;
    border-color: #333 !important;
}

body.a11y-dark a {
    color: #6ec6ff !important;
}

body.a11y-dark .a11y-widget,
body.a11y-dark .a11y-widget * {
    background-color: revert !important;
    color: revert !important;
    border-color: revert !important;
}

/* Responsive */
@media (max-width: 400px) {
    .a11y-panel {
        width: calc(100vw - 40px);
        max-height: 70vh;
    }
}
