/* Modern Menu Styles - Enhanced Version */
:root {
    /* These variables will be overridden by inline styles in the template */
    --primary-color: #0e8040; /* Default menu background color */
    --primary-dark: #0a6030; /* Default hover background color */
    --primary-light: #4caf50;
    --accent-color: #ed2024; /* Default red line color */
    --text-light: #FFFFFF; /* Default menu text color */
    --text-dark: #333333;
    --bg-light: #F5F5F5;
    --bg-white: #FFFFFF;
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
    --border-radius: 4px;
    --menu-height: 45px; /* Default menu height - can be overridden in the template */

    /* Submenu variables */
    --submenu-bg: #0e8040; /* Default submenu background color */
    --submenu-hover-bg: #0a6030; /* Default submenu hover background color */
    --submenu-text: #FFFFFF; /* Default submenu text color */
    --submenu-hover-text: #FFFFFF; /* Default submenu hover text color */
}

/* Header and Navigation Container */
header {
    background-color: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 999;
}

.main-nav {
    background-color: var(--primary-color);
    position: sticky;
    top: 0;
    z-index: 1001; /* Higher than header */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    border-bottom: 2px solid var(--accent-color); /* Red line under menu */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: var(--menu-height);
    display: flex;
    align-items: center;
}

/* Override for search results page */
.search-container .main-nav {
    border-bottom: none !important;
}

/* Main Navigation List */
.nav-list {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    flex: 1;
    height: 100%;
}

/* Main Nav Container */
.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Search Icon Container - Integrated with menu */
.search-container {
    display: flex;
    align-items: center;
    height: 100%;
}

.search-icon {
    color: var(--text-light);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 20px;
    height: 100%;
    transition: all var(--transition-speed);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Search menu item - positioned absolutely to the right */
.search-menu-item {
    position: absolute;
    right: 15px;
    top: 0;
    height: var(--menu-height);
    display: flex;
    align-items: center;
}

.search-menu-item a {
    height: var(--menu-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    color: var(--text-light);
    text-decoration: none;
    transition: background-color var(--transition-speed);
}

.search-menu-item a i {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.search-menu-item a:hover {
    background-color: var(--primary-dark);
}

/* Search Modal - Full screen with animation */
.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(5px);
}

.search-modal.active {
    display: flex;
    opacity: 1;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.search-popup-content {
    width: 95%;
    max-width: 1200px;
    position: relative;
    padding: 20px;
}

.search-form {
    width: 100%;
    position: relative;
}

.search-input-container {
    position: relative;
    display: flex;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

.search-input {
    width: 100%;
    padding: 20px 70px 20px 30px;
    font-size: 1.3rem;
    border: none;
    background-color: var(--bg-white);
    transition: all 0.3s ease;
    outline: none;
    border-radius: 8px 0 0 8px;
    min-width: 300px;
}

.search-input:focus {
    box-shadow: 0 0 0 2px var(--primary-color);
}

.search-submit {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 70px;
    background-color: var(--primary-color);
    border: none;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 8px 8px 0;
}

.search-submit:hover {
    background-color: var(--primary-dark);
}

.search-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #FFFFFF;
    font-size: 1.5rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 10px;
    border-radius: 50%;
    transition: all var(--transition-speed);
    z-index: 2001;
}

.search-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* Main Menu Items */
.nav-item {
    position: relative;
    transition: background-color var(--transition-speed);
}

.nav-item > a {
    display: flex;
    align-items: center;
    color: var(--text-light);
    text-decoration: none;
    padding: 0 20px;
    height: var(--menu-height);
    font-weight: 500;
    transition: all var(--transition-speed);
    position: relative;
}

.nav-item > a i {
    margin-right: 8px;
    font-size: 1.1em;
}

.nav-item:hover > a,
.nav-item:focus-within > a {
    background-color: var(--primary-dark);
}

/* Indicator for items with submenu - handled in the template */
.has-submenu > a .submenu-indicator {
    margin-left: 8px;
    font-weight: bold;
    transition: transform var(--transition-speed);
}

/* Override any other submenu indicators */
.has-submenu > a::after {
    content: none !important;
}

.has-submenu:hover > a .submenu-indicator,
.has-submenu:focus-within > a .submenu-indicator {
    transform: rotate(45deg);
}

/* Submenu Styles - Enhanced with animations */
.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--submenu-bg, var(--primary-color));
    min-width: 250px;
    box-shadow: var(--shadow-lg);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 100;
    list-style: none;
    padding: 8px 0;
    border-top: 2px solid var(--accent-color);
    pointer-events: none; /* Prevent interaction when hidden */
}

.nav-item:hover > .submenu,
.nav-item:focus-within > .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto; /* Enable interaction when visible */
}

.submenu li {
    position: relative;
}

.submenu li a {
    display: flex;
    align-items: center;
    color: var(--submenu-text, var(--text-light));
    padding: 12px 20px;
    text-decoration: none;
    transition: all var(--transition-speed);
    font-size: 0.95em;
}

.submenu li a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
    color: var(--primary-color);
}

.submenu li a:hover,
.submenu li a:focus {
    background-color: var(--submenu-hover-bg, var(--primary-dark));
    color: var(--submenu-hover-text, var(--text-light));
    padding-left: 25px;
}

/* Active state */
.nav-item.active > a {
    background-color: var(--primary-dark);
}

.submenu li.active > a {
    background-color: rgba(0, 0, 0, 0.05);
    font-weight: 600;
    color: var(--primary-color);
}

/* Mobile Menu Toggle and Close Button */
.menu-toggle, .mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px 15px;
    align-items: center;
    justify-content: center;
}

.mobile-menu-close {
    display: none;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1002;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 8px;
    line-height: 1;
}

/* Smart Sticky Behavior */
.main-nav.sticky-active {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.main-nav.hide-on-scroll {
    transform: translateY(-100%);
}

/* Separator between menu items */
.nav-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background-color: rgba(255, 255, 255, 0.2);
}

/* Responsive Styles - Enhanced for better mobile experience */
@media (max-width: 992px) {
    /* Hide the green bar on mobile */
    .main-menu {
        background-color: transparent !important;
        height: 0 !important;
        border: none !important;
    }

    /* Hide the menu container by default */
    .main-menu .container {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh !important;
        background-color: #0e8040 !important; /* Force green color */
        z-index: 2000;
        overflow-y: auto;
        padding-top: 50px; /* Space for close button */
    }

    /* Show it when active */
    .main-menu.active .container {
        display: block;
        animation: fadeIn 0.3s ease;
    }

    /* Hide close button by default on mobile */
    .mobile-menu-close {
        display: none !important;
    }

    /* Close button styling - only visible when menu is open */
    .main-menu.active .mobile-menu-close {
        display: block !important;
        position: fixed;
        top: 15px;
        right: 15px;
        left: auto;
        font-size: 24px;
        color: var(--text-light);
        z-index: 2001;
        background: rgba(0,0,0,0.1);
        width: 40px;
        height: 40px;
        border-radius: 50%;
        text-align: center;
        line-height: 40px;
    }

    .nav-list {
        flex-direction: column;
        height: auto !important;
        padding-bottom: 50px;
    }

    .nav-item {
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .nav-item > a {
        padding: 15px 20px;
        height: auto !important;
        font-size: 1.1rem;
        justify-content: center;
    }

    /* Ensure submenu works in full screen mode */
    .submenu {
        position: static;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        background-color: rgba(0,0,0,0.1);
        text-align: center;
    }

    .submenu li a {
        padding: 12px 20px;
        justify-content: center;
    }

    /* Expand submenu when active/hovered */
    .nav-item.active > .submenu,
    .nav-item:hover > .submenu, 
    .has-submenu.active > .submenu {
        max-height: 1000px;
    }

    /* Center language switcher on mobile */
    .language-switcher-item {
        margin-left: 0 !important;
        justify-content: center;
        display: flex;
        width: 100%;
    }

    .lang-dropdown {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .lang-dropdown .dropbtn {
        width: 100%;
        justify-content: center;
    }

    .lang-dropdown .dropdown-content {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        text-align: center;
    }
}
