/* style.css */

/* הגדרות כלליות */
body {
    background-color: #1f5a95; /* סגול פסטל נעים */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    color: #333;
    overflow-x: hidden; /* מונע גלילה לצדדים */
}

/* החלת ה-GIF על כל המסכים */
main, section.screen, section.hidden, section#game-screen, section#medium-screen, section#hard-screen, section#profile-screen {
    background-image: url('night_sky_v2.gif'); /* ודא שזה השם המדויק של הקובץ */
    min-height: 100vh;
    box-sizing: border-box;
    padding-top: 10px; /* מרווח כדי שהתוכן לא ייכנס מתחת ל-Navbar */
}

/* הופך את כל הכרטיסיות והמודאלים לקצת שקופים ומטושטשים מאחורה */
.level-card, .stat-card, .theory-container, .profile-container, .modal-content, .overlay-box {
    background: rgba(255, 255, 255, 0.9) !important; /* לבן עם 90% אטימות */
    backdrop-filter: blur(8px); /* טשטוש עדין של ה-GIF מאחורי הכרטיס */
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
}

/* מוודא שהכותרות על הרקע עצמו (מחוץ לכרטיסים) יהיו לבנות וקריאות */
main > h1, .screen-header h1 {
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
    padding: 10px;
}


/* --- עיצוב הבר העליון (NAVBAR) --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background-color: #c1e6ed; /* הסגול הכהה המקורי שלך */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .logo {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.nav-links {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* כפתורי התחברות ואזור אישי בבר העליון */
.navbar .login-btn, .navbar .profile-link {
    background-color: #5ac0cd;
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.3s;
    text-decoration: none;
}

.navbar .login-btn:hover, .navbar .profile-link:hover {
    background-color: #483d8b;
}

.hamburger {
    font-size: 28px;
    cursor: pointer;
    margin-right: 15px; /* רווח מהכפתורים */
}

/* --- תפריט צדדי --- */
.sidebar {
    position: fixed;
    top: 0;
    right: -300px;
    width: 250px;
    height: 100%;
    background-color: #ffffff;
    box-shadow: -2px 0 5px rgba(0,0,0,0.2);
    transition: right 0.3s ease;
    z-index: 1100;
    padding-top: 60px;
    display: flex;
    flex-direction: column;
}

.sidebar a {
    padding: 15px 25px;
    text-decoration: none;
    font-size: 18px;
    color: #333;
    border-bottom: 1px solid #eee;
}

.sidebar a:hover { background-color: #f0f0f0; }
.sidebar.open { right: 0; }

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1050;
    display: none;
}

.overlay.open { display: block; }

/* --- מסך הבית --- */
main {
    text-align: center;
    padding: 50px 20px;
}

.levels-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* הטקסט "שלום אורח" והדיב שלו */
#welcome-message p {
    color: #ffffff; /* לבן נקי */
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8); /* צל כדי שיבלוט על הכוכבים */
    margin-bottom: 5px;
}

/* הטקסט "קדימה להתאמן!!!" שמופיע אחרי כרטיס הלמידה */
#home-screen > p {
    color: #fbfbfb; /* זהב עדין - נראה מעולה על רקע כחול כהה/לילה */
    font-size: 1.5rem;
    font-weight: 900; /* מודגש מאוד */
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.9);
    margin-top: 10px;
    margin-bottom: 5px;
    text-align: center;
}

/* מוודא שהכותרת הראשית (H1) גם בהירה */
#home-screen h1 {
    color: #ffffff;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.9);
}

.level-card {
    background-color: #ffffff;
    border: 2px solid #D8BFD8;
    border-radius: 15px;
    padding: 30px;
    width: 200px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.level-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.level-card h2 { margin: 0; color: #6a5acd; }
.level-card p { font-size: 14px; color: #666; }

.easy { border-right: 10px solid #90ee90; }
.medium { border-right: 10px solid #ffcc00; }
.hard { border-right: 10px solid #ff6666; }

/* --- משחק ואלמנטים כלליים --- */
.hidden { display: none !important; }

.game-header {
    display: flex;
    justify-content: space-around;
    background: #ffffff;
    padding: 15px;
    border-radius: 10px;
    margin: 20px auto 50px;
    max-width: 800px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.stat-box { font-size: 20px; font-weight: bold; position: relative; }

.big-letter {
    font-size: 100px;
    font-weight: bold;
    color: #6a5acd;
    background: white;
    width: 170px; /* הגדלתי מעט כדי שיהיה מקום לאותיות רחבות */
    height: 170px;
    
    /* פתרון המירכוז המנצח: */
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: normal; /* ביטול ה-line-height הישן */
    
    margin: 0 auto;
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

/* חלוניות ומודאלים */
.overlay-box, .modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-width: 400px;
    margin: 100px auto;
    text-align: center;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
}

.action-btn {
    background-color: #6a5acd;
    color: rgb(255, 255, 255);
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 18px;
    cursor: pointer;
    margin: 0px;
    transition: 0.3s;
}

.action-btn:hover { background-color: #483d8b; }
.action-btn.secondary { background-color: #aaa; }

/* --- רמה בינונית וקשה --- */
.word-wrapper {
    font-size: 80px;
    font-weight: bold;
    letter-spacing: 10px;
    display: flex;
    justify-content: center;
    direction: rtl;
}

.sentence-wrapper {
    font-size: 35px;
    line-height: 1.8;
    max-width: 90%;
    margin: 0 auto;
    text-align: right;
    direction: rtl;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.letter { color: #e5e0e0; transition: color 0.2s; }
.letter.correct { color: #2ecc71; }
.letter.wrong { color: #e74c3c; }
.letter.active { border-bottom: 3px solid #6a5acd; }
.letter.space { width: 15px; display: inline-block; }

/* --- אזור אישי --- */
.profile-container {
    max-width: 800px;
    margin: 50px auto;
    padding: 30px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: right;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.user-avatar {
    font-size: 50px;
    background: #e0e0e0;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* הגדרת הגריד הראשי */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 עמודות שוות לרמות הקל, בינוני, קשה */
    gap: 20px;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

/* הגדרת כרטיסיית מרכז הלמידה לתפוס את כל השורה הראשונה */
.stat-card.learning-center {
    grid-column: 1 / -1; /* אומר לכרטיס להתחיל בעמודה הראשונה ולהסתיים באחרונה */
    justify-self: center; /* ממרכז את התוכן של הכרטיס עצמו */
    width: 100%; /* או רוחב ספציפי אם תרצה שהוא יהיה צר יותר מהשורה */
    max-width: 600px; /* נותן לו רוחב יפה וממורכז */
}

.stat-card {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #eee;
}

.stat-card h3 { color: #6a5acd; margin-bottom: 10px; }

/* --- אנימציות --- */
@keyframes bounce {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    50% { transform: translateY(-20px) scale(1.2); opacity: 1; }
    100% { transform: translateY(-40px) scale(1); opacity: 0; }
}

/* --- כפתור יציאה במשחק --- */
.exit-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: #ff6666;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    z-index: 1001;
}

/* עיצוב כפתור ההמבורגר */
.hamburger {
    background: none;
    border: none;
    color: #6a5acd; /* צבע סגול יפה */
    font-size: 32px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: transform 0.2s;
}

.hamburger:hover {
    transform: scale(1.1);
}

/* עיצוב כפתור ההתחברות המרכזי במסך הבית */
.login-prompt {
    margin-top: 40px;
}

#main-profile-btn {
    background-color: #2ecc71; /* ירוק לאזור אישי כדי להבדיל */
}

#main-profile-btn:hover {
    background-color: #27ae60;
}

/* --- עיצוב מסך תיאוריה --- */
#theory-screen {
    padding: 40px 20px;
    display: flex;
    justify-content: center;
}

.theory-container {
    max-width: 800px;
    width: 100%;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: right; /* עברית */
    direction: rtl;
}

.theory-container h1 {
    color: #6a5acd;
    margin-bottom: 25px;
    border-bottom: 3px solid #f0f0f0;
    padding-bottom: 10px;
}

.theory-content p {
    font-size: 18px;
    line-height: 1.8;
    color: #444;
}

/* עיצוב התמונה/פלייסחולדר */
.hand-image-placeholder {
    margin: 30px 0;
    text-align: center;
    background: #f9f7ff;
    padding: 20px;
    border-radius: 15px;
    border: 2px dashed #D8BFD8;
}

.mock-image {
    font-size: 60px;
    margin-top: 10px;
}

/* רשימת השלבים */
.theory-steps {
    list-style-type: none;
    padding: 0;
    margin-top: 30px;
}

.theory-steps li {
    background: #ffffff;
    margin-bottom: 15px;
    padding: 20px;
    border-right: 6px solid #6a5acd; /* פס סגול בצד ימין */
    border-radius: 5px 15px 15px 5px;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.05);
    font-size: 17px;
    transition: transform 0.2s;
}

.theory-steps li:hover {
    transform: translateX(-5px); /* קפיצה קלה שמאלה בגלל ה-RTL */
}

.theory-steps li strong {
    color: #6a5acd;
    display: block;
    margin-bottom: 5px;
}

/* כפתור חזרה בתוך התיאוריה */
.theory-container .action-btn {
    margin-top: 30px;
    width: 100%; /* כפתור רחב ונוח */
}

/* עטיפת הלוגו והטקסט */
.logo-wrapper {
    display: flex;
    align-items: center; /* ממרכז אותם אנכית אחד מול השני */
    gap: 3px;           /* רווח בין התמונה לטקסט */
    cursor: pointer;
    transition: opacity 0.2s;
}

.logo-wrapper:hover {
    opacity: 0.8;        /* אפקט קטן כשעוברים עם העכבר */
}

/* עיצוב התמונה עצמה */
.nav-logo-img {
    height: 40px;        /* גובה מתאים לסרגל העליון - שנה לפי הצורך */
    width: auto;         /* שומר על פרופורציות */
    object-fit: contain;
}

/* עיצוב הטקסט "קלידים" */
.logo-text {
    font-size: 24px;
    font-weight: bold;
    color: #333;         /* או כל צבע אחר שמתאים לך */
}

/* וודא שמסך הבית הוא נקודת הייחוס */
#home-screen {
    position: relative; 
    min-height: 90vh; /* מבטיח שהמסך בגובה מלא כדי שה-GIF יהיה באמת למטה */
    padding-bottom: 0px; /* רווח למטה כדי שהתוכן לא יעלה על ה-GIF */
}

/* עיצוב ומיקום ה-GIF */
.home-animated-gif {
    position: absolute;
    bottom: 20px;   /* מרווח קטן מהתחתית */
    left: 0px;     /* מרווח קטן משמאל */
    max-width: 400px; /* הגבלת גודל - שנה לפי הצורך */
    height: auto;   /* שומר על פרופורציות */
    z-index: 10;     /* מבטיח שהוא יהיה מעל אלמנטים אחרים ברקע */
    opacity: 0.9;    /* שקיפות קלה למראה מעודן יותר - אופציונלי */
    pointer-events: none; /* ה-GIF לא יפריע ללחיצות על כפתורים אם הוא מעליהם */
}

/* צבע ייחודי למרכז הלמידה - כחול שמיים */
.study { 
    border-right: 10px solid #4a90e2; 
}


/* כפתור חזור בראש המסך */
.back-btn {
    padding: 10px 20px;
    background-color: #6a5acd;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    margin: 10px auto;
}

/* --- מירכוז כותרות וכפתורים בראש המסך --- */
#study-screen {
    text-align: center;
}

#study-screen .screen-header {
    display: flex;
    flex-direction: column; /* הופך את האלמנטים לעמודה במקום לשורה */
    align-items: center;    /* ממורכז לאמצע */
    gap: 10;              /* רווח אחיד בין הכפתורים והכותרת */
    margin-bottom: 10px;
}

.circle-container {
    position: relative;
    width: 450px;  /* גודל המעגל */
    height: 450px;
    margin: 0px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.learning-circle {
    position: relative;
    width: 100%;
    height: 100%;
}

/* כפתור התיאוריה במרכז */
.center-theory-btn {
    position: absolute;
    width: 100px;
    height: 100px;
    background-color: #6a5acd;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 0 20px rgba(106, 90, 205, 0.4);
    transition: transform 0.2s;
}

.center-theory-btn:hover {
    transform: scale(1.1);
}

/* כפתורי השלבים */
.step-node {
    position: absolute;
    width: 55px;
    height: 55px;
    background-color: white;
    border: 3px solid #4a90e2;
    color: #4a90e2;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    /* מרכוז הכפתור על הנקודה המתמטית */
    margin-left: -27px; 
    margin-top: -27px;
    z-index: 5;
}

.step-node:hover {
    background-color: #4a90e2;
    color: white;
    transform: scale(1.2);
}

/* קו מעגלי מקווקו ברקע (אופציונלי למראה) */
.circle-container::before {
    content: '';
    position: absolute;
    width: 360px; /* רדיוס המסלול */
    height: 360px;
    border: 2px dashed #4a90e2;
    border-radius: 50%;
    z-index: 1;
}

#study-text-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 40px;
    font-family: monospace;
    margin: 20px 0;
    direction: rtl;
}

.study-char {
    padding: 5px 15px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.2s;
    border-bottom: 4px solid transparent;
}

/* התו שהמשתמש צריך להקליד עכשיו */
.study-char.current {
    border-bottom: 4px solid #4a90e2;
    transform: scale(1.1);
    background-color: #f0f8ff;
}

/* הצלחה / שגיאה */
.study-char.correct {
    color: #28a745;
    background-color: #e8f5e9;
    border-bottom: 4px solid #28a745;
}

.study-char.error {
    color: #dc3545;
    background-color: #fde8e8;
    border-bottom: 4px solid #dc3545;
    animation: shake 0.3s;
}

/* אנימציית שקשוק לשגיאה */
@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(5px); }
    50% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

#study-timer {
    font-size: 24px;
    font-weight: bold;
    color: #d9534f;
    margin: 0px 0;
}


/* Header של מסך הלמידה */
.study-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: #f8f9fa;
    border-bottom: 2px solid #eee;
    margin-bottom: 20px;
    width: 97%;
}

.study-header h1 {
    margin: 0;
    font-size: 24px;
    flex-grow: 1;
    text-align: center;
}

.back-btn-small {
    padding: 8px 15px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.timer {
    font-size: 20px;
    font-weight: bold;
    min-width: 100px;
    text-align: left;
}

/* התאמות למודל תוצאות */
.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* הבזק ירוק רגעי */
.key-success-flash {
    background-color: #2ecc71 !important;
    box-shadow: 0 0 15px #2ecc71;
    transform: scale(1.1);
    transition: all 0.1s;
    color: white !important;
}

/* אדום קבוע לטעות - עד שהמשתמש לוחץ נכון */
.key-error-hold {
    background-color: #e74c3c !important;
    box-shadow: 0 0 10px #e74c3c;
    color: white !important;
    animation: shake 0.2s ease-in-out;
}

/* אופציונלי: אנימציית רעידה קלה לטעות */
@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    100% { transform: translateX(0); }
}

.locked-level {
    background-color: #bdc3c7 !important; /* צבע אפור אחיד */
    color: #7f8c8d !important;
    cursor: not-allowed !important;
    opacity: 0.9;
    filter: grayscale(100%); /* הופך את כל הצבעים לאפור */
    box-shadow: none !important; /* מסיר הילה או צל של כפתור פעיל */
    transform: scale(0.95); /* מקטין אותו מעט כדי להדגיש שהוא לא פעיל */
}

/* ביטול אפקט המעבר (Hover) על שלבים נעולים */
.locked-level:hover {
    transform: scale(0.95) !important;
    background-color: #2c3e50 !important;
}

/* עיצוב השורה - גם לכותרת וגם לנתונים */
.leaderboard-header-row, 
.leaderboard-item {
    display: grid;
    /* הגדרת העמודות: 40px לדירוג, גמיש לשם, ו-70px לניקוד */
    grid-template-columns: 60px 1fr 90px; 
    align-items: center;
    padding: 10px 5px;
    border-bottom: 1px solid #eee;
    text-align: right; /* יישור טקסט לימין (עברית) */
}

/* כותרת הטבלה */
.leaderboard-header-row {
    font-size: 0.85rem;
    font-weight: bold;
    color: #7f8c8d;
    background-color: #f8f9fa;
    border-radius: 5px 5px 0 0;
}

/* עמודת הניקוד - נצמיד אותה לשמאל כדי שתהיה רחוקה מהשם */
.leaderboard-item .score, 
.leaderboard-header-row span:last-child {
    text-align: left;
    font-weight: bold;
    color: #27ae60;
}

.leaderboard-item .name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* קיצור שמות ארוכים מדי עם ... */
    padding-right: 10px;
}

.leaderboard-item .rank {
    font-weight: bold;
    color: #e67e22;
}

/* הסרת הקו התחתון מהאלמנט האחרון ברשימה */
.leaderboard-list li:last-child {
    border-bottom: none;
}

/* כתר למקום הראשון */
.leaderboard-item:first-child .rank::after {
    content: " 👑";
}