.search-panel {
    display: none;
    position: fixed;
    top: 78px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
}

.search-results-bar {
    padding: 2.5rem 2rem 0;
    max-width: 112rem;
    margin: 0 auto;
    text-align: center;
}

.search-results-bar .search-results-title {
    font-family: var(--font-serif);
    font-size: clamp(1.9rem, 2.6vw, 2.6rem);
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--color-ink);
    margin: 0 0 0.5rem;
}

.search-results-count {
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--color-ink);
    margin: 0 0 1.5rem;
    text-align: center;
}

.search-panel.open {
    display: block;
}

.search-panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}

.search-panel-inner {
    position: relative;
    z-index: 1;
    background: var(--color-white);
    border-bottom: 1px solid rgba(var(--emerald-rgb), 0.1);
    padding-inline: 3rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.07);
    max-height: calc(100vh - 78px - 5rem);
    overflow-y: auto;
}

.search-panel-form {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 1.25rem;
    padding-block: 1.5rem;
}

.search-panel-icon {
    color: var(--emerald);
    width: 22px;
    height: 22px;
}

.search-panel-input {
    border: none;
    outline: none;
    font-family: var(--font-body);
    font-size: 1.15rem;
    color: var(--color-ink);
    background: transparent;
    padding: 0;
    width: 100%;
}

.search-panel-input::placeholder {
    color: var(--color-text-muted);
}

.search-panel-input::-webkit-search-cancel-button,
.search-panel-input::-webkit-search-decoration {
    display: none;
}

.search-panel-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0.3rem;
    display: flex;
    align-items: center;
    transition: color 0.18s ease;
}

.search-panel-close:hover {
    color: var(--emerald);
}

.search-suggestions {
    padding-bottom: 1.25rem;
}

.search-suggest-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.search-suggest-item {
    display: block;
    text-decoration: none;
    border-radius: 0;
    overflow: hidden;
    background: var(--color-white);
    border: 1px solid rgba(var(--emerald-rgb), 0.1);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.search-suggest-item:hover {
    border-color: rgba(var(--emerald-rgb), 0.34);
    box-shadow: 0 10px 24px rgba(var(--emerald-rgb), 0.1);
    transform: translateY(-2px);
}

.search-suggest-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    background: rgba(var(--beige-light-rgb), 0.65);
    overflow: hidden;
}

/* the image is sized by ratio here, so the quick add button is measured up
   from the fixed-height info block instead of down from the image */
.search-suggest-info {
    height: 4.4rem;
    box-sizing: border-box;
}

.search-suggest-grid .quick-add-btn {
    top: auto;
    bottom: 5.1rem;
}

.search-suggest-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.45s ease;
}

.search-suggest-img--primary {
    opacity: 1;
    z-index: 1;
}

.search-suggest-img--hover {
    opacity: 0;
    z-index: 2;
}

.search-suggest-item:hover .search-suggest-img-wrap.has-hover-image .search-suggest-img--primary {
    opacity: 0;
}

.search-suggest-item:hover .search-suggest-img-wrap.has-hover-image .search-suggest-img--hover {
    opacity: 1;
}

.search-suggest-img--empty {
    width: 100%;
    height: 100%;
    background: rgba(var(--beige-light-rgb), 0.75);
}

.search-suggest-img-wrap .product-card-badges {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    pointer-events: none;
}

.search-suggest-img-wrap .product-badge {
    display: block;
    text-align: center;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.18rem 0.5rem;
    border-radius: 0;
    background: rgba(250, 248, 245, 0.96);
}

.search-suggest-img-wrap .product-badge--featured {
    color: var(--emerald);
}

.search-suggest-img-wrap .product-badge--bestsales {
    color: #9a7520;
}

.search-suggest-info {
    padding: 0.6rem 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.search-suggest-name {
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: var(--color-headings);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-suggest-price {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--emerald);
}

.search-no-results {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    padding: 0.5rem 0;
    margin: 0;
}

.search-view-all {
    display: block;
    text-align: center;
    padding: 0.75rem;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--emerald);
    border-top: 1px solid rgba(var(--emerald-rgb), 0.12);
    text-decoration: none;
    transition: background 0.15s ease;
    border-radius: 0 0 6px 6px;
}

.search-view-all:hover {
    background: rgba(var(--emerald-rgb), 0.07);
    color: var(--emerald);
}

@media (max-width: 768px) {
    .search-panel { top: 72px; }

    .search-suggest-grid {
        grid: auto / auto-flow 36vw;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        gap: 0.5rem;
    }

    .search-suggest-grid .quick-add-btn {
        bottom: 4.9rem;
    }

    .search-suggest-grid .product-card-link {
        scroll-snap-align: start;
        min-width: 0;
    }
}
