/* ==========================================================
   AI BOOKING — css/ai-booking.css
   Form demo đặt phòng Đất Rồng / đặt sân golf Sonadezi.
   Cùng tông với ai-panel.css: nền kính tối, viền & nhấn teal.
   z-index 10050: trên chat panel (9600) và transcript (10000).
   ========================================================== */

.bk-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  color: #e2e8f0;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}
.bk-overlay--open {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.2s ease;
}
.bk-overlay *,
.bk-overlay *::before,
.bk-overlay *::after { box-sizing: border-box; }

.bk-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 16, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.bk-dialog {
  position: relative;
  width: min(520px, 100%);
  max-height: min(720px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  background: rgba(8, 20, 36, 0.94);
  border: 1px solid rgba(94, 234, 212, 0.22);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 40px rgba(94, 234, 212, 0.08);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.bk-overlay--open .bk-dialog { transform: none; }

/* ── Header ── */
.bk-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 10px;
}
.bk-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.bk-demo {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.1);
}
.bk-sub {
  margin-top: 3px;
  font-size: 0.78rem;
  color: #8fa3b5;
}
.bk-x {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.bk-x:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

/* ── Tabs ── */
.bk-tabs {
  display: flex;
  gap: 6px;
  margin: 0 20px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.bk-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #94a3b8;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.bk-tab:hover { color: #e2e8f0; }
.bk-tab--active {
  background: rgba(94, 234, 212, 0.14);
  color: #5eead4;
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.35);
}

/* ── Body / form ── */
.bk-body {
  padding: 14px 20px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.bk-venue {
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: #5eead4;
  font-weight: 600;
}
.bk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.bk-span2 { grid-column: 1 / -1; }

.bk-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.bk-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #94a3b8;
}
.bk-field input,
.bk-field select,
.bk-field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #f1f5f9;
  font: inherit;
  font-size: 0.9rem;
  color-scheme: dark;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.bk-field textarea { resize: vertical; min-height: 60px; }
.bk-field select option { background: #0b1a2c; color: #e2e8f0; }
.bk-field input::placeholder,
.bk-field textarea::placeholder { color: #5b6b7c; }
.bk-field input:focus,
.bk-field select:focus,
.bk-field textarea:focus {
  border-color: rgba(94, 234, 212, 0.6);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.15);
}

/* Ô vừa được trợ lý AI điền: nháy viền xanh */
.bk-field--ai input,
.bk-field--ai select {
  animation: bk-ai-fill 1.6s ease;
}
@keyframes bk-ai-fill {
  0%, 40% { border-color: #16d472; box-shadow: 0 0 0 3px rgba(22, 212, 114, 0.25); }
  100%    { border-color: rgba(255, 255, 255, 0.12); box-shadow: none; }
}

.bk-checks { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.bk-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: #cbd5e1;
  cursor: pointer;
}
.bk-check input { width: 17px; height: 17px; accent-color: #2dd4bf; }

.bk-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.bk-errors ul {
  margin: 12px 0 0;
  padding: 10px 12px 10px 28px;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  font-size: 0.8rem;
  line-height: 1.5;
}

.bk-submit {
  width: 100%;
  margin-top: 16px;
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #2dd4bf, #06b6d4);
  color: #04202a;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.bk-submit:hover { opacity: 0.92; }
.bk-submit:active { transform: scale(0.99); }
.bk-submit:disabled { opacity: 0.6; cursor: wait; }
.bk-submit--ghost {
  background: transparent;
  color: #5eead4;
  border: 1px solid rgba(94, 234, 212, 0.4);
}

/* ── Success view ── */
.bk-done { text-align: center; padding: 10px 4px 0; }
.bk-done-icon {
  width: 56px;
  height: 56px;
  margin: 4px auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #04202a;
  background: linear-gradient(135deg, #34d399, #2dd4bf);
  box-shadow: 0 0 24px rgba(52, 211, 153, 0.4);
}
.bk-done-title { font-size: 1.05rem; font-weight: 700; color: #fff; }
.bk-done-code { margin-top: 8px; font-size: 0.95rem; color: #cbd5e1; }
.bk-done-code strong { color: #5eead4; letter-spacing: 0.06em; }
.bk-done-summary { margin-top: 8px; font-size: 0.85rem; color: #94a3b8; line-height: 1.5; }
.bk-done-note { margin-top: 10px; font-size: 0.8rem; color: #8fa3b5; line-height: 1.5; }

/* ── Toast ── */
.bk-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 10060;
  max-width: min(460px, calc(100vw - 32px));
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(6, 40, 34, 0.94);
  border: 1px solid rgba(52, 211, 153, 0.5);
  color: #d1fae5;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  font-size: 0.85rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.bk-toast--show { opacity: 1; transform: translate(-50%, 0); }

/* ── Control bar: 2 nút đặt chỗ ── */
.ctrl-icon--booking {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
}
.ctrl-btn:hover .ctrl-icon--booking {
  border-color: rgba(94, 234, 212, 0.55);
  color: #5eead4;
}

/* ── Mobile: bottom sheet ── */
@media (max-width: 560px) {
  .bk-overlay { align-items: flex-end; padding: 0; }
  .bk-dialog {
    width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    transform: translateY(40px);
  }
  .bk-body { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .bk-tab { font-size: 0.78rem; }
  /* iOS zoom khi focus ô < 16px */
  .bk-field input,
  .bk-field select,
  .bk-field textarea { font-size: 16px; }
}

/* ── Khung chat: ghi chú hệ thống (đã lưu đặt chỗ, phiên kết thúc) ── */
.ai-pn-bubble.sys {
  align-self: center;
  max-width: 92%;
  margin: 4px auto;
  padding: 6px 12px;
  border-radius: 999px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  font-size: 0.76rem;
  text-align: center;
}

/* Tab / nút của loại đặt chỗ bị tắt trong admin (thuộc tính hidden bị display:flex đè) */
.bk-overlay [hidden],
.ctrl-btn[hidden] { display: none !important; }

/* ── Thanh toán QR (js/ai-payment.js) ── */
.pay-dialog { width: min(420px, 100%); }
.pay-code { color: #5eead4; letter-spacing: 0.04em; }
.pay-wait { text-align: center; }
.pay-qr {
  width: min(260px, 70vw);
  margin: 4px auto 12px;
  padding: 10px;
  background: #fff;
  border-radius: 14px;
}
.pay-qr img { display: block; width: 100%; height: auto; }
.pay-amount { font-size: 1rem; color: #cbd5e1; }
.pay-amount strong { color: #fff; font-size: 1.25rem; }
.pay-info {
  margin: 12px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  text-align: left;
  font-size: 0.85rem;
}
.pay-info dt { color: #8fa3b5; }
.pay-info dd { margin: 0; color: #e2e8f0; font-weight: 600; word-break: break-word; }
.pay-timer { margin: 12px 0; font-size: 0.85rem; color: #fbbf24; }
.pay-open { display: block; text-decoration: none; text-align: center; }
.pay-hint { margin-top: 8px; font-size: 0.78rem; color: #8fa3b5; }
.pay-result--fail .bk-done-icon {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  box-shadow: 0 0 24px rgba(249, 115, 22, 0.4);
}
.pay-links { display: grid; gap: 8px; margin-top: 14px; }
.pay-links a { display: block; text-decoration: none; text-align: center; }

/* ── Phiếu thông tin đặt phòng trong khung chat (ai-ui.js renderChecklist) ── */
.ai-pn-bubble.ai-checklist { max-width: 94%; width: 94%; display: grid; gap: 8px; }
.ai-checklist-title { font-weight: 600; color: #0f766e; }
.ai-checklist-row { display: grid; gap: 3px; font-size: 12px; color: #475569; }
.ai-checklist-row input, .ai-checklist-row select {
  width: 100%; box-sizing: border-box; padding: 7px 9px; border: 1px solid #cbd5e1; border-radius: 8px;
  font-size: 13px; color: #0f172a; background: #fff;
}
.ai-checklist-row--missing input, .ai-checklist-row--missing select { border-color: #f59e0b; background: #fffbeb; }
.ai-checklist-row--error input, .ai-checklist-row--error select { border-color: #ef4444; background: #fef2f2; }
.ai-checklist-row small { color: #b91c1c; }
.ai-checklist-send {
  margin-top: 4px; padding: 9px 12px; border: 0; border-radius: 8px; background: #0f766e; color: #fff;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.ai-checklist-send:disabled { opacity: 0.6; cursor: default; }

/* ── Thẻ đơn đặt phòng trong khung chat (ai-ui.js bookingCard) ── */
.ai-pn-bubble.ai-bk-card { width: 94%; max-width: 94%; display: grid; gap: 8px; border: 1px solid #d1fae5; }
.ai-bk-card-head { display: flex; align-items: center; gap: 8px; }
.ai-bk-card-ok {
  width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: #10b981; color: #fff; font-size: 12px; font-weight: 700; flex: none;
}
.ai-bk-card-title { font-weight: 700; color: #0f172a; }
.ai-bk-card-code {
  margin-left: auto; padding: 2px 8px; border-radius: 999px; background: #ecfdf5; color: #047857;
  font-size: 12px; font-weight: 700; letter-spacing: 0.03em;
}
.ai-bk-card-sum { color: #475569; font-size: 12.5px; }
.ai-bk-card-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ai-bk-btn {
  display: flex; align-items: center; justify-content: center; padding: 9px 10px; border-radius: 10px;
  border: 1px solid #0f766e; color: #0f766e; background: #fff; font-size: 13px; font-weight: 600;
  text-decoration: none; text-align: center;
}
.ai-bk-btn:hover { background: #f0fdfa; }
.ai-bk-btn--main { background: #0f766e; color: #fff; }
.ai-bk-btn--main:hover { background: #115e59; }
.ai-bk-btn[hidden] { display: none; }
.ai-bk-card-btns:has(.ai-bk-btn[hidden]) { grid-template-columns: 1fr; }
.ai-bk-card-pay {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px;
  border-radius: 8px; font-size: 12.5px; background: #fffbeb; color: #92400e;
}
.ai-bk-card-pay--paid { background: #ecfdf5; color: #047857; font-weight: 600; }
.ai-bk-card-pay--expired, .ai-bk-card-pay--failed, .ai-bk-card-pay--cancelled { background: #fef2f2; color: #b91c1c; }
.ai-bk-link { border: 0; background: none; color: #0f766e; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 0; }
.ai-bk-link[hidden] { display: none; }

.ai-bk-more { font-size: 12.5px; color: #0f766e; font-weight: 600; text-decoration: none; text-align: center; padding: 2px 0; }
.ai-bk-more:hover { text-decoration: underline; }
.ai-bk-more[hidden] { display: none; }
.ai-bk-card--cancelled { border-color: #fecaca; }
.ai-bk-card--cancelled .ai-bk-card-ok { background: #94a3b8; }
.ai-bk-card--cancelled .ai-bk-card-code { background: #f1f5f9; color: #64748b; text-decoration: line-through; }

/* ══ Hộp thanh toán QR (js/ai-payment.js) — thiết kế 10/2026 ══ */
.aipay {
  position: fixed; inset: 0; z-index: 2147483000; display: flex; align-items: center; justify-content: center;
  padding: 16px; opacity: 0; pointer-events: none; transition: opacity .2s ease;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
}
.aipay--open { opacity: 1; pointer-events: auto; }
.aipay *, .aipay *::before, .aipay *::after { box-sizing: border-box; }
.aipay [hidden] { display: none !important; }
.aipay-backdrop { position: absolute; inset: 0; background: rgba(2, 12, 20, .55); backdrop-filter: blur(3px); }
.aipay-sheet {
  position: relative; width: min(380px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: #fff; color: #0f172a; border-radius: 20px; padding: 18px 20px 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35); transform: translateY(10px) scale(.98); transition: transform .22s ease;
}
.aipay--open .aipay-sheet { transform: none; }

.aipay-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.aipay-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.aipay-code, .aipay-chip {
  display: inline-block; margin-top: 4px; padding: 2px 9px; border-radius: 999px; background: #ecfdf5; color: #047857;
  font-size: 12px; font-weight: 700; letter-spacing: .03em;
}
.aipay-chip { margin-top: 0; }
.aipay-x {
  flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; background: #f1f5f9; color: #475569;
  font-size: 20px; line-height: 1; cursor: pointer;
}
.aipay-x:hover { background: #e2e8f0; }

/* chờ thanh toán */
.aipay-wait { text-align: center; }
.aipay-amount-label { font-size: 12px; color: #64748b; }
.aipay-amount { font-size: 28px; font-weight: 800; color: #0f766e; letter-spacing: -.01em; margin: 2px 0 12px; }
.aipay-qr {
  width: min(220px, 64vw); margin: 0 auto; padding: 10px; border-radius: 16px; background: #fff;
  border: 1px solid #e2e8f0; box-shadow: 0 4px 16px rgba(15, 23, 42, .08); position: relative;
}
.aipay-qr img { display: block; width: 100%; height: auto; }
.aipay-qr--expired img { filter: grayscale(1) blur(2px); opacity: .35; }
.aipay-timer {
  display: inline-flex; align-items: center; gap: 6px; margin: 10px 0 14px; padding: 4px 10px; border-radius: 999px;
  background: #fffbeb; color: #b45309; font-size: 12.5px; font-weight: 600;
}
.aipay-timer--over { background: #fef2f2; color: #b91c1c; }

.aipay-info { margin: 0 0 14px; padding: 4px 12px; border-radius: 12px; background: #f8fafc; text-align: left; }
.aipay-row { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 8px 0; border-bottom: 1px solid #eef2f6; }
.aipay-row:last-child { border-bottom: 0; }
.aipay-row dt { font-size: 11.5px; color: #64748b; }
.aipay-row dd { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.aipay-row dd > span { font-size: 14px; font-weight: 600; color: #0f172a; word-break: break-word; }
.aipay-copy {
  flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 8px;
  border: 1px solid #cbd5e1; background: #fff; color: #0f766e; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.aipay-copy:hover { border-color: #0f766e; }
.aipay-copy--done { background: #ecfdf5; border-color: #10b981; color: #047857; }

.aipay-btn {
  display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 14px; border-radius: 12px;
  font-size: 14px; font-weight: 700; text-decoration: none; text-align: center; line-height: 1.2; cursor: pointer;
}
.aipay-btn--main { background: #0f766e; color: #fff; border: 1px solid #0f766e; }
.aipay-btn--main:hover { background: #115e59; }
.aipay-btn--ghost { background: #fff; color: #0f766e; border: 1px solid #0f766e; }
.aipay-btn--ghost:hover { background: #f0fdfa; }
.aipay-hint { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 12px 0 0; font-size: 12px; color: #64748b; }
.aipay-pulse { width: 8px; height: 8px; border-radius: 50%; background: #10b981; animation: aipayPulse 1.4s ease-in-out infinite; }
@keyframes aipayPulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }

/* kết quả */
.aipay-result { text-align: center; padding-top: 4px; }
.aipay-badge {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800; color: #fff; background: #10b981; box-shadow: 0 0 0 8px #d1fae5;
}
.aipay-result--warn .aipay-badge { background: #f59e0b; box-shadow: 0 0 0 8px #fef3c7; }
.aipay-result-title { font-size: 18px; font-weight: 800; }
.aipay-result-sub { margin-top: 6px; font-size: 13.5px; color: #334155; }
.aipay-result-note { margin: 10px 0 16px; font-size: 12.5px; color: #64748b; line-height: 1.5; }
.aipay-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.aipay-actions--one { grid-template-columns: 1fr; }
.aipay-more { display: block; margin-top: 12px; font-size: 13px; font-weight: 600; color: #0f766e; text-decoration: none; }
.aipay-more:hover { text-decoration: underline; }
.aipay-text-btn {
  margin-top: 10px; border: 0; background: none; color: #64748b; font: inherit; font-size: 13px; cursor: pointer; padding: 6px;
}
.aipay-text-btn:hover { color: #0f172a; }

@media (max-width: 420px) {
  .aipay { padding: 0; align-items: flex-end; }
  .aipay-sheet { width: 100%; border-radius: 20px 20px 0 0; max-height: 92vh; }
}
.aipay-sheet--result .aipay-head { margin-bottom: 0; justify-content: flex-end; }
.aipay-sheet--result .aipay-head > div { display: none; }
