/* ─── Navbar Wrapper ──────────────────────────────────────────── */
#main-header {
    position: absolute;
    width: 100%;
    z-index: 999;
}
#main-header.sticky-scrolled {
    position: fixed;
    background: rgba(255, 255, 255, 0.48);
    z-index: 999;
    backdrop-filter: blur(17.9px);
    -webkit-backdrop-filter: blur(17.9px);
    width: 100%;
}

.navbar-wrap {
    width: 100%;
}

.navbar {
    display: grid;
    grid-template-columns: auto 2fr auto;
    align-items: center;
    padding: 30px 24px;
    gap: 20px;
}

/* ─── Logo ────────────────────────────────────────────────────── */
.logo img {
    width: 250px;
    position: relative;
    display: block;
}

/* ─── Center Nav Links ────────────────────────────────────────── */
.nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    list-style: none;
    gap: 45px;
}

.nav-links li {
    position: relative;
}

.nav-links a,
.nav-links button.nav-btn,
.nav-right .nav-links span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 13px;
    font-size: clamp(1.7rem, 2vw, 2.4rem);
    font-weight: 500;
    color: var(--text-color);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-family);
    position: relative;
    transition:
        color 0.2s,
        background 0.2s;
    white-space: nowrap;
}

/* Animated underline */
.nav-links a::after,
.nav-links button.nav-btn::after {
    content: "";
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0%;
    height: 2px;
    background: var(--black);
    border-radius: 2px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-links a:hover,
.nav-links button.nav-btn:hover {
    color: var(--black);
    background: rgba(90, 122, 74, 0.07);
}
.nav-links a:hover::after,
.nav-links button.nav-btn:hover::after {
    width: 70%;
}

.nav-links a.active,
.nav-links button.nav-btn.active {
    border-color: var(--black);
}
.nav-links a.active::after,
.nav-links button.nav-btn.active::after {
    width: 80%;
}

/* ─── Right Side Icons ────────────────────────────────────────── */
.nav-right {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-shrink: 0;
    justify-content: center;
}

.search-container {
    position: relative;
}

.search-dropdown {
    position: absolute;
    top: 50px;
    right: -10px;
    width: 300px;
    background: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 15px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: 0.3s ease;
    z-index: 100;
}

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

/* Update wrapper to relative for absolute positioning of the button */
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper input {
    width: 100%;
    padding: 10px;
    padding-right: 35px; /* Added right padding so text doesn't hide behind the button */
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1.4rem;
    outline: none;
}

/* Styles for the new close button */
.close-search-btn {
    position: absolute;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.close-search-btn:hover {
    color: #000;
}

.search-results {
    margin-top: 15px;
}

.search-results li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.search-results li:last-child {
    border-bottom: none;
}

.search-results a {
    font-size: 1.5rem;
    color: #555;
    display: block;
}

.search-results a:hover {
    color: #000;
    padding-left: 5px;
    transition: 0.2s;
}

.search-results .search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 4px;
}

.search-results .search-result-item:hover {
    padding-left: 8px;
}

.search-result-item img {
    width: 38px;
    height: 38px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: #f5f5f5;
}

.search-result-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.search-result-name {
    font-size: 1.4rem;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-price {
    font-size: 1.3rem;
    color: var(--text-color, #666);
}

.search-results .search-empty {
    font-size: 1.4rem;
    color: #999;
    text-align: center;
    padding: 10px 4px;
}

.search-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

.search-footer a {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-color, #3f4929);
}

/* Icon buttons */
.icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-color);
    transition:
        background 0.2s,
        color 0.2s;
}
.icon-btn:hover {
    background: rgba(90, 122, 74, 0.1);
    color: var(--black);
}
.icon-btn svg {
    width: clamp(2.4rem, 3vw, 3.8rem);
    height: clamp(2.4rem, 3vw, 3.8rem);
}

.icon-btn .badge {
    position: absolute;
    top: -5px;
    right: -6px;
    min-width: 22px;
    height: 22px;
    background: var(--black);
    color: var(--white);
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    border: 1.5px solid var(--white);
}

/* ─── Mobile Hamburger ────────────────────────────────────────── */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s;
}
.hamburger:hover {
    background: rgba(90, 122, 74, 0.1);
}
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-color);
    border-radius: 2px;
    transition:
        transform 0.3s,
        opacity 0.3s;
    transform-origin: center;
}
.hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ─── Mobile Drawer ───────────────────────────────────────────── */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 300;
    opacity: 0;
    visibility: hidden;
    height: 100vh;
    transition:
        opacity 0.3s,
        visibility 0.3s;
}
.drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.drawer {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 300px;
    max-width: 85vw;
    background: var(--body-bg);
    z-index: 400;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}
.drawer.open {
    transform: translateX(0);
}

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--black);
    line-height: 1;
    padding: 4px 6px;
    border-radius: 6px;
    transition:
        background 0.2s,
        color 0.2s;
}
.drawer-close:hover {
    background: var(--bg-transparent);
    color: var(--black);
}

.drawer-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px;
}
.drawer-nav ul {
    list-style: none;
}

.drawer-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    font-family: var(--font-family);
    transition:
        background 0.2s,
        color 0.2s;
    text-align: left;
}
.drawer-nav a:hover {
    background: rgba(90, 122, 74, 0.08);
    color: var(--black);
}
.drawer-nav a.active {
    color: var(--black);
    font-weight: 600;
}

.drawer-foot {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    justify-content: space-around;
}
.drawer-foot .icon-btn {
    flex-direction: column;
    gap: 2px;
    width: auto;
    height: auto;
    padding: 6px 10px;
    border-radius: 8px;
}
.drawer-foot .icon-btn span {
    font-size: 0.65rem;
    color: var(--bg-muted);
}

/* ─── Responsive ──────────────────────────────────────────────── */
@media screen and (max-width: 1030px) {
    .nav-links {
        gap: 15px;
    }
}

@media (max-width: 992px) {
    .nav-links {
        display: none;
    }
    .Wishlist-desktop,
    .search-wrap {
        display: none;
    }
    .hide-sm {
        display: none !important;
    }
    .navbar {
        grid-template-columns: auto 1fr auto;
    }
}

@media (max-width: 576px) {
    .search-dropdown {
        width: 280px;
        right: -34px;
    }
    .navbar {
        padding: 0 5px;
    }
}

.drawer-foot .icon-btn span.badge {
    color: var(--white);
}

/* Container */
.profile-dropdown-container {
    position: relative;
    display: inline-block;
}

/* Reset button styling */
.profile-dropdown-container .icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}

/* Profile initials badge */
.profile-initials-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color, #3f4929);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.profile-dropdown-container .icon-btn:hover .profile-initials-badge {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(63, 73, 41, 0.3);
}

/* The dropdown menu */
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: #ffffff;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border-radius: 8px;
    border: 1px solid #eee;
    margin-top: 12px; /* Increased margin to fit the arrow */
}

/* THE TOP NOTCH ARROW */
.dropdown-menu::before {
    content: "";
    position: absolute;
    top: -7px; /* Pulls the arrow above the menu box */
    right: 12px; /* Aligns arrow under the center of the profile icon */
    width: 12px;
    height: 12px;
    background-color: #ffffff;
    border-left: 1px solid #eee;
    border-top: 1px solid #eee;
    transform: rotate(
        45deg
    ); /* Rotates a square to make it look like a triangle */
}

/* Show class for JS */
.dropdown-menu.show {
    display: block;
}

/* Styling the links (Flexbox for Icon + Text alignment) */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between the SVG icon and the text */
    color: #333333;
    padding: 12px 16px;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

/* Keep rounded corners on hover since overflow:hidden was removed */
.dropdown-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}
.dropdown-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
}

.dropdown-menu form {
    margin: 0;
}

.dropdown-menu .dropdown-item-logout {
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-family);
    text-align: left;
    color: #c0392b;
}

/* == bottom  naviagtion */
.bottom-nav-wrap {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 100;
}

.bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--white);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-card-hover);
    padding: 10px 8px;
}

.bottom-nav__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 4px;
    font-family: var(--font-family);
    color: var(--secondary-color);
    -webkit-tap-highlight-color: transparent;
}

/* Menu button + its popup share one relative wrapper so the popup
     always anchors to this exact button, no matter where it sits in the bar */
.bottom-nav__menu-wrap {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: center;
}

.bottom-nav__icon-wrap {
    position: relative;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-pill);
    transition: background var(--transition-base);
}

.bottom-nav__icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottom-nav__icon svg {
    width: 100%;
    height: 100%;
    stroke: var(--text-color);
    fill: none;
    stroke-width: 1.6;
    transition:
        stroke var(--transition-base),
        fill var(--transition-base);
}

.bottom-nav__label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-color);
    line-height: 1;
    transition: color var(--transition-base);
}

/* Badge — always pinned to the top-right corner of the icon-wrap, same rule for every item that has one */
.bottom-nav__badge {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 22px;
    height: 22px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    background: var(--color-accent-icon);
    color: var(--white);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid var(--white);
    z-index: 1;
}

.bottom-nav__item.is-active .bottom-nav__icon-wrap {
    background: var(--active-tint);
}

.bottom-nav__item.is-active .bottom-nav__icon svg {
    stroke: var(--primary-color);
}

.bottom-nav__item.is-active .bottom-nav__label {
    color: var(--primary-color);
}

/* ===== Menu Popup ===== */
/* Anchored to .bottom-nav__menu-wrap, so it is always centred exactly
     above the Menu button regardless of its position in the bar or screen width */
.nav-popup {
    position: absolute;
    bottom: calc(100% + 18px);
    left: 50%;
    transform: translateX(-50%) translateY(8px) scale(0.97);
    width: 200px;
    max-width: 60vw;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card-hover);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform-origin: bottom center;
    transition:
        opacity var(--transition-base),
        transform var(--transition-base),
        visibility var(--transition-base);
    display: none;
}

.nav-popup::after {
    content: "";
    position: absolute;
    bottom: -7px;
    left: 50%;
    width: 14px;
    height: 14px;
    background: var(--white);
    transform: translateX(-50%) rotate(45deg);
    border-radius: 3px;
}

.nav-popup.is-open {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

.nav-popup__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 10px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    -webkit-tap-highlight-color: transparent;
}

.nav-popup__item:hover {
    background: var(--bg-color);
}

/* ===== Responsive ===== */

/* Small phones: edge-to-edge pill (default above) */

/* Larger phones / small tablets: keep it from stretching too wide, centre it */
@media (min-width: 480px) {
    .bottom-nav-wrap {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: 100%;
        max-width: 420px;
    }
}

/* Tablet: a bit roomier, slightly larger touch targets */
@media (min-width: 768px) and (max-width: 992px) {
    .bottom-nav-wrap {
        max-width: 460px;
        bottom: 24px;
    }

    .bottom-nav {
        padding: 12px 14px;
    }

    .bottom-nav__icon-wrap {
        width: 38px;
        height: 38px;
    }

    .bottom-nav__icon {
        width: 24px;
        height: 24px;
    }

    .bottom-nav__label {
        font-size: 12.5px;
    }

    .nav-popup {
        width: 220px;
    }
}

/* Only show up to 992px; hide above it */
@media (min-width: 992px) {
    .bottom-nav-wrap {
        display: none;
    }
}

.bottom-nav-wrap {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    bottom: 16px !important;
    transform: translateX(-50%) !important;
    width: 90% !important; /* shrink to the pill's real size, not full width */
    margin: 0 !important;
    pointer-events: none;
}

.bottom-nav,
.nav-popup {
    pointer-events: auto;
}

.bottom-nav__item.is-active .bottom-nav__icon-wrap {
    background: var(--active-tint);
}

.bottom-nav__item.is-active .bottom-nav__icon svg {
    stroke: var(--primary-color);
}

.bottom-nav__item.is-active .bottom-nav__label {
    color: var(--primary-color);
}

.nav-popup__item.is-active {
    background: var(--active-tint);
    color: var(--primary-color);
}
