/* FlowCoffee - Ô chọn, Chọn ngày, Chọn giờ (assets/js/fc-pick.js). Dùng token màu chung (--bg-raised, --line...), có chế độ tối.
   Nút hiển thị lấy lại class của ô gốc (fca-input, co-input...) nên khớp các ô bên cạnh; mặc định theo design: cao 44px, bo 14px. */

/* Ô gốc: vẫn trong form, chỉ ẩn khỏi mắt */
.fcp-native { position: absolute !important; width: 1px !important; height: 1px !important; min-width: 0 !important; margin: 0 !important; padding: 0 !important; border: 0 !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden !important; clip-path: inset(50%) !important; white-space: nowrap !important; }

/* ---------- Ô ---------- */
:where(.fcp-trigger) { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 14px; padding: 0 12px 0 14px; background-color: var(--bg-raised); color: var(--text-strong); font-size: 14px; line-height: 20px; }
.fcp-trigger { display: flex; align-items: center; gap: 10px; min-width: 0; text-align: left; font-family: inherit; cursor: pointer; -webkit-appearance: none; appearance: none; box-sizing: border-box; }
.fcp-trigger.fcp-trigger { background-image: none; }
.fcp-trigger[hidden] { display: none !important; }
.fcp-val { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcp-trigger.is-empty .fcp-val { color: var(--text-muted); }
.fcp-ico { flex: 0 0 auto; color: var(--text-muted); }
.fcp-chev { flex: 0 0 auto; margin-left: auto; transition: transform .15s ease; }
.fcp-trigger[aria-expanded="true"] .fcp-chev { transform: rotate(180deg); }
.fcp-trigger:focus { outline: none; }
.fcp-trigger:focus-visible { border-color: var(--line-strong); box-shadow: 0 0 0 1px var(--line-strong); }
.fcp-trigger.fcp-trigger[aria-expanded="true"] { border-color: var(--line-strong); box-shadow: 0 0 0 0.5px var(--line-strong), 0 0 0 4px rgba(159, 139, 231, 0.25); }
.fcp-trigger.fcp-trigger.is-invalid, .fcp-trigger.fcp-trigger[aria-invalid="true"] { border-color: #d75852; box-shadow: 0 0 0 0.5px #d75852, 0 0 0 4px rgba(215, 88, 82, 0.12); }
.fcp-trigger.fcp-trigger:disabled { background-color: var(--bg-sunken); color: var(--text-muted); cursor: not-allowed; opacity: 1; }
.fcp-trigger:disabled .fcp-val { color: var(--text-muted); }
/* Ô kiểu gạch chân (trang khách .fc-select) */
.fcp-trigger.fc-select { border: 0; border-bottom: 1.5px solid var(--line); border-radius: 0; background-color: transparent; padding: 10px 2px; height: auto; }
.fcp-trigger.fc-select[aria-expanded="true"], .fcp-trigger.fc-select:focus-visible { border-bottom-color: var(--line-strong); box-shadow: 0 1.5px 0 0 var(--line-strong); }
.fcp-trigger.fc-select.is-invalid, .fcp-trigger.fc-select[aria-invalid="true"] { border-bottom-color: #d75852; box-shadow: 0 1.5px 0 0 #d75852; }
.fcp-trigger.fc-select:disabled { background-color: transparent; }
.fcp-help { display: block; margin-top: 6px; font-size: 12px; line-height: 16px; color: var(--text-muted); }
.fcp-help[hidden] { display: none; }

/* Nút chia đoạn: select có data-fcp-seg, 2 đến 4 lựa chọn ngắn */
.fcp-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; max-width: 100%; min-height: 44px; padding: 3px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-sunken); box-sizing: border-box; vertical-align: middle; }
.fcp-seg[hidden] { display: none !important; }
.fcp-seg--full { display: flex; width: 100%; max-width: 560px; }
.fcp-seg.is-2x2 .fcp-seg__b { flex-basis: calc(50% - 2px); }
.fcp-seg.is-measure .fcp-seg__b { flex: none; font-weight: 400; }
.fcp-seg.is-measure.is-bold .fcp-seg__b { font-weight: 600; }
.fcp-seg__b { flex: 1 1 auto; min-height: 36px; padding: 0 12px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--text-muted); font: inherit; font-size: 14px; line-height: 20px; white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.fcp-seg__b:hover:not(:disabled):not(.is-sel) { color: var(--text-strong); }
.fcp-seg__b.is-sel { background: var(--bg-raised); border-color: var(--line); color: var(--text-strong); font-weight: 600; box-shadow: 0 1px 2px rgba(22, 22, 22, 0.08); }
.fcp-seg__b:focus { outline: none; }
.fcp-seg__b:focus-visible { border-color: var(--line-strong); box-shadow: 0 0 0 0.5px var(--line-strong), 0 0 0 4px rgba(159, 139, 231, 0.25); }
.fcp-seg__b:disabled { cursor: not-allowed; opacity: 0.5; }
.fcp-seg.is-disabled .fcp-seg__b:disabled { opacity: 1; }
.fcp-seg.is-invalid { border-color: #d75852; box-shadow: 0 0 0 0.5px #d75852, 0 0 0 4px rgba(215, 88, 82, 0.12); }
@media (max-width: 640px) { .fcp-seg { min-height: 48px; } .fcp-seg__b { min-height: 40px; padding: 0 10px; } }

/* ---------- Bảng nổi (PC) và tấm trượt (mobile) ---------- */
.fcp-pop, .fcp-sheet, .fcp-inline { font-family: var(--font-display); color: var(--text-strong); font-size: 14px; line-height: 20px; box-sizing: border-box; text-align: left; }
.fcp-pop *, .fcp-sheet *, .fcp-inline * { box-sizing: border-box; }
.fcp-pop { position: fixed; z-index: 75; max-width: calc(100vw - 16px); background: var(--bg-raised); border: 1px solid var(--line-subtle); border-radius: 18px; box-shadow: 0 16px 40px rgba(22, 22, 22, 0.16); padding: 8px; }
.fcp-pop--date, .fcp-pop--range, .fcp-pop--datetime, .fcp-pop--month, .fcp-pop--time { padding: 12px; }
.fcp-pop--select { width: max-content; max-width: min(420px, calc(100vw - 16px)); }
.fcp-pop--time { width: 320px; }
.fcp-back { position: fixed; inset: 0; z-index: 76; background: rgba(22, 22, 22, 0.4); }
.fcp-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 77; max-height: 86vh; max-height: 86dvh; display: flex; flex-direction: column; background: var(--bg-raised); border-radius: 24px 24px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.2); padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); animation: fcp-up .22s ease; }
@keyframes fcp-up { from { transform: translateY(100%); } }
.fcp-sheet__bar { align-self: center; width: 40px; height: 4px; border-radius: 99px; background: var(--line-subtle); margin-bottom: 8px; flex: 0 0 auto; }
.fcp-sheet__head { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; flex: 0 0 auto; }
.fcp-sheet__t { flex: 1 1 auto; min-width: 0; font-size: 17px; line-height: 24px; font-weight: 600; }
.fcp-x { width: 40px; height: 40px; flex: 0 0 auto; border: 0; border-radius: 50%; background: var(--bg-sunken); color: var(--text-strong); font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.fcp-sheet > .fcp-sel, .fcp-sheet > .fcp-date, .fcp-sheet > .fcp-time, .fcp-sheet > .fcp-mon { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; overflow-y: auto; }
.fcp-sheet > .fcp-sel { overflow: hidden; }

/* ---------- Ô chọn ---------- */
.fcp-search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; margin-bottom: 6px; border-radius: 12px; background: var(--bg-sunken); color: var(--text-muted); flex: 0 0 auto; }
.fcp-search input { flex: 1 1 auto; min-width: 0; height: 40px; border: 0; padding: 0; background: transparent; font: inherit; font-size: 14px; color: var(--text-strong); outline: none; }
.fcp-search input::placeholder { color: var(--text-muted); opacity: 1; }
.fcp-sheet .fcp-search input { font-size: 16px; } /* iOS không phóng to khi gõ */
.fcp-list { max-height: 280px; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 2px; outline: none; }
.fcp-sheet .fcp-list { max-height: none; flex: 1 1 auto; min-height: 0; }
.fcp-grp { padding: 8px 12px 4px; font-size: 11px; line-height: 16px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-muted); }
.fcp-opt { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 12px; border-radius: 12px; cursor: pointer; flex: 0 0 auto; }
.fcp-opt__t { flex: 1 1 auto; min-width: 0; }
.fcp-opt__m { flex: 0 0 auto; font-size: 12px; color: var(--text-muted); }
.fcp-chk { flex: 0 0 auto; opacity: 0; }
.fcp-opt.is-active { background: rgba(159, 139, 231, 0.14); }
.fcp-opt.is-sel { background: var(--bg-sunken); font-weight: 600; }
.fcp-opt.is-sel .fcp-chk { opacity: 1; }
.fcp-opt.is-sel.is-active { box-shadow: inset 0 0 0 1.5px rgba(159, 139, 231, 0.6); }
.fcp-opt[aria-disabled="true"] { color: var(--text-subtle); cursor: not-allowed; }
.fcp-opt mark { background: rgba(221, 241, 96, 0.8); color: #161616; border-radius: 3px; padding: 0 1px; }
.fcp-none { padding: 20px 12px; text-align: center; font-size: 13px; line-height: 18px; color: var(--text-muted); }

/* ---------- Lịch ---------- */
.fcp-date__wrap { display: flex; gap: 16px; align-items: flex-start; }
.fcp-presets { flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px; padding-right: 12px; border-right: 1px solid var(--line-subtle); }
.fcp-preset { height: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text-strong); font: inherit; font-size: 13px; font-weight: 500; text-align: left; white-space: nowrap; cursor: pointer; }
.fcp-preset:hover { background: rgba(159, 139, 231, 0.12); }
.fcp-preset.is-on { background: var(--bg-sunken); font-weight: 700; }
.fcp-month { flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fcp-month__head { display: flex; align-items: center; gap: 4px; }
.fcp-month__t { flex: 1 1 auto; text-align: center; font-size: 15px; line-height: 36px; font-weight: 700; }
.fcp-nav { width: 36px; height: 36px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: var(--text-strong); cursor: pointer; }
.fcp-nav:hover { background: var(--bg-sunken); }
.fcp-nav-sp { width: 36px; flex: 0 0 auto; }
.fcp-grid { display: flex; flex-direction: column; gap: 2px; }
.fcp-row { display: grid; grid-template-columns: repeat(7, minmax(40px, 1fr)); } /* giãn đều theo bề ngang bảng, không dồn về bên trái */
.fcp-dow { height: 28px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--text-muted); }
.fcp-cell { height: 40px; display: flex; align-items: center; justify-content: center; }
.fcp-cell.is-band { background: rgba(159, 139, 231, 0.18); }
.fcp-cell.is-bs { background: linear-gradient(90deg, transparent 50%, rgba(159, 139, 231, 0.18) 50%); }
.fcp-cell.is-be { background: linear-gradient(90deg, rgba(159, 139, 231, 0.18) 50%, transparent 50%); }
.fcp-day { position: relative; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-strong); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.fcp-day:hover { background: var(--bg-sunken); }
.fcp-day:focus { outline: none; }
.fcp-day:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.fcp-day.is-today { box-shadow: inset 0 0 0 1.5px var(--line-strong); font-weight: 700; }
.fcp-day.is-today:focus-visible { box-shadow: inset 0 0 0 1.5px var(--line-strong), 0 0 0 2px var(--accent); }
.fcp-day.is-sel { background: var(--bg-inverse); color: var(--text-inverse); font-weight: 700; }
.fcp-day[aria-disabled="true"] { color: var(--text-subtle); cursor: default; background: transparent; }
.fcp-day.is-dot::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: #60b358; }
.fcp-day.is-dot.is-sel::after { background: var(--accent-alt); }
.fcp-dtime { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--line-subtle); }
.fcp-dtime label, .fcp-other { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); white-space: nowrap; }
.fcp-tin { width: 84px; height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--bg-raised); font: inherit; font-size: 14px; text-align: center; color: var(--text-strong); }
.fcp-tin:focus { outline: none; border-color: var(--line-strong); box-shadow: 0 0 0 1px var(--line-strong); }
.fcp-sheet .fcp-tin { font-size: 16px; height: 44px; }
.fcp-err { flex: 1 0 100%; font-size: 12px; line-height: 16px; color: #b23a35; }
.fcp-err[hidden] { display: none; }
[data-theme="dark"] .fcp-err { color: #f08a84; }
.fcp-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--line-subtle); flex: 0 0 auto; }
.fcp-note { flex: 1 1 140px; min-width: 0; font-size: 13px; line-height: 18px; color: var(--text); }
.fcp-btn { height: 36px; padding: 0 16px; border-radius: 99px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.fcp-btn--line { border: 1px solid var(--line); background: transparent; color: var(--text-strong); }
.fcp-btn--dark { border: 0; background: var(--bg-inverse); color: var(--text-inverse); }
.fcp-sheet .fcp-btn { height: 44px; }

/* Chọn tháng */
.fcp-mon { width: 280px; max-width: 100%; }
.fcp-mgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.fcp-mbtn { height: 44px; border: 1px solid var(--line-subtle); border-radius: 12px; background: var(--bg-raised); color: var(--text-strong); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.fcp-mbtn.is-today { border-color: var(--line-strong); }
.fcp-mbtn.is-sel { background: var(--bg-inverse); color: var(--text-inverse); border-color: var(--bg-inverse); }
.fcp-mbtn[aria-disabled="true"] { color: var(--text-subtle); cursor: default; }

/* ---------- Giờ ---------- */
.fcp-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; max-height: 228px; overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.fcp-slot { height: 40px; border: 1px solid var(--line-subtle); border-radius: 12px; background: var(--bg-raised); color: var(--text-strong); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.fcp-slot:hover { border-color: var(--line); }
.fcp-slot:focus { outline: none; }
.fcp-slot:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.fcp-slot.is-sel { background: var(--bg-inverse); color: var(--text-inverse); border-color: var(--line-strong); }
.fcp-slot.is-busy { background: var(--bg-sunken); color: var(--text-subtle); text-decoration: line-through; cursor: not-allowed; border-color: var(--line-subtle); }
.fcp-sheet .fcp-slots { max-height: 50vh; }
.fcp-sheet .fcp-slot { height: 44px; }

/* Lịch hiện sẵn trong trang (data-fcp-inline) */
.fcp-inline { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-raised); }
.fcp-inline[hidden] { display: none; }
.fcp-inline .fcp-date__wrap { display: block; }
.fcp-inline .fcp-row { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.fcp-inline .fcp-note { flex: 1 1 auto; }

/* Mobile: lịch giãn hết bề ngang, ô ngày 44px */
.fcp-sheet .fcp-date__wrap { display: block; }
.fcp-sheet .fcp-row { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.fcp-sheet .fcp-cell { height: 44px; }
.fcp-sheet .fcp-day { width: 44px; height: 44px; }
.fcp-sheet .fcp-mon { width: auto; }

@media (prefers-reduced-motion: reduce) { .fcp-sheet { animation: none; } .fcp-chev { transition: none; } }
