/* הסרת האפקט הכחול מכפתורים במצב טלפון/טאבלט */
* {
    -webkit-tap-highlight-color: transparent !important;
}

button, 
.btn, 
a, 
input[type="button"], 
input[type="submit"], 
input[type="reset"],
.clickable,
.interactive {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

button:focus, 
.btn:focus, 
a:focus, 
input[type="button"]:focus, 
input[type="submit"]:focus, 
input[type="reset"]:focus,
.clickable:focus,
.interactive:focus {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* עיצוב פופ-אפ נגישות חדש - מודרני ונוח */
#accessibilityToolbar {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%) !important;
    border-radius: 24px;
    box-shadow:
        0 32px 64px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    z-index: 99999 !important;
    padding: 0;
    width: 420px;
    max-width: 90vw;
    max-height: 85vh;
    overflow: hidden;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: accessibilityPopIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* התאמה למכשירים ניידים */
@media (max-width: 768px) {
    #accessibilityToolbar {
        width: 95%;
        border-radius: 20px;
    }
}

@media (max-width: 480px) {
    #accessibilityToolbar {
        width: 98%;
        max-height: 90vh;
        border-radius: 16px;
    }
}

/* רקע כהה מאחורי הפופ-אפ */
#accessibilityToolbar::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    animation: fadeInOverlay 0.3s ease forwards;
}

/* תמיכה בדפדפנים שלא תומכים ב-backdrop-filter */
@supports not (backdrop-filter: blur(12px)) {
    #accessibilityToolbar {
        background: #ffffff;
    }
}

/* תמיכה בדפדפנים ישנים */
@supports not (backdrop-filter: blur(20px)) {
    #accessibilityToolbar {
        background: #ffffff !important;
    }
    
    body.dark-mode #accessibilityToolbar {
        background: #0f172a !important;
    }
}

/* אפקטי אינטראקציה נוספים */
.accessibility-button:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

body.dark-mode .accessibility-button:focus {
    outline-color: #6366f1;
}

/* הוספת עיצוב למצבי פעיל */
.accessibility-button.active {
    background: linear-gradient(145deg, #4f46e5 0%, #7c3aed 100%);
    color: #ffffff;
    border-color: #4338ca;
    transform: translateY(-2px);
}

.accessibility-button.active i {
    color: #ffffff;
}

body.dark-mode .accessibility-button.active {
    background: linear-gradient(145deg, #6366f1 0%, #8b5cf6 100%);
}

/* אנימציית פתיחה מתקדמת */
@keyframes accessibilityPopIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.6) rotate(-5deg);
        filter: blur(10px);
    }
    60% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.05) rotate(1deg);
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        filter: blur(0px);
    }
}

/* אנימציית רקע כהה */
@keyframes fadeInOverlay {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* כפתור פתיחת/סגירת סרגל הנגישות */
.accessibility-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 45px;
    height: 45px;
    background: #0078d4;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: all 0.3s ease;
}

.accessibility-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.accessibility-toggle i {
    font-size: 1.2rem;
}

/* כותרת מקצועית וחלקה */
.accessibility-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px 32px 24px;
    background: linear-gradient(145deg, #4f46e5 0%, #7c3aed 100%);
    border-radius: 24px 24px 0 0;
    position: relative;
    overflow: hidden;
}

.accessibility-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    pointer-events: none;
}

.accessibility-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

/* כפתור סגירה מודרני */
.accessibility-close {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: rgba(255, 255, 255, 0.9);
    padding: 0;
    border-radius: 12px;
    position: relative;
    z-index: 2;
    backdrop-filter: blur(10px);
}

.accessibility-close:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1) rotate(90deg);
    color: #ffffff;
}

.accessibility-close i {
    font-size: 1.1rem;
    font-weight: 600;
}

/* אפקט מיוחד לכפתור הסגירה */
.accessibility-close::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: rgba(196, 168, 83, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: all 0.2s ease;
    z-index: -1;
}

.accessibility-close:hover::before {
    transform: translate(-50%, -50%) scale(1);
}

/* תוכן הפופ-אפ - מושלם וחלק */
.accessibility-content {
    padding: 32px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 0 0 24px 24px;
    max-height: 65vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.accessibility-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 32px;
    right: 32px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
}

/* התאמה למובייל - עמודה אחת */
@media (max-width: 768px) {
    .accessibility-content {
        grid-template-columns: 1fr;
        padding: 24px;
        gap: 12px;
    }
    
    .accessibility-header {
        padding: 24px 28px 20px;
    }
    
    .accessibility-header h3 {
        font-size: 1.3rem;
    }
    
    .accessibility-close {
        width: 36px;
        height: 36px;
    }
    
    .accessibility-button {
        padding: 16px 18px;
        min-height: 72px;
        font-size: 0.9rem;
    }
    
    .accessibility-button i {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .accessibility-content {
        padding: 20px;
        gap: 10px;
    }
    
    .accessibility-header {
        padding: 20px 24px 16px;
    }
    
    .accessibility-header h3 {
        font-size: 1.2rem;
    }
    
    .accessibility-close {
        width: 32px;
        height: 32px;
    }
    
    .accessibility-close i {
        font-size: 1rem;
    }
    
    .accessibility-button {
        padding: 14px 16px;
        min-height: 68px;
        font-size: 0.85rem;
    }
    
    .accessibility-button i {
        font-size: 1.2rem;
    }
}

/* סקרול בר מתקדם */
.accessibility-content::-webkit-scrollbar {
    width: 6px;
}

.accessibility-content::-webkit-scrollbar-track {
    background: transparent;
}

.accessibility-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #cbd5e1, #94a3b8);
    border-radius: 10px;
    border: none;
}

.accessibility-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #94a3b8, #64748b);
}

/* כפתורי נגישות מודרניים וחלקים */
.accessibility-button {
    padding: 18px 20px;
    background: linear-gradient(145deg, #ffffff 0%, #f1f5f9 100%);
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    margin: 0;
    text-align: center;
    position: relative;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
    min-height: 80px;
    overflow: hidden;
}

.accessibility-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, transparent 0%, rgba(255,255,255,0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.accessibility-button:hover::before {
    opacity: 1;
}

.accessibility-button:hover {
    background: linear-gradient(145deg, #4f46e5 0%, #7c3aed 100%);
    color: #ffffff;
    border-color: #4338ca;
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

.accessibility-button:active {
    transform: translateY(-2px) scale(1.01);
}

.accessibility-button i {
    font-size: 1.5rem;
    width: auto;
    text-align: center;
    color: #4f46e5;
    transition: all 0.3s ease;
    margin-bottom: 4px;
}

.accessibility-button:hover i {
    color: #ffffff;
    transform: scale(1.1);
}

/* מצב מוסתר של סרגל הנגישות */
.accessibility-toolbar.hidden {
    transform: translateX(-120%);
}

/* מצב כהה מתקדם */
body.dark-mode #accessibilityToolbar {
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
    box-shadow: 
        0 32px 64px -12px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.dark-mode #accessibilityToolbar::before {
    background: rgba(0, 0, 0, 0.8);
}

body.dark-mode .accessibility-header {
    background: linear-gradient(145deg, #1e293b 0%, #334155 100%);
}

body.dark-mode .accessibility-header::before {
    background: linear-gradient(145deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
}

body.dark-mode .accessibility-close {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

body.dark-mode .accessibility-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

body.dark-mode .accessibility-content {
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
}

body.dark-mode .accessibility-content::before {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

body.dark-mode .accessibility-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #475569, #334155);
}

body.dark-mode .accessibility-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #64748b, #475569);
}

body.dark-mode .accessibility-button {
    background: linear-gradient(145deg, #1e293b 0%, #334155 100%);
    color: #e2e8f0;
    border-color: #475569;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.3),
        0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

body.dark-mode .accessibility-button::before {
    background: linear-gradient(145deg, transparent 0%, rgba(255,255,255,0.05) 100%);
}

body.dark-mode .accessibility-button:hover {
    background: linear-gradient(145deg, #6366f1 0%, #8b5cf6 100%);
    color: #ffffff;
    border-color: #5b21b6;
}

body.dark-mode .accessibility-button i {
    color: #6366f1;
}

body.dark-mode .accessibility-button:hover i {
    color: #ffffff;
}

/* כפתור איפוס במצב כהה */
body.dark-mode .accessibility-button.reset {
    background: linear-gradient(145deg, #450a0a 0%, #7f1d1d 100%);
    color: #fecaca;
    border-color: #991b1b;
}

body.dark-mode .accessibility-button.reset:hover {
    background: linear-gradient(145deg, #dc2626 0%, #b91c1c 100%);
    color: #ffffff;
    border-color: #dc2626;
}

body.dark-mode .accessibility-button.reset i {
    color: #f87171;
}

body.dark-mode .accessibility-button.reset:hover i {
    color: #ffffff;
}

/* כפתור דארק מוד במצב כהה */
body.dark-mode .accessibility-button.dark-mode {
    background: linear-gradient(145deg, #374151 0%, #4b5563 100%);
    color: #f9fafb;
    border-color: #6b7280;
}

body.dark-mode .accessibility-button.dark-mode:hover {
    background: linear-gradient(145deg, #f9fafb 0%, #e5e7eb 100%);
    color: #1f2937;
    border-color: #d1d5db;
}

body.dark-mode .accessibility-button.dark-mode i {
    color: #fbbf24;
}

body.dark-mode .accessibility-button.dark-mode:hover i {
    color: #f59e0b;
}

/* כפתור איפוס מיוחד */
.accessibility-button.reset {
    grid-column: 1 / -1;
    background: linear-gradient(145deg, #fef2f2 0%, #fee2e2 100%);
    color: #dc2626;
    border-color: #fecaca;
    margin-top: 8px;
    position: relative;
}

.accessibility-button.reset::before {
    background: linear-gradient(145deg, rgba(220, 38, 38, 0.1) 0%, rgba(220, 38, 38, 0.05) 100%);
}

.accessibility-button.reset:hover {
    background: linear-gradient(145deg, #dc2626 0%, #b91c1c 100%);
    color: #ffffff;
    border-color: #dc2626;
}

.accessibility-button.reset i {
    color: #dc2626;
}

.accessibility-button.reset:hover i {
    color: #ffffff;
}

/* כפתור דארק מוד מיוחד */
.accessibility-button.dark-mode {
    background: linear-gradient(145deg, #1e293b 0%, #334155 100%);
    color: #f1f5f9;
    border-color: #475569;
}

.accessibility-button.dark-mode:hover {
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    border-color: #1e293b;
}

.accessibility-button.dark-mode i {
    color: #fbbf24;
}

.accessibility-button.dark-mode:hover i {
    color: #fbbf24;
}

/* ניגודיות גבוהה - חל על כל האלמנטים */
body.high-contrast,
body.high-contrast *:not(.accessibility-toolbar):not(.accessibility-toggle):not(.accessibility-button) {
    background-color: black !important;
    color: white !important;
    border-color: white !important;
}

/* התאמות ספציפיות לאזור הצ'אט במצב ניגודיות גבוהה */
body.high-contrast .chat-section,
body.high-contrast .messages,
body.high-contrast .input-area textarea,
body.high-contrast .message {
    background-color: black !important;
    color: white !important;
    border: 2px solid white !important;
}

body.high-contrast .message.user,
body.high-contrast .message.bot {
    background-color: #333 !important;
    color: white !important;
    border: 1px solid white !important;
    margin: 10px 0 !important;
}

body.high-contrast .input-area button {
    background-color: #333 !important;
    color: white !important;
    border: 1px solid white !important;
}

/* היפוך צבעים - חל על ה-body */
body.inverted-colors {
    filter: invert(100%) !important;
}

body.inverted-colors img,
body.inverted-colors video {
    filter: invert(100%) !important;
}

/* כפתור הנגישות כשהוא מחוץ ל-body (ישירות תחת html) */
html > .accessibility-toggle.desktop-only {
    position: fixed !important;
    bottom: 24px !important;
    left: 24px !important;
    width: 48px;
    height: 48px;
    background: linear-gradient(145deg, #c4a853 0%, #b8941f 100%);
    color: white;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(196, 168, 83, 0.3);
    z-index: 99999 !important;
    transition: all 0.3s ease;
    opacity: 0.85;
}

html > .accessibility-toggle.desktop-only:hover {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(196, 168, 83, 0.4);
}

html > .accessibility-toggle.desktop-only i {
    font-size: 1.3rem;
}

/* הסתרה במובייל */
@media (max-width: 768px) {
    html > .accessibility-toggle.desktop-only {
        display: none !important;
    }
}

/* פופאפ הנגישות כשהוא מחוץ ל-body */
html > #accessibilityToolbar {
    z-index: 999999 !important;
}

/* התאמת גודל טקסט לכל האלמנטים */
body[style*="font-size"] .chat-section,
body[style*="font-size"] .messages,
body[style*="font-size"] .message,
body[style*="font-size"] .input-area textarea,
body[style*="font-size"] .input-area button,
body[style*="font-size"] .header,
body[style*="font-size"] .footer,
body[style*="font-size"] .card {
    font-size: inherit !important;
}

/* שמירה על קריאות בכל המצבים */
.message,
.input-area textarea,
.card,
.header,
.footer {
    transition: all 0.3s ease !important;
} 