/* ==========================================================================
   Live Search Dropdown
   ========================================================================== */
.mg-ls-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.04);
    margin-top: 8px;
    max-height: 480px;
    overflow-y: auto;
    padding: 6px 0;
}

.mg-ls-dropdown[hidden],
.mg-ls-empty[hidden],
.mg-ls-all[hidden] {
    display: none !important;
}

.mg-ls-results {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mg-ls-item + .mg-ls-item {
    border-top: 1px solid #f2eff5;
}

.mg-ls-item__link {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}

.mg-ls-item__link:hover {
    background: #f9f7fb;
}

.mg-ls-item__img {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    background: #f7f5f9;
    flex-shrink: 0;
}

.mg-ls-item__img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mg-ls-item__info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.mg-ls-item__title {
    font-size: 13.5px;
    font-weight: 600;
    color: #2d1c44;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.mg-ls-item__meta {
    font-size: 11.5px;
    color: #9a8eab;
}

.mg-ls-item__price {
    font-size: 14px;
    font-weight: 700;
    color: #490D78;
    white-space: nowrap;
    text-align: right;
}

.mg-ls-item__price del {
    opacity: 0.45;
    font-weight: 400;
    font-size: 12px;
}

.mg-ls-item__price ins {
    text-decoration: none;
}

/* Category pills in dropdown */
.mg-ls-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px 6px;
    align-items: center;
    border-top: 1px solid #f2eff5;
}

.mg-ls-cats:empty {
    display: none;
}

.mg-ls-cats__heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #a89bb8;
    letter-spacing: 0.06em;
    margin-right: 4px;
}

.mg-ls-cats__pill {
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 999px;
    background: #f4f0f8;
    color: #3a3048;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
}

.mg-ls-cats__pill:hover {
    background: #490D78;
    color: #fff;
}

/* Empty state */
.mg-ls-empty {
    padding: 28px 16px;
    text-align: center;
    color: #a89bb8;
    font-size: 14px;
}

/* "Ver todos" link */
.mg-ls-all {
    display: block;
    padding: 12px 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #490D78;
    text-decoration: none;
    border-top: 1px solid #f2eff5;
    transition: background 0.12s;
}

.mg-ls-all:hover {
    background: #f9f7fb;
}

/* Loading state on search input */
.mg-ls-loading {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' stroke='%23ccc' stroke-width='2' fill='none' stroke-dasharray='31.4' stroke-dashoffset='10'%3E%3CanimateTransform attributeName='transform' type='rotate' dur='.6s' from='0 12 12' to='360 12 12' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 18px !important;
}

/* Blocksy search modal: position dropdown correctly */
#search-modal .mg-ls-dropdown {
    position: fixed;
    top: auto;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    z-index: 1000000;
}
/* Ensure Blocksy modal search form has position context */
#search-modal .ct-search-form {
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    .mg-ls-dropdown {
        border-radius: 0 0 12px 12px;
        margin-top: 0;
        max-height: 320px;
    }
    .mg-ls-item__img {
        width: 40px;
        height: 40px;
    }
    .mg-ls-item__title {
        font-size: 13px;
    }
}


/* ==========================================================================
   Search Dropdown — fix overlap with page content
   ========================================================================== */
.mg-hero-search,
.mg-hero-banner__search {
    z-index: 100;
}
.mg-hero-search .mg-ls-dropdown,
.mg-hero-banner__search .mg-ls-dropdown {
    z-index: 9999;
    max-height: 380px;
    overflow-y: auto;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
