/**
 * ACENOR SEARCH — Estilos del buscador predictivo
 */

.acenor-search {
    position: relative;
    width: 100%;
    min-width: 260px;
}

/* Cuando el buscador vive dentro de un mega-menu-item (Max Mega Menu),
   forzar que el <li> se expanda y ocupe el ancho disponible. */
.mega-menu > li.mega-menu-item:has(> .acenor-search),
#mega-menu-secondary > li:has(> .acenor-search) {
    flex: 1 1 auto !important;
    min-width: 280px;
}

/* Dentro del <li>, el buscador ocupa 80% y queda centrado */
.mega-menu-item > .acenor-search {
    width: 80%;
    max-width: 600px;
    min-width: 260px;
    margin-left: auto;
    margin-right: auto;
    display: block;
}

.acenor-search__form {
    position: relative;
    margin: 0;
}

.acenor-search__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.acenor-search__icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
    z-index: 2;
    width: 20px;
    height: 20px;
}

.acenor-search__input {
    width: 100%;
    height: 48px;
    padding: 0.75rem 3rem 0.75rem 3rem;
    border: 1px solid #ced4da;
    border-radius: 50rem;
    background: #fff;
    font-size: 1rem;
    line-height: 1.5;
    color: #212529;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.acenor-search__input:focus {
    outline: none;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* Ocultar la X nativa del browser en input[type=search] (tenemos botón custom) */
.acenor-search__input::-webkit-search-cancel-button,
.acenor-search__input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}
.acenor-search__input::-ms-clear {
    display: none;
    width: 0;
    height: 0;
}

.acenor-search__clear {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    line-height: 1;
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    z-index: 2;
}
.acenor-search__clear:hover { color: #dc3545; background: #f1f3f5; }

.acenor-search__spinner {
    position: absolute;
    right: 48px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #dee2e6;
    border-top-color: #0d6efd;
    border-radius: 50%;
    animation: acenor-search-spin 0.7s linear infinite;
    z-index: 2;
}
@keyframes acenor-search-spin { to { transform: translateY(-50%) rotate(360deg); } }

/* === Dropdown === */
.acenor-search__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    max-height: 70vh;
    overflow-y: auto;
    z-index: 9999;
}

.acenor-search__empty {
    padding: 1rem 1.25rem;
    color: #6c757d;
    font-size: 0.9rem;
    text-align: center;
}

.acenor-search__group + .acenor-search__group {
    border-top: 1px solid #f1f3f5;
}

.acenor-search__group-title {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    background: #f8f9fa;
}

.acenor-search__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.acenor-search__item {
    border-bottom: 1px solid #f8f9fa;
}
.acenor-search__item:last-child { border-bottom: none; }

.acenor-search__item.is-focused,
.acenor-search__item:hover {
    background: #f1f3f5;
}

.acenor-search__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    text-decoration: none;
    color: #212529;
}

.acenor-search__link--cat,
.acenor-search__link--page {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.acenor-search__thumb {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 4px;
    background: #f8f9fa;
    flex-shrink: 0;
}

.acenor-search__thumb--placeholder {
    background: #e9ecef;
    display: inline-block;
}

.acenor-search__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.acenor-search__title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #212529;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.acenor-search__sku {
    font-size: 0.75rem;
    color: #6c757d;
}

.acenor-search__count {
    font-size: 0.8rem;
    color: #6c757d;
    margin-left: 0.4rem;
}

.acenor-search__title mark {
    background: #fff3cd;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

.acenor-search__footer {
    padding: 0.6rem 0.75rem;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #f1f3f5;
}

.acenor-search__see-all {
    color: #0d6efd;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}
.acenor-search__see-all:hover { text-decoration: underline; }

/* Mobile */
@media (max-width: 576px) {
    .acenor-search__dropdown {
        max-height: 60vh;
    }
    .acenor-search__thumb {
        width: 36px;
        height: 36px;
    }
}


/* ============================================================
   RESULTS PAGE — Página de resultados de búsqueda (/?s=...)
   ============================================================ */

/* Header estilizado */
.acenor-search-results-header {
    min-height: 175px;
}
@media (min-width: 768px) {
    .acenor-search-results-header {
        min-height: 240px;
    }
}

/* Secciones de resultados */
.acenor-results-section {
    scroll-margin-top: 80px;
}
.acenor-results-section__title {
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

/* Chips de categorías relacionadas */
.acenor-results-cats-chips .badge {
    font-size: 0.85rem;
    font-weight: 500;
    transition: background-color 0.15s;
}
.acenor-results-cats-chips .badge:hover {
    background-color: #0b5ed7 !important;
}

/* Cards de "Otros resultados" (páginas, servicios) */
.acenor-results-other-item {
    border: 1px solid #dee2e6 !important;
    border-radius: 0.5rem !important;
    margin-bottom: 0.5rem;
    padding: 0.85rem 1rem;
    transition: background-color 0.15s, box-shadow 0.15s;
}
.acenor-results-other-item:hover {
    background-color: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.acenor-results-other-item__thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    flex-shrink: 0;
}

/* Sidebar */
.acenor-results-sidebar__block {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem;
}
.acenor-results-sidebar__title {
    color: #6c757d;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem !important;
}

/* Lista de categorías con contador */
.acenor-results-sidebar-cats__item a {
    color: #212529;
    border-radius: 0.3rem;
    transition: background-color 0.15s;
}
.acenor-results-sidebar-cats__item a:hover {
    background: #f1f3f5;
    color: #0d6efd;
}
.acenor-results-sidebar-cats__count {
    font-weight: 400;
}


/* Empty state */
.acenor-results-empty {
    max-width: 520px;
    margin: 0 auto;
}

/* Grid de productos: 4 por fila con altura uniforme (CSS Grid) */
.acenor-results-section .woocommerce ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    list-style: none;
    padding: 0;
    margin: 0;
}
.acenor-results-section .woocommerce ul.products::before,
.acenor-results-section .woocommerce ul.products::after {
    display: none !important;
    content: none !important;
}
.acenor-results-section .woocommerce ul.products li.product {
    margin: 0 !important;
    width: auto !important;
    max-width: none !important;
    float: none !important;
    clear: none !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}
.acenor-results-section .woocommerce ul.products li.product > a {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.acenor-results-section .woocommerce ul.products li.product img {
    max-width: 100%;
    height: auto;
    display: block;
    flex-shrink: 0;
    width: 100%;
}
.acenor-results-section .woocommerce ul.products li.product .title-wrapper {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.5rem;
}
.acenor-results-section .woocommerce ul.products li.product .title-wrapper .custom-title {
    margin: 0;
}

@media (max-width: 991px) {
    .acenor-results-section .woocommerce ul.products {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
@media (max-width: 767px) {
    .acenor-results-section .woocommerce ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 479px) {
    .acenor-results-section .woocommerce ul.products {
        grid-template-columns: 1fr;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .acenor-results-other-item__thumb {
        width: 60px;
        height: 60px;
    }
}
