/**
 * Accessibility Widget Styles - עיצוב ווידג'ט נגישות
 * תואם לתקן ישראלי SI 5568 (WCAG 2.1 Level AA)
 * עיצוב מקצועי ומסודר
 */

/* כפתור פתיחה */
.a11y-toggle {
    position: fixed !important;
    bottom: 100px !important;
    left: 20px !important;
    z-index: 200001 !important;
    background: #000000 !important;
    border: none !important;
    border-radius: 50% !important;
    width: 48px !important;
    height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #ffffff !important;
    overflow: visible !important;
    animation: none !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}


.a11y-toggle svg {
    width: 24px;
    height: 30px;
    display: block;
    margin: 0 auto;
    fill: #ffffff;
    stroke: none;
    color: #ffffff;
    pointer-events: none;
}

/* הסתרת span אם קיים (למקרה של אימוג'י ישן) */
.a11y-toggle span {
    display: none;
}

.a11y-toggle:hover,
.a11y-toggle:focus {
    background: #1a1a1a;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45), 0 4px 8px rgba(0, 0, 0, 0.25);
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
    border: none;
    animation: none;
}

.a11y-toggle:hover svg,
.a11y-toggle:focus svg {
    fill: #ffffff;
    stroke: none;
}

.a11y-toggle:active {
    transform: scale(0.98);
    animation: none;
}

/* Overlay */
.a11y-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999999 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.a11y-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* פאנל */
.a11y-panel {
    position: fixed;
    top: 0;
    right: -480px;
    width: 480px;
    max-width: 90vw;
    height: 100vh;
    z-index: 9999999 !important;
    background: #ffffff;
    box-shadow: -2px 0 16px rgba(0, 0, 0, 0.1);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    direction: rtl;
    overflow: hidden;
}

.a11y-panel.open {
    right: 0;
}

/* כותרת פאנל */
.a11y-header {
    background: linear-gradient(135deg, #666666 0%, #555555 100%);
    padding: 24px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.a11y-title {
    font-family: 'Assistant', 'Heebo', sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    letter-spacing: 0.5px;
}

.a11y-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    min-width: 36px;
    min-height: 36px;
    transition: all 0.2s ease;
}

.a11y-close:hover,
.a11y-close:focus {
    background: rgba(255, 255, 255, 0.3);
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.a11y-close svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* תוכן פאנל */
.a11y-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    background: #ffffff;
}

.a11y-section {
    margin-bottom: 32px;
}

.a11y-section:last-child {
    margin-bottom: 0;
}

.a11y-section-title {
    font-family: 'Assistant', 'Heebo', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8e8e8;
    letter-spacing: 0.3px;
}

/* כפתורי גודל טקסט */
.a11y-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.a11y-btn {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 14px 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Assistant', 'Heebo', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: #333333;
    min-width: 52px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.a11y-btn:hover,
.a11y-btn:focus {
    background: #e8e8e8;
    border-color: #666666;
    outline: none;
    box-shadow: 0 2px 4px rgba(102, 102, 102, 0.15);
}

.a11y-btn.active {
    background: #666666;
    border-color: #666666;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(102, 102, 102, 0.25);
}

/* אפשרויות */
.a11y-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.a11y-option {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 110px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.a11y-option:hover,
.a11y-option:focus {
    background: #e8e8e8;
    border-color: #666666;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 102, 102, 0.15);
    outline: none;
}

.a11y-option.active {
    background: #666666;
    border-color: #666666;
    box-shadow: 0 4px 12px rgba(102, 102, 102, 0.25);
}

.a11y-option svg {
    width: 36px;
    height: 36px;
    fill: #666666;
    stroke: #666666;
}

.a11y-option.active svg {
    fill: #ffffff;
    stroke: #ffffff;
}

/* צבעים שונים לכל אייקון */
.a11y-option[data-feature="fontSize"] svg {
    fill: #4A90E2;
    stroke: #4A90E2;
}

.a11y-option[data-feature="highContrast"] svg {
    fill: #FF6B6B;
    stroke: #FF6B6B;
}

.a11y-option[data-feature="darkMode"] svg {
    fill: #6C5CE7;
    stroke: #6C5CE7;
}

.a11y-option[data-feature="lightMode"] svg {
    fill: #FDCB6E;
    stroke: #FDCB6E;
}

.a11y-option[data-feature="grayscale"] svg {
    fill: #95A5A6;
    stroke: #95A5A6;
}

.a11y-option[data-feature="underlineLinks"] svg {
    fill: #00B894;
    stroke: #00B894;
}

.a11y-option[data-feature="highlightFocus"] svg {
    fill: #0984E3;
    stroke: #0984E3;
}

.a11y-option[data-feature="readableFont"] svg {
    fill: #A29BFE;
    stroke: #A29BFE;
}

.a11y-option[data-feature="textSpacing"] svg {
    fill: #00CEC9;
    stroke: #00CEC9;
}

.a11y-option[data-feature="stopAnimations"] svg {
    fill: #E17055;
    stroke: #E17055;
}

.a11y-option[data-feature="siteColor"] svg {
    fill: #FD79A8;
    stroke: #FD79A8;
}

/* כשהאופציה פעילה, האייקון לבן */
.a11y-option.active[data-feature] svg {
    fill: #ffffff;
    stroke: #ffffff;
}

.a11y-option span {
    font-family: 'Assistant', 'Heebo', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #333333;
    line-height: 1.4;
}

.a11y-option.active span {
    color: #ffffff;
    font-weight: 600;
}

/* צבעים */
.a11y-colors {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.a11y-color {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.a11y-color:hover,
.a11y-color:focus {
    transform: scale(1.1);
    border-color: #666666;
    outline: none;
    box-shadow: 0 2px 6px rgba(102, 102, 102, 0.2);
}

.a11y-color.active {
    border-color: #666666;
    box-shadow: 0 0 0 3px rgba(102, 102, 102, 0.2);
}

/* Footer */
.a11y-footer {
    background: #f8f9fa;
    padding: 24px 28px;
    border-top: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.a11y-reset {
    background: #ffffff;
    border: 2px solid #666666;
    color: #666666;
    cursor: pointer;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: 'Assistant', 'Heebo', sans-serif;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.a11y-reset:hover,
.a11y-reset:focus {
    background: #666666;
    color: #ffffff;
    outline: none;
    box-shadow: 0 2px 6px rgba(102, 102, 102, 0.25);
}

.a11y-reset svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.a11y-link {
    color: #666666;
    text-decoration: underline;
    text-decoration-color: rgba(102, 102, 102, 0.4);
    font-family: 'Assistant', 'Heebo', sans-serif;
    font-size: 14px;
    transition: text-decoration-color 0.3s ease;
}

.a11y-link:hover,
.a11y-link:focus {
    text-decoration-color: #666666;
    outline: none;
}

/* קישור דילוג */
.a11y-skip-link {
    position: absolute;
    top: -100px;
    right: 0;
    background: #666666;
    color: #ffffff;
    padding: 12px 20px;
    text-decoration: none;
    font-family: 'Assistant', 'Heebo', sans-serif;
    font-size: 16px;
    font-weight: 500;
    z-index: 10001;
    border-radius: 0 0 4px 4px;
    transition: top 0.3s ease;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

/* הגדרות נגישות על העמוד */
/* גודל טקסט */
body.a11y-font-size {
    font-size: calc(1em * var(--a11y-font-size, 1));
}

body.a11y-font-size * {
    font-size: inherit;
}

/* ניגודיות גבוהה */
body.a11y-high-contrast {
    filter: contrast(1.5) brightness(1.1);
}

body.a11y-high-contrast * {
    border-color: #000000 !important;
}

/* מצב כהה */
body.a11y-dark-mode {
    filter: brightness(0.8) contrast(1.2);
    background-color: #1a1a1a !important;
    color: #ffffff !important;
}

body.a11y-dark-mode * {
    background-color: transparent !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}

/* מצב בהיר */
body.a11y-light-mode {
    filter: brightness(1.3) contrast(1.1);
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* גווני אפור */
body.a11y-grayscale {
    filter: grayscale(100%);
}

/* קו תחתון לקישורים */
body.a11y-underline-links a {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
}

/* גופן קריא */
body.a11y-readable-font {
    font-family: 'Assistant', 'Heebo', 'Arial', sans-serif !important;
}

body.a11y-readable-font * {
    font-family: inherit !important;
}

/* עצירת אנימציות */
body.a11y-stop-animations *,
body.a11y-stop-animations *::before,
body.a11y-stop-animations *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
}

/* הדגשת פוקוס */
body.a11y-highlight-focus *:focus {
    outline: 3px solid #666666 !important;
    outline-offset: 2px !important;
}

body.a11y-highlight-focus *:focus-visible {
    outline: 3px solid #666666 !important;
    outline-offset: 2px !important;
}

/* ניווט מקלדת */
body.a11y-keyboard-nav a:focus,
body.a11y-keyboard-nav button:focus,
body.a11y-keyboard-nav input:focus,
body.a11y-keyboard-nav select:focus,
body.a11y-keyboard-nav textarea:focus {
    outline: 3px solid #666666 !important;
    outline-offset: 2px !important;
}

/* ריווח טקסט */
body.a11y-text-spacing p,
body.a11y-text-spacing li,
body.a11y-text-spacing div {
    line-height: 1.8 !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.1em !important;
}

/* צבע האתר */
body.a11y-site-color a,
body.a11y-site-color button,
body.a11y-site-color .a11y-toggle {
    color: var(--a11y-site-color, inherit) !important;
}

body.a11y-site-color a:hover,
body.a11y-site-color button:hover {
    color: var(--a11y-site-color, inherit) !important;
    opacity: 0.8;
}

/* רספונסיבי */
@media (max-width: 768px) {
    .a11y-panel {
        width: 100%;
        right: -100%;
        max-width: 100vw;
    }
    
    .a11y-toggle {
        position: fixed !important;
        bottom: 80px !important;
        left: 15px !important;
        width: 42px !important;
        height: 42px !important;
        z-index: 200001 !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    .a11y-toggle svg {
        width: 22px;
        height: 27px;
    }
    
    .a11y-toggle span {
        display: none;
    }
    
    .a11y-content {
        padding: 24px 20px;
    }
    
    .a11y-header {
        padding: 20px 24px;
    }
    
    .a11y-section {
        margin-bottom: 28px;
    }
    
    .a11y-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .a11y-option {
        min-height: 100px;
        padding: 18px 12px;
    }
    
    .a11y-option svg {
        width: 32px;
        height: 32px;
    }
    
    .a11y-option span {
        font-size: 12px;
    }
    
    .a11y-footer {
        padding: 20px 24px;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .a11y-reset {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .a11y-options {
        grid-template-columns: 1fr;
    }
    
    .a11y-toggle {
        position: fixed !important;
        bottom: 80px !important;
        left: 15px !important;
        width: 38px !important;
        height: 38px !important;
        z-index: 200001 !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    .a11y-toggle svg {
        width: 20px;
        height: 25px;
    }
    
    .a11y-toggle span {
        display: none;
    }
    
    .a11y-controls {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .a11y-btn {
        padding: 12px 10px;
        font-size: 14px;
    }
    
    .a11y-content {
        padding: 20px 16px;
    }
    
    .a11y-header {
        padding: 18px 20px;
    }
}

/* העדפות מופחתות תנועה */
@media (prefers-reduced-motion: reduce) {
    .a11y-panel,
    .a11y-toggle,
    .a11y-overlay,
    .a11y-option,
    .a11y-btn {
        transition: none;
        animation: none !important;
    }
}

/* ניגודיות גבוהה במערכת */
@media (prefers-contrast: high) {
    .a11y-toggle {
        border: 3px solid #ffffff;
    }
    
    .a11y-panel {
        border-left: 3px solid #000000;
    }
    
    .a11y-btn,
    .a11y-option {
        border-width: 3px;
    }
}

/* התאמה למצב כהה במערכת */
@media (prefers-color-scheme: dark) {
    .a11y-panel {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .a11y-content {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .a11y-section-title {
        color: #ffffff;
        border-bottom-color: #444444;
    }
    
    .a11y-btn {
        background: #2a2a2a;
        border-color: #444444;
        color: #ffffff;
    }
    
    .a11y-option {
        background: #2a2a2a;
        border-color: #444444;
    }
    
    .a11y-option span {
        color: #ffffff;
    }
    
    .a11y-footer {
        background: #2a2a2a;
        border-top-color: #444444;
    }
}

/* נגישות - פוקוס גלוי */
.a11y-toggle:focus-visible,
.a11y-close:focus-visible,
.a11y-btn:focus-visible,
.a11y-option:focus-visible,
.a11y-color:focus-visible,
.a11y-reset:focus-visible,
.a11y-link:focus-visible {
    outline: 3px solid #666666;
    outline-offset: 2px;
}

/* וודא שהכפתור תמיד גלוי גם כשיש overlays פתוחים - רק בדסקטופ */
@media (min-width: 769px) {
    body.cart-open .a11y-toggle,
    body.menu-open .a11y-toggle,
    body.search-open .a11y-toggle,
    body.filter-open .a11y-toggle {
        z-index: 200001 !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        position: fixed !important;
    }
}

/* במובייל - הסתר את כפתור הנגישות כשהעגלה או התפריט פתוחים */
@media (max-width: 768px) {
    body.cart-open .a11y-toggle,
    body.menu-open .a11y-toggle {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

/* הדפסה */
@media print {
    .a11y-toggle,
    .a11y-panel,
    .a11y-overlay,
    .a11y-skip-link {
        display: none !important;
    }
}
