/* =====================================================
   Custom Woo Search – Frontend Styles
   ===================================================== */

.bws-smart-search {
    position: relative;
    width: 100%;
}

/* ── Wrapper barra ── */
.bws-search-wrap {
    display: flex;
    align-items: stretch;
    position: relative;
    width: 100%;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}
.bws-search-wrap:focus-within {
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
}

/* ── Input ── */
.bws-search-input {
    flex: 1 1 auto;
    width: 100%;
    border: 1px solid #dddddd;
    outline: none;
    font-family: inherit;
    font-size: 15px;
    padding: 0 16px;
    height: 50px;
    background-color: #ffffff;
    color: #333333;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    /* rimuove il cross di default del tipo search */
}
.bws-search-input::-webkit-search-decoration,
.bws-search-input::-webkit-search-cancel-button,
.bws-search-input::-webkit-search-results-button,
.bws-search-input::-webkit-search-results-decoration {
    display: none;
}
.bws-search-input:focus {
    border-color: #2271b1;
}

/* ── Bottone ── */
.bws-search-btn {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    background-color: #2271b1;
    color: #ffffff;
    height: 50px;
    width: 50px;
    transition: background-color 0.2s ease;
    padding: 0;
}
.bws-search-btn:hover {
    background-color: #135e96;
}
.bws-search-btn svg {
    display: block;
    fill: none;
    stroke: #ffffff;
    transition: stroke 0.2s ease;
}

/* Senza bottone – bordo radius completo sull'input */
.bws-no-button .bws-search-wrap {
    border-radius: inherit;
}
.bws-no-button .bws-search-input {
    border-radius: inherit;
}

/* ── Dropdown ── */
.bws-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 9999;
    background-color: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    max-height: 420px;
    overflow-y: auto;
}
.bws-dropdown.bws-open {
    display: block;
}

/* ── Singolo risultato ── */
.bws-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.bws-result-item:hover,
.bws-result-item.bws-active {
    background-color: #f5f5f5;
    text-decoration: none;
}
.bws-result-item + .bws-result-item {
    border-top: 1px solid #eeeeee;
}

/* Thumbnail */
.bws-result-thumb {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 4px;
    background-color: #f0f0f0;
}

/* Testo */
.bws-result-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.bws-result-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #222222;
}
.bws-result-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}
.bws-result-price {
    font-size: 12px;
    color: #666666;
    white-space: nowrap;
}
.bws-result-price ins {
    text-decoration: none;
}

/* Badge tipo */
.bws-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 100px;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.bws-badge--product  { background-color: #2271b1; }
.bws-badge--category { background-color: #46b450; }
.bws-badge--tag      { background-color: #f0ad4e; }

/* Loading spinner */
.bws-dropdown-loading {
    padding: 16px;
    text-align: center;
    color: #888888;
    font-size: 13px;
}
.bws-dropdown-loading::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #cccccc;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: bws-spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}
@keyframes bws-spin {
    to { transform: rotate(360deg); }
}

/* Nessun risultato */
.bws-no-results {
    padding: 16px;
    text-align: center;
    color: #888888;
    font-size: 13px;
}

/* ── Editor Elementor preview ── */
.elementor-editor-active .bws-dropdown {
    pointer-events: none;
}
