/* ============================================
   ESTILOS BÚSQUEDA AVANZADA - ESSENTIAL
   ============================================ */

.search-container-advanced {
    position: relative;
}

/* Botón de búsqueda por voz */
.voice-search-btn {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #7f8c8d;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 8px;
    transition: all 0.3s;
    z-index: 10;
}

.voice-search-btn:hover {
    color: #0066FF;
    transform: translateY(-50%) scale(1.1);
}

.voice-search-btn.listening {
    color: #e74c3c;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Overlay */
.search-overlay-advanced {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.search-overlay-advanced.active {
    opacity: 1;
    visibility: visible;
}

/* Contenedor de resultados */
.search-results-advanced {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    max-height: 600px;
    overflow-y: auto;
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
}

.search-results-advanced.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Sección de resultados */
.search-section {
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.search-section:last-child {
    border-bottom: none;
}

.search-section-title {
    padding: 10px 20px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-section-title i {
    color: #0066FF;
}

/* Items de resultado */
.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    color: #2c3e50;
    transition: all 0.3s;
    cursor: pointer;
    gap: 15px;
}

.search-result-item:hover,
.search-result-item.active {
    background: #f8f9fa;
}

/* Productos */
.product-item {
    position: relative;
}

.search-product-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.search-product-info {
    flex: 1;
    min-width: 0;
}

.search-product-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-product-name mark {
    background: #fff3cd;
    color: #856404;
    padding: 2px 4px;
    border-radius: 3px;
}

.search-product-category {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 4px;
}

.search-product-price {
    font-weight: 700;
    color: #0066FF;
    font-size: 1.1rem;
}

.search-old-price {
    font-size: 0.9rem;
    color: #95a5a6;
    text-decoration: line-through;
    margin-left: 8px;
}

.search-low-stock {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: #fff3cd;
    color: #856404;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Categorías */
.category-item {
    font-weight: 500;
}

.category-item i {
    color: #9b59b6;
    width: 20px;
}

.category-item mark {
    background: #f3e5f5;
    color: #6c3483;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Historial */
.history-item {
    color: #7f8c8d;
    justify-content: space-between;
}

.history-item i {
    color: #95a5a6;
}

.history-item span {
    flex: 1;
    cursor: pointer;
}

.history-item span:hover {
    color: #2c3e50;
}

.remove-history {
    background: transparent;
    border: none;
    color: #95a5a6;
    cursor: pointer;
    padding: 5px;
    transition: all 0.3s;
    opacity: 0;
}

.history-item:hover .remove-history {
    opacity: 1;
}

.remove-history:hover {
    color: #e74c3c;
}

/* Footer */
.search-footer {
    padding: 15px 20px;
    border-top: 1px solid #f0f0f0;
}

.search-view-all {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: #f8f9fa;
    color: #0066FF;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
}

.search-view-all:hover {
    background: #0066FF;
    color: white;
}

.search-clear-history {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 2px solid #e0e0e0;
    color: #7f8c8d;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.search-clear-history:hover {
    background: #f8f9fa;
    border-color: #e74c3c;
    color: #e74c3c;
}

/* Estados especiales */
.search-loading,
.search-no-results,
.search-error {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.search-loading i,
.search-no-results i,
.search-error i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #bdc3c7;
}

.search-loading p,
.search-no-results p,
.search-error p {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.search-loading small,
.search-no-results small,
.search-error small {
    font-size: 0.9rem;
}

/* Spinner de carga */
.search-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0066FF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .search-results-advanced {
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 0;
        max-height: none;
    }
    
    .voice-search-btn {
        right: 10px;
    }
    
    .search-product-image {
        width: 50px;
        height: 50px;
    }
    
    .search-low-stock {
        position: static;
        transform: none;
        margin-top: 5px;
        display: inline-block;
    }
}

/* Scrollbar personalizado */
.search-results-advanced::-webkit-scrollbar {
    width: 8px;
}

.search-results-advanced::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.search-results-advanced::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 10px;
}

.search-results-advanced::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}
