/* =========================================================
   Bổ sung cho bản có trang quản trị: biểu mẫu gửi thật, nút liên hệ nhanh,
   xem trước bản nháp, khung chat. Dùng chung biến màu của style.css.
   ========================================================= */

.section-note {
  margin-top: 24px;
  padding: 12px 16px;
  border-left: 3px solid var(--amber);
  background: rgba(249, 248, 246, .07);
  border-radius: 0 8px 8px 0;
  font-size: 15px;
  color: var(--on-teal-soft);
}

/* Ô bẫy chống bot: ẩn khỏi người dùng và trình đọc màn hình */
.hp-field { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.req { font-weight: 400; color: #6B6B73; font-size: 13px; }

.form-status[data-kind="pending"] { background: var(--beige); color: var(--ink-soft); }
.form-status[data-kind="success"] { background: #E3F1EA; color: #14532D; }
.form-status[data-kind="error"] { background: #FDECEA; color: #8A1C12; }
button[disabled] { opacity: .65; cursor: progress; }

/* Công trình: bố cục theo số ảnh */
.project-grid.project-count-1 { grid-template-columns: 1fr; }
.project-grid.project-count-1 .project img { aspect-ratio: 16 / 9; }
.project-grid.project-count-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .project-grid.project-count-2 { grid-template-columns: 1fr; } }

/* Trước – sau bằng hai ảnh riêng */
.compare-separate .compare-frame img.compare-own { position: absolute; inset: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }

/* Thanh báo đang xem bản nháp */
.preview-banner {
  position: sticky; top: 0; z-index: 60;
  padding: 10px 16px;
  background: #FEF3C7; color: #78350F;
  font-size: 14px; text-align: center;
  border-bottom: 1px solid #F59E0B;
}
.preview-banner a { color: inherit; font-weight: 600; margin-left: 8px; }
.preview-banner + .site-header { top: 41px; }

/* Nút gọi / Zalo nhanh */
.contact-dock {
  position: fixed; left: 16px; bottom: 16px; z-index: 45;
  display: flex; flex-direction: column; gap: 10px;
}
.dock-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 46px; padding: 10px 16px 10px 12px;
  border-radius: 999px;
  font: 600 15px/1 var(--font-body);
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(15, 61, 62, .22);
}
.dock-call { background: var(--teal); color: var(--cream); }
.dock-zalo { background: #0068FF; color: #fff; }
.dock-btn .icon { width: 20px; height: 20px; }
@media (max-width: 640px) {
  .dock-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .dock-btn { width: 48px; height: 48px; padding: 0; justify-content: center; }
}

/* =========================================================
   Khung chat (trợ lý tự động)
   ========================================================= */
.chat-launcher {
  position: fixed; right: 16px; bottom: 16px; z-index: 46;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 12px 18px 12px 14px;
  border: 0; border-radius: 999px;
  background: var(--amber); color: var(--ink);
  font: 600 15px/1 var(--font-body);
  box-shadow: 0 8px 24px rgba(15, 61, 62, .25);
  cursor: pointer;
}
.chat-launcher .icon { width: 22px; height: 22px; }
.chat-launcher[aria-expanded="true"] { display: none; }
@media (max-width: 640px) {
  .chat-launcher { width: 56px; height: 56px; padding: 0; justify-content: center; }
  .chat-launcher span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

.chat-panel {
  position: fixed; right: 16px; bottom: 16px; z-index: 70;
  width: min(400px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 32px));
  display: flex; flex-direction: column;
  background: var(--cream);
  border: 1px solid var(--beige-line);
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(15, 61, 62, .28);
  overflow: hidden;
}
.chat-panel[hidden] { display: none; }
@media (max-width: 640px) {
  .chat-panel { inset: 0; right: 0; bottom: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
}
.chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 12px 16px;
  background: var(--teal); color: var(--cream);
}
.chat-head strong { font-family: var(--font-head); font-size: 16px; }
.chat-head small { display: block; color: var(--on-teal-soft); font-size: 12px; }
.chat-head .chat-close {
  margin-left: auto; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.1); color: inherit; cursor: pointer;
  display: grid; place-items: center;
}
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 12px; align-content: start; }
.chat-msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.chat-msg p { margin: 0 0 6px; }
.chat-msg p:last-child { margin-bottom: 0; }
.chat-msg ul, .chat-msg ol { margin: 4px 0 6px; padding-left: 20px; }
.chat-msg a { color: var(--teal); font-weight: 600; }
.chat-bot { background: #fff; border: 1px solid var(--beige-line); border-bottom-left-radius: 4px; justify-self: start; }
.chat-user { background: var(--teal); color: var(--cream); border-bottom-right-radius: 4px; justify-self: end; }
.chat-note { justify-self: center; font-size: 13px; color: #6B6B73; text-align: center; }
.chat-typing { display: inline-flex; gap: 4px; }
.chat-typing i { width: 6px; height: 6px; border-radius: 50%; background: #9CA3AF; animation: chat-dot 1s infinite; }
.chat-typing i:nth-child(2) { animation-delay: .15s; }
.chat-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.chat-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-chip {
  border: 1px solid var(--beige-line); background: #fff; color: var(--teal);
  border-radius: 999px; padding: 8px 12px; min-height: 40px;
  font: 500 14px/1.2 var(--font-body); cursor: pointer; text-align: left;
}
.chat-chip:hover { border-color: var(--teal); }
.chat-chip.primary { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.chat-lead { display: grid; gap: 8px; background: #fff; border: 1px solid var(--beige-line); border-radius: 14px; padding: 12px; }
.chat-lead input, .chat-lead textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  font: 400 15px/1.4 var(--font-body);
  border: 1.5px solid #CFC8BB; border-radius: 10px; background: #fff;
}
.chat-lead textarea { min-height: 70px; resize: vertical; }
.chat-lead .btn { min-height: 44px; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--beige-line); background: #fff; }
.chat-form textarea {
  flex: 1; resize: none; min-height: 44px; max-height: 120px;
  padding: 10px 12px; border: 1.5px solid #CFC8BB; border-radius: 12px;
  font: 400 15px/1.4 var(--font-body);
}
.chat-form textarea:focus, .chat-lead input:focus, .chat-lead textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 61, 62, .18); }
.chat-send {
  width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 12px;
  background: var(--teal); color: var(--cream); cursor: pointer; display: grid; place-items: center;
}
.chat-send[disabled] { opacity: .5; cursor: default; }
.chat-foot { padding: 0 12px 10px; background: #fff; font-size: 12px; color: #6B6B73; }
body.chat-open { overflow: hidden; }
@media (min-width: 641px) { body.chat-open { overflow: auto; } }
/* Nút Zalo/Gọi không che nút chat */
@media (max-width: 640px) { .contact-dock { bottom: 84px; left: auto; right: 16px; } }
