/* =====================================================
   Buscador de productos en vivo (AJAX)
   ===================================================== */

.rls-form { position: relative; }

.rls-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99999;
    margin-top: 6px;
    background: #fff;
    border: 1px solid #e6e6ee;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
    overflow-y: auto;
    overflow-x: hidden;
    /* alto para ~3 productos visibles + scroll del resto */
    max-height: 270px;
}
.rls-results.is-open { display: block; }

/* Cada producto: 3 columnas (foto | nombre | precio) */
.rls-item {
    display: grid;
    grid-template-columns: 52px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f5;
    text-decoration: none !important;
    color: #1a1a2e;
    transition: background 0.15s;
    min-height: 64px;
}
.rls-item:last-child { border-bottom: none; }
.rls-item:hover { background: #f6f3ff; }

/* Columna 1: foto */
.rls-img {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rls-img img {
    max-width: 52px;
    max-height: 52px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
}

/* Columna 2: nombre */
.rls-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: #1a1a2e;
    /* máximo 2 líneas */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Columna 3: precio */
.rls-price {
    font-size: 14px;
    font-weight: 800;
    color: #894BE2;
    white-space: nowrap;
    text-align: right;
}
.rls-price del {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: #aaa;
}
.rls-price ins { text-decoration: none; }

/* Estados */
.rls-empty,
.rls-loading {
    padding: 22px 16px;
    text-align: center;
    font-size: 13px;
    color: #888;
}
.rls-empty { font-weight: 600; }

/* Scrollbar suave */
.rls-results::-webkit-scrollbar { width: 8px; }
.rls-results::-webkit-scrollbar-thumb {
    background: #d8cef0;
    border-radius: 8px;
}
.rls-results::-webkit-scrollbar-track { background: transparent; }

/* Mobile */
@media (max-width: 575px) {
    .rls-results { max-height: 240px; }
    .rls-item { grid-template-columns: 44px 1fr auto; gap: 10px; padding: 9px 12px; }
    .rls-img { width: 44px; height: 44px; }
    .rls-img img { max-width: 44px; max-height: 44px; }
    .rls-name { font-size: 12px; }
    .rls-price { font-size: 13px; }
}
