/* Live Search: theme tokens are used when defined, fallbacks keep the module portable */
.live-search {
    --ls-text: var(--primary-black, #081222);
    --ls-muted: var(--gray-60, #7b7d83);
    --ls-border: var(--gray-10, #e7e7e7);
    --ls-hover: var(--primary-light-gray, #f7f7f7);
    --ls-bg: var(--primary-white, #fff);
    --ls-thumb: var(--gray-20, #f9f9f9);
    --ls-accent: var(--red, #ff2f2f);
    --ls-focus: var(--primary-blue, #394f9a);

    position: absolute;
    top: calc(100% + .25rem);
    left: 0;
    right: 0;
    z-index: 1000;
    display: none;
    overflow: hidden;
    color: var(--ls-text);
    font-family: inherit;
    text-align: left;
    background: var(--ls-bg);
    border: 1px solid var(--ls-border);
    border-radius: .5rem;
    box-shadow: 0 12px 24px rgba(8, 18, 34, .12);
}

.live-search.is-open {
    display: block;
}

.live-search-list {
    max-height: min(60vh, 24rem);
    margin: 0;
    padding: .25rem 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
    transition: opacity .2s ease-in-out;
}

.live-search.is-loading .live-search-list {
    opacity: .5;
}

.live-search-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem .75rem;
    color: inherit;
    text-decoration: none;
    transition: background-color .2s ease-in-out;
}

.live-search-item:hover,
.live-search-item:focus {
    color: inherit;
    text-decoration: none;
    background: var(--ls-hover);
    outline: none;
}

.live-search-item:focus-visible,
.live-search-all:focus-visible {
    box-shadow: inset 0 0 0 2px var(--ls-focus);
}

.live-search-image {
    display: flex;
    flex: 0 0 3rem;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    overflow: hidden;
    background: var(--ls-thumb);
    border-radius: .25rem;
}

.live-search-image img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.live-search-name {
    display: -webkit-box;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    font-size: .875rem;
    line-height: 1.3;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.live-search-price {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-end;
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
}

.live-search-price-old {
    font-size: .75rem;
    font-weight: 400;
    color: var(--ls-muted);
    text-decoration: line-through;
}

.live-search-price-new {
    color: var(--ls-accent);
}

.live-search-empty,
.live-search-loading {
    display: flex;
    justify-content: center;
    padding: 1rem .75rem;
    font-size: .875rem;
    color: var(--ls-muted);
}

.live-search-spinner {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--ls-border);
    border-top-color: var(--ls-text);
    border-radius: 50%;
    animation: live-search-spin .7s linear infinite;
}

.live-search-all {
    display: block;
    padding: .75rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--ls-text);
    text-align: center;
    text-decoration: none;
    border-top: 1px solid var(--ls-border);
    transition: background-color .2s ease-in-out;
}

.live-search-all:hover,
.live-search-all:focus {
    color: var(--ls-text);
    text-decoration: none;
    background: var(--ls-hover);
    outline: none;
}

@keyframes live-search-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .live-search-spinner {
        animation-duration: 2s;
    }
}
