/* ═══════════════════════════════════════════════════════════════════════════════════════════════
   KHUNG DÙNG CHUNG CỦA MODULE BUỒNG PHÒNG — modal · nút · ô nhập.

   🔴 VÌ SAO PHẢI LÀ FILE CSS CẤP MODULE, ⛔ KHÔNG PHẢI `.razor.css`:
      CSS scoped gắn `[b-xxxxx]` của CHÍNH component vào mọi selector. Khi khung này còn nằm trong
      `PmsHousekeeping.razor.css`, nó biên dịch thành `.hk-overlay[b-xvhyudbo9g]` và ⛔ KHÔNG BAO GIỜ
      khớp phần tử của component khác. Hậu quả đã thấy tận mắt 2026-08-22: hai panel mới
      (`HkMaintenancePanel`, `HkLostFoundPanel`) render modal ra **thẳng luồng trang**, nút về kiểu
      trình duyệt mặc định — build XANH, `RZ10012` rỗng, 0 log.

   ⇒ MỘT nguồn cho MỌI component HK. ⛔ TUYỆT ĐỐI đừng chép các lớp này vào `.razor.css` của panel
     nào nữa: hai bản là hai bảng màu, và bản ít người nhìn hơn sẽ lặng lẽ trôi.

   ⚠️ Khai TAY trong `Ezibee.Web/Components/App.razor` dạng
      `_content/Ezibee.HK.Web/css/hk-shell.css?v=…` — **sửa file này thì PHẢI bump `?v=`**, nếu không
      bản cũ nằm trong cache trình duyệt lễ tân và deploy thành vá hụt.

   ⚠️ Biến `--…` KHÔNG khai ở đây: chúng đến từ `.hk-page` (và từ khối `!important` trong
      `PmsHousekeeping.razor.css` cho các lớp phủ nằm NGOÀI `.hk-page`). Modal của panel nằm TRONG
      `.hk-page` nên kế thừa bình thường.
   ═══════════════════════════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════
   MODAL / OVERLAY
   ═══════════════════════════════════════════════════════ */
.hk-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: hk-fade .18s ease;
}

@keyframes hk-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.hk-modal {
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--surface);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 0;
    animation: hk-pop .24s cubic-bezier(.2, .8, .2, 1);
}

@keyframes hk-pop {
    from {
        transform: scale(.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.hk-modal-sm {
    max-width: 420px;
}

.hk-modal-h {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fffaf2 0%, var(--surface) 100%);
    border-radius: 18px 18px 0 0;
}

    .hk-modal-h h3 {
        margin: 0;
        font-family: 'Fraunces', serif;
        font-size: 17px;
        font-weight: 600;
        color: var(--ink);
        display: flex;
        align-items: center;
        gap: 8px;
    }

        .hk-modal-h h3 i {
            color: var(--brand);
            font-style: normal;
            font-size: 12px;
        }

.hk-modal-x {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink-soft);
    cursor: pointer;
    font-size: 13px;
    display: grid;
    place-items: center;
    transition: all .15s;
}

    .hk-modal-x:hover {
        background: var(--danger-soft);
        color: var(--danger);
    }

/* Modal body — all direct children after .hk-modal-h get padding */
.hk-modal > :not(.hk-modal-h):not(.hk-acts) {
    padding-left: 20px;
    padding-right: 20px;
}

.hk-modal > :first-child:not(.hk-modal-h) {
    padding-top: 16px;
}

.hk-modal > p:first-of-type {
    padding-top: 16px;
}

/* Acts (modal footer) */
.hk-acts {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 0 0 18px 18px;
    flex-wrap: wrap;
}

/* Buttons inside modal/ctx — override generic hk-btn */
.hk-btn,
.hk-overlay .hk-btn,
.hk-ctx .hk-btn {
    height: 36px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

    .hk-btn:hover {
        background: var(--brand-softer);
        border-color: #e8cfa6;
    }

    .hk-btn:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.hk-btn-on {
    background: var(--brand-soft);
    border-color: #e8cfa6;
    color: var(--brand-deep);
}

/* ⚠️ Phải kèm `.hk-overlay .hk-btn-gold`: rule `.hk-overlay .hk-btn` (0,2,0) ở trên THẮNG `.hk-btn-gold` (0,1,0) ⇒
   mọi nút chính trong hộp thoại từng hiện TRẮNG (vá 14/10/2026 — nút "Tiếp ›" của phiếu Minibar). */
.hk-btn-gold,
.hk-overlay .hk-btn-gold,
.hk-ctx .hk-btn-gold {
    background: linear-gradient(180deg, var(--brand-light) 0%, var(--brand) 100%);
    color: #fff;
    border-color: var(--brand);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(184, 116, 42, .28);
}

    .hk-btn-gold:hover,
    .hk-overlay .hk-btn-gold:hover {
        background: linear-gradient(180deg, var(--brand) 0%, var(--brand-deep) 100%);
    }

.hk-btn-sky {
    background: var(--info-soft);
    color: var(--info);
    border-color: #c6dbf9;
}

/* Bulk action button (nhỏ, dùng trong bulk bar cũ — backward compat) */
.hk-bbtn {
    height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    font-family: inherit;
    font-size: 12px;
    color: var(--ink);
    cursor: pointer;
    transition: all .15s;
}

    .hk-bbtn:hover {
        background: var(--brand-softer);
    }

/* Form groups */
.hk-fg {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hk-fg2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.hk-fl {
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-mute);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.hk-fi {
    /* 🔴 `border-box` cho MOI o nhap: khong co reset `*{box-sizing}` nao voi toi day, nen mac dinh
       cua trinh duyet lam `<input>` (content-box, 36+2 vien = 38px) CAO HON `<select>` (border-box,
       36px) ngay tren cung mot hang — lech 2px co san, thay ro khi o "Diem ban" nam canh o "Tim". */
    box-sizing: border-box;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color .15s;
}

textarea.hk-fi {
    height: auto;
    padding: 8px 10px;
    min-height: 60px;
    font-family: inherit;
    resize: vertical;
}

.hk-fi:focus {
    border-color: var(--brand);
}

select.hk-fi {
    padding-right: 28px;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23a39a90' stroke-width='2.5'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

/* ── Modal ghi dich vu: rong hon vi danh muc co the vai tram dong ─────────────────────────── */
/* ⚠️ Bang bang CLASS chu ⛔ khong inline `width:` — `.hk-modal` co `max-width:520px`, ma max-width
   THANG width, nen `style="width:640px"` cua ban cu bi kep xuong 520px (modal hep hon ca y dinh). */
.hk-modal-lg {
    /* HEP ngang + CAO len (chu du an chot 2026-08-21): phieu nay chi co 3 cot so lieu, keo rong
       1040px thi mat hang nam le loi ben trai con nua ben phai bo trong; doi lai chieu cao de
       nhin duoc nhieu dong hon trong mot man. */
    max-width: min(720px, 96vw);
    display: flex;
    flex-direction: column;
    max-height: 94vh;
    overflow: hidden;                 /* vung cuon nam o `.hk-svc-list`, ⛔ khong cuon ca modal */
}

/* ═══════════════════════════════════════════════════════════════════════════════════════════════
   `hk-only-desk` / `hk-only-mob` — hiện/ẩn theo khổ màn hình.

   🔴 CHÚNG CHỈ ĐẶT `display: none`, ⛔ TUYỆT ĐỐI KHÔNG ÉP `display`.
      Cặp cũ `.desktop-only`/`.mobile-only` ép `display: flex !important` (sinh ra cho hai THANH
      điều khiển) ⇒ đặt lên `<table>` là bảng thành flex container, `<thead>`/`<tbody>` thành hai
      flex item NẰM CẠNH NHAU. Bẫy đã trả giá 2026-08-22.
      ⛔ Đừng "sửa gốc" `.desktop-only` — `.page-header`/`.controls` đang dựa vào `flex` ở đó.

   ⚠️ Khai Ở ĐÂY (CSS cấp module) chứ ⛔ không trong `.razor.css` của từng panel: trước 22/08 tối có
      tới BỐN bản rải rác, và `HkConfigPanel` thì thiếu hẳn ⇒ câu "chỉ mở trên máy tính" hiện CẢ
      TRÊN PC.
   ═══════════════════════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 959px) {
    .hk-only-desk { display: none !important; }
}

@media (min-width: 960px) {
    .hk-only-mob { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════════════════════════
   ĐIỆN THOẠI (≤959px): MỌI hộp thoại của module thành TẤM TỪ ĐÁY (14/10/2026, mockup
   docs/Style-UI-Ezibee/HK-mobile-thao-tac-phong.html).

   ⚠️ Khung ĐẦU của animation vẫn phải NHÌN THẤY được (bẫy 22/08: tab nền / máy yếu đứng ở khung
      đầu ⇒ tấm nằm ngoài màn hình) ⇒ chỉ dịch 14px, ⛔ translateY(100%).
   ⚠️ Chỉ đổi HÌNH, ⛔ đổi nội dung hay luồng — máy tính giữ nguyên (chủ dự án chốt 14/10).
   ═══════════════════════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 959px) {
    .hk-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .hk-overlay .hk-modal,
    .hk-overlay .hk-modal-sm,
    .hk-overlay .hk-modal-lg {
        max-width: 100%;
        width: 100%;
        max-height: 92vh;
        border-radius: 22px 22px 0 0;
        animation: hk-sheet-up .2s ease-out;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .hk-overlay .hk-modal-h {
        border-radius: 22px 22px 0 0;
        padding: 14px 16px;
        position: sticky;
        top: 0;
        z-index: 2;
    }

    .hk-overlay .hk-modal > :not(.hk-modal-h):not(.hk-acts) {
        padding-left: 16px;
        padding-right: 16px;
    }

    .hk-overlay .hk-acts {
        position: sticky;
        bottom: 0;
        z-index: 2;
        border-radius: 0;
        padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
    }

    /* Ngón tay, ⛔ chuột: nút ≥ 44px, ô nhập 16px (iOS phóng to cả trang khi chạm ô chữ < 16px). */
    .hk-overlay .hk-acts .hk-btn {
        height: 46px;
        flex: 1 1 auto;
        font-size: 15px;
    }

    .hk-overlay input:not([type=checkbox]):not([type=radio]),
    .hk-overlay select,
    .hk-overlay textarea {
        font-size: 16px;
    }

    .hk-overlay .hk-modal-x {
        width: 38px;
        height: 38px;
    }
}

@keyframes hk-sheet-up {
    from { transform: translateY(14px); }
    to   { transform: translateY(0); }
}
