/* 2026/09/26 ツー: form theo layout app mobile (ExpoClientNew NeedSupport/SafeInfo).
   - .fm-stepper : ô "Tổng số người" dạng [-] số [+] — dùng cho CẢ admin (Bootstrap 3) lẫn màn bản đồ (Bootstrap 5)
   - .fm-form    : 5 form đăng ký trên màn bản đồ (header nền nhạt, icon ở nhãn, đối tượng ưu tiên dạng thẻ)
   Icon: font MaterialCommunityIcons của app mobile, đã cắt còn 19 glyph (doc/scripts/python/subset_mdi_icons.py). */
@font-face {
    font-family: "mdi-form";
    src: url("../fonts/mdi-form.woff") format("woff");
    font-display: block;
}

.fm-mdi {
    display: inline-block;
    font-family: "mdi-form";
    font-style: normal;
    font-weight: normal;
    line-height: 1;
    speak: never;
    -webkit-font-smoothing: antialiased;
}
.fm-mdi::before { display: block; }
.fm-mdi[data-i="alert-circle"]::before { content: "\F0028"; }
.fm-mdi[data-i="account-group"]::before { content: "\F0849"; }
.fm-mdi[data-i="phone"]::before { content: "\F03F2"; }
.fm-mdi[data-i="square-edit-outline"]::before { content: "\F090C"; }
.fm-mdi[data-i="map-marker"]::before { content: "\F034E"; }
.fm-mdi[data-i="heart"]::before { content: "\F02D1"; }
.fm-mdi[data-i="human-pregnant"]::before { content: "\F05CF"; }
.fm-mdi[data-i="human-child"]::before { content: "\F02E7"; }
.fm-mdi[data-i="human-cane"]::before { content: "\F1581"; }
.fm-mdi[data-i="wheelchair-accessibility"]::before { content: "\F05A4"; }
.fm-mdi[data-i="minus"]::before { content: "\F0374"; }
.fm-mdi[data-i="plus"]::before { content: "\F0415"; }
.fm-mdi[data-i="email-outline"]::before { content: "\F01F0"; }
.fm-mdi[data-i="clock-outline"]::before { content: "\F0150"; }
.fm-mdi[data-i="image-multiple"]::before { content: "\F02F9"; }
.fm-mdi[data-i="shield-check"]::before { content: "\F0565"; }
.fm-mdi[data-i="hand-heart"]::before { content: "\F10F1"; }
.fm-mdi[data-i="alert"]::before { content: "\F0026"; }
.fm-mdi[data-i="check-circle"]::before { content: "\F05E0"; }
.fm-mdi[data-i="plus-circle"]::before { content: "\F0417"; }
.fm-mdi[data-i="close-circle"]::before { content: "\F0159"; }

/* ---------- bộ tăng giảm ---------- */
.fm-stepper {
    display: inline-flex !important;
    align-items: stretch;
    flex: 0 0 auto;
    max-width: 100%;
    height: 44px;
    border: 1px solid #d8e2e0;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    vertical-align: middle;
}
.fm-stepper:focus-within { border-color: #0f766e; box-shadow: 0 0 0 3px rgba(15, 118, 110, .15); }
.fm-stepper .fm-step {
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    background: #f1f5f4;
    color: #182742;
    font-size: 20px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.fm-stepper .fm-step:hover { background: #e3ecea; }
.fm-stepper .fm-step:active { background: #d4e2df; }
.fm-stepper .fm-step[aria-disabled="true"] { color: #a3b1ae; cursor: default; background: #f1f5f4; }
.fm-stepper > input[data-fm-stepper] {
    float: none !important;
    flex: 0 0 48px;
    width: 48px !important;
    min-width: 0;
    min-height: 0 !important; /* CSS modal cũ đặt min-height 40–44px → ô cao hơn khung, số bị đẩy xuống */
    height: auto !important;
    align-self: stretch;
    margin: 0 !important;
    padding: 0 4px !important;
    border: 0 !important;
    border-left: 1px solid #d8e2e0 !important;
    border-right: 1px solid #d8e2e0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    color: #182742;
    font-size: 18px !important;
    font-weight: 700;
    line-height: normal !important;
    text-align: center !important;
}
.fm-stepper input:focus { outline: none; }
.fm-stepper input:disabled,
.fm-stepper input[readonly] { background: #f7faf9 !important; }
/* admin (Bootstrap 3) ô thấp hơn cho khớp các ô 34px cạnh bên */
body.no-skin .fm-stepper { height: 34px; border-radius: 8px; }
body.no-skin .fm-stepper .fm-step { flex-basis: 34px; width: 34px; font-size: 18px; }
/* QC No78 (2026/10/07): modern-theme "body.no-skin input[type=text]" (0,2,2 + !important) thắng phần bỏ viền / bo góc
   của .fm-stepper > input (0,2,1) ⇒ ô số có khung bo góc riêng, trông to hơn cả cụm. Nhắc lại ở độ ưu tiên cao hơn. */
body.no-skin .fm-stepper > input[data-fm-stepper] {
    flex-basis: 44px; width: 44px !important; font-size: 16px !important;
    border: 0 !important; border-left: 1px solid #d8e2e0 !important; border-right: 1px solid #d8e2e0 !important;
    border-radius: 0 !important; box-shadow: none !important;
}
body.no-skin .fm-stepper > input[data-fm-stepper]:focus { border-color: #d8e2e0 !important; box-shadow: none !important; }
@media (pointer: coarse) {
    /* No78: 40 -> 36 cho gọn (bằng ô nhập 36px cạnh bên) */
    body.no-skin .fm-stepper { height: 36px; }
    body.no-skin .fm-stepper .fm-step { flex-basis: 36px; width: 36px; }
}
/* thông báo lỗi của Bootstrap 5 đi theo input: input đã bị bọc nên phải chỉ lại */
.was-validated .fm-stepper:has(input:invalid) { border-color: #dc3545; }
.was-validated .fm-stepper:has(input:invalid) ~ .invalid-feedback { display: block; }

/* ---------- form đăng ký trên màn bản đồ ---------- */
.fm-form { --fm-c: #d63341; --fm-rgb: 214, 51, 65; --fm-ink: #b4232f; }
.fm-form.fm-tone-success { --fm-c: #047857; --fm-rgb: 4, 120, 87; --fm-ink: #065f46; }
.fm-form.fm-tone-warning { --fm-c: #c2410c; --fm-rgb: 194, 65, 12; --fm-ink: #9a3412; }

body.map-page .fm-form .modal-content { border: 0; border-radius: 16px; overflow: hidden; }
body.map-page .fm-form .modal-header {
    align-items: center;
    padding: 14px 16px 12px;
    background: rgba(var(--fm-rgb), .09);
    border-bottom: 2px solid var(--fm-c);
    box-shadow: none;
}
body.map-page .fm-form .modal-title { margin: 0; color: #182742; font-size: 19px; font-weight: 800; line-height: 1.25; }
.fm-form .modal-body { padding: 14px 16px 6px; }

.fm-form .fm-label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: #182742;
    font-size: 16px;
    font-weight: 700 !important;
    line-height: 1.3;
}
.fm-form .fm-label > .text-danger { margin-left: -6px; }
.fm-form .fm-ico {
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(var(--fm-rgb), .1);
    color: var(--fm-c);
    font-size: 19px;
}
.fm-form .form-control,
.fm-form .form-select { min-height: 44px; border-color: #d8e2e0; border-radius: 12px; }
.fm-form .form-control:focus,
.fm-form .form-select:focus { border-color: var(--fm-c); box-shadow: 0 0 0 3px rgba(var(--fm-rgb), .15); }

/* hàng "Tổng số người": nhãn trái, bộ tăng giảm phải (như app) */
.fm-form .fm-count-row { display: flex !important; flex-wrap: nowrap; align-items: center; justify-content: space-between !important; gap: 8px 12px !important; }
.fm-form .fm-count-row > .fm-label { flex: 1 1 auto; min-width: 0; width: auto; margin-bottom: 0; }
.fm-form .fm-count-row { flex-wrap: wrap; }
.fm-form .fm-count-row > .fm-label + .fm-stepper { margin-left: auto; }
.fm-form .fm-count-row > .invalid-feedback { flex-basis: 100%; margin-top: 0; }

/* đối tượng ưu tiên: lưới 2×2 thẻ có icon màu */
.fm-form .fm-prio { margin: 12px 0 14px; }
.fm-form .fm-prio > .fm-label { margin-bottom: 8px; }
.fm-form .fm-prio-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fm-form .fm-opt { position: relative; margin: 0; }
.fm-form .fm-opt input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}
.fm-form .fm-opt label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    width: 100%;
    max-width: none;
    margin: 0 !important;
    padding: 5px 10px !important;
    border: 1px solid rgba(var(--fm-rgb), .28);
    border-radius: 12px;
    background: #fff;
    color: #182742;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.25;
    transition: background-color .15s, border-color .15s;
}
.fm-form .fm-opt label .fm-mdi { flex: 0 0 auto; font-size: 20px; }
/* dấu tích nổi góc phải: không chiếm chỗ của chữ */
.fm-form .fm-opt label .fm-check { position: absolute; top: -7px; right: -7px; padding: 1px; border-radius: 50%; background: #fff; color: var(--fm-c); font-size: 18px; display: none; }
.fm-form .fm-opt input:checked + label { border-color: var(--fm-c); background: rgba(var(--fm-rgb), .08); font-weight: 700; }
.fm-form .fm-opt input:checked + label .fm-check { display: block; }
.fm-form .fm-opt input:focus-visible + label { outline: 3px solid rgba(var(--fm-rgb), .45); outline-offset: 1px; }

.fm-form .modal-footer { gap: 10px; padding: 12px 16px; border-top: 1px solid #e3ebe9; }
.fm-form .modal-footer > .btn { flex: 1 1 0; min-height: 48px; margin: 0; border-radius: 12px; font-size: 16px; font-weight: 700; }

@media (max-width: 359.98px) {
    .fm-form .fm-prio-grid { grid-template-columns: minmax(0, 1fr); }
}

/* bộ tăng giảm trên form bản đồ: gọn hơn cho cân với nhãn */
.fm-form .fm-stepper { height: 38px; border-radius: 10px; }
.fm-form .fm-stepper .fm-step { flex-basis: 34px; width: 34px; font-size: 18px; }
.fm-form .fm-stepper > input[data-fm-stepper] { flex-basis: 42px; width: 42px !important; font-size: 16px !important; }

/* số điện thoại: xếp dọc như app, SĐT phụ ẩn tới khi bấm "Thêm số" */
.fm-form .phone-number-container { display: flex; flex-direction: column; gap: 12px; }
.fm-form .phone-number-container > .phone-number-item { width: 100%; }
.fm-form .phone-number-secondary[hidden] { display: none !important; }
.fm-form .fm-label-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.fm-form .fm-label-row > .fm-label { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }
.fm-form .fm-add-phone {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 36px;
    margin: 0;
    padding: 4px 6px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #1d4ed8;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.fm-form .fm-add-phone .fm-mdi { font-size: 18px; }
.fm-form .fm-add-phone:hover { background: rgba(29, 78, 216, .08); }
.fm-form .fm-add-phone:focus-visible { outline: 3px solid rgba(29, 78, 216, .4); outline-offset: 1px; }

/* gọn chiều dọc để form vừa màn điện thoại, ít phải cuộn */
.fm-form .fm-ico { flex-basis: 30px; width: 30px; height: 30px; border-radius: 9px; font-size: 17px; }
.fm-form .fm-label { margin-bottom: 6px; }
.fm-form .modal-body textarea.form-control { min-height: 72px; height: 72px; }
