/* Live search + panel descubrir (estilo AliExpress) */
.site-header__search-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

 .site-header__search {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    position: relative;
    display: flex;
    align-items: center;
    height: 40px;
    margin: 0;
    border: 0.5px solid #000;
    border-radius: 999px;
    background: var(--color-white);
    overflow: hidden;
}

.site-header__search:focus-within {
    border-color: #000;
    box-shadow: 0 0 0 1px #000;
}

.site-header__search input,
.site-header__search-input {
    width: 100%;
    height: 100%;
    padding: 0 78px 0 18px;
    border: none;
    border-radius: 0;
    font-size: var(--font-size-base);
    background: transparent;
}

.site-header__search input:focus,
.site-header__search-input:focus {
    outline: none;
}

.site-header__visual-search {
    position: absolute;
    right: 42px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-header__visual-search-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #333;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
    padding: 0;
}

.site-header__visual-search-btn:hover {
    color: #000;
    background: rgba(0, 0, 0, 0.06);
}

.site-header__visual-search-btn svg {
    width: 18px;
    height: 18px;
}

.site-header__search-submit {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #000;
    color: var(--color-white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    padding: 0;
}

.site-header__search-submit:hover {
    background: var(--color-orange);
}

.site-header__search-submit svg {
    width: 16px;
    height: 16px;
}

.live-search {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 450;
    background: var(--color-white);
    border: 1px solid var(--color-grey-border);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    max-height: min(78vh, 540px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    width: max(100%, min(920px, calc(100% - 32px)));
    max-width: calc(100% - 24px);
}

.site-header__search-wrap.is-live-search-open {
    z-index: 460;
}

@media (max-width: 1100px) {
    .site-header__search-wrap.is-live-search-open .live-search {
        position: fixed;
        left: var(--live-search-left, 12px);
        right: auto;
        width: var(--live-search-width, calc(100% - 24px));
        max-width: calc(100% - 24px);
        top: var(--live-search-top, calc(100% + 8px));
        max-height: var(--live-search-max-height, min(70vh, 480px));
    }
}

.live-search[hidden] {
    display: none !important;
}

/* Panel descubrir */
.live-search__discover {
    display: grid;
    /* Sidebar más estrecho: el texto de "Más buscadas" no necesita 280px */
    grid-template-columns: 220px 1fr;
    min-height: 280px;
}

.live-search__discover[hidden] {
    display: none !important;
}

.live-search__discover-side {
    padding: 16px 14px;
    border-right: 1px solid var(--color-grey-border, #e8e8e8);
    background: #fafafa;
}

.live-search__discover-main {
    padding: 16px 18px 20px;
}

.live-search__section + .live-search__section {
    margin-top: 18px;
}

.live-search__section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.live-search__section-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-dark, #1a1a1a);
}

.live-search__clear,
.live-search__more {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: #1677ff;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.live-search__clear:hover,
.live-search__more:hover {
    text-decoration: underline;
}

.live-search__suggest-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.live-search__suggest-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-search__suggest-link {
    flex: 1 1 auto;
    min-width: 0;
    display: block;
    padding: 7px 4px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.35;
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-search__suggest-link:hover {
    color: var(--color-orange, #bf360c);
    background: rgba(0, 0, 0, 0.03);
}

.live-search__suggest-remove {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.live-search__suggest-remove:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #333;
}

.live-search__cat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px 12px;
}

.live-search__cat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #333;
    text-align: center;
}

.live-search__cat:hover {
    color: var(--color-orange, #bf360c);
}

.live-search__cat-thumb {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    background: #f3f3f3;
    border: 1px solid #eee;
}

.live-search__cat-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.live-search__cat-name {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Resultados en vivo */
.live-search__results[hidden] {
    display: none !important;
}

.live-search__list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
}

.live-search__item {
    margin: 0;
}

.live-search__link {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px 16px;
    text-decoration: none;
    color: inherit;
}

.live-search__meta {
    min-width: 0;
}

.live-search__link:hover,
.live-search__link.is-active {
    background: #f7f7f7;
}

.live-search__thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    background: #f0f0f0;
}

.live-search__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.live-search__title {
    margin: 0;
    font-size: var(--font-size-sm, 13px);
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.live-search__sku {
    margin: 2px 0 0;
    font-size: 11px;
    color: #888;
}

.live-search__price {
    margin: 0;
    font-size: var(--font-size-sm, 13px);
    font-weight: 700;
    color: var(--color-dark, #1a1a1a);
    white-space: nowrap;
}

.live-search__price .amount,
.live-search__price .woocommerce-Price-amount {
    font-weight: 700;
}

.live-search__price .woocommerce-Price-currencySymbol,
.live-search__price .woocommerce-Price-cents {
    font-size: 0.65em;
    font-weight: 700;
    vertical-align: top;
    line-height: 1;
    position: relative;
    top: 0.15em;
}

/* En buscador la coma se mantiene visible para evitar ambigüedad. */
.live-search__price .woocommerce-Price-decimal {
    font-size: inherit;
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    clip: auto;
    overflow: visible;
}

.live-search__all {
    display: block;
    padding: 12px 16px;
    border-top: 1px solid var(--color-grey-border);
    text-align: center;
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--color-orange);
}

.live-search__all:hover {
    background: #fff8f0;
}

.live-search__empty,
.live-search__loading {
    margin: 0;
    padding: 20px 16px;
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--color-grey-text);
}

/* Compat FiboSearch */
.dgwt-wcas-search-wrapp {
    max-width: none !important;
}

.dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input {
    border-radius: 999px !important;
    height: 40px !important;
    border: 0.5px solid #000 !important;
}

.dgwt-wcas-suggestions-wrapp {
    border-radius: var(--radius-md) !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14) !important;
}

@media (max-width: 1100px) {
    .site-header__search-wrap {
        max-width: 100%;
        width: 100%;
    }

    .site-header__search {
        width: 100%;
        max-width: 100%;
    }

    .site-header__search input,
    .site-header__search-input {
        font-size: 16px;
        min-width: 0;
    }

    .live-search__discover {
        grid-template-columns: 1fr;
    }

    .live-search__discover-side {
        border-right: 0;
        border-bottom: 1px solid var(--color-grey-border, #e8e8e8);
    }

    .live-search__cat-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .site-header__search input,
    .site-header__search-input {
        padding-right: 68px;
        padding-left: 14px;
    }

    .site-header__visual-search {
        right: 36px;
    }

    .site-header__visual-search-btn,
    .site-header__search-submit {
        width: 28px;
        height: 28px;
    }

    .site-header__visual-search-btn svg {
        width: 16px;
        height: 16px;
    }

    .site-header__search-submit {
        right: 4px;
    }

    .site-header__search-submit svg {
        width: 14px;
        height: 14px;
    }

    .live-search__cat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px 8px;
    }

    .live-search__cat-thumb {
        width: 58px;
        height: 58px;
    }

    .live-search__link {
        grid-template-columns: 44px minmax(0, 1fr);
        grid-template-areas:
            "thumb meta"
            "thumb price";
        gap: 4px 10px;
        padding: 10px 12px;
        align-items: start;
    }

    .live-search__thumb {
        grid-area: thumb;
        width: 44px;
        height: 44px;
    }

    .live-search__meta {
        grid-area: meta;
    }

    .live-search__price {
        grid-area: price;
        text-align: left;
        white-space: normal;
        font-size: 13px;
        line-height: 1.25;
    }

    .live-search__all {
        padding: 10px 12px;
        word-break: break-word;
    }
}

@media (max-width: 400px) {
    .site-header__visual-search {
        display: none;
    }

    .site-header__search input,
    .site-header__search-input {
        padding-right: 40px;
    }

    .live-search__cat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Modal AI Image Search (plugin [ai_image_search]) */
.doro-ai-search-modal {
    position: fixed;
    inset: 0;
    z-index: 100060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.doro-ai-search-modal[hidden] {
    display: none !important;
}

.doro-ai-search-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.doro-ai-search-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    max-height: min(92vh, 900px);
    overflow: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
}

.doro-ai-search-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}

.doro-ai-search-modal__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.doro-ai-search-modal__close {
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #222;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.doro-ai-search-modal__close svg {
    width: 28px;
    height: 28px;
    stroke-width: 2.5;
}

.doro-ai-search-modal__close:hover {
    background: #f3f3f3;
}

.doro-ai-search-modal__body {
    padding: 8px 12px 20px;
}

.doro-ai-search-modal__body .ai-image-search {
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    overflow: visible;
}

.doro-ai-search-modal__body .ai-image-search-form {
    padding: 16px 12px 8px;
    box-shadow: none;
    background: #fff;
}

body.doro-ai-search-open {
    overflow: hidden;
}
