/* ============ Basic Settings ============ */
body {
    /* Prevents content from being hidden under the fixed header */
    padding-top: 80px; 
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ============ Navigation Bar (Header) ============ */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000; 
    background: linear-gradient(90deg, #1a2a47 0%, #2c426e 100%);
    padding: 10px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-logo {
    font-size: 1.8em;
    font-weight: bold;
    color: #a0e6ff;
    text-decoration: none;
    text-shadow: 0 0 8px rgba(160, 230, 255, 0.6);
}

/* ============ Navigation Links (Desktop) ============ */
.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links li a {
    text-decoration: none;
    color: #e0f2f7;
    font-size: 1.05em;
    font-weight: 500;
    padding: 8px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: block;
}

.nav-links li a:hover {
    color: #ffffff;
    background-color: rgba(160, 230, 255, 0.1);
    box-shadow: 0 0 15px rgba(160, 230, 255, 0.5);
}

/* ============ Hamburger Menu Button ============ */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #a0e6ff;
    font-size: 2em;
    cursor: pointer;
}

/* ============ Language and User Selector ============ */
.lang-dropdown {
    position: relative;
}

.lang-current {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    color: #a0e6ff !important;
    font-weight: bold;
    border: 1px solid rgba(160, 230, 255, 0.3);
    border-radius: 8px;
    text-decoration: none;
}

.lang-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #1a2a47;
    list-style: none;
    min-width: 140px;
    border-radius: 8px;
    padding: 10px 0;
    margin-top: 5px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1001;
    border: 1px solid rgba(160, 230, 255, 0.1);
}

.lang-dropdown:hover .lang-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: block;
    padding: 10px 20px;
    color: #e0f2f7;
    text-decoration: none;
    text-align: right;
}

.lang-option:hover {
    background: rgba(160, 230, 255, 0.2);
}

/* ============ Mobile Adjustment (Media Query) ============ */
@media (max-width: 900px) {
    .main-header {
        padding: 5px 0;
    }

    body {
        padding-top: 60px; /* Reduced spacing for mobile */
    }

    .menu-toggle {
        display: block;
    }

    .nav-links {
        display: none; /* Will be toggled by 'active' class via JS */
        flex-direction: column;
        background: linear-gradient(180deg, #1a2a47 0%, #2c426e 100%);
        position: fixed;
        top: 60px; /* Directly below the header */
        left: 0;
        width: 100%;
        
        /* Critical fix for Landscape mode and low screen height */
        max-height: calc(100vh - 60px); 
        overflow-y: auto; 
        
        padding: 10px 0 30px 0;
        gap: 0;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
    }

    .nav-links li a {
        padding: 15px;
        font-size: 1.2em;
        border-radius: 0;
        border-bottom: 1px solid rgba(160, 230, 255, 0.05);
    }

    /* Language and user selector on mobile - automatic opening without Hover */
    .lang-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        background: rgba(0, 0, 0, 0.1);
        box-shadow: none;
        border: none;
        margin: 0;
        width: 100%;
    }

    .lang-current {
        border: none;
        justify-content: center;
        background: rgba(160, 230, 255, 0.05);
    }

    .lang-option {
        text-align: center;
        padding: 12px;
    }

    #user-display-name {
        max-width: 200px;
    }
}

/* Special button (if needed to restore) */
.special-button {
    background: linear-gradient(45deg, #00c6ff, #0072ff);
    color: white !important;
    padding: 10px 25px !important;
    border-radius: 50px !important;
    font-weight: bold !important;
}

/* ============ Lesson Page Menu Design (Lesson Mode) ============ */

/* Main container for lesson mode */
.nav-container-lesson {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation group definition - Flex: 1 pushes the sides to the edges */
.nav-group {
    display: flex;
    align-items: center;
    flex: 1; 
}

.nav-left { justify-content: flex-start; gap: 12px; }
.nav-right { justify-content: flex-end; gap: 12px; }

/* Site name - always visible */
.nav-site-name {
    color: #a0e6ff;
    font-weight: bold;
    font-size: 1.1em;
    text-shadow: 0 0 5px rgba(160, 230, 255, 0.4);
    white-space: nowrap;
}

/* Center: Score bubble and lesson info */
.nav-score-container {
    flex: 0; 
    display: flex;
    justify-content: center;
    z-index: 10;
}

.score-badge {
    background: linear-gradient(45deg, #00c6ff, #0072ff);
    color: white;
    padding: 6px 16px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 0.95em;
    box-shadow: 0 4px 10px rgba(0, 198, 255, 0.4);
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

/* Navigation Arrows styling */
.nav-lesson-btn {
    color: #a0e6ff;
    text-decoration: none;
    font-size: 1.8em;
    font-weight: bold;
    transition: all 0.3s ease;
    cursor: pointer;
    line-height: 1;
}

.nav-lesson-btn:hover {
    color: #ffffff;
    transform: scale(1.1);
}

/* Disabling list bullets */
.lesson-mode .nav-links {
    list-style: none !important;
    display: flex;
    margin: 0;
    padding: 0;
    gap: 15px;
}

/* ============ Mobile Adjustment (Narrow Screens) ============ */
@media (max-width: 900px) {
    .nav-site-name {
        font-size: 0.85em; /* Slightly smaller to fit the site name */
    }

    .nav-container-lesson {
        padding: 0 10px;
    }

    /* Arrows and score remain spread across full width */
    .nav-left, .nav-right {
        flex: 1;
    }

    .nav-lesson-btn {
        font-size: 2em;
        padding: 0 8px;
    }

    .score-badge {
        font-size: 0.8em;
        padding: 4px 10px;
        gap: 4px;
    }

    /* Hiding Home/Lessons inside hamburger */
    .lesson-mode .nav-links {
        display: none;
    }

    .lesson-mode .nav-links.active {
        display: flex;
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        background: #1a2a47;
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
        z-index: 1001;
        box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    }
}

/* Handling very small screens (under 380px) */
@media (max-width: 380px) {
    .nav-site-name {
        display: none; /* Hide name on very narrow devices to prevent crushing the score badge */
    }
}
/* ============ Feedback =========== */
.nav-feedback-link {
    color: var(--secondary) !important; /* צבע סגול בולט */
    font-weight: bold;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.nav-feedback-link:hover {
    border-bottom: 2px solid var(--secondary);
    opacity: 0.8;
}

/* עיצוב לתפריט המובייל - שהלינק לא יצמד לצדדים */
@media (max-width: 768px) {
    #lesson-menu li {
        margin: 10px 0;
    }
}