/**
 * css/search-improved.css - Estilos para Búsqueda Inteligente
 * Optimizado y sin conflictos con estilos existentes
 */

/* ========================================
   CONTENEDOR PRINCIPAL
   ======================================== */

#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e7e7e7;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    max-height: 600px;
    overflow-y: auto;
    z-index: 9999;
    margin-top: -1px;
}

.search-results-container {
    padding: 0;
}

/* ========================================
   TÍTULOS DE SECCIÓN
   ======================================== */

.search-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #999;
    padding: 12px 20px 8px;
    border-bottom: 1px solid #f5f5f5;
    background: #fafafa;
    letter-spacing: 0.5px;
}

/* ========================================
   SUGERENCIAS
   ======================================== */

.search-suggestions {
    border-bottom: 1px solid #e7e7e7;
}

.suggestions-list {
    padding: 8px 0;
}

.suggestion-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s;
    gap: 8px;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.suggestion-item:hover {
    background: #f8f8f8;
    border-left-color: #c96;
    color: #333;
}

.suggestion-item i {
    color: #999;
    font-size: 14px;
    min-width: 16px;
}

.suggestion-label {
    font-size: 11px;
    color: #666;
    font-style: italic;
}

.suggestion-text {
    font-size: 13px;
    color: #333;
    flex: 1;
}

.suggestion-badge {
    background: #c96;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* ========================================
   PRODUCTOS
   ======================================== */

.search-products {
    max-height: 400px;
    overflow-y: auto;
}

.products-list {
    padding: 8px 0;
}

.search-product-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    gap: 15px;
}

.search-product-item:hover {
    background: #f8f8f8;
    border-left-color: #c96;
    color: #333;
}

.product-image-wrapper {
    position: relative;
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border: 1px solid #e7e7e7;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

.product-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge-no-stock,
.badge-nuevo,
.badge-oferta {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 2px;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1;
}

.badge-no-stock {
    background: #dc3545;
    color: #fff;
}

.badge-nuevo {
    background: #28a745;
    color: #fff;
}

.badge-oferta {
    background: #ff6b6b;
    color: #fff;
}

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

.product-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 4px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-title mark {
    background: #fff3cd;
    color: #856404;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 700;
}

.product-category {
    font-size: 11px;
    color: #999;
    margin: 0 0 6px;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.product-price .price,
.product-price .price-new {
    font-size: 15px;
    font-weight: 700;
    color: #c96;
}

.product-price .price-old {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #666;
}

.rating-stars {
    position: relative;
    display: inline-block;
    height: 12px;
    width: 60px;
    background: linear-gradient(90deg, #ffc107 var(--rating, 0%), #ddd var(--rating, 0%));
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>') repeat-x;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>') repeat-x;
    -webkit-mask-size: 12px 12px;
    mask-size: 12px 12px;
}

.rating-count {
    color: #999;
}

/* ========================================
   PIE DE RESULTADOS
   ======================================== */

.search-results-footer {
    padding: 15px 20px;
    border-top: 1px solid #e7e7e7;
    background: #fafafa;
    text-align: center;
}

.view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #c96;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.view-all-link:hover {
    color: #a85;
    gap: 12px;
}

.view-all-link i {
    font-size: 14px;
}

/* ========================================
   ESTADOS
   ======================================== */

.search-loading,
.search-error,
.search-no-results {
    padding: 40px 20px;
    text-align: center;
}

.search-loading i,
.search-error i,
.no-results-message i {
    font-size: 36px;
    color: #c96;
    margin-bottom: 12px;
    display: block;
}

.search-loading span {
    font-size: 14px;
    color: #666;
}

.search-error {
    color: #dc3545;
}

.no-results-message p {
    font-size: 14px;
    color: #666;
    margin: 12px 0;
}

.no-results-suggestions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e7e7e7;
}

.suggestions-title {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
    font-weight: 600;
}

.suggestion-chip {
    display: inline-block;
    padding: 6px 12px;
    margin: 4px;
    background: #f5f5f5;
    color: #333;
    border-radius: 20px;
    font-size: 12px;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid #e7e7e7;
}

.suggestion-chip:hover {
    background: #c96;
    color: #fff;
    border-color: #c96;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(204, 153, 102, 0.3);
}

.no-results-footer {
    margin-top: 20px;
}

.btn-browse-all {
    display: inline-block;
    padding: 10px 24px;
    background: #c96;
    color: #fff;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-browse-all:hover {
    background: #a85;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(204, 153, 102, 0.3);
}

/* ========================================
   SCROLLBAR
   ======================================== */

#search-results::-webkit-scrollbar,
.search-products::-webkit-scrollbar {
    width: 6px;
}

#search-results::-webkit-scrollbar-track,
.search-products::-webkit-scrollbar-track {
    background: #f5f5f5;
}

#search-results::-webkit-scrollbar-thumb,
.search-products::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#search-results::-webkit-scrollbar-thumb:hover,
.search-products::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    #search-results {
        max-height: 400px;
    }
    
    .product-image-wrapper {
        width: 60px;
        height: 60px;
    }
    
    .product-title {
        font-size: 13px;
    }
    
    .suggestion-item,
    .search-product-item {
        padding: 10px 15px;
    }
}