/* Contenedor general */
#kuad-advanced-search-form {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

/* Wrapper */
.kuad-advanced-search-wrapper {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Input */
#kuad-advanced-search-input {
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    color: #000;
    background: #fff;
}

/* Select */
#kuad-advanced-search-filter-type {
    width: 140px;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 0.5rem;
    font-size: 1rem;
    color: #000;
    background: #fff;
    display: block;
}

/* Botón */
#kuad-advanced-search-submit {
    position: relative;
    width: 42px;
    height: 42px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
#kuad-advanced-search-submit.loading .dashicons {
    display: none;
}
#kuad-advanced-search-submit.loading .kuad-advanced-search-spinner {
    display: block;
}

/* Spinner */
.kuad-advanced-search-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: kuad-spin 0.8s linear infinite;
    display: none;
}
@keyframes kuad-spin {
    to { transform: rotate(360deg); }
}

/* Autocomplete */
.kuad-advanced-search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    z-index: 999;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 180px;
    overflow-y: auto;
}
.kuad-advanced-search-autocomplete-item {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    cursor: pointer;
    color: #333;
}
.kuad-advanced-search-autocomplete-item:hover {
    background: #f0f0f0;
}

/* Resultados */
#kuad-advanced-search-results {
    margin-top: 0.5rem;
    display: none;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
    z-index: 998;
}

/* Cerrar botón visible */
.kuad-advanced-search-close-results {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #000;
    border: none;
    font-size: 20px;
    color: #fff;
    cursor: pointer;
    border-radius: 6px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    line-height: 23px;
}

/* Item */
.kuad-advanced-search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    opacity: 0;
    animation: kuadFadeIn 0.3s ease-out forwards;
    position: relative;
    z-index: 1;
}
.kuad-advanced-search-result-item:hover {
    background: #f0f0f0;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.08);
}

/* Cascada delay */
.kuad-advanced-search-result-item:nth-child(1) { animation-delay: 0.05s; }
.kuad-advanced-search-result-item:nth-child(2) { animation-delay: 0.10s; }
.kuad-advanced-search-result-item:nth-child(3) { animation-delay: 0.15s; }
.kuad-advanced-search-result-item:nth-child(4) { animation-delay: 0.20s; }
.kuad-advanced-search-result-item:nth-child(5) { animation-delay: 0.25s; }
.kuad-advanced-search-result-item:nth-child(6) { animation-delay: 0.30s; }
.kuad-advanced-search-result-item:nth-child(7) { animation-delay: 0.35s; }
.kuad-advanced-search-result-item:nth-child(8) { animation-delay: 0.40s; }
.kuad-advanced-search-result-item:nth-child(9) { animation-delay: 0.45s; }
.kuad-advanced-search-result-item:nth-child(10) { animation-delay: 0.50s; }

@keyframes kuadFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Fade out */
@keyframes kuadFadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(10px); }
}
.kuad-advanced-search-closing {
    animation: kuadFadeOut 0.2s ease-in forwards;
}

/* Thumb */
.kuad-advanced-search-product-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    background: #f0f0f0;
}

/* Info */
.kuad-advanced-search-product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Título */
.kuad-advanced-search-product-title {
    font-size: 1rem;
    color: #000;
    font-weight: 600;
    line-height: 1.2;
}

/* Precio */
.kuad-advanced-search-product-price {
    font-size: 0.95rem;
    color: #000;
}

/* Categoría */
.kuad-advanced-search-product-category {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: #333;
    gap: 0.4rem;
}
.kuad-advanced-search-product-category .dashicons {
    font-size: 14px;
    color: #333;
}
.kuad-advanced-search-category-text {
    font-style: italic;
    color: #333;
}

/* WooCommerce Price */
.kuad-advanced-search-product-info .woocommerce-Price-currencySymbol,
.kuad-advanced-search-product-info .woocommerce-Price-amount {
    color: #000;
    font-weight: 500;
}

/* Mensajes */
.kuad-advanced-search-no-results,
.kuad-advanced-search-error {
    padding: 1rem;
    text-align: center;
    color: #666;
}

/* Historial de búsqueda */
.kuad-advanced-search-history {
    padding: 1rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    margin-top: 0.5rem;
    position: relative;
}

.kuad-advanced-search-history-label {
    font-size: 0.95rem;
    color: #333;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.kuad-advanced-search-history-item {
    display: inline-block;
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 0.4rem 0.8rem;
    margin: 0.25rem 0.35rem 0 0;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.kuad-advanced-search-history-item:hover {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* Responsive */
@media (max-width: 600px) {
    .kuad-advanced-search-wrapper {
        flex-direction: column;
        gap: 0.75rem;
    }
    #kuad-advanced-search-filter-type,
    #kuad-advanced-search-submit {
        width: 100%;
    }
}
