
/* --- משתני בסיס (ברירת מחדל כחולה לגיבוי) --- */
:root {
    --primary-color: #27BBF5;
    --primary-rgb: 39, 187, 245;
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-500: #27BBF5;
    --primary-600: #2563eb;
    --app-radius: 12px;
    --app-font-size: 16px;
}

*, ::before, ::after {
    box-sizing: border-box;
}

/* --- מנגנון הדריסה (Override Engine) --- */
/* 1. דריסת רקעים בהירים (כמו ב-Leaderboard ובתפריטים) */
.bg-blue-50, .bg-blue-100, .bg-[#E0F2FE], .bg-yellow-50 {
    background-color: var(--primary-50) !important;
    border-color: var(--primary-100) !important;
}

/* 2. דריסת טקסטים כחולים */
.text-blue-500, .text-blue-600, .text-\[\#27BBF5\], .text-yellow-600, .text-yellow-700 {
    color: var(--primary-color) !important;
}

/* 3. דריסת כפתורים ורקעים כהים */
.bg-blue-500, .bg-blue-600, .bg-\[\#27BBF5\], .bg-yellow-100 { 
    background-color: var(--primary-color) !important;
    color: white !important; /* וידוא שהטקסט לבן על רקע כהה */
}
.bg-yellow-100 .text-yellow-600 {
     color: white !important; /* תיקון ספציפי לכפתורים שהיו צהובים */
}

/* 4. תיקון ספציפי לשקיפות (כמו בסקרים) */
.bg-\[\#27BBF5\]\/80 {
    background-color: rgba(var(--primary-rgb), 0.8) !important;
}

/* 5. תיקון גבולות (Borders) */
.border-blue-100, .border-blue-200, .border-blue-500, .border-\[\#27BBF5\] {
    border-color: var(--primary-color) !important;
}
.ring-\[\#27BBF5\], .focus\:ring-\[\#27BBF5\]:focus {
    --tw-ring-color: var(--primary-color) !important;
}

/* 6. החלת הרדיוס הגלובלי */
.rounded-xl, .rounded-2xl, .rounded-lg, .rounded-md {
    border-radius: var(--app-radius) !important;
}

/* הגדרות כלליות */
html { 
    font-size: var(--app-font-size); 
}
body { 
    overflow-x: hidden; 
    width: 100%; 
    position: relative;
    margin: 0;
    padding: 0;
}


body { 
    font-family: sans-serif; 
    color: #1f2937;
    /* רקע בהיר אחיד לכל האתר */
    background-color: #f9fafb !important; 
    background-image: none !important;
    background-attachment: fixed;
    padding-bottom: 80px;
    transition: background-color 0.3s;
    overscroll-behavior-y: none; /* השורה שחוסמת את הריענון המובנה של כרום/ספארי */
}

.dark body {
    /* רקע כהה אחיד למצב לילה */
    background-color: #111827 !important;
    background-image: none !important;
    color: #f3f4f6 !important;
}

.dark body {
    background-color: #111827 !important; /* צבע כחול-שחור עמוק */
    color: #f3f4f6 !important; /* טקסט בהיר */
    background-attachment: fixed;
    
    /* תבנית רקע מותאמת למצב כהה (דפוס אפור כהה יותר) */
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%234B5563' fill-opacity='0.15'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") !important;
}


/* אפקט הילה לכוכב זהב */
.gold-glow {
    color: #FFD700 !important;
    filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.8));
}
/* אנימציית 'פופ' לכפתורים (כמו בלייק) */
.pop-active { animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

/* --- Force Static Colors (עוקף את העיצוב הדינמי) --- */

/* 1. כוכבים תמיד זהב */
.static-gold { color: #FFD700 !important; fill: #FFD700 !important; }
.static-gold-bg { background-color: #FFD700 !important; color: #713f12 !important; }

/* 2. וי אמינות תמיד כחול */
.static-verified { color: #3B82F6 !important; fill: #3B82F6 !important; }

/* 3. נקודת אונליין ירוקה בכל האתר */
.static-online-dot { background-color: #4ade80 !important; border-color: white !important; }
.dark .static-online-dot { border-color: #1f2937 !important; }

/* 4. עיצוב חדש ומודרני לתגיות בפרופיל (לא משעמם!) */
.profile-stat-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: transform 0.2s;
    border: 1px solid transparent;
}
.profile-stat-badge:hover { transform: translateY(-2px); }

/* תגית כוכבים (זהב נקי) */
.stat-stars {
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
    color: #D97706;
    border-color: #FDE68A;
}
.dark .stat-stars { background: rgba(245, 158, 11, 0.2); color: #FCD34D; border-color: rgba(245, 158, 11, 0.3); }

/* תגית אמינות (סגול-כחול יוקרתי, לא מושפע מהעיצוב) */
.stat-points {
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    color: #4F46E5;
    border-color: #C7D2FE;
}
.dark .stat-points { background: rgba(99, 102, 241, 0.2); color: #818CF8; border-color: rgba(99, 102, 241, 0.3); }

/* 5. טקסט שחור בפוקוס (לכפתורי הסינון) */
.text-focus-black { color: #111827 !important; }
.dark .text-focus-black { color: #ffffff !important; }

/* --- אנימציית אייקון מרחף לכרטיסיות --- */
@keyframes glass-icon-float {
    0% { transform: translateY(0) rotate(-12deg) scale(1); }
    50% { transform: translateY(-15px) rotate(-6deg) scale(1.05); }
    100% { transform: translateY(0) rotate(-12deg) scale(1); }
}

.animate-glass-float {
    animation: glass-icon-float 10s ease-in-out infinite;
    will-change: transform; /* אופטימיזציה לביצועים */
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; }
.fade-in { animation: fadeIn 0.5s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.slide-down-fade { animation: slideDownFade 0.6s cubic-bezier(0.16, 1, 0.3, 1); transform-origin: top; }
@keyframes slideDownFade { from { opacity: 0; transform: translateY(-10px) scaleY(0.95); max-height: 0; } to { opacity: 1; transform: translateY(0) scaleY(1); max-height: 1000px; } }
.slide-in-right { animation: slideInRight 0.3s ease-out forwards; }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.slide-in-left { animation: slideInLeft 0.3s ease-out forwards; }
@keyframes slideUpFade { 
    0% { transform: translate(-50%, 100%); opacity: 0; } 
    100% { transform: translate(-50%, 0); opacity: 1; } 
}
.toast-enter { animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes slideInLeft { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.4); } 100% { transform: scale(1); } }
.star-pop { animation: pop 0.3s ease-out; }
.text-shadow { text-shadow: 0 2px 4px rgba(0,0,0,0.8); }
.hide-scrollbar::-webkit-scrollbar { display: none; }
@keyframes pulse-green { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); } 70% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }
.online-glow { animation: pulse-green 2s infinite; border: 2px solid #4ade80; }
input[type=range] { -webkit-appearance: none; background: transparent; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 16px; width: 16px; border-radius: 50%; background: #27BBF5; cursor: pointer; margin-top: -6px; }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 4px; cursor: pointer; background: #ddd; border-radius: 2px; }
.blur-gradient-mask { mask-image: linear-gradient(to top, black 0%, transparent 100%); -webkit-mask-image: linear-gradient(to top, black 0%, transparent 100%); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
@media (max-width: 640px) { 
    .mobile-no-padding { padding: 0 !important; } 
    .mobile-edge-to-edge { border-radius: 0 !important; border-left: none !important; border-right: none !important; margin-left: 0 !important; margin-right: 0 !important; width: 100% !important; box-shadow: none !important; border-bottom: none !important; }
    /* הוספת מרווח בטיחות רק בדף השאלה */
    .container { max-width: 100% !important; width: 100% !important; } .question-immersive-img { height: auto !important; min-height: 40vh; border-radius: 0 !important; border: none !important; } .fab-fixed { position: fixed; bottom: 24px; left: 24px; z-index: 100; } }

.sticky-stack-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-bottom: 60px; /* משאיר מקום לפיד הרגיל לטפס */
}

.sticky-layer {
    position: sticky;
    will-change: transform;
    
    /* הורדנו את הצל העליון האגרסיבי והחלפנו בצל רגיל ונעים */
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    border-radius: 1.5rem;
    transform-origin: top center;
    
    /* התיקון הקריטי: הרקע הפך לשקוף לחלוטין כדי שהרווחים יהיו שקופים */
    background-color: transparent !important;
}

/* הוספת רווח (Margin) בין השכבות כדי שהן לא "יידבקו" */
.sticky-layer.layer-2, .sticky-layer.layer-3 {
    margin-top: 15px;
}

/* השכבה הראשונה לא צריכה צל עליון כי אין עליה כלום */
.sticky-layer.layer-1 {
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}


.sticky-layer.layer-1 { top: 64px; z-index: 10; transform: scale(1); }
.sticky-layer.layer-2 { top: 84px; z-index: 11; transform: scale(0.96); }
.sticky-layer.layer-3 { top: 104px; z-index: 12; transform: scale(0.92); }

/* התאמת גודל הפונט בריבועים (שכבות 2 ו-3) כדי שהכותרות לא יחתכו */
.sticky-layer.layer-2 h3,
.sticky-layer.layer-3 h3 {
    font-size: 1.15rem !important;
    line-height: 1.3;
}

.rank-badge {
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}





/* --- עיצוב הבנטו גריד (מחשב) --- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 220px);
    gap: 1rem;
    margin-bottom: 2rem;
}
.bento-hero {
    grid-column: span 2;
    grid-row: span 2;
}
.bento-item {
    grid-column: span 1;
    grid-row: span 1;
}

/* --- Shaloni Chat Styles --- */

/* 1. התאמת גובה למובייל (מונע את הבר העליון של הדפדפן מלהסתיר) */
.h-screen-safe {
    height: 100vh; /* Fallback */
    height: 100dvh; /* Dynamic Viewport Height */
}

/* 2. עיצוב גלגלת דק ויפה לצ'אט */
.chat-scroll::-webkit-scrollbar {
    width: 6px;
}
.chat-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.chat-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}
.dark .chat-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
}

/* --- תיקון גלילה אופקית בעת החלקת הודעות (Swipe to reply) ומניעת קפיצות (Rubber-Banding) --- */
.chat-messages-container {
    overflow-x: hidden !important;
    overscroll-behavior-y: contain !important;
}

/* 3. אנימציית כניסה להודעה (קופץ כמו בוואטסאפ) */
@keyframes message-pop {
    0% { opacity: 0; transform: translateY(10px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
.message-enter {
    animation: message-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* בועות צ'אט בסיסיות - מעוגלות מכל הצדדים כברירת מחדל */
.bubble-sent, .bubble-received {
    position: relative;
    border-radius: 18px !important; /* מעוגל מכל הצדדים */
    transition: border-radius 0.2s ease;
}

/* הודעה שלי (צד ימין) */
.bubble-sent {
    background-color: var(--primary-color) !important;
    color: white;
}

/* זנב להודעה ראשונה שלי - למעלה בימין */
.bubble-sent.has-tail {
    border-top-right-radius: 4px !important;
}

.bubble-sent.has-tail::after {
    content: "";
    position: absolute;
    top: 0;
    right: -8px;
    width: 14px;
    height: 18px;
    background-color: inherit;
    clip-path: polygon(0 0, 100% 0, 0 100%, 30% 40%, 0 100%);
}

/* הודעה של הצד השני (צד שמאל) */
.bubble-received {
    background-color: white;
    color: #1f2937;
}
.dark .bubble-received {
    background-color: #1f2937;
    color: white;
}

/* זנב להודעה ראשונה שלהם - למעלה בשמאל */
.bubble-received.has-tail {
    border-top-left-radius: 4px !important;
}

.bubble-received.has-tail::after {
    content: "";
    position: absolute;
    top: 0;
    left: -8px;
    width: 14px;
    height: 18px;
    background-color: inherit;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 70% 40%, 100% 100%);
}

/* תיקון כירורגי לקישורים בתוך בועת ההודעה שלי */
.chat-bubble-me a {
    color: #ffffff !important;
    text-decoration: underline !important;
    text-underline-offset: 3px;
    opacity: 0.9;
}

.chat-bubble-me a:hover {
    opacity: 1;
    text-decoration: none !important;
}


.dark .chat-bubble-other {
    background-color: #1f2937;
    color: white;
}

/* מפריד תאריכים שדוחף אחד את השני (WhatsApp Style) */
.chat-date-separator {
    position: sticky;
    top: 8px; /* המרחק מהקצה העליון כשהוא נדבק */
    z-index: 20;
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 12px 0;
    pointer-events: none; /* מאפשר ללחוץ על הודעות שמתחת למרחב של המפריד */
}

.chat-date-badge {
    pointer-events: auto; /* מחזיר יכולת לחיצה למדבקה עצמה אם תרצה בעתיד */
    background-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(4px);
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 14px;
    border-radius: 9999px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
}

.dark .chat-date-badge {
    background-color: rgba(31, 41, 55, 0.95);
    color: #cbd5e1;
    border-color: rgba(255, 255, 255, 0.1);
}

/* אנימציה חלקה לטעינת התוכן האמיתי */
.fade-in-content {
    animation: fadeInSmooth 0.5s ease-out forwards;
}

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

/* עיצוב משופר לשלד הטעינה */
.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .6; }
}


/* ביטול תמונת הרקע מהגוף הכללי של האתר */
@media (max-width: 640px) { 
    body::before { 
        display: none !important; 
    } 
}

.chat-view-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image: var(--mobile-bg);
    background-size: cover;
    background-position: center;
    filter: blur(var(--mobile-bg-blur));
    transform: scale(1.05); /* מונע קצוות שקופים בגלל הבלור */
    opacity: 1;
    pointer-events: none;
}


/* אנימציית מחיקה חלקה לשאלות ותשובות */
.item-deleting {
    animation: delete-collapse 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: none;
}

@keyframes delete-collapse {
    0% {
        opacity: 1;
        transform: scale(1);
        max-height: 800px;
        margin-bottom: 0;
    }
    40% {
        opacity: 0;
        transform: scale(0.95);
        max-height: 800px;
        margin-bottom: 0;
    }
    100% {
        opacity: 0;
        transform: scale(0.9);
        max-height: 0;
        margin-bottom: -16px; /* מבטל בעדינות את הרווח של ה-gap */
        padding: 0;
        overflow: hidden;
        border: none;
    }
}



/* אנימציית הבהוב להודעה מצוטטת */
@keyframes highlight-flash {
    0% { background-color: rgba(var(--primary-rgb), 0.4); }
    100% { background-color: transparent; }
}

.highlight-message-flash {
    animation: highlight-flash 1.5s ease-out forwards;
    border-radius: var(--app-radius);
}


/* --- מנגנון ארכיון, מחיקה וצ'אט --- */
.chat-item-swipe-container {
    position: relative;
    overflow: hidden;
}
.chat-item-content {
    position: relative;
    z-index: 10;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background-color: inherit;
}

/* כיווני החלקה (RTL) */
.chat-item-content.swiped-left {
    transform: translateX(-80px); /* חושף את הארכיון (צד ימין המסך ב-RTL) */
}
.chat-item-content.swiped-right {
    transform: translateX(80px); /* חושף את המחיקה (צד שמאל המסך ב-RTL) */
}

/* רקעים משותפים לפעולות */
.chat-item-action-bg {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    color: white;
    transition: opacity 0.2s ease;
}

.chat-item-action-bg.archive-bg {
    background-color: #27BBF5;
    justify-content: flex-end; /* ב-RTL זה צד ימין של האלמנט הנסתר, שמופיע בשמאל המסך */
}

.chat-item-action-bg.delete-bg {
    background-color: #EF4444; /* אדום */
    justify-content: flex-start; /* ב-RTL זה צד שמאל של האלמנט הנסתר, שמופיע בימין המסך */
}
.context-menu-glass {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.05);
}
.dark .context-menu-glass {
    background: rgba(31, 41, 55, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}


/* --- אנימציית דיבורים (כניסה חלקה ואלגנטית) --- */
@keyframes smooth-talk-enter {
    0% { opacity: 0; transform: translateY(-20px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.talk-item-new {
    animation: smooth-talk-enter 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: top center;
}


/* --- Poll Animations --- */
@keyframes poll-ripple {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(4); opacity: 0; }
}
.animate-ripple {
    animation: poll-ripple 0.6s linear forwards;
}

@keyframes spring-bounce {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.3); opacity: 1; }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}
.animate-spring-bounce {
    animation: spring-bounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* עיצוב ציטוטים מרובעים */
.border-r-4[class*="bg-gray-50"] {
    border-radius: 0 !important;
}


/* יישור אימייל: Placeholder לימין ותוכן לשמאל */
.email-input-field {
    text-align: right;
    direction: rtl;
}

.email-input-field:focus::placeholder,
.email-input-field:not(:placeholder-shown) {
    text-align: left;
    direction: ltr;
}

.email-input-field::placeholder {
    text-align: right;
    direction: rtl;
}
