/* =========================================================
   Teddy Baba— HEADER (strip + sticky bar + category chips)
   Mobile-first fixes:
   - category chips can always be scrolled to the first chip
   - slide-down menu is anchored directly under the top bar
   - nothing overflows on 320–480px phones
   - inputs are 16px on phones so iOS does not zoom the page
   ========================================================= */

/* ---------- Announcement strip ---------- */
.tb-strip {
    background: var(--secondary);
    color: #E2E8F0;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}
.tb-strip-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    min-height: 36px;
    flex-wrap: wrap;
}
.tb-strip i { color: #FDBA74; margin-right: 6px; }
.tb-strip a { color: #fff; font-weight: 600; }
.tb-strip a:hover { color: #FDBA74; }
.tb-strip-sep { width: 1px; height: 12px; background: rgba(255,255,255,.25); }

/* ---------- Sticky header ---------- */
.tb-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.05);
}
/* the bar's container is the anchor for the mobile slide-down menu */
.tb-header > .container { position: relative; }
.tb-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 72px;
}

/* ---------- Brand ---------- */
.tb-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-width: 0;
}
.tb-brand-mark {  height: 100px; display: block; flex-shrink: 0; }
.tb-brand-text {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--secondary);
    white-space: nowrap;
}
.tb-brand-text em { font-style: normal; color: var(--primary); }

/* ---------- Links ---------- */
.tb-nav-wrap { flex: 1; display: flex; justify-content: center; }
.tb-links { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tb-links a {
    position: relative;
    display: inline-block;
    padding: 10px 16px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    border-radius: 999px;
    transition: var(--transition);
}
.tb-links a:hover { background: var(--primary-light); color: var(--primary-dark); }
.tb-links a.active { background: var(--secondary); color: #fff; }
.tb-mobile-only { display: none; }

/* ---------- Actions ---------- */
.tb-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tb-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.tb-icon-btn:hover { background: var(--primary-light); color: var(--primary-dark); }
.tb-account-name { font-size: 0.85rem; }
.tb-cart { background: var(--secondary); color: #fff; }
.tb-cart:hover { background: var(--primary); color: #fff; }
.tb-cart .cart-badge {
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    box-sizing: content-box;
    font-size: 0.62rem;
}
.tb-burger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--secondary);
    font-size: 1.05rem;
    cursor: pointer;
}

/* cart badge (shared with JS-created badges) */
.cart-badge {
    position: absolute;
    top: 0;
    right: 4px;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
}

/* ---------- Search drawer ---------- */
.mobile-search-bar { display: none; background: #fff; border-top: 1px solid var(--border-light); padding: 12px 0; }
.mobile-search-bar.show { display: block; animation: acDrop .2s ease; }
.mobile-search-bar .container { position: relative; }
.mobile-search-bar form { position: relative; display: flex; align-items: center; max-width: 720px; margin: 0 auto; }
.mobile-search-bar form > i { position: absolute; left: 16px; color: #738078; pointer-events: none; }
.mobile-search-bar input {
    width: 100%;
    height: 46px;
    padding: 0 46px 0 44px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-light);
    font-size: 0.92rem;
    color: var(--secondary);
}
.mobile-search-bar input:focus {
    outline: none;
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.12);
}
.mobile-search-close {
    position: absolute;
    right: 6px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #738078;
    cursor: pointer;
}
.mobile-search-close:hover { background: var(--primary-light); color: var(--primary); }
.mobile-search-bar .search-suggestions {
    left: 50%;
    right: auto;
    width: min(720px, calc(100% - 32px));
    transform: translateX(-50%);
    top: calc(100% - 4px);
}

/* ---------- Category chips ----------
   One scrollable row.  The row is left-aligned (NOT justify-content:center)
   so the first chip is never cut off; the auto margins on the first and
   last item centre the row only when every chip fits on screen. */
.tb-cats { border-top: 1px solid var(--border-light); background: var(--bg-light); }
.tb-cats-list {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 10px 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
}
.tb-cats-list::-webkit-scrollbar { display: none; }
.tb-cats-list > li { flex: 0 0 auto; scroll-snap-align: start; }
.tb-cats-list > li:first-child { margin-left: auto; }
.tb-cats-list > li:last-child  { margin-right: auto; }
.tb-cats-list a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    transition: var(--transition);
}
.tb-cats-list a i { color: var(--primary); font-size: 0.78rem; }
.tb-cats-list a:hover { border-color: var(--primary); color: var(--primary-dark); transform: translateY(-1px); }
.tb-cats-list a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tb-cats-list a.active i { color: #fff; }

@keyframes acDrop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Tablet / mobile ---------- */
@media (max-width: 900px) {
    .tb-bar { min-height: 64px; gap: 10px; }
    .tb-brand-mark {  height: 50px; }
    .tb-brand-text { font-size: 1.05rem; }
    .tb-burger { display: inline-flex; }
    .tb-account-name, .tb-hide-sm { display: none; }
    .tb-strip-inner > span:nth-of-type(n+3), .tb-strip-sep:nth-of-type(n+2) { display: none; }

    /* slide-down menu: sits right under the top bar, full screen width */
    .tb-nav-wrap { position: absolute; top: 100%; left: 0; right: 0; display: block; }
    .tb-nav {
        display: none;
        background: #fff;
        border-top: 1px solid var(--border-light);
        box-shadow: 0 18px 30px rgba(15,23,42,.12);
        max-height: calc(100vh - 130px);
        max-height: calc(100dvh - 130px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .tb-nav.show { display: block; animation: acDrop .2s ease; }
    .tb-links { flex-direction: column; align-items: stretch; gap: 0; padding: 8px 16px 14px; }
    .tb-links a {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 48px;
        padding: 14px 8px;
        border-radius: 0;
        border-bottom: 1px solid var(--border-light);
    }
    .tb-links a.active { background: var(--primary-light); color: var(--primary-dark); }
    .tb-links a i { color: var(--primary); width: 18px; }
    .tb-mobile-only { display: block; }

    /* category chips: edge-to-edge swipe row, compact so the sticky header stays short */
    .tb-cats > .container { padding-left: 0; padding-right: 0; }
    .tb-cats-list { gap: 7px; padding: 8px 15px; scroll-padding-left: 15px; }
    .tb-cats-list > li:first-child { margin-left: 0; }
    .tb-cats-list > li:last-child  { margin-right: 0; }
    .tb-cats-list a { padding: 7px 13px; font-size: 0.78rem; min-height: 34px; }

    /* search drawer */
    .mobile-search-bar { padding: 10px 0; }
    .mobile-search-bar input { font-size: 16px; }   /* >=16px stops iOS zoom-on-focus */
    .mobile-search-bar .search-suggestions { max-height: 60vh; max-height: 60dvh; }
}

@media (max-width: 640px) {
    .tb-strip { font-size: 0.72rem; }
    .tb-strip-inner { gap: 10px; min-height: 32px; padding-top: 4px; padding-bottom: 4px; text-align: center; }
    .tb-strip i { margin-right: 4px; }
}

@media (max-width: 480px) {
    .tb-bar { min-height: 58px; gap: 8px; }
    .tb-brand { gap: 8px; }
    .tb-brand-mark {  height: 50px; }
    .tb-brand-text { font-size: 0.95rem; letter-spacing: 0.05em; }
    .tb-actions { gap: 2px; }
    .tb-icon-btn { min-width: 40px; height: 40px; padding: 0 9px; }
    .tb-burger { width: 40px; height: 40px; }
    .tb-nav { max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); }
}

/* very small phones: the account link already lives inside the menu */
@media (max-width: 400px) {
    .tb-account { display: none; }
    .tb-brand-text { font-size: 0.9rem; letter-spacing: 0.04em; }
    .tb-strip { font-size: 0.68rem; }
}

@media (max-width: 340px) {
    .tb-brand-text { display: none; }   /* logo mark only on 320px devices */
}

@media (prefers-reduced-motion: reduce) {
    .tb-nav.show, .mobile-search-bar.show { animation: none; }
}

/* ---------- Search suggestions (shared) ---------- */

/* =========================================================
   SEARCH SUGGESTIONS (shared by desktop + mobile)
   ========================================================= */
.search-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 1200;
    max-height: 420px;
    overflow-y: auto;
    padding: 7px;
    background: #ffffff;
    border: 1px solid #F1F5F9;
    border-radius: 16px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14);
}

.search-suggestions[hidden] { display: none; }

.search-suggestion {
    width: 100%;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #0F172A;
    text-align: left;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}

.search-suggestion:hover,
.search-suggestion.is-active { background: #F8FAFC; }
.search-suggestion:hover { transform: translateX(2px); }

.search-suggestion-thumb {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 9px;
    background: #F8FAFC;
    color: var(--primary);
}

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

.search-suggestion-main { min-width: 0; }

.search-suggestion-name {
    display: block;
    color: #0F172A;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-suggestion-category {
    display: block;
    margin-top: 2px;
    color: #7b8780;
    font-size: 0.75rem;
}

.search-suggestion-price {
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 800;
    white-space: nowrap;
}

.search-empty {
    padding: 16px 14px;
    color: #758078;
    font-size: 0.88rem;
}