/* ===== Glasseria Accessibility Widget Styles ===== */
/* תקן ישראלי 5568 / WCAG 2.0 AA */

/* ===== Screen Reader Only ===== */
.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;
}

/* ===== Skip Link ===== */
.skip-link {
    position: absolute;
    top: -100px;
    right: 0;
    background: #1a1a1a;
    color: #fff;
    padding: 12px 24px;
    z-index: 10000;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 8px 8px;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #ffd700;
    outline-offset: 2px;
}

/* ===== Focus Styles ===== */
*:focus-visible {
    outline: 3px solid #0066cc !important;
    outline-offset: 2px !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #0066cc !important;
    outline-offset: 2px !important;
}

/* ===== Accessibility Button ===== */
.accessibility-widget-btn {
    position: fixed;
    bottom: 96px;  /* 24px (לב) + 56px (גובה לב) + 16px (רווח) */
    right: 24px;   /* אותו מיקום כמו כפתור הלב */
    width: 56px;   /* אותו גודל כמו כפתור הלב */
    height: 56px;
    border-radius: 50%;
    background: #1a1a1a;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 90;  /* אותו z-index כמו כפתור הלב */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, background 0.3s;
}

.accessibility-widget-btn:hover {
    transform: scale(1.1);
    background: #333;
}

.accessibility-widget-btn svg {
    width: 28px;
    height: 28px;
}

/* ===== Accessibility Panel ===== */
.accessibility-panel {
    position: fixed;
    bottom: 168px;  /* 96px (כפתור נגישות) + 56px (גובה) + 16px (רווח) */
    right: 24px;
    width: 320px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    direction: rtl;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.accessibility-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.accessibility-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    background: #1a1a1a;
    color: #fff;
    border-radius: 16px 16px 0 0;
}

.accessibility-panel-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.accessibility-panel-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.3s;
}

.accessibility-panel-close:hover {
    background: rgba(255,255,255,0.2);
}

.accessibility-panel-close svg {
    width: 18px;
    height: 18px;
}

.accessibility-panel-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===== Accessibility Options ===== */
.accessibility-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 15px;
    text-align: right;
    width: 100%;
}

.accessibility-option:hover {
    background: #eee;
}

.accessibility-toggle.active {
    background: #e8f4e8;
    border-color: #4caf50;
}

.accessibility-option-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.accessibility-option-label {
    flex: 1;
    font-weight: 500;
}

.accessibility-option-status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ddd;
    position: relative;
    flex-shrink: 0;
}

.accessibility-toggle.active .accessibility-option-status {
    background: #4caf50;
}

.accessibility-toggle.active .accessibility-option-status::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

/* ===== Font Size Controls ===== */
.accessibility-font-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
}

.accessibility-font-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.accessibility-font-btn:hover {
    background: #333;
}

.accessibility-font-size {
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

/* ===== Panel Footer ===== */
.accessibility-panel-footer {
    padding: 16px;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.accessibility-reset-btn {
    width: 100%;
    padding: 12px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.accessibility-reset-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

.accessibility-statement-link {
    display: block;
    text-align: center;
    color: #666;
    font-size: 13px;
    text-decoration: none;
    padding: 8px;
}

.accessibility-statement-link:hover {
    color: #1a1a1a;
    text-decoration: underline;
}

/* ===== Accessibility Modes ===== */

/* High Contrast Mode */
.accessibility-high-contrast {
    filter: contrast(1.3);
}

.accessibility-high-contrast * {
    border-color: #000 !important;
}

.accessibility-high-contrast a,
.accessibility-high-contrast button {
    text-decoration: underline !important;
}

/* Readable Font Mode */
.accessibility-readable-font,
.accessibility-readable-font * {
    font-family: Arial, Helvetica, sans-serif !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.1em !important;
}

/* Stop Animations Mode */
.accessibility-stop-animations,
.accessibility-stop-animations *,
.accessibility-stop-animations *::before,
.accessibility-stop-animations *::after {
    animation: none !important;
    transition: none !important;
}

/* Highlight Links Mode */
.accessibility-highlight-links a {
    background: #ffff00 !important;
    color: #000 !important;
    padding: 2px 4px !important;
    text-decoration: underline !important;
    outline: 2px solid #000 !important;
}

/* Big Cursor Mode */
.accessibility-big-cursor,
.accessibility-big-cursor * {
    cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="%23000" d="M0 0 L0 24 L6 18 L12 28 L16 26 L10 16 L18 16 Z"/><path fill="%23fff" d="M2 2 L2 20 L6 16 L12 26 L14 25 L8 15 L16 15 Z"/></svg>') 0 0, auto !important;
}

/* ===== Respect User Preferences ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .accessibility-widget-btn {
        bottom: 96px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
    
    .accessibility-widget-btn svg {
        width: 24px;
        height: 24px;
    }
    
    .accessibility-panel {
        bottom: 162px;  /* 96 + 50 + 16 */
        right: 16px;
        left: 16px;
        width: auto;
        max-width: none;
        max-height: calc(100vh - 200px);
    }
    
    .accessibility-option {
        padding: 12px 14px;
        font-size: 14px;
    }
}

/* ===== iPhone Safe Areas ===== */
@supports (padding: max(0px)) {
    .accessibility-widget-btn {
        bottom: calc(max(20px, calc(env(safe-area-inset-bottom) + 10px)) + 56px + 16px);
        right: max(24px, env(safe-area-inset-right));
    }
    
    .accessibility-panel {
        bottom: calc(max(20px, calc(env(safe-area-inset-bottom) + 10px)) + 56px + 16px + 56px + 16px);
        right: max(24px, env(safe-area-inset-right));
    }
    
    @media (max-width: 768px) {
        .accessibility-widget-btn {
            bottom: calc(max(20px, calc(env(safe-area-inset-bottom) + 10px)) + 50px + 12px);
            right: max(20px, env(safe-area-inset-right));
        }
        
        .accessibility-panel {
            bottom: calc(max(20px, calc(env(safe-area-inset-bottom) + 10px)) + 50px + 12px + 50px + 12px);
            right: max(16px, env(safe-area-inset-right));
            left: max(16px, env(safe-area-inset-left));
        }
    }
}
