/* =============================================================
   product_search.css — Makeup Artist Pro
   Product search typeahead component (shared by browse + category)
   ============================================================= */

/* Shared product-media tokens — keep identical to products_browse.css,
   product_category.css, brand.css and product_compare.css. */
:root {
    --prod-media-ratio: 1 / 1;
    --prod-media-pad: 8%;
    --prod-media-bg: #ffffff;
}

/* Allow the search dropdown to extend past hero containers that clip overflow. */
.pb-hero,
.pc-hero {
    overflow: visible !important;
}

.pb-search {
    position: relative;
    max-width: 440px;
    margin: 1.5rem auto 0;
    z-index: 1000;
    font-family: 'Outfit', sans-serif;
}

/* Ensure hero containers stack above the page sections below
   (product cards create their own stacking context via transform/box-shadow). */
.pb-hero,
.pc-hero {
    position: relative;
    z-index: 100;
}

.pb-search__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.pb-search__icon {
    position: absolute;
    left: 0.95rem;
    width: 15px;
    height: 15px;
    color: #b88a8a;
    pointer-events: none;
    flex-shrink: 0;
}

.pb-search__input {
    width: 100%;
    padding: 0.7rem 2.25rem 0.7rem 2.4rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 400;
    color: #550000;
    background: #ffffff;
    border: 1px solid #f0d4d4;
    border-radius: 999px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pb-search__input::placeholder {
    color: #c9a8a8;
    font-weight: 400;
}

.pb-search__input:focus {
    border-color: #d4a8a8;
    box-shadow: 0 2px 12px rgba(85, 0, 0, 0.06);
}

.pb-search__clear {
    position: absolute;
    right: 0.6rem;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #c9a8a8;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    line-height: 1;
    transition: color 0.15s;
}

.pb-search__clear:hover {
    color: #550000;
}

/* ---------- Results dropdown ---------- */
.pb-search__results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1001;
    background: #ffffff;
    border: 1px solid #f0d4d4;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(85, 0, 0, 0.08);
    /* Exactly 6 full result rows visible, no partial 7th row — each
       .pb-search__item is 52px (36px square thumb + 1rem vertical padding),
       plus this container's own 0.25rem top+bottom padding: 6*52 + 8 = 320px.
       Past 6, the list scrolls (overflow below) rather than growing further.
       min() still shrinks it further on short viewports. */
    max-height: min(320px, 48vh);
    overflow: hidden auto;
    overscroll-behavior: contain;
    padding: 0.25rem 0;
}

.pb-search__empty {
    padding: 1rem;
    text-align: center;
    font-size: 0.82rem;
    color: #a07878;
}

.pb-search__item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.85rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s ease;
}

.pb-search__item:hover,
.pb-search__item--active {
    background: #fdf5f5;
}

/* Same square box + contain as the product cards. Padding is in px here,
   not --prod-media-pad: percentage padding resolves against the flex row
   width, which would blow a 36px thumb up to ~66px. */
.pb-search__item-img {
    display: block;
    width: 36px;
    aspect-ratio: var(--prod-media-ratio);
    height: auto;
    border-radius: 6px;
    object-fit: contain;
    padding: 3px;
    box-sizing: border-box;
    background: var(--prod-media-bg);
    flex-shrink: 0;
}

.pb-search__item-img--empty {
    display: block;
    background: #fdeeee;
}

.pb-search__item-text {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
    flex: 1;
}

.pb-search__item-brand {
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: #a07878;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pb-search__item-name {
    font-size: 0.86rem;
    font-weight: 500;
    color: #2a2a2a;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pb-search__item-meta {
    font-size: 0.72rem;
    font-weight: 400;
    color: #8a4444;
    margin-left: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.pb-search__item mark {
    background: transparent;
    color: inherit;
    font-weight: 600;
    padding: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .pb-search {
        max-width: 100%;
    }

    .pb-search__input {
        font-size: 0.86rem;
    }

    .pb-search__results {
        max-height: min(320px, 42vh);
    }
}
