/**
 * ==============================================================================
 * KUMARA MARKETPLACE — ESTILOS DEL BUSCADOR INSTANTÁNEO (TYPEAHEAD DROPDOWN)
 * ==============================================================================
 * Estándar visual Enterprise: Floating glassmorphism, responsive y mobile-ready.
 * ==============================================================================
 */

.km-search-wrapper {
    position: relative;
}

.km-instant-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    min-width: 320px;
    max-width: 520px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 12px 32px rgba(17, 24, 39, 0.12), 0 4px 12px rgba(0, 0, 0, 0.05);
    z-index: 1090;
    max-height: 480px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0;
    animation: kmDropdownFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes kmDropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar personalizada discreta */
.km-instant-dropdown::-webkit-scrollbar {
    width: 6px;
}
.km-instant-dropdown::-webkit-scrollbar-thumb {
    background-color: #e5e7eb;
    border-radius: 10px;
}
.km-instant-dropdown::-webkit-scrollbar-thumb:hover {
    background-color: #d1d5db;
}

/* Loading & Empty States */
.km-sug-loading,
.km-sug-empty {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    color: #4b5563;
}

.km-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: #111827;
    border-radius: 50%;
    animation: kmSpin 0.7s linear infinite;
    margin-right: 12px;
}

@keyframes kmSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Secciones */
.km-sug-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: #9ca3af;
    padding: 10px 18px 4px 18px;
}

/* Items Generales y Navegación con Teclado */
.km-sug-item {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.km-sug-item:hover,
.km-sug-item.km-sug-active {
    background-color: #f3f4f6;
    color: #111827;
}

/* Coincidencias Resaltadas */
.km-match-hl {
    background-color: #fef08a;
    color: #111827;
    font-weight: 700;
    border-radius: 2px;
    padding: 0 2px;
}

/* 1. Tiendas Oficiales */
.km-sug-tiendas-grid {
    padding: 4px 12px 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.km-sug-tienda-item {
    padding: 8px 12px;
    border-radius: 10px;
    gap: 12px;
}

.km-sug-tienda-img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.km-sug-tienda-placeholder {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #111827;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.km-sug-tienda-info {
    display: flex;
    flex-direction: column;
}

.km-sug-tienda-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #111827;
}

.km-sug-tienda-badge {
    font-size: 0.7rem;
    color: #16a34a;
    font-weight: 600;
}

/* 2. Categorías Chips */
.km-sug-chips-wrapper {
    padding: 4px 18px 10px 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.km-sug-chip {
    padding: 6px 12px;
    background: #f3f4f6;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    border: 1px solid transparent;
}

.km-sug-chip:hover,
.km-sug-chip.km-sug-active {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #111827;
}

/* 3. Productos */
.km-sug-productos-list {
    padding: 4px 12px 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.km-sug-producto-item {
    padding: 8px 12px;
    border-radius: 10px;
    gap: 12px;
}

.km-sug-prod-img {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    background: #f3f4f6;
    border: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.km-sug-prod-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.km-sug-prod-title {
    font-size: 0.86rem;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.km-sug-prod-meta {
    font-size: 0.78rem;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.km-sug-prod-price {
    font-weight: 700;
    color: #111827;
}

.km-sug-prod-store {
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer */
.km-sug-footer {
    border-top: 1px solid #f3f4f6;
    padding: 10px 18px 4px 18px;
    margin-top: 4px;
}

.km-sug-all-link {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #4f46e5;
    text-decoration: none;
    padding: 6px 0;
    text-align: center;
    transition: color 0.15s ease;
}

.km-sug-all-link:hover {
    color: #3730a3;
    text-decoration: underline;
}

/* Ajustes Responsive en Móviles */
@media (max-width: 768px) {
    .km-instant-dropdown {
        position: fixed;
        top: 60px;
        left: 12px;
        right: 12px;
        width: auto;
        min-width: 0;
        max-width: none;
        max-height: 70vh;
        z-index: 1100;
    }
}
