/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--primary-dark);
}

.brand-icon {
    font-size: 2rem;
    color: var(--primary-color);
}

.brand-logo {
    height: 48px;
    width: auto;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.brand-text .brand-name {
    font-family: var(--font-heading, 'Playfair Display', serif);
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.1;
    display: block;
    color: var(--primary-color);
}

.brand-text .brand-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
}

/* Search Bar */
.search-container {
    position: relative;
    flex: 1;
    max-width: 640px;
    margin: 0 12px;
    display: flex;
    align-items: stretch;
    height: 44px;
}

.search-bar {
    position: relative;
    flex: 1;
    display: flex;
}

.search-bar input {
    width: 100%;
    height: 44px;
    padding: 0 16px 0 44px;
    background: var(--bg-input);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px 0 0 6px;
    border-right: none;
    font-size: 1rem;
    transition: var(--transition-fast);
}

.search-bar input:focus {
    background: var(--bg-card);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 95, 45, 0.1);
}

.search-bar i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-btn {
    height: 44px;
    padding: 0 22px;
    background: var(--gradient-primary);
    background-size: 200% 100%;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 0 6px 6px 0;
    white-space: nowrap;
    transition: all 0.3s ease;
    border: none;
}

.search-btn:hover {
    background-position: 100% 0;
    box-shadow: 0 4px 12px rgba(44, 95, 45, 0.3);
}

.search-close-btn {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 1.15rem;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

/* Nav Actions */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    color: var(--text-main);
    font-size: 1.2rem;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--bg-input);
    color: var(--primary-color);
}

.badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    height: 20px;
    min-width: 20px;
    padding: 0 6px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* User Menu Dropdown */
.user-menu {
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1001;
    overflow: hidden;
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.15s ease;
}

.dropdown-item:hover {
    background: var(--bg-input);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.dropdown-item:hover i {
    color: var(--primary-color);
}

.dropdown-item.logout {
    color: var(--danger);
}

.dropdown-item.logout i {
    color: var(--danger);
}

.dropdown-divider {
    height: 1px;
    background: var(--bg-input);
    margin: 4px 0;
}

/* Navbar Bottom (Categories) */
.navbar-bottom {
    position: relative;
    /* Part of scrollable content */
    margin-top: var(--header-height);
    /* Offset for fixed navbar */
    width: 100%;
    height: var(--subheader-height);
    background: white;
    border-bottom: 1px solid #e8e8e8;
    z-index: 998;
    display: flex;
    align-items: center;
}

.category-menu {
    display: flex;
    list-style: none;
    gap: 32px;
    margin: 0;
    padding: 0;
    height: 100%;
    flex-shrink: 0;
}

.menu-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.menu-link {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
    height: 100%;
}

.menu-link:hover {
    color: var(--primary-color);
}

.menu-link i.fa-chevron-down {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.menu-item:hover .menu-link i.fa-chevron-down {
    transform: rotate(180deg);
}

.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-radius: 0 0 12px 12px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    border-top: 2px solid var(--primary-color);
}

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

.dropdown-content a {
    display: block;
    padding: 10px 20px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.dropdown-content a:hover {
    background: var(--bg-input);
    color: var(--primary-color);
}

/* Hero */
.hero {
    padding: 60px 0 40px;
    text-align: center;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Footer */
.footer {
    margin-top: 80px;
    padding: 40px 0;
    background: var(--gradient-primary);
    color: white;
    text-align: center;
    font-size: 0.9rem;
}

/* Search icon button - hidden on desktop */
.search-icon-btn {
    display: none;
}

/* Mobile search expansion */
@media (max-width: 900px) {
    .brand {
        transition: all 0.3s ease;
        overflow: hidden;
        flex-shrink: 0;
    }

    /* Constrain logo width on mobile to prevent squeezing nav actions */
    .brand-logo {
        height: 40px;
    }

    .brand-text .brand-name {
        font-size: 1.1rem;
    }

    .brand-text .brand-subtitle {
        font-size: 0.7rem;
    }

    .search-container {
        display: none;
        flex: 1;
        max-width: none;
        margin: 0;
        opacity: 0;
        transform: translateX(-20px);
        transition: all 0.3s ease;
    }

    .search-icon-btn {
        display: flex;
        transition: all 0.3s ease;
    }

    /* Ensure enough space between nav action buttons */
    .nav-actions {
        gap: 2px;
        flex-shrink: 0;
    }

    /* User dropdown on mobile: offset enough to not cover search/icons */
    .user-dropdown {
        top: 100% !important;
        right: 0 !important;
        left: auto !important;
        bottom: auto !important;
        margin-top: 12px !important;
        border-radius: 12px !important;
        min-width: 220px !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
        position: absolute !important;
    }

    .user-dropdown .dropdown-item {
        padding: 16px 20px;
        font-size: 1rem;
    }

    /* When search is expanded */
    .navbar.search-expanded .brand {
        width: 0;
        opacity: 0;
        margin-right: 0;
        pointer-events: none;
    }

    .navbar.search-expanded .search-container {
        display: flex;
        position: absolute;
        left: 12px;
        right: 12px;
        top: 50%;
        z-index: 5;
        opacity: 1;
        transform: translateY(-50%);
    }

    .navbar.search-expanded .search-icon-btn {
        display: none;
    }

    .navbar.search-expanded .search-bar {
        flex: 1;
        min-width: 0;
    }

    .navbar.search-expanded .search-btn {
        flex: 0 0 auto;
        padding: 0 16px;
        white-space: nowrap;
    }
}

@media (max-width: 900px) {
    body.search-overlay-open {
        overflow: hidden;
    }

    body.search-overlay-open .search-container {
        display: flex;
        position: fixed;
        inset: 0;
        height: 100vh;
        height: 100dvh;
        max-width: none;
        margin: 0;
        padding: 14px 12px;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(14px);
        box-shadow: none;
        z-index: 2000;
        align-items: flex-start;
        opacity: 1;
        transform: none;
    }

    body.search-overlay-open .search-bar {
        flex: 1;
        min-width: 0;
    }

    body.search-overlay-open .search-bar input {
        border-radius: 999px 0 0 999px;
        background: var(--bg-card);
    }

    body.search-overlay-open .search-btn {
        height: 44px;
        padding: 0 14px;
        border-radius: 0 999px 999px 0;
    }

    body.search-overlay-open .search-close-btn {
        display: inline-flex;
        flex: 0 0 44px;
        margin-left: 8px;
    }
}

@media (max-width: 480px) {
    .brand-text .brand-name {
        font-size: 1rem;
    }

    .brand-text .brand-subtitle {
        font-size: 0.7rem;
    }

    .brand-logo {
        height: 36px;
    }

    /* Even smaller gap to prevent overlap */
    .nav-actions {
        gap: 0;
    }
}
