/* nav.css - Complete navigation styling for Sivan Altar's website */

/* ----- Header and Navigation Base Styles ----- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: background-color var(--transition-speed);
    padding: 8px 0;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ----- Logo Styling ----- */
.logo {
    flex-shrink: 0;
    z-index: 1001; /* Above the mobile menu */
}

.logo img {
    height: 40px;
    width: auto;
    display: block;
}

/* ----- Main Navigation - Desktop ----- */
.main-nav {
    display: flex;
    align-items: center;
}

.main-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.main-nav li {
    margin: 0 15px;
    position: relative;
}

.main-nav a {
    text-decoration: none;
    color: var(--heading-color);
    font-size: 16px;
    font-weight: 500;
    padding: 8px 0;
    display: block;
    position: relative;
    transition: color var(--transition-speed);
}

.main-nav a:after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width var(--transition-speed);
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--primary-color);
}

.main-nav a:hover:after,
.main-nav a.active:after {
    width: 100%;
}

/* ----- Auth Item Styling ----- */
.main-nav li.auth-item {
    display: flex;
    align-items: center;
}

#auth-container {
    display: flex;
    align-items: center;
    height: 100%;
}

/* ----- Mobile Menu Toggle Button ----- */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    width: 30px;
    height: 24px;
    position: relative;
    cursor: pointer;
    z-index: 1010;
    padding: 0;
}

.mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #333; /* Fixed color for hamburger icon */
    position: absolute;
    left: 0;
    transition: all 0.3s ease;
}

.mobile-menu-toggle span:nth-child(1) {
    top: 0;
}

.mobile-menu-toggle span:nth-child(2) {
    top: 10px;
}

.mobile-menu-toggle span:nth-child(3) {
    top: 20px;
}

/* ----- Mobile Menu Toggle Animation ----- */
.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
}

/* ----- Mobile Elements - Hidden on Desktop ----- */
.mobile-menu-header,
.mobile-contact-info {
    display: none;
}

/* ----- Menu Overlay ----- */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed), visibility var(--transition-speed);
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ----- Mobile Styles - Media Query ----- */
@media (max-width: 768px) {
    /* Header container in mobile */
    .site-header .container {
        position: relative;
    }

    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: block;
    }

    /* Mobile Nav Layout */
    .main-nav {
        position: fixed;
        top: 0;
        left: -280px; /* Start off-screen FROM LEFT */
        right: auto; /* Reset right property */
        width: 280px;
        height: 100vh;
        background-color: var(--background-light);
        z-index: 1000;
        overflow-y: auto;
        transition: left var(--transition-speed); /* Change to animate left property */
        padding-top: 60px;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1); /* Change shadow direction */
        display: block; /* Override flex */
    }

    /* Show menu when active */
    .main-nav.active {
        left: 0; /* Slide in FROM LEFT when active */
        right: auto; /* Reset right property */
    }

    /* Mobile Nav Links */
    .main-nav ul {
        flex-direction: column;
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .main-nav li,
    .main-nav li.auth-item {
        margin: 0;
        width: 100%;
    }

    .main-nav a {
        padding: 15px 25px;
        display: block;
        border-bottom: 1px solid var(--border-color);
        font-size: 16px;
        width: 100%;
    }

    .main-nav a:after {
        display: none; /* Remove underline effect */
    }

    /* Show mobile header */
    .mobile-menu-header {
        display: block;
        padding: 15px 25px;
        background-color: var(--primary-color);
        color: white;
        font-size: 18px;
        font-weight: bold;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        text-align: center;
    }

    /* Show mobile contact info */
    .mobile-contact-info {
        display: block;
        padding: 20px 25px;
        border-top: 1px solid var(--border-color);
        margin-top: 20px;
    }

    .mobile-contact-info p {
        margin-bottom: 10px;
        color: var(--text-color);
    }

    .mobile-contact-info a {
        color: var(--primary-color);
        text-decoration: none;
    }
}

/* ----- RTL Support for Hebrew ----- */
html[dir="rtl"] .main-nav {
    left: auto; /* Reset left property */
    right: -280px; /* Start off-screen FROM RIGHT for RTL */
}

/* Add this to your RTL section */
html[dir="rtl"] .main-nav {
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1); /* Shadow on left side for RTL */
}

html[dir="rtl"] .main-nav.active {
    left: auto; /* Reset left property */
    right: 0; /* Slide in FROM RIGHT for RTL */
}

html[dir="rtl"] .mobile-menu-toggle span {
    left: auto;
    right: 0;
}

html[dir="rtl"] .main-nav a:after {
    left: auto;
    right: 0;
}

/* Ensure the container spacing is correct for RTL */
html[dir="rtl"] .main-nav li {
    margin-left: 15px;
    margin-right: 15px;
}

/* Fix alignment of auth elements for RTL */
html[dir="rtl"] #auth-container {
    justify-content: flex-end;
}

/* Prevent page scroll when menu is open */
body.menu-open {
    overflow: hidden;
}