/*
 * Ô tìm theo tên + gợi ý trên trang danh sách khách sạn / tour (theme Danang24h).
 * Partial: themes/Danang24h/Layout/parts/listing-search.blade.php · JS: ../js/listing-search.js
 *
 * Class riêng lsg-*, KHÔNG mượn class của theme (.form-control, .btn, .row…): theme style trần các class
 * đó kèm !important nên cùng markup ra giao diện khác nhau. Màu bám biến của theme, có giá trị dự phòng.
 */
.lsg-head {
    --lsg-gap: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--lsg-gap);
}

.lsg-head > :first-child {
    flex: 1 1 320px;
    min-width: 0;
    margin: 0;
}

.lsg-head > .lsg {
    flex: 0 1 440px;
}

.lsg {
    --lsg-primary: var(--primary-color, #0366D6);
    --lsg-text: var(--text-color, #072A47);
    --lsg-muted: #5b6474;
    --lsg-border: #d5dfec;
    --lsg-line: #edf1f7;
    --lsg-hover: #f2f7fe;
    --lsg-radius: 999px;
    position: relative;
    width: 100%;
    margin: 0;
    font-family: inherit;
    color: var(--lsg-text);
}

/* ---------- Ô nhập ---------- */
.lsg__box {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 48px;
    padding: 4px 4px 4px 16px;
    border: 1px solid var(--lsg-border);
    border-radius: var(--lsg-radius);
    background: #fff;
    box-shadow: 0 1px 2px rgba(7, 42, 71, .04);
    transition: border-color .15s, box-shadow .15s;
}

.lsg__box:hover {
    border-color: #b9c8dc;
}

.lsg.is-focus .lsg__box {
    border-color: var(--lsg-primary);
    box-shadow: 0 0 0 4px rgba(3, 102, 214, .12);
}

.lsg__icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    color: var(--lsg-muted);
}

.lsg.is-focus .lsg__icon {
    color: var(--lsg-primary);
}

.lsg .lsg__input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0 4px 0 8px;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
    color: var(--lsg-text);
    font: inherit;
    font-size: 15px;
    line-height: 1.4;
    -webkit-appearance: none;
    appearance: none;
}

/* main.css của Danang24h khai "input[type=search]:focus { box-shadow: inset 0 -1px 0 #ddd !important }"
   (cả type=text cũng dính) ⇒ vệt gạch dưới chữ khi đang gõ. Chỉ !important mới đè được !important. */
.lsg .lsg__input:focus {
    outline: 0 !important;
    box-shadow: none !important;
}

.lsg .lsg__input::placeholder {
    color: #8a93a3;
    opacity: 1;
}

/* Bỏ nút X mặc định của type=search — đã có nút xoá riêng, cùng kiểu mọi trình duyệt */
.lsg .lsg__input::-webkit-search-cancel-button,
.lsg .lsg__input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

.lsg__spinner {
    flex: 0 0 auto;
    display: none;
    width: 18px;
    height: 18px;
    margin: 0 4px;
    border: 2px solid rgba(3, 102, 214, .18);
    border-top-color: var(--lsg-primary);
    border-radius: 50%;
    animation: lsg-spin .7s linear infinite;
}

.lsg.is-loading .lsg__spinner {
    display: block;
}

.lsg__clear {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--lsg-muted);
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

.lsg__clear:hover {
    background: var(--lsg-line);
    color: var(--lsg-text);
}

.lsg__clear[hidden],
.lsg.is-loading .lsg__clear {
    display: none;
}

.lsg__clear svg {
    width: 16px;
    height: 16px;
}

.lsg__submit {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    margin: 0;
    padding: 0 20px;
    border: 0;
    border-radius: var(--lsg-radius);
    background: var(--lsg-primary);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: filter .15s, transform .1s;
}

.lsg__submit:hover {
    filter: brightness(1.08);
}

.lsg__submit:active {
    transform: scale(.98);
}

.lsg__submit:focus-visible,
.lsg__clear:focus-visible,
.lsg__more:focus-visible,
.lsg__retry:focus-visible {
    outline: 2px solid var(--lsg-primary);
    outline-offset: 2px;
}

.lsg__submit svg {
    display: none;
    width: 18px;
    height: 18px;
}

/* ---------- Hộp gợi ý ---------- */
.lsg__panel {
    position: absolute;
    z-index: 1050;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 320px;
    max-height: min(520px, 70vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px;
    border: 1px solid var(--lsg-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(7, 42, 71, .14), 0 2px 8px rgba(7, 42, 71, .06);
    animation: lsg-pop .14s ease-out;
    text-align: left;
}

.lsg__panel[hidden] {
    display: none;
}

/* Đang tải lượt mới: giữ kết quả cũ nhưng làm mờ, tránh hộp nhấp nháy mỗi lần gõ thêm chữ */
.lsg.is-loading .lsg__list {
    opacity: .5;
    transition: opacity .15s;
}

.lsg__group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 4px 8px 4px;
    padding-top: 4px;
    color: var(--lsg-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.lsg__group + .lsg__item,
.lsg__item + .lsg__item {
    margin-top: 2px;
}

.lsg__item + .lsg__group {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--lsg-line);
}

.lsg__item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 8px;
    border-radius: 12px;
    color: var(--lsg-text);
    text-decoration: none;
    transition: background-color .12s;
}

.lsg__item:hover,
.lsg__item.is-active {
    background: var(--lsg-hover);
    color: var(--lsg-text);
    text-decoration: none;
}

.lsg__item.is-active {
    box-shadow: inset 0 0 0 1px rgba(3, 102, 214, .25);
}

/* Khung ảnh có biểu tượng nằm dưới: ảnh lỗi / chưa có ảnh thì JS gỡ thẻ img, biểu tượng lộ ra */
.lsg__thumb {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    overflow: hidden;
    border-radius: 10px;
    background: var(--lsg-line);
    color: #a8b3c4;
}

.lsg__thumb svg {
    width: 24px;
    height: 24px;
}

.lsg__thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lsg__body {
    flex: 1 1 auto;
    min-width: 0;
}

.lsg__title {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: var(--lsg-text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.lsg__title mark {
    padding: 0;
    border-radius: 2px;
    background: transparent;
    color: var(--lsg-primary);
    font-weight: 700;
}

.lsg__sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin-top: 4px;
    color: var(--lsg-muted);
    font-size: 12px;
    line-height: 1.4;
}

.lsg__sub > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.lsg__sub svg {
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
}

.lsg__stars {
    color: #b7791f;
    letter-spacing: 1px;
}

.lsg__price {
    flex: 0 0 auto;
    max-width: 40%;
    text-align: right;
    line-height: 1.3;
}

.lsg__price strong {
    display: block;
    color: var(--lsg-primary);
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.lsg__price small {
    color: var(--lsg-muted);
    font-size: 12px;
}

.lsg__price.is-contact strong {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--lsg-line);
    color: var(--lsg-muted);
    font-size: 12px;
    font-weight: 600;
}

/* Chân hộp: xem tất cả */
.lsg__foot {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--lsg-line);
}

.lsg__more {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--lsg-primary);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.lsg__more:hover,
.lsg__more.is-active {
    background: var(--lsg-hover);
    color: var(--lsg-primary);
    text-decoration: none;
}

.lsg__more.is-secondary {
    color: var(--lsg-text);
    font-weight: 500;
}

.lsg__more svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

/* Trạng thái: đang tải lần đầu (khung xương), rỗng, lỗi */
.lsg__skel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
}

.lsg__skel i {
    display: block;
    border-radius: 8px;
    background: linear-gradient(90deg, #eef2f7 25%, #f7f9fc 37%, #eef2f7 63%);
    background-size: 400% 100%;
    animation: lsg-shimmer 1.2s ease-in-out infinite;
}

.lsg__skel i:first-child {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    flex: 0 0 auto;
}

.lsg__skel span {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lsg__skel span i:first-child {
    width: 80%;
    height: 12px;
}

.lsg__skel span i + i {
    width: 45%;
    height: 10px;
}

.lsg__state {
    padding: 24px 16px;
    color: var(--lsg-muted);
    font-size: 14px;
    text-align: center;
}

.lsg__state svg {
    display: block;
    width: 32px;
    height: 32px;
    margin: 0 auto 8px;
    color: #a8b3c4;
}

.lsg__state strong {
    display: block;
    margin-bottom: 4px;
    color: var(--lsg-text);
    font-size: 15px;
}

.lsg__state .lsg__more {
    justify-content: center;
    margin-top: 8px;
}

.lsg__retry {
    margin-top: 12px;
    padding: 8px 16px;
    border: 1px solid var(--lsg-border);
    border-radius: 999px;
    background: #fff;
    color: var(--lsg-text);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.lsg__retry:hover {
    border-color: var(--lsg-primary);
    color: var(--lsg-primary);
}

.lsg__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

@keyframes lsg-spin {
    to { transform: rotate(360deg); }
}

@keyframes lsg-pop {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

@keyframes lsg-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .lsg__panel,
    .lsg__skel i {
        animation: none;
    }
}

/* ---------- Màn hẹp ---------- */
@media (max-width: 767.98px) {
    .lsg-head > .lsg {
        flex-basis: 100%;
    }

    .lsg__panel {
        min-width: 0;
        max-height: 60vh;
    }

    /* Nút tìm thu về biểu tượng để ô nhập còn đủ chỗ gõ */
    .lsg__submit {
        width: 40px;
        padding: 0;
    }

    .lsg__submit span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .lsg__submit svg {
        display: block;
    }

    .lsg__thumb {
        width: 48px;
        height: 48px;
    }

    .lsg__price {
        max-width: 36%;
    }
}
