/* Hội Câu — thành phần giao diện dùng chung (đi cùng assets/core.js). */

/* Nền chung cho mọi trang. */
* { box-sizing: border-box; }
a { color: inherit; text-decoration: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Thanh tab chính — hoicau_render_bottom_nav(); màu tab đang chọn lấy từ --nav. */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  display: flex; height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: #fff;
  border-top: 1px solid rgba(28,36,35,.08);
}
.bottom-nav a {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  color: #3F4A48; font-size: 10px; font-weight: 600; line-height: 1;
}
.bottom-nav .mark { display: grid; place-items: center; padding: 4px 10px; border-radius: 16px; }
.bottom-nav svg { width: 22px; height: 22px; }
.bottom-nav a.on { color: var(--nav, #0B6E6E); }
.bottom-nav a.on .mark { background: color-mix(in srgb, var(--nav, #0B6E6E) 14%, transparent); }

:root {
  color-scheme: light;
  --hc-accent: #0F766E;
  --app-tf-accent: #0B6E6E;
  --hc-ink: #1C2423;
  --hc-muted: rgba(28,36,35,.55);
  --hc-surface: #FFFEFE;
  --hc-border: rgba(28,36,35,.1);
  --hc-danger: #C62828;
}

/* Hộp thoại xác nhận — hoicau.confirm() */
.hc-dialog {
  position: fixed; inset: 0; z-index: 10050;
  display: grid; place-items: center; padding: 20px;
  background: rgba(4,32,30,.42);
}
.hc-dialog-panel {
  width: min(420px, 100%);
  background: var(--hc-surface); color: var(--hc-ink);
  border: 1px solid var(--hc-border); border-radius: 16px;
  padding: 18px 16px 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,.18);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.hc-dialog-panel h2 { margin: 0 0 10px; font-size: 17px; font-weight: 800; }
.hc-dialog-panel p {
  margin: 0; color: rgba(28,36,35,.82); font-size: 14px; line-height: 1.45; white-space: pre-wrap;
}
.hc-dialog-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.hc-dialog-actions.is-row { flex-direction: row; gap: 10px; }
.hc-dialog-actions .hc-btn { width: 100%; }
.hc-dialog-actions.is-row .hc-btn { flex: 1; width: auto; }
.hc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border: 0; border-radius: 12px;
  font: inherit; font-weight: 700; cursor: pointer;
}
.hc-btn.is-primary { background: var(--hc-accent); color: #fff; }
.hc-btn.is-ghost { background: rgba(28,36,35,.06); color: var(--hc-ink); }
.hc-btn.is-danger { background: var(--hc-danger); color: #fff; }
.hc-btn:disabled { opacity: .6; cursor: default; }

/* AppTextField — floating outline giống Flutter */
.app-tf { width: 100%; }
.app-tf-box {
  position: relative; display: flex; align-items: center; gap: 0;
  min-height: 56px; border-radius: 14px;
  border: 1px solid rgba(28,36,35,.18);
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.app-tf.is-multiline .app-tf-box { align-items: flex-start; min-height: 96px; }
.app-tf-box:focus-within { border-color: var(--app-tf-accent); box-shadow: 0 0 0 1.5px var(--app-tf-accent); }
.app-tf.is-disabled .app-tf-box { background: rgba(28,36,35,.03); border-color: rgba(28,36,35,.1); }
.app-tf-prefix, .app-tf-suffix {
  flex: none; display: grid; place-items: center;
  width: 44px; align-self: stretch; color: color-mix(in srgb, var(--app-tf-accent) 85%, #fff);
}
.app-tf-prefix svg, .app-tf-suffix svg { width: 22px; height: 22px; display: block; }
.app-tf-suffix { width: auto; min-width: 44px; padding: 0 6px; color: rgba(28,36,35,.45); }
.app-tf-suffix .app-tf-suffix-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 10px; background: transparent; color: inherit; cursor: pointer;
}
.app-tf-control {
  flex: 1; min-width: 0; border: 0; background: transparent; color: inherit;
  font: inherit; font-size: 16px; line-height: 1.35;
  padding: 18px 14px 12px; outline: none; width: 100%;
}
.app-tf.has-prefix .app-tf-control { padding-left: 0; }
.app-tf.has-suffix .app-tf-control { padding-right: 0; }
.app-tf.is-multiline .app-tf-control { padding-top: 20px; min-height: 88px; resize: vertical; }
.app-tf-control::placeholder { color: transparent; transition: color .12s ease; }
.app-tf-box:focus-within .app-tf-control::placeholder { color: rgba(28,36,35,.38); }
.app-tf-label {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%);
  padding: 0 4px; margin: 0;
  font-size: 15px; font-weight: 500; line-height: 1;
  color: rgba(28,36,35,.58);
  background: #fff; pointer-events: none;
  transition: top .15s ease, transform .15s ease, font-size .15s ease, color .15s ease, font-weight .15s ease;
  max-width: calc(100% - 28px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-tf.has-prefix .app-tf-label { left: 44px; max-width: calc(100% - 58px); }
.app-tf.is-multiline .app-tf-label { top: 18px; transform: none; }
.app-tf-box:focus-within .app-tf-label,
.app-tf.has-value .app-tf-label,
.app-tf-control:not(:placeholder-shown) ~ .app-tf-label {
  top: 0; transform: translateY(-50%) scale(0.86);
  transform-origin: left center;
  font-size: 12.5px; font-weight: 700; color: var(--app-tf-accent);
}
.app-tf.is-multiline .app-tf-box:focus-within .app-tf-label,
.app-tf.is-multiline.has-value .app-tf-label,
.app-tf.is-multiline .app-tf-control:not(:placeholder-shown) ~ .app-tf-label {
  top: 0; transform: translateY(-50%) scale(0.86);
}
.app-tf-helper { margin: 6px 12px 0; font-size: 12px; color: var(--hc-muted); line-height: 1.35; }
.app-tf.is-error .app-tf-box { border-color: var(--hc-danger); }
.app-tf.is-error .app-tf-box:focus-within { box-shadow: 0 0 0 1.5px var(--hc-danger); }
.app-tf.is-error .app-tf-label,
.app-tf.is-error .app-tf-helper { color: var(--hc-danger); }

/* AppSnackBar — floating snack giống Flutter */
.app-snack-host {
  position: fixed; z-index: 10060;
  right: 16px; left: auto;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  padding: 0; max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
@media (min-width: 1100px) and (hover: hover) and (pointer: fine) {
  body.has-php-inbox .app-snack-host { bottom: 16px; right: 16px; }
}
body.po-sd.app-snack-above-dock .app-snack-host { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
.app-snack {
  pointer-events: auto; width: 100%; max-width: 420px;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border-radius: 14px; border: 1px solid transparent;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  font-size: 14px; font-weight: 600; line-height: 1.35;
  transform: translateY(12px); opacity: 0;
  transition: transform .22s ease, opacity .22s ease;
}
.app-snack.is-in { transform: translateY(0); opacity: 1; }
.app-snack .app-snack-ico { flex: none; width: 22px; height: 22px; margin-top: 1px; display: grid; place-items: center; }
.app-snack .app-snack-ico svg { width: 22px; height: 22px; display: block; }
.app-snack .app-snack-msg { flex: 1; min-width: 0; }
.app-snack .app-snack-action {
  flex: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-weight: 800; padding: 0 4px; color: inherit;
}
.app-snack.is-success { background: #E8F5E9; color: #1B5E20; border-color: #A5D6A7; }
.app-snack.is-warning { background: #FFF8E1; color: #E65100; border-color: #FFE082; }
.app-snack.is-error { background: #FFEBEE; color: #B71C1C; border-color: #EF9A9A; }
.app-snack.is-info { background: #E0F2F1; color: #004D40; border-color: #80CBC4; }

/* Sheet tuỳ chọn hội thoại (chat-menu.js) */
.chat-menu-sheet {
  display: none; position: fixed; inset: 0; z-index: 60;
}
.chat-menu-sheet:not([hidden]) { display: block; }
.chat-menu-backdrop {
  position: absolute; inset: 0; border: 0; background: rgba(16,24,23,.35); cursor: pointer;
}
.chat-menu-panel {
  position: absolute; left: 50%; right: auto; bottom: 0; top: auto;
  width: min(360px, calc(100% - 24px)); max-width: 360px; max-height: min(70vh, 420px); overflow: auto;
  transform: translateX(-50%);
  padding: 0 12px calc(12px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; background: #fff;
  box-shadow: 0 -8px 28px rgba(16,24,23,.12);
}
.chat-menu-handle {
  display: block; width: 36px; height: 4px; margin: 8px auto 10px; border-radius: 999px;
  background: rgba(28,36,35,.16);
}
.chat-menu-panel h2 { margin: 0 0 4px; font-size: 14px; font-weight: 800; }
.chat-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 2px; border: 0;
  background: transparent; color: inherit; text-align: left; cursor: pointer; border-radius: 10px; font: inherit;
}
.chat-menu-item:hover { background: rgba(28,36,35,.04); }
.chat-menu-ico {
  width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; flex: none;
  color: var(--ico, #2F80ED); background: color-mix(in srgb, var(--ico, #2F80ED) 14%, #fff);
}
.chat-menu-ico svg { width: 16px; height: 16px; }
.chat-menu-copy { flex: 1; min-width: 0; }
.chat-menu-copy strong { display: block; font-size: 13px; font-weight: 700; line-height: 1.25; }
.chat-menu-copy span { display: block; margin-top: 1px; color: rgba(28,36,35,.55); font-size: 11px; line-height: 1.3; }
.chat-menu-chev { width: 16px; height: 16px; color: rgba(28,36,35,.35); flex: none; }
.chat-menu-switch {
  flex: none; width: 38px; height: 22px; border-radius: 999px; border: 0; padding: 2px; cursor: pointer;
  background: rgba(28,36,35,.18);
}
.chat-menu-switch.on { background: #2F80ED; }
.chat-menu-switch i {
  display: block; width: 18px; height: 18px; border-radius: 999px; background: #fff;
  transition: transform .18s ease;
}
.chat-menu-switch.on i { transform: translateX(16px); }
.chat-menu-item.danger .chat-menu-copy strong { color: var(--ico); }
