/*
 * Icon kính lúp trên header + thanh tìm kiếm mở ra khi bấm — dùng chung mọi theme.
 * JS: public/module/search/js/header-search.js. Core tự nạp (App\Search\SearchAssets).
 *
 * Mọi class mang tiền tố bcs-hs- để không đụng CSS theme. Theme hay ép
 * `ul li { margin/padding }` và `button { ... }` nên chỗ nào cần chắc thì dùng !important.
 *
 * Lớp phủ: nền 99990, thanh tìm 99991 — dưới khung gợi ý Meilisearch (99999,
 * search-dropdown.css) để danh sách gợi ý nổi lên trên thanh tìm.
 */

/* ---------- Icon trên header ---------- */
.bcs-hs-li {
    display: inline-flex !important;
    align-items: center;
    list-style: none !important;
}

.bcs-hs-wrap {
    display: inline-flex;
    align-items: center;
}

/* Icon dự phòng đứng trước nút ba gạch: chừa khoảng cho khỏi dính nút. */
.bcs-hs-wrap--truoc {
    margin-right: 6px;
    vertical-align: middle;
}

/* JS gắn cho cha của nút ba gạch khi cha xếp dọc — chỉ lúc icon dự phòng đang hiện. */
.bcs-hs-row {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
}

.bcs-hs-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: inherit;
    line-height: 1;
    cursor: pointer;
    box-shadow: none !important;
    transition: background-color .15s ease;
}

.bcs-hs-btn:hover,
.bcs-hs-btn[aria-expanded="true"] {
    background: rgba(0, 0, 0, .06) !important;
}

.bcs-hs-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.bcs-hs-btn svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* ---------- Thanh tìm kiếm ---------- */
.bcs-hs-backdrop,
.bcs-hs-panel {
    display: none;
}

html.bcs-hs-open .bcs-hs-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 99990;
    background: rgba(15, 23, 42, .45);
}

html.bcs-hs-open .bcs-hs-panel {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99991;
    padding: 16px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
    animation: bcs-hs-in .18s ease-out;
}

@keyframes bcs-hs-in {
    from { transform: translateY(-12px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

.bcs-hs-form {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 760px;
    margin: 0 auto !important;
}

.bcs-hs-field {
    position: relative;
    flex: 1;
    min-width: 0;
}

.bcs-hs-field__icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    line-height: 0;
}

.bcs-hs-input {
    display: block;
    width: 100% !important;
    height: 48px !important;
    margin: 0 !important;
    padding: 0 14px 0 44px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    background: #fff !important;
    color: #0f172a !important;
    /* 16px: nhỏ hơn là iPhone tự phóng to trang khi focus. */
    font-size: 16px !important;
    line-height: 48px;
    box-shadow: none !important;
    outline: none;
}

.bcs-hs-input:focus {
    border-color: #64748b !important;
    box-shadow: 0 0 0 3px rgba(100, 116, 139, .2) !important;
}

.bcs-hs-submit {
    flex: none;
    height: 48px;
    margin: 0 !important;
    padding: 0 20px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: #0f172a !important;
    color: #fff !important;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.bcs-hs-submit:hover {
    opacity: .9;
}

.bcs-hs-close {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: #475569;
    cursor: pointer;
}

.bcs-hs-close:hover {
    background: #f1f5f9 !important;
}

/* Mobile: bỏ chữ "Tìm kiếm" cho ô nhập đủ rộng — Enter trên bàn phím là tìm. */
@media (max-width: 575px) {
    html.bcs-hs-open .bcs-hs-panel {
        padding: 12px;
    }

    .bcs-hs-submit {
        display: none;
    }
}
