/**
 * Accessibility Widget Styles
 * Israeli Standard 5568 & WCAG 2.1 Level AA Compliant
 */

/* Widget Container */
#accessibility-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 99999;
    font-family: 'Heebo', Arial, sans-serif;
    direction: rtl;
}

/* Toggle Button */
.a11y-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: white;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.a11y-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.a11y-toggle:focus {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

/* Panel */
.a11y-panel {
    position: absolute;
    bottom: 70px;
    left: 0;
    width: 320px;
    max-height: 80vh;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.a11y-header {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.a11y-header h2 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
}

.a11y-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.a11y-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.a11y-close:focus {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}

/* Content */
.a11y-content {
    padding: 20px;
    max-height: calc(80vh - 120px);
    overflow-y: auto;
}

.a11y-control {
    margin-bottom: 15px;
}

.a11y-control label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1e293b;
}

/* Font Size Control */
.a11y-button-group {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    background: #f1f5f9;
    padding: 10px;
    border-radius: 8px;
}

.a11y-btn {
    background: white;
    border: 2px solid #cbd5e1;
    color: #1e293b;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.a11y-btn:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.a11y-btn:focus {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

#fontSize-value {
    font-weight: 700;
    color: #1e40af;
    min-width: 50px;
    text-align: center;
}

/* Toggle Buttons */
.a11y-toggle-btn {
    width: 100%;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    padding: 12px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: right;
}

.a11y-toggle-btn:hover {
    background: #f1f5f9;
    border-color: #3b82f6;
}

.a11y-toggle-btn:focus {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

.a11y-toggle-btn.active {
    background: #dbeafe;
    border-color: #3b82f6;
}

.a11y-icon {
    font-size: 1.3em;
    min-width: 24px;
}

.a11y-toggle-btn span:nth-child(2) {
    flex: 1;
    font-weight: 500;
    color: #1e293b;
}

.a11y-status {
    font-size: 0.85em;
    color: #64748b;
    font-weight: 600;
}

.a11y-toggle-btn.active .a11y-status {
    color: #1e40af;
}

/* Reset Button */
.a11y-reset-btn {
    width: 100%;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.a11y-reset-btn:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.a11y-reset-btn:focus {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

/* Footer */
.a11y-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #e2e8f0;
    text-align: center;
}

.a11y-link {
    display: inline-block;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.a11y-link:hover {
    color: #1e40af;
    text-decoration: underline;
}

.a11y-link:focus {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Accessibility Classes Applied to Body */

/* High Contrast Mode */
body.high-contrast {
    filter: contrast(120%);
}

body.high-contrast * {
    text-shadow: none !important;
}

/* Underline Links */
body.underline-links a {
    text-decoration: underline !important;
}

/* Readable Font */
body.readable-font,
body.readable-font * {
    font-family: 'Arial', sans-serif !important;
}

/* Keyboard Navigation Highlights */
body.keyboard-nav *:focus {
    outline: 3px solid #fbbf24 !important;
    outline-offset: 2px !important;
}

body.keyboard-nav button:focus,
body.keyboard-nav a:focus,
body.keyboard-nav input:focus,
body.keyboard-nav textarea:focus,
body.keyboard-nav select:focus {
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.3) !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #accessibility-widget {
        bottom: 10px;
        left: 10px;
    }
    
    .a11y-panel {
        width: calc(100vw - 20px);
        max-width: 350px;
    }
    
    .a11y-toggle {
        width: 48px;
        height: 48px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .a11y-toggle,
    .a11y-btn,
    .a11y-toggle-btn,
    .a11y-reset-btn {
        transition: none !important;
    }
    
    .a11y-panel {
        animation: none !important;
    }
}

/* High Contrast Mode for OS */
@media (prefers-contrast: high) {
    .a11y-toggle {
        border-width: 4px;
    }
    
    .a11y-toggle-btn {
        border-width: 3px;
    }
}

/* Print Styles */
@media print {
    #accessibility-widget {
        display: none !important;
    }
}

