/* =========================================
   NAVBAR STYLES - FIXED
   ========================================= */
.navbar {
    background-color: #ffffff;
    height: 80px; /* Increased height for bigger logo */
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05); /* Softer shadow */
    font-family: 'Inter', sans-serif;
}

.navbar-container {
    max-width: 1400px; /* Wider container for better spacing */
    margin: 0 auto;
    height: 100%;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* --- Brand / Logo (Fixed Size) --- */
.navbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    margin-right: 10px;
}

.brand-logo {
    height: 60px; /* Restored size */
    width: auto;
    max-width: 200px;
    object-fit: contain;
    display: block;
    transition: transform 0.2s ease;
}

.brand-logo:hover {
    transform: scale(1.02);
}

/* --- Central Search Bar (Styled like search.css) --- */
.nav-search {
    flex: 1;
    max-width: 500px; /* Wider search bar */
    margin: 0 20px;
    position: relative; /* Anchor for dropdown */
}

.search-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.nav-search input {
    width: 100%;
    padding: 12px 20px 12px 45px; /* Comfortable padding */
    border: 1px solid #e0e0e0;
    border-radius: 50px; /* Pill shape */
    background: #f9fafb;
    font-size: 0.95rem;
    color: #333;
    transition: all 0.3s ease;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* Focus State - Matches your Green Theme */
.nav-search input:focus {
    background: white;
    border-color: #2e7d32;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.15);
}

.nav-search .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
    transition: color 0.3s;
}

.nav-search input:focus + .search-icon {
    color: #2e7d32;
}

/* --- Autocomplete Dropdown (Hidden by default) --- */
/* This matches the style of #autocomplete-results in search.css */
.nav-search-results {
    position: absolute;
    top: 110%; /* Just below input */
    left: 10px;
    right: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid #f0f0f0;
    list-style: none;
    padding: 0;
    margin: 0;
    z-index: 1001;
    overflow: hidden;
    display: none; /* HTMX will toggle this */
}

/* Only show when it has content */
.nav-search-results:not(:empty) {
    display: block;
}

.nav-search-results li {
    padding: 12px 16px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    transition: background 0.2s;
}

.nav-search-results li:hover {
    background: #f0fdf4; /* Light green hover */
    color: #16a34a;
}

/* --- Navigation Links --- */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 30px;
    white-space: nowrap;
}

.nav-link {
    text-decoration: none;
    color: #4b5563;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    padding: 5px 0;
}

/* Animated Underline */
.nav-menu .nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #2e7d32;
    transition: width 0.3s;
}

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

/* --- Auth Buttons --- */
.auth-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-login {
    background-color: transparent;
    color: #4b5563;
    padding: 9px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-login:hover {
    color: #2e7d32;
    background-color: #f0fdf4;
    transform: translateY(-1px);
}

.btn-primary {
    background-color: #2e7d32;
    color: white;
    padding: 10px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(46, 125, 50, 0.2);
    border: 1px solid transparent;
}

.btn-primary:hover {
    background-color: #1b5e20;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(46, 125, 50, 0.3);
}

/* Mobile Search Bar */
.mobile-search-form {
    display: flex;
    gap: 8px;
    padding-bottom: 20px;
    margin-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.mobile-search-form input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 50px;
    background: #f9fafb;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.mobile-search-form input:focus {
    border-color: #16a34a;
    background: white;
}

.mobile-search-form button {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #16a34a;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.mobile-menu a:not(.btn-primary):not(.btn-login) {
    display: block;
    text-decoration: none;
    color: #1f2937;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 14px 12px;
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s;
}

.mobile-menu a:not(.btn-primary):not(.btn-login):hover {
    background-color: #f0fdf4;
    color: #16a34a;
    padding-left: 18px;
}


.mobile-menu hr {
    border: 0;
    border-top: 1px solid #f0f0f0;
    margin: 10px 0;
}


.mobile-auth-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 5px;
}

.mobile-menu .btn-login,
.mobile-menu .btn-primary {
    display: block;
    text-align: center;
    width: 100%;
    padding: 14px;
    box-sizing: border-box;
}

.nav-search-results.mobile-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1005;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #eee;
    background: white;
    margin-top: 5px;
    border-radius: 8px;
}

/* --- Mobile Search Input Styling --- */
.mobile-input-wrapper input {
    width: 100%;
    padding-right: 35px !important;
}

#mobileClearBtn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    padding: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#mobileClearBtn:hover {
    color: #ef4444;
}

/* --- Scroll Behavior Fixes --- */

body.no-scroll {
    overflow: hidden;
    height: 100vh;
}

/* 2. Allow the menu itself to scroll */

.mobile-menu {
    /* ... existing styles ... */
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 40px;
}

/* --- Nav Actions (Right Side) --- */

.nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Profile Avatar */

.avatar-button img, .avatar-placeholder {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: border-color 0.2s;
}

.avatar-placeholder {
    background: #2e7d32;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.avatar-button:hover img,
.avatar-button:hover .avatar-placeholder {
    border-color: #2e7d32;
}

/* --- Mobile Toggle --- */

.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

/* --- Mobile Menu --- */

.mobile-menu {
    display: none;
    background: white;
    position: absolute;
    top: 80px;
    left: 0;
    width: 100%;
    padding: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    flex-direction: column;
    gap: 15px;
    border-top: 1px solid #f0f0f0;
    box-sizing: border-box;
    z-index: 999;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 40px;
}

.mobile-menu.show {
    display: flex;
}

/* --- Responsive --- */
@media (max-width: 992px) {
    .desktop-only {
        display: none !important;
    }

    .hamburger {
        display: block;
    }

    .navbar-container {
        padding: 0 15px;
    }

    .brand-logo {
        height: 45px;
    }
}

