/* Navigation */
.navbar {
    background: var(--dark-green);
    will-change: box-shadow, background-color;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    direction: rtl;
    border-bottom: 2px solid var(--primary-green);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-direction: row; /* use LTR flex ordering for predictable placement while page remains RTL */
}

/* ensure nav menu items align to the right and center visually */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 28px;
    flex-direction: row; /* menu items laid out visually left-to-right (logo stays on the right due to RTL page direction) */
    align-items: center;
    justify-content: center;
    text-align: right;
}

/* place action buttons to the left visually but maintain rtl flow */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    order: 1;
}

/* Add: new class to hide mobile-only button on desktop */
.nav-menu-action {
    display: none;
}

/* make logo always stick to the far right in RTL */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-green);
    flex-direction: row; /* keep icon then text visually (icon at left of logo block) */
    order: 0;
}

/* Add: larger standalone logo treatment */
.logo-image-wrapper.logo-large {
    width: 110px;
    height: 38px;
    border-radius: 6px;
    overflow: visible;
    box-shadow: none;
    border: none;
    background: transparent;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* hide the decorative orbit rings */
.logo-orbit { display: none; }

/* Remove dependence on logo text for spacing when collapsed */
.logo-text { display: none; }

.brand-name {
    font-size: 24px;
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.brand-tagline {
    font-size: 11px;
    color: var(--gray-300);
    font-weight: 400;
}

.nav-menu a {
    text-decoration: none;
    color: var(--gray-100);
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    right: 0;
    width: 0;
    height: 2px;
    background: var(--accent-green);
    transition: width 0.3s ease;
}

.nav-menu a:hover {
    color: var(--accent-green);
}

.nav-menu a:hover::after {
    width: 100%;
}

.search-container {
    display: flex;
    align-items: center;
    background: var(--gray-100);
    border-radius: 24px;
    padding: 8px 16px;
    transition: all 0.3s ease;
    flex-direction: row-reverse;
}

.search-container:focus-within {
    background: var(--white);
    box-shadow: var(--shadow);
}

.search-input {
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    width: 200px;
    color: var(--gray-900);
    text-align: right;
}

.search-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    padding: 4px;
    transition: color 0.3s ease;
}

.search-btn:hover {
    color: var(--primary-green);
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background: var(--white);
    transition: all 0.3s ease;
}

.dropdown {
    position: relative;
}

/* Dropdown Toggle Styling */
.dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: center; /* Default center align for desktop */
    gap: 8px; /* Space between text and icon */
}

.dropdown-icon {
    transition: transform 0.3s ease;
}

/* Desktop Hover Icon Rotation */
.dropdown:hover .dropdown-icon {
    transform: rotate(180deg);
}

/* Add: new class to hide mobile-only button on desktop */
.nav-menu-action {
    display: none;
}

.lang-switcher {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    border-radius: 12px;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    list-style: none;
    padding: 8px;
    margin-top: 8px;
    z-index: 1000;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(45,122,62,0.12);
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* JS controlled visibility for touch/click (works on desktop too) */
.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown.active .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu a {
    display: inline-flex;
    padding: 0;
    background: transparent;
}

.dropdown-menu a .menu-btn-label {
    background: var(--primary-green);
    color: var(--white);
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(45,122,62,0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.dropdown-menu a:hover .menu-btn-label {
    background: var(--secondary-green);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(45,122,62,0.22);
}

.dropdown:hover > a.nav-link-products,
.navbar.scrolled .nav-menu a[href="products.html"] {
    background: var(--white);
    color: var(--dark-green);
    padding: 10px 16px;
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.18);
    border: 1px solid rgba(45,122,62,0.20);
}

.navbar.highlight-products .nav-menu a.nav-link-products {
    background: var(--white);
    color: var(--dark-green);
    padding: 10px 16px;
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.18);
    border: 1px solid rgba(45,122,62,0.20);
}

/* Add: navbar scrolled state */
.navbar.scrolled {
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    transition: box-shadow 0.25s ease, background 0.25s ease;
}

.navbar.scrolled .nav-menu a[href="products.html"] {
    background: var(--white);
    color: var(--dark-green);
    padding: 8px 14px;
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.navbar.scrolled .nav-menu a[href="products.html"]::after {
    display: none;
}

@media (max-width: 992px) {
    .nav-container {
        gap: 16px;
    }
    .nav-menu {
        gap: 18px; /* Reduce gap on tablet screens */
    }
    .nav-actions .btn {
        padding: 8px 18px; /* Slightly smaller button on tablets */
        font-size: 15px;
    }
}

@media (max-width: 768px) {
    .nav-actions {
        display: none;
    }

    /* Navigation/Header Overrides */
    .mobile-menu-btn {
        display: flex;
    }

    .nav-menu {
        position: fixed; /* Use fixed positioning for full-screen overlay */
        top: 78px; /* Position below navbar */
        right: 0;
        left: 0;
        height: calc(100vh - 78px); /* Full viewport height minus navbar */
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        flex-direction: column;
        padding: 32px;
        gap: 12px;
        box-shadow: var(--shadow-lg);
        transform: translateY(-105%); /* Move completely off-screen */
        opacity: 0;
        pointer-events: none;
        transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.4s ease;
        overflow-y: auto; /* Allow scrolling if content overflows */
    }

    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }

    /* Add: Style nav links to look like buttons on mobile */
    .nav-menu li a {
        display: block;
        padding: 12px;
        text-align: center;
        background: var(--light-green);
        color: var(--dark-green);
        border-radius: 12px;
        font-weight: 600;
        font-size: 15px;
        transition: background 0.2s ease, transform 0.2s ease;
    }

    .nav-menu li a:hover,
    .nav-menu li a:focus {
        background: var(--primary-green);
        color: var(--white);
        transform: scale(1.03);
    }
    
    /* Remove text decoration from mobile links */
    .nav-menu a, .nav-menu a:hover {
        color: var(--dark-green);
    }

    /* NEW: Add language switcher to mobile menu */
    .nav-actions .lang-switcher {
        display: none; /* Hide desktop switcher */
    }

    .nav-menu::after { /* Add a pseudo-element to push switcher to bottom */
        content: '';
        flex-grow: 1;
    }

    .nav-menu-lang-switcher-mobile {
        display: block;
        margin-top: auto; /* Pushes to the bottom */
        padding-top: 20px;
        width: 100%;
        border-top: 1px solid var(--gray-200);
    }

    .nav-menu-lang-switcher-mobile .lang-switcher {
        width: 100%;
        justify-content: center;
        background: var(--dark-green);
        color: var(--white);
    }

    .nav-menu a:hover {
        color: var(--white);
    }

    .nav-menu a::after {
        display: none;
    }

    /* Override mobile dropdown styling */
    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0;
        margin-top: 0; 
        /* Start hidden on mobile */
        opacity: 0;
        visibility: hidden;
        max-height: 0; /* Use max-height for transitions */
        overflow: hidden;
        transition: opacity 0.3s ease, max-height 0.3s ease, margin-top 0.3s ease;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .dropdown.active .dropdown-menu {
        opacity: 1;
        visibility: visible;
        max-height: 500px; /* Sufficiently large value for content */
        margin-top: 12px;
    }
    
    /* Ensure the link that acts as a toggle looks good and is justified */
    .dropdown > .dropdown-toggle {
        justify-content: space-between;
        padding-right: 20px;
        padding-left: 20px;
    }
    
    .dropdown-menu a .menu-btn-label {
        width: 100%;
        text-align: center;
    }

    /* Add: Show the action button in the mobile menu */
    .nav-menu-action {
        display: none; /* Hide the standalone "Browse Products" button on mobile */
    }

    .nav-menu-action .btn {
        width: 100%;
        justify-content: center;
    }

    .search-container {
        display: none;
    }

    .brand-name {
        font-size: 20px;
    }

    .brand-tagline {
        font-size: 10px;
    }
}

.logo-image-wrapper img {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    vertical-align: middle;
    image-rendering: auto;
    pointer-events: none;
}