/**
 * ESTILOS DE AUTOCOMPLETADO - Mayoreo Joinet
 * Meilisearch Search Suggestions
 */

/* Contenedor del autocompletado */
.jn-autocomplete-wrapper {
    position: relative;
    width: 100%;
}

/* Dropdown de sugerencias */
.jn-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.jn-autocomplete-dropdown.active {
    display: block;
}

/* Item de sugerencia */
.jn-autocomplete-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.jn-autocomplete-item:last-child {
    border-bottom: none;
}

.jn-autocomplete-item:hover,
.jn-autocomplete-item.active {
    background: #f5f9ff;
}

/* Imagen del producto */
.jn-autocomplete-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 4px;
    margin-right: 12px;
    background: #f8f8f8;
}

/* Info del producto */
.jn-autocomplete-info {
    flex: 1;
    min-width: 0;
}

.jn-autocomplete-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.jn-autocomplete-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #666;
}

.jn-autocomplete-sku {
    font-family: monospace;
    background: #eee;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.jn-autocomplete-brand {
    color: #888;
}

/* Precio y stock */
.jn-autocomplete-price {
    text-align: right;
    margin-left: 15px;
}

.jn-autocomplete-price-value {
    font-size: 14px;
    font-weight: 400;
    color: #e74c3c;
}

.jn-autocomplete-stock {
    font-size: 11px;
    margin-top: 2px;
}

.jn-autocomplete-stock.in-stock {
    color: #27ae60;
}

.jn-autocomplete-stock.out-stock {
    color: #e74c3c;
}

/* Estado de cargando */
.jn-autocomplete-loading {
    padding: 20px;
    text-align: center;
    color: #666;
}

.jn-autocomplete-loading i {
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

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

/* Sin resultados */
.jn-autocomplete-empty {
    padding: 20px;
    text-align: center;
    color: #888;
}

/* Indicador de velocidad en header de resultados */
.jn-search-speed {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #68aa41 0%, #018f2b 100%);
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 12px;
}

.jn-search-speed i {
    color: #ffd700;
}

/* Ver todos los resultados */
.jn-autocomplete-footer {
    padding: 12px 15px;
    background: #f8f9fa;
    text-align: center;
    border-top: 1px solid #e0e0e0;
}

.jn-autocomplete-footer a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
}

.jn-autocomplete-footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .jn-autocomplete-item {
        padding: 8px 12px;
    }

    .jn-autocomplete-img {
        width: 40px;
        height: 40px;
    }

    .jn-autocomplete-title {
        font-size: 13px;
    }

    .jn-autocomplete-price-value {
        font-size: 13px;
    }
}