/* --- Navbar Styles --- */

/* Main Header Container */
.header-wrapper {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: box-shadow 0.3s ease;
}

.header-wrapper.scrolled {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* Shared width with main content containers */
.header-content-width {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Utility Row Above Navbar */
.utility-bar {
    max-height: 34px;
    display: flex;
    align-items: center;
    background: #f3f3f3;
    overflow: hidden;
    opacity: 1;
    transition: max-height 0.24s ease, opacity 0.2s ease, border-color 0.2s ease;
}

.utility-bar-inner {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.utility-links {
    display: flex;
    align-items: center;
    gap: 18px;
}

.utility-link,
.utility-phone,
.utility-email {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-decoration: none;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: color 0.18s ease;
}

.utility-contact {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.utility-link:hover,
.utility-phone:hover,
.utility-email:hover {
    color: #334155;
    text-decoration: none;
}

/* Top Blue Bar */
.top-bar {
    background-color: #3467ce;
    color: white;
}

.top-bar-inner {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* LEFT SECTION: Logo & Nav */
.left-section {
    display: flex;
    align-items: center;
    gap: 25px;
    flex-shrink: 0;
}

/* Logo Styling */
.logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-right: 10px;
    text-decoration: none;
    color: white;
}

.logo-image {
    width: 30px;
    height: 30px;
    object-fit: contain;
    border-radius: 6px;
    padding: 2px;
}

.logo-text {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
}

.logo-com {
    background-color: white;
    color: #3467ce;
    font-size: 13px;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 4px;
    margin-left: 2px;
    position: relative;
    bottom: 3px;
}

/* Nav Items */
.header-wrapper .nav-item {
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    transition: opacity 0.2s;
}

.header-wrapper .nav-item.nav-item-btn {
    border: none;
    background: transparent;
    padding: 0;
    font-family: inherit;
}

.header-wrapper .nav-item:hover {
    opacity: 0.85;
}

.header-wrapper .nav-item i {
    font-size: 18px;
}

/* MIDDLE SECTION: Search Bar */
.search-container {
    flex-grow: 1;
    max-width: 800px;
    margin: 0 40px;
    position: relative;
}

.search-form {
    width: 100%;
}

.search-wrapper {
    width: 100%;
    background: white;
    border: 2px solid transparent;
    border-radius: 50px;
    display: flex;
    align-items: center;
    padding: 0 5px 0 20px;
    height: 40px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.search-wrapper.search-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.search-wrapper input {
    border: none;
    outline: none;
    flex-grow: 1;
    font-size: 14px;
    color: #333;
    font-family: "Open Sans", sans-serif;
}

.search-wrapper input::placeholder {
    color: #777;
}

.search-btn {
    background: none;
    border: none;
    color: #3467ce;
    font-size: 18px;
    padding: 8px 15px;
    cursor: pointer;
    transition: color 0.2s;
}

.search-btn:hover {
    color: #1e4a9e;
}

.live-search-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #dbe4fb;
    border-radius: 14px;
    box-shadow: 0 16px 34px rgba(8, 24, 68, 0.2);
    overflow: hidden;
    z-index: 1200;
}

.live-search-panel.hidden {
    display: none;
}

.live-search-results {
    max-height: min(70vh, 420px);
    overflow-y: auto;
}

.live-search-item {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
    text-decoration: none;
    color: #111827;
    border-bottom: 1px solid #eef2f8;
    transition: background-color 0.16s ease;
}

.live-search-item:hover {
    background: #f4f8ff;
}

.live-search-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #f2f5fb;
    border: 1px solid #e7eef9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #9aa8c3;
}

.live-search-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.live-search-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.live-search-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-search-meta {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-search-price {
    font-size: 13px;
    font-weight: 700;
    color: #1f3a8a;
    white-space: nowrap;
}

.live-search-all {
    display: block;
    padding: 11px 14px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    color: #2559b9;
    background: #f8fbff;
    border-top: 1px solid #eef2f8;
}

.live-search-all:hover {
    background: #edf4ff;
}

.live-search-empty {
    padding: 14px;
    font-size: 13px;
    color: #4b5563;
}

.live-search-skeleton {
    padding: 8px 0;
}

.live-search-skeleton-item {
    display: grid;
    grid-template-columns: 48px 1fr;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
}

.live-skeleton-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #e8edf7;
}

.live-skeleton-lines {
    display: grid;
    gap: 8px;
}

.live-skeleton-line {
    height: 12px;
    border-radius: 999px;
    background: #e8edf7;
    width: 88%;
}

.live-skeleton-line.short {
    width: 56%;
}

.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
    animation: live-search-shimmer 1.1s infinite;
}

@keyframes live-search-shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* RIGHT SECTION: Account, Cart */
.right-section {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.account-link {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    color: white;
    text-decoration: none;
    transition: opacity 0.2s;
}

.account-link:hover {
    opacity: 0.85;
}

.account-link i {
    font-size: 17px;
}

.account-link span {
    display: inline-block;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-dropdown {
    position: relative;
}

.account-dropdown-trigger {
    background: transparent;
    border: none;
    padding: 0;
    font-family: inherit;
}

.account-caret {
    font-size: 10px;
    margin-left: 1px;
    opacity: 0.9;
}

.account-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 190px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
    display: none;
    overflow: hidden;
    z-index: 1400;
}

.account-dropdown.open .account-dropdown-menu {
    display: block;
}

.account-menu-item {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    display: block;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.account-menu-item:hover {
    background: #f3f6ff;
    color: #1d4ed8;
}

.account-menu-form {
    margin: 0;
}

.account-menu-signout {
    border-top: 1px solid #eef2f7;
}

.vertical-divider {
    width: 1px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.4);
    margin: 0 5px;
}

.cart-link {
    color: white;
    text-decoration: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    transition: opacity 0.2s;
}

.cart-link:hover {
    opacity: 0.85;
}

.cart-icon {
    font-size: 18px;
    cursor: pointer;
}

/* Keep desktop navbar icon/text proportions consistent */
@media (min-width: 901px) {
    .header-wrapper .nav-item {
        font-size: 14px;
        gap: 7px;
        line-height: 1;
    }

    .header-wrapper .nav-item i {
        font-size: 17px;
    }

    .right-section {
        gap: 14px;
    }
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    background-color: #e0245e;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Bottom Light Blue Bar */
.bottom-bar {
    background-color: #e6f3fe;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #222;
    gap: 15px;
    border-bottom: 1px solid #dcebf7;
    overflow: hidden;
    max-height: 40px;
    transition:
        max-height 0.3s ease,
        opacity 0.3s ease;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
}

.mobile-search-overlay {
    display: none;
}

.shop-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1690;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.shop-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.shop-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(390px, 92vw);
    background: #fff;
    z-index: 1700;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 8px 0 24px rgba(2, 6, 23, 0.2);
}

.shop-drawer.open {
    transform: translateX(0);
}

.shop-drawer-header {
    background: #3467ce;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.shop-drawer-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

.shop-drawer-logo-image {
    width: 30px;
    height: 30px;
    object-fit: contain;
    border-radius: 6px;
}

.shop-drawer-close {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 1.1rem;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.shop-drawer-body {
    flex: 1;
    overflow-y: auto;
    background: #fff;
}

.shop-drawer-shop-title {
    background: #1f2b68;
    color: #fff;
    font-size: 1.65rem;
    font-weight: 700;
    padding: 12px 16px;
}

.shop-drawer-section {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.shop-drawer-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #1f2937;
    text-decoration: none;
    font-size: 1.05rem;
    padding: 10px 0;
    line-height: 1.2;
}

.shop-drawer-link i {
    color: #334155;
    font-size: 0.85rem;
}

.shop-drawer-link.shop-drawer-link-primary {
    color: #1d4ed8;
    font-weight: 700;
}

.shop-drawer-link.shop-drawer-link-primary i {
    color: #1d4ed8;
}

.shop-drawer-section-help h4 {
    margin: 0 0 8px;
    color: #1f2937;
    font-size: 1.3rem;
    font-weight: 700;
}

.shop-drawer-link.shop-drawer-link-plain {
    justify-content: flex-start;
    color: #374151;
    font-size: 1.05rem;
}

body.shop-drawer-open {
    overflow: hidden;
}

.header-wrapper.scrolled .utility-bar {
    max-height: 0;
    opacity: 0;
    border-bottom-color: transparent;
    display: none;
}

.header-wrapper.scrolled .bottom-bar {
    max-height: 0;
    opacity: 0;
}

/* Rating Bar */
.rating-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.rating-bar strong {
    color: #111;
}

.rating-bar .stars {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 4px;
}

.rating-bar .stars i {
    color: #f59e0b;
    font-size: 14px;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .utility-bar {
        display: none;
    }

    .logo-text {
        font-size: 24px;
    }

    .header-wrapper .top-bar .nav-item span {
        display: none;
    }

    .search-container {
        margin: 0 15px;
    }

    .account-link span {
        display: none;
    }

    .account-dropdown-menu {
        right: -6px;
    }

    .right-section {
        display: none;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0 !important;
        margin: 0 !important;
        z-index: 1150;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: center;
        min-height: 64px;
        height: calc(64px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: #fff;
        border-top: 1px solid #dbe4ef;
        box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.08);
        transform: translateZ(0);
        transition: transform 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        color: #64748b;
        text-decoration: none;
        min-height: 100%;
        font-size: 11px;
        font-weight: 600;
        position: relative;
        transition: color 0.2s ease;
    }

    .mobile-nav-item.mobile-chat-nav-trigger {
        border: none;
        background: transparent;
        width: 100%;
        font-family: inherit;
        padding: 0;
    }

    .mobile-nav-item i {
        font-size: 18px;
        line-height: 1;
    }

    .mobile-nav-label {
        font-size: 11px;
        line-height: 1.1;
    }

    .mobile-nav-item.active {
        color: #3467ce;
    }

    .mobile-nav-icon-wrap {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-bottom-nav .cart-count {
        top: -9px;
        right: -11px;
    }

    .mobile-chat-unread-badge {
        position: absolute;
        top: -9px;
        right: -11px;
        min-width: 16px;
        height: 16px;
        border-radius: 999px;
        background: #e67e22;
        color: #fff;
        font-size: 9px;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 2px solid #fff;
        padding: 0 4px;
    }

    .mobile-chat-unread-badge[hidden] {
        display: none !important;
    }

    .mobile-search-overlay {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.5);
        z-index: 1600;
        display: none;
    }

    body.mobile-search-active .mobile-search-overlay {
        display: block;
    }

    body.mobile-search-active .header-wrapper {
        z-index: 1650;
    }

    body.mobile-search-active .search-wrapper {
        position: relative;
        z-index: 1655;
        border-color: #3467ce;
        box-shadow: 0 0 0 3px rgba(52, 103, 206, 0.2);
    }

    body.cart-open .mobile-bottom-nav {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(120%);
    }

    body.shop-drawer-open .mobile-bottom-nav {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(120%);
    }
}

@media (max-width: 600px) {
    .header-content-width {
        padding: 0 10px;
    }

    .top-bar-inner {
        height: auto;
        min-height: 60px;
        flex-wrap: wrap;
        gap: 10px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .search-container {
        order: 3;
        flex-basis: 100%;
        margin: 0;
    }

    .live-search-panel {
        border-radius: 12px;
    }

    .left-section {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }

    .logo-container {
        margin-right: 0;
    }

    .header-wrapper .top-bar .nav-item {
        margin-left: auto;
    }

    .right-section {
        gap: 10px;
    }

    .vertical-divider {
        display: none;
    }

    .mobile-bottom-nav {
        min-height: 62px;
        height: calc(62px + env(safe-area-inset-bottom));
    }
}
