.nes-search {
    position: relative;
    width: 100%;
    max-width: 100%;
    z-index: 10;
    font: inherit;
}

.nes-search *,
.nes-search *::before,
.nes-search *::after,
.nes-search__panel *,
.nes-search__panel *::before,
.nes-search__panel *::after {
    box-sizing: border-box;
}

.nes-search__form {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0;
}

.nes-search__input {
    width: 100%;
    min-width: 0;
    height: 38px;
    padding: 7px 42px 7px 12px;
    border: 1px solid #d10a4b;
    border-radius: 8px;
    background: #fff;
    color: #222;
    font: inherit;
    line-height: 1.2;
    outline: none;
}

.nes-search__input:focus {
    border-color: #ba0743;
    box-shadow: 0 0 0 2px rgba(186, 7, 67, .13);
}

.nes-search__button {
    position: absolute;
    right: 0;
    top: 0;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: #ba0743;
    font-size: 20px;
    cursor: pointer;
}

.nes-search__spinner {
    position: absolute;
    right: 42px;
    top: 50%;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border: 2px solid rgba(186, 7, 67, .2);
    border-top-color: #ba0743;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

.nes-search.is-loading .nes-search__spinner {
    opacity: 1;
    animation: nes-search-spin .65s linear infinite;
}

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

.nes-search__panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: min(520px, 92vw);
    max-height: min(620px, 75vh);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 36px rgba(0, 0, 0, .18);
    z-index: 10050;
}

.nes-search__panel[hidden] {
    display: none !important;
}

.nes-search__section + .nes-search__section {
    border-top: 1px solid #ececec;
}

.nes-search__section-title {
    padding: 11px 12px 7px;
    color: #333;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.nes-search__section-items {
    display: block;
}

.nes-search__item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    color: inherit;
    text-decoration: none;
    background: #fff;
}

.nes-search__item:hover,
.nes-search__item:focus {
    background: #faf4f6;
    color: inherit;
    text-decoration: none;
    outline: none;
}

.nes-search__thumb {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid #ececec;
    border-radius: 7px;
    background: #fff;
}

.nes-search__thumb img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.nes-search__badge {
    flex: 0 0 auto;
    margin-top: 2px;
    padding: 3px 7px;
    border-radius: 999px;
    background: #f6e6ec;
    color: #9d123f;
    font-size: 10px;
    font-weight: 700;
}

.nes-search__content {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.nes-search__title,
.nes-search__summary,
.nes-search__price {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: normal;
}

.nes-search__title {
    color: #ba0743;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.nes-search__summary {
    color: #555;
    font-size: 11px;
    line-height: 1.35;
}

.nes-search__price {
    color: #ba0743;
    font-size: 12px;
    font-weight: 800;
}

.nes-search mark,
.nes-search__panel mark {
    padding: 0;
    background: transparent;
    color: #d10a4b;
    font-weight: 800;
}

.nes-search__message {
    padding: 16px 14px;
    color: #555;
    font-size: 13px;
}

.nes-search__message--error {
    color: #9c1b1b;
}

.nes-search__sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}


/* En móvil el desplegable permanece dentro del off-canvas y entra en el flujo.
   Así no puede salirse, quedar recortado ni provocar reposicionamientos continuos. */
@media (max-width: 767.98px) {
    .nes-search {
        z-index: auto;
    }

    .nes-search__panel {
        position: static;
        top: auto;
        right: auto;
        left: auto;
        width: 100%;
        max-width: 100%;
        max-height: min(58vh, 520px);
        margin-top: 6px;
        border-radius: 7px;
        transform: none;
    }

    .nes-search__section-title {
        padding: 9px 10px 6px;
        font-size: 10px;
    }

    .nes-search__item {
        gap: 8px;
        padding: 9px 10px;
    }

    .nes-search__thumb {
        flex-basis: 44px;
        width: 44px;
        height: 44px;
    }

    .nes-search__title {
        font-size: 12px;
    }

    .nes-search__summary {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 10.5px;
    }
}
