/* קומפוננטת נגישות אחידה לכל המערכת */

/* טעינת גופן OpenDyslexic */
@import url('https://fonts.cdnfonts.com/css/open-dyslexic');

/* סגנונות בסיס לווידג'ט הנגישות */
.accessibility-widget {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    direction: ltr;
    cursor: grab;
    font-family: Arial, sans-serif;
    pointer-events: none; /* לא מפריע לקליקים */
}

.accessibility-widget button {
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto; /* כפתורים עדיין ניתנים לקליק */
}

/* כפתור סגירת הווידג'ט */
#closeAccessWidget {
    position: absolute;
    top: 2px;
    right: 6px;
    background: none;
    color: #111;
    border: none;
    padding: 0;
    font-size: 1.1em;
    line-height: 1;
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

#closeAccessWidget:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* כפתור ראשי של הנגישות */
#accessMainBtn {
    background: #4fc3f7;
    color: #222;
    border: none;
    padding: 10px 18px;
    border-radius: 50px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

#accessMainBtn:hover {
    background: #29b6f6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* תפריט הנגישות */
#accessMenu {
    display: none;
    flex-direction: column;
    gap: 8px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    padding: 16px 18px;
    min-width: 200px;
    width: max-content;
    margin-top: 8px;
    border: 1px solid #e0e0e0;
    pointer-events: auto; /* התפריט ניתן לקליק */
}

/* כשהתפריט פתוח, הווידג'ט צריך להיות clickable */
.accessibility-widget.menu-open {
    pointer-events: auto;
}

/* כפתורי הנגישות */
.access-btn {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 160px;
    width: 100%;
}

.access-btn:hover {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1976d2;
}

.access-btn:active,
.access-btn[aria-pressed="true"] {
    background: #2196f3;
    color: white;
    border-color: #1976d2;
}

/* קישור דילוג לתוכן */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #2196f3;
    color: white;
    padding: 8px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    z-index: 1000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

/* --- הדגשת קישורים --- */
body.highlight-links a {
    text-decoration: underline 3px #1976d2 !important;
    color: #1976d2 !important;
    background: #fffde7 !important;
    font-weight: bold !important;
    border-radius: 3px;
    padding: 0 2px;
    transition: background 0.2s, color 0.2s;
}

/* הדגשת קישורים בכרטיסיות */
.topic-card.highlight-links,
.subtopic-card.highlight-links,
.lesson-card.highlight-links,
.card.highlight-links {
    box-shadow: 0 0 0 4px #1976d2 !important;
    border-color: #1976d2 !important;
    background: #fffde7 !important;
}

.topic-card.highlight-links h3,
.subtopic-card.highlight-links h3,
.lesson-card.highlight-links h3,
.card.highlight-links h3 {
    color: #1976d2 !important;
    text-decoration: underline 3px #1976d2 !important;
    background: #fffde7 !important;
    font-weight: bold !important;
    border-radius: 3px;
    padding: 0 2px;
}

.topic-card.highlight-links p,
.subtopic-card.highlight-links p,
.lesson-card.highlight-links p,
.card.highlight-links p {
    color: #1976d2 !important;
    background: #fffde7 !important;
}

/* --- הגדלת סמן עכבר --- */
body.big-cursor {
    cursor: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQiIGhlaWdodD0iNjQiIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEwIDEwTDEwIDU0TDI1IDM5TDM5IDUzTDUzIDM5TDM5IDI1TDU0IDEwSDEwWiIgZmlsbD0iIzAwMCIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiLz4KPC9zdmc+') 32 0, pointer !important;
}

body.big-cursor a, 
body.big-cursor button, 
body.big-cursor input, 
body.big-cursor textarea, 
body.big-cursor select, 
body.big-cursor label, 
body.big-cursor .accessibility-widget {
    cursor: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQiIGhlaWdodD0iNjQiIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEwIDEwTDEwIDU0TDI1IDM5TDM5IDUzTDUzIDM5TDM5IDI1TDU0IDEwSDEwWiIgZmlsbD0iIzAwMCIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiLz4KPC9zdmc+') 32 0, pointer !important;
}

/* --- ניגודיות גבוהה כהה --- */
body.high-contrast {
    background: #000 !important;
}

body.high-contrast, 
body.high-contrast * {
    color: #fff !important;
    background: #000 !important;
    border-color: #fff !important;
}

body.high-contrast a, 
body.high-contrast .btn,
body.high-contrast .header,
body.high-contrast .container,
body.high-contrast .welcome-section,
body.high-contrast .topic-card,
body.high-contrast .subtopic-card,
body.high-contrast .title-section,
body.high-contrast .lessons-grid,
body.high-contrast .lesson-card,
body.high-contrast .sidebar,
body.high-contrast .quiz-section,
body.high-contrast .card,
body.high-contrast .section,
body.high-contrast .modal-content,
body.high-contrast .form-group,
body.high-contrast input,
body.high-contrast select,
body.high-contrast textarea,
body.high-contrast button {
    background: #111 !important;
    color: #fff !important;
    border-color: #fff !important;
}

/* --- ניגודיות גבוהה בהירה --- */
body.high-contrast-light {
    background: #fff !important;
}

body.high-contrast-light, 
body.high-contrast-light * {
    color: #111 !important;
    background: #fff !important;
    border-color: #111 !important;
}

body.high-contrast-light a, 
body.high-contrast-light .btn,
body.high-contrast-light .header,
body.high-contrast-light .container,
body.high-contrast-light .welcome-section,
body.high-contrast-light .topic-card,
body.high-contrast-light .subtopic-card,
body.high-contrast-light .title-section,
body.high-contrast-light .lessons-grid,
body.high-contrast-light .lesson-card,
body.high-contrast-light .sidebar,
body.high-contrast-light .quiz-section,
body.high-contrast-light .card,
body.high-contrast-light .section,
body.high-contrast-light .modal-content,
body.high-contrast-light .form-group,
body.high-contrast-light input,
body.high-contrast-light select,
body.high-contrast-light textarea,
body.high-contrast-light button {
    background: #f5f5f5 !important;
    color: #111 !important;
    border-color: #111 !important;
}

/* --- הגדלת טקסט --- */
body.large-text, 
body.large-text * {
    font-size: 1.25em !important;
    line-height: 1.4 !important;
}

/* --- גופן קריא (Dyslexic) --- */
body.dyslexic-font, 
body.dyslexic-font * {
    font-family: 'OpenDyslexic', Arial, sans-serif !important;
    font-size: 1.1em !important;
}

/* עיצוב מותאם למובייל */
@media (max-width: 768px) {
    .accessibility-widget {
        top: 10px;
        left: 10px;
    }
    
    #accessMainBtn {
        padding: 8px 14px;
        font-size: 1em;
    }
    
    #accessMenu {
        min-width: 180px;
        padding: 12px 14px;
    }
    
    .access-btn {
        padding: 8px 10px;
        font-size: 13px;
        min-width: 140px;
    }
}

/* תמיכה בעיצוב RTL */
[dir="rtl"] .accessibility-widget {
    left: auto;
    right: 16px;
    direction: ltr;
}

[dir="rtl"] #closeAccessWidget {
    right: auto;
    left: 6px;
}

@media (max-width: 768px) {
    [dir="rtl"] .accessibility-widget {
        right: 10px;
        left: auto;
    }
}
