/*
 * Milkyshisha SmartSearch 1.0.0 — dropdown styles.
 *
 * Scoped to #search.ms-search and our own .ms-smartsearch* classes. The only
 * change to an existing element is position:relative on the search container,
 * which does not affect layout and is required for the absolute dropdown.
 */

#search.ms-search {
    position: relative;
}

.ms-smartsearch {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 120;
    color: #222;
    font-size: 14px;
    line-height: 1.35;
}

.ms-smartsearch[hidden],
.ms-smartsearch [hidden] {
    display: none !important;
}

.ms-smartsearch__panel {
    overflow: hidden auto;
    max-height: min(70vh, 520px);
    background: #fff;
    border: 1px solid #e2e5e9;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.ms-smartsearch__status {
    padding: 12px 14px;
    color: #6b7280;
    font-size: 13px;
    text-align: center;
}

.ms-smartsearch__status:empty {
    display: none;
}

.ms-smartsearch__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ms-smartsearch__item {
    border-top: 1px solid #eef0f2;
}

.ms-smartsearch__item:first-child {
    border-top: 0;
}

.ms-smartsearch__item.is-active,
.ms-smartsearch__item:hover {
    background: #f3f6f9;
}

.ms-smartsearch__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: inherit;
    text-decoration: none;
    outline: none;
}

.ms-smartsearch__item.is-active .ms-smartsearch__link {
    box-shadow: inset 3px 0 0 var(--ms-accent, #d7263d);
}

.ms-smartsearch__thumb {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    overflow: hidden;
    border: 1px solid #eef0f2;
    border-radius: 6px;
    background: #f5f6f7;
}

.ms-smartsearch__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

.ms-smartsearch__body {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.ms-smartsearch__name {
    display: -webkit-box;
    overflow: hidden;
    color: #1f2328;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.ms-smartsearch__name mark {
    padding: 0;
    background: #fff1a8;
    color: inherit;
    font-weight: 700;
}

.ms-smartsearch__brand {
    overflow: hidden;
    color: #77808a;
    font-size: 12px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ms-smartsearch__price {
    flex: 0 0 auto;
    text-align: right;
    white-space: nowrap;
}

.ms-smartsearch__current-price {
    display: block;
    color: #1f2328;
    font-size: 14px;
    font-weight: 700;
}

.ms-smartsearch__old-price {
    display: block;
    color: #9aa1a9;
    font-size: 11px;
    font-weight: 400;
    text-decoration: line-through;
}

.ms-smartsearch__all {
    display: block;
    padding: 11px 14px;
    border-top: 1px solid #eef0f2;
    background: #fafbfc;
    color: var(--ms-accent, #d7263d);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.ms-smartsearch__all:hover,
.ms-smartsearch__all:focus {
    background: #f1f3f5;
    color: var(--ms-accent, #d7263d);
}

.ms-smartsearch__all:focus-visible,
.ms-smartsearch__link:focus-visible {
    outline: 2px solid var(--ms-accent, #d7263d);
    outline-offset: -2px;
}

@media (max-width: 767px) {
    .ms-smartsearch {
        top: calc(100% + 4px);
        font-size: 13px;
    }

    .ms-smartsearch__panel {
        max-height: 62vh;
    }

    .ms-smartsearch__link {
        gap: 9px;
        padding: 8px 10px;
    }

    .ms-smartsearch__thumb {
        flex-basis: 42px;
        width: 42px;
        height: 42px;
    }

    .ms-smartsearch__name,
    .ms-smartsearch__current-price {
        font-size: 13px;
    }

    .ms-smartsearch__brand {
        font-size: 11px;
    }

    .ms-smartsearch__status,
    .ms-smartsearch__all {
        padding: 10px 12px;
    }
}

@media (max-width: 380px) {
    .ms-smartsearch__thumb {
        flex-basis: 38px;
        width: 38px;
        height: 38px;
    }

    .ms-smartsearch__link {
        gap: 8px;
        padding: 7px 8px;
    }

    .ms-smartsearch__name {
        -webkit-line-clamp: 3;
    }

    .ms-smartsearch__old-price {
        font-size: 10px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .ms-smartsearch__item,
    .ms-smartsearch__all {
        transition: background-color .12s ease;
    }
}
