/* AMDV 2026-11-15: подсказки в строке поиска и крестик «Очистить» (includes/search-suggest.php, assets/search-suggest.js). */

/* Свой крестик вместо встроенного в браузер (он не везде есть и выглядит по-разному). */
input.amdv-suggest-input::-webkit-search-cancel-button,
input.amdv-suggest-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

/* Крестик — span с role="button" (у тегов button в полях поиска свои правила шапки и главной). Место по горизонтали
   и вертикали ставит скрипт: внутри поля справа, перед кнопкой поиска. */
form .amdv-search-clear {
    position: absolute !important;
    top: 50%;
    right: 52px;
    z-index: 2;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    line-height: 1;
    transform: translateY(-50%);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .15s ease, color .15s ease;
}

form .amdv-search-clear[hidden] {
    display: none !important;
}

form .amdv-search-clear:hover {
    background: #eef2f7;
    color: #0f172a;
}

form .amdv-search-clear:focus-visible {
    outline: 2px solid rgba(37, 99, 235, .45);
    outline-offset: 1px;
}

form .amdv-search-clear svg {
    display: block;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

/* Список подсказок. */
.amdv-suggest {
    position: fixed;
    z-index: 100000;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .16), 0 2px 6px rgba(15, 23, 42, .06);
    color: #0f172a;
    font-size: 13px;
    line-height: 1.3;
    text-align: left;
}

.amdv-suggest[hidden] {
    display: none !important;
}

.amdv-suggest-title {
    padding: 8px 14px 4px;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.amdv-suggest a.amdv-suggest-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    color: #0f172a;
    text-decoration: none;
    outline: none;
}

.amdv-suggest a.amdv-suggest-item:hover,
.amdv-suggest a.amdv-suggest-item:focus {
    text-decoration: none;
    outline: none;
}

.amdv-suggest a.amdv-suggest-item.is-active {
    background: #f1f6ff;
}

.amdv-suggest.is-loading a.amdv-suggest-item {
    opacity: .55;
}

.amdv-suggest a.amdv-suggest-product {
    grid-template-columns: 40px minmax(0, 1fr) auto;
}

.amdv-suggest-pic {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid #edf1f6;
    border-radius: 8px;
    background: #f8fafc;
    color: #2563eb;
    font-size: 18px;
}

.amdv-suggest-pic img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.amdv-suggest-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.amdv-suggest-name {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.amdv-suggest-name b {
    color: #1d4ed8;
    font-weight: 800;
}

.amdv-suggest-sub {
    overflow: hidden;
    color: #64748b;
    font-size: 11.5px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.amdv-suggest-count {
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f5fb;
    color: #475569;
    font-size: 11.5px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.amdv-suggest-price {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.amdv-suggest a.is-out .amdv-suggest-price {
    color: #94a3b8;
}

.amdv-suggest a.amdv-suggest-all {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid #eef2f7;
    color: #1d4ed8;
    font-weight: 750;
}

.amdv-suggest-empty {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 14px;
    color: #64748b;
}

.amdv-suggest-empty strong {
    color: #0f172a;
    font-weight: 750;
}

.amdv-suggest-loading {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 14px;
    color: #64748b;
}

.amdv-suggest-spinner {
    width: 14px;
    height: 14px;
    box-sizing: border-box;
    border: 2px solid #cbd5e1;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: amdv-suggest-spin .8s linear infinite;
}

@keyframes amdv-suggest-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .amdv-suggest-spinner {
        animation: none;
    }
}

@media (max-width: 600px) {
    .amdv-suggest a.amdv-suggest-item {
        gap: 10px;
        padding: 9px 12px;
    }

    .amdv-suggest-title {
        padding-right: 12px;
        padding-left: 12px;
    }
}
