/**
 * Accessibility Widget Styles
 * Full accessibility widget with all required features for Israeli Standard 5568 (WCAG 2.0 AA)
 */

/* CSS Variables for Accessibility */
:root {
    --a11y-base-font-size: 1rem;
}

/* Accessibility Widget Container */
.a11y-widget {
    position: fixed;
    left: 1rem;
    bottom: 1rem;
    z-index: 9999;
    direction: rtl;
}

/* Toggle Button */
.a11y-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(to right, #0d9488, #0891b2);
    color: white;
    border: none;
    border-radius: 2rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.a11y-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.a11y-toggle-btn:focus {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

.a11y-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.a11y-toggle-text {
    display: none;
}

@media (min-width: 640px) {
    .a11y-toggle-text {
        display: inline;
    }
}

/* Widget Menu */
.a11y-menu {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0;
    width: 320px;
    max-width: calc(100vw - 2rem);
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}

.a11y-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.a11y-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(to right, #0d9488, #0891b2);
    color: white;
    border-radius: 1rem 1rem 0 0;
}

.a11y-menu-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
    color: white;
}

.a11y-menu-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.a11y-menu-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.a11y-menu-body {
    padding: 1.25rem;
}

.a11y-control-group {
    margin-bottom: 1.5rem;
}

.a11y-control-group:last-child {
    margin-bottom: 0;
}

.a11y-control-label {
    display: block;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

/* Button Group */
.a11y-button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.a11y-btn {
    flex: 1;
    min-width: 60px;
    padding: 0.625rem 0.75rem;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #4b5563;
    font-size: 0.875rem;
}

.a11y-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.a11y-btn:focus {
    outline: 2px solid #0d9488;
    outline-offset: 2px;
}

.a11y-btn.active {
    background: #0d9488;
    color: white;
    border-color: #0d9488;
}

/* Toggle Switch */
.a11y-toggle-switch {
    display: flex;
    align-items: center;
}

.a11y-switch-label {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    cursor: pointer;
}

.a11y-switch-label input {
    opacity: 0;
    width: 0;
    height: 0;
}

.a11y-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: 0.3s;
    border-radius: 24px;
}

.a11y-switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .a11y-switch-slider {
    background-color: #0d9488;
}

input:checked + .a11y-switch-slider:before {
    transform: translateX(24px);
}

input:focus + .a11y-switch-slider {
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

/* Info Button */
.a11y-info-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: #f0fdfa;
    border: 2px solid #0d9488;
    border-radius: 0.5rem;
    color: #0d9488;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    width: 100%;
    justify-content: center;
}

.a11y-info-btn:hover {
    background: #0d9488;
    color: white;
}

.a11y-info-btn:focus {
    outline: 2px solid #0d9488;
    outline-offset: 2px;
}

/* Reset Button */
.a11y-reset-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: #fee2e2;
    border: 2px solid #ef4444;
    border-radius: 0.5rem;
    color: #dc2626;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    width: 100%;
    justify-content: center;
}

.a11y-reset-btn:hover {
    background: #ef4444;
    color: white;
}

.a11y-reset-btn:focus {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
}

/* Menu Footer */
.a11y-menu-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 1rem 1rem;
}

.a11y-statement-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #0d9488;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.a11y-statement-link:hover {
    color: #0f766e;
    text-decoration: underline;
}

/* Reading Guide */
.reading-guide {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    height: 2px;
    background: #ef4444;
    pointer-events: none;
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.reading-guide.active {
    opacity: 1;
}

/* Accessibility Classes Applied to Body */
.a11y-text-small {
    font-size: 0.875rem;
}

.a11y-text-normal {
    font-size: 1rem;
}

.a11y-text-large {
    font-size: 1.25rem;
}

.a11y-text-xlarge {
    font-size: 1.5rem;
}

.a11y-contrast-high {
    filter: contrast(1.2);
}

.a11y-contrast-dark {
    filter: invert(1) hue-rotate(180deg);
    background: #000 !important;
}

.a11y-contrast-dark img,
.a11y-contrast-dark video {
    filter: invert(1) hue-rotate(180deg);
}

.a11y-highlight-links a {
    background: #fef3c7 !important;
    padding: 0.125rem 0.25rem !important;
    border-radius: 0.25rem !important;
    text-decoration: underline !important;
    font-weight: 700 !important;
}

.a11y-highlight-links a:focus {
    outline: 3px solid #fbbf24 !important;
    outline-offset: 2px !important;
}

.a11y-reduce-motion *,
.a11y-reduce-motion *::before,
.a11y-reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

/* Enhanced Focus Indicators */
*:focus-visible {
    outline: 3px solid #0d9488;
    outline-offset: 2px;
}

/* Keyboard Help Modal */
.a11y-help-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    direction: rtl;
}

.a11y-help-modal.active {
    opacity: 1;
    visibility: visible;
}

.a11y-help-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.a11y-help-content {
    position: relative;
    background: white;
    border-radius: 1rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.a11y-help-modal.active .a11y-help-content {
    transform: scale(1);
}

.a11y-help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.a11y-help-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.a11y-help-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.a11y-help-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.a11y-help-body {
    padding: 1.5rem;
}

.a11y-help-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.a11y-help-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #4b5563;
}

.a11y-help-list li:last-child {
    border-bottom: none;
}

.a11y-help-list kbd {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-family: monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
    min-width: 2rem;
    text-align: center;
    display: inline-block;
}

/* Responsive */
@media (max-width: 640px) {
    .a11y-widget {
        left: 0.5rem;
        bottom: 0.5rem;
    }
    
    .a11y-menu {
        width: calc(100vw - 1rem);
        left: 0.5rem;
    }
    
    .a11y-toggle-btn {
        padding: 0.625rem;
    }
    
    .a11y-toggle-text {
        display: none;
    }
}

/* Print Styles */
@media print {
    .a11y-widget {
        display: none;
    }
}
