/* ==========================================
   DIAMANTE — Buscador en tiempo real (dropdown estilo CRONOSTEC)
   ========================================== */

[data-live-search-wrap] {
    position: relative;
}

[data-live-search-results] {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(13, 31, 60, 0.22);
    z-index: 999;
    max-height: 70vh;
    overflow: hidden;
}
[data-live-search-results].open { display: block; }

.ls-panel {
    display: grid;
    grid-template-columns: 1fr 300px;
    max-height: 70vh;
}
@media (max-width: 640px) {
    .ls-panel { grid-template-columns: 1fr; }
    .ls-col-preview { display: none; } /* en mobile priorizamos la lista */
}

.ls-col-list {
    padding: 0.75rem 0;
    overflow-y: auto;
    max-height: 70vh;
    border-right: 1px solid #eceef0;
}

.ls-section-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    color: #7A8B99;
    padding: 0.6rem 1.25rem 0.4rem;
}

.ls-cat-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1.25rem;
    color: #0D1F3C;
    text-decoration: none;
    font-size: 0.87rem;
    font-weight: 600;
    border-left: 3px solid transparent;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.ls-cat-item:hover,
.ls-cat-item.active {
    background: #F7F7F5;
    border-left-color: #C9A84C;
}
.ls-cat-item svg { color: #C9A84C; flex-shrink: 0; }

.ls-prod-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1.25rem;
    text-decoration: none;
    color: inherit;
    border-left: 3px solid transparent;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.ls-prod-item:hover,
.ls-prod-item.active {
    background: #F7F7F5;
    border-left-color: #C9A84C;
}
.ls-prod-item img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 6px;
    background: #F7F7F5;
    flex-shrink: 0;
}
.ls-prod-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.ls-prod-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #0D1F3C;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ls-prod-code {
    font-size: 0.72rem;
    color: #7A8B99;
}

.ls-ver-todos {
    display: block;
    text-align: center;
    padding: 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #C9A84C;
    text-decoration: none;
    border-top: 1px solid #eceef0;
    margin-top: 0.4rem;
}
.ls-ver-todos:hover { text-decoration: underline; }

/* ---------- Columna derecha: vista previa ---------- */
.ls-col-preview {
    background: #F7F7F5;
    padding: 1.25rem;
    overflow-y: auto;
}
.ls-preview-card { display: flex; flex-direction: column; }
.ls-preview-img {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    margin-bottom: 0.85rem;
}
.ls-preview-img img { width: 100%; height: 100%; object-fit: cover; }
.ls-preview-name {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 0.9rem;
    color: #0D1F3C;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}
.ls-preview-desc {
    font-size: 0.76rem;
    color: #555;
    line-height: 1.5;
    margin-bottom: 1rem;
}
.ls-preview-desc strong { color: #0D1F3C; }
.ls-preview-btn {
    display: inline-block;
    text-align: center;
    background: #C9A84C;
    color: #0D1F3C;
    font-weight: 700;
    font-size: 0.78rem;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    text-decoration: none;
}
.ls-preview-btn:hover { background: #b8973f; }

/* ---------- Vista previa de CATEGORÍA (hover sobre categoría) ---------- */
.ls-preview-cat-label {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    color: #7A8B99;
    margin-bottom: 0.3rem;
}
.ls-preview-cat-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    color: #0D1F3C;
    line-height: 1.3;
    margin-bottom: 1rem;
}
.ls-cat-preview-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.ls-cat-preview-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    background: #fff;
    border-radius: 6px;
    padding: 0.4rem 0.5rem;
    transition: box-shadow 0.15s ease;
}
.ls-cat-preview-item:hover { box-shadow: 0 2px 8px rgba(13,31,60,0.1); }
.ls-cat-preview-item img {
    width: 34px;
    height: 34px;
    object-fit: cover;
    border-radius: 5px;
    background: #F7F7F5;
    flex-shrink: 0;
}
.ls-cat-preview-item span {
    font-size: 0.74rem;
    font-weight: 600;
    color: #0D1F3C;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ls-ver-categoria-btn {
    background: #0D1F3C;
    color: #F7F7F5;
    text-align: center;
}
.ls-ver-categoria-btn:hover { background: #16305c; }

/* ---------- Sin resultados ---------- */
.ls-empty {
    padding: 2rem 1.5rem;
    text-align: center;
}
.ls-empty p { font-size: 0.85rem; color: #333; margin: 0 0 0.5rem; }
.ls-empty-sub { color: #7A8B99 !important; font-size: 0.78rem !important; }
.ls-empty-sub a { color: #C9A84C; font-weight: 600; }

/* ==========================================
   Modal de búsqueda — tablet/mobile (<1024px)
   Reutiliza .ls-preview-card / .ls-preview-cat / .ls-cat-preview-item /
   .ls-preview-btn (definidas arriba) para las pantallas de detalle de
   categoría y producto — así se ven igual que la vista previa de escritorio.
   ========================================== */
.search-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: #fff;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}
.search-modal.open { transform: translateY(0); }
@media (min-width: 1024px) { .search-modal { display: none; } }
body.search-modal-lock { overflow: hidden; }

.search-modal__bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eceef0;
}
.search-modal__input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #F7F7F5;
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    min-width: 0;
}
.search-modal__icon { color: #7A8B99; flex-shrink: 0; width: 18px; height: 18px; }
.search-modal__input {
    flex: 1;
    min-width: 0;
    border: none;
    background: none;
    outline: none;
    font-size: 0.95rem;
    color: #0D1F3C;
    font-family: inherit;
}
.search-modal__clear {
    background: none; border: none; color: #7A8B99; cursor: pointer; padding: 0.15rem; flex-shrink: 0;
}
.search-modal__clear svg { width: 16px; height: 16px; display: block; }
.search-modal__close {
    background: none; border: none; color: #0D1F3C; cursor: pointer; padding: 0.3rem; flex-shrink: 0;
}
.search-modal__close svg { width: 1.4rem; height: 1.4rem; display: block; }

.search-modal__body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sm-list { padding: 0.4rem 0; }
.sm-section-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: #7A8B99;
    padding: 0.75rem 1.25rem 0.4rem;
}
.sm-cat-item, .sm-prod-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.8rem 1.25rem;
    border: none;
    border-bottom: 1px solid #f2f2f2;
    background: none;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}
.sm-cat-item svg:first-child { color: #C9A84C; flex-shrink: 0; }
.sm-cat-item span { flex: 1; font-size: 0.92rem; font-weight: 600; color: #0D1F3C; }
.sm-chevron { color: #ccc; flex-shrink: 0; }
.sm-prod-item img {
    width: 48px; height: 48px; object-fit: cover; border-radius: 6px;
    background: #F7F7F5; flex-shrink: 0;
}
.sm-prod-info { display: flex; flex-direction: column; min-width: 0; gap: 0.15rem; }
.sm-prod-name {
    font-size: 0.88rem; font-weight: 600; color: #0D1F3C;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sm-prod-code { font-size: 0.76rem; color: #7A8B99; }

.sm-ver-todos {
    display: block;
    text-align: center;
    padding: 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #C9A84C;
    text-decoration: none;
}

.sm-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem 1.25rem;
    border: none;
    border-bottom: 1px solid #eceef0;
    background: none;
    text-align: left;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    color: #0D1F3C;
    cursor: pointer;
}

.sm-empty { padding: 3rem 1.5rem; text-align: center; }
.sm-empty p { font-size: 0.9rem; color: #333; margin: 0 0 0.5rem; }
.sm-empty-sub { color: #7A8B99 !important; font-size: 0.82rem !important; }
.sm-empty-sub a { color: #C9A84C; font-weight: 600; }

/* Las cards de vista previa (.ls-preview-card) fuera de .ls-col-preview
   necesitan su propio padding/fondo dentro del modal. */
.search-modal .ls-preview-card { padding: 1.25rem; background: #fff; }
.search-modal .ls-preview-cat { background: #fff; }
.search-modal .ls-preview-img { max-width: 280px; margin-inline: auto; width: 100%; }