/* CentralHeat_Search - autocomplete dropdown and search-page extras.
   Colours are custom properties so a theme can restyle without overriding rules. */
:root {
    --ch-ac-bg: #fff;
    --ch-ac-text: #1f2933;
    --ch-ac-muted: #6b7280;
    --ch-ac-border: #d9dee3;
    --ch-ac-hover: #f3f6f9;
    --ch-ac-accent: #c8102e;
    --ch-ac-mark: #fff3bf;
}

/* Magento's native suggestion list is replaced by this dropdown. */
.ch-autocomplete-on #search_autocomplete {
    display: none !important;
}

.ch-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    margin-top: 4px;
    max-height: min(70vh, 560px);
    min-width: 280px;
    overflow-y: auto;
    background: var(--ch-ac-bg);
    color: var(--ch-ac-text);
    border: 1px solid var(--ch-ac-border);
    border-radius: 6px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .16);
    font-size: 14px;
    line-height: 1.35;
    text-align: left;
}

.ch-autocomplete[hidden] {
    display: none;
}

.ch-autocomplete--loading {
    opacity: .7;
}

.ch-autocomplete__section + .ch-autocomplete__section {
    border-top: 1px solid var(--ch-ac-border);
}

.ch-autocomplete__heading {
    padding: 10px 14px 4px;
    color: var(--ch-ac-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.ch-autocomplete__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    color: inherit;
    text-decoration: none;
}

.ch-autocomplete__item:hover,
.ch-autocomplete__item:focus,
.ch-autocomplete__item.is-active {
    background: var(--ch-ac-hover);
    color: inherit;
    text-decoration: none;
    outline: none;
}

.ch-autocomplete__image {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    object-fit: contain;
    background: #fff;
    border-radius: 4px;
}

.ch-autocomplete__text {
    flex: 1 1 auto;
    min-width: 0;
}

.ch-autocomplete__title {
    display: block;
    overflow-wrap: anywhere;
}

.ch-autocomplete__sku {
    display: block;
    color: var(--ch-ac-muted);
    font-size: 12px;
}

.ch-autocomplete__price {
    flex: 0 0 auto;
    font-weight: 700;
    white-space: nowrap;
}

.ch-autocomplete mark {
    padding: 0;
    background: var(--ch-ac-mark);
    color: inherit;
    font-weight: 600;
}

.ch-autocomplete__all {
    justify-content: center;
    border-top: 1px solid var(--ch-ac-border);
    color: var(--ch-ac-accent);
    font-weight: 600;
}

.ch-autocomplete__empty {
    padding: 14px;
    color: var(--ch-ac-muted);
}

/* Search results page */
.ch-search-notice {
    margin-bottom: 16px;
}

.ch-search-related {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 32px;
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid var(--ch-ac-border);
    border-radius: 6px;
}

.ch-search-related__title {
    display: block;
    margin-bottom: 6px;
}

.ch-search-related__list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ch-search-related__list li {
    margin: 0;
}

@media (max-width: 767px) {
    .ch-autocomplete {
        position: fixed;
        top: auto;
        left: 8px;
        right: 8px;
        max-height: 60vh;
    }
}
