* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green: #2e7d4f;
  --green-dark: #1f5c39;
  --green-light: #eef3ef;
  --ink: #1f2a24;
  --muted: #5a6b61;
}

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  line-height: 1.6;
  background: #fff;
}

.container { width: min(1080px, 92%); margin: 0 auto; }

a { color: inherit; text-decoration: none; }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid #e6ece8;
  z-index: 50;
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-size: 1.25rem; font-weight: 800; color: var(--green-dark); }
.brand span { color: var(--green); }
.nav nav { display: flex; gap: 22px; }
.nav nav a { color: var(--muted); font-weight: 500; }
.nav nav a:hover { color: var(--green); }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff;
  padding: 88px 0;
  text-align: center;
}
.hero h1 { font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1.2; max-width: 800px; margin: 0 auto; }
.hero .lead { font-size: 1.15rem; opacity: 0.95; max-width: 640px; margin: 18px auto 30px; }
.hero b { color: #d9f3e3; }

.btn {
  display: inline-block;
  background: #fff;
  color: var(--green-dark);
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  margin: 6px;
}
.btn:hover { background: #f0f0f0; }
.btn-ghost { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,0.7); }
.btn-ghost:hover { background: rgba(255,255,255,0.12); }

/* ===== Sections ===== */
.section { padding: 72px 0; }
.section-alt { background: var(--green-light); }
.section h2 { font-size: 2rem; text-align: center; color: var(--green-dark); }
.section-sub { text-align: center; color: var(--muted); margin-top: 8px; margin-bottom: 40px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.card {
  background: #fff;
  border: 1px solid #e6ece8;
  border-radius: 16px;
  padding: 28px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(0,0,0,0.08); }
.card-emoji { font-size: 2.6rem; }
.card h3 { margin: 12px 0 8px; color: var(--green-dark); }
.card p { color: var(--muted); font-size: 0.95rem; }
.card-link {
  margin-top: 16px;
  background: none;
  border: none;
  color: var(--green);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  font-size: 0.95rem;
}
.card-link:hover { text-decoration: underline; }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; margin-top: 40px; }
.step { text-align: center; }
.step span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--green); color: #fff; font-weight: 800; font-size: 1.2rem;
  margin-bottom: 12px;
}
.step h4 { color: var(--green-dark); }
.step p { color: var(--muted); font-size: 0.95rem; }

/* About */
.about { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; align-items: center; }
.about h2 { text-align: left; }
.about p { color: var(--muted); margin-top: 14px; }
.facts { list-style: none; display: grid; gap: 16px; }
.facts li { background: var(--green-light); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); }
.facts b { display: block; font-size: 1.8rem; color: var(--green-dark); }

@media (max-width: 720px) {
  .about { grid-template-columns: 1fr; }
  .nav nav { display: none; }
}

/* ===== Footer ===== */
.site-footer { background: var(--ink); color: #cfd8d2; padding: 56px 0 0; }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.site-footer h3 { color: #fff; }
.site-footer h4 { color: #fff; margin-bottom: 8px; }
.site-footer p { font-size: 0.9rem; margin-top: 4px; }
.copyright { text-align: center; padding: 24px; margin-top: 40px; border-top: 1px solid #33403a; font-size: 0.85rem; }

@media (max-width: 600px) { .footer-grid { grid-template-columns: 1fr; } }

/* ===== Chat widget ===== */
.chat-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 1.6rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  z-index: 100;
  transition: transform 0.15s;
}
.chat-toggle:hover { transform: scale(1.08); }

.chat-widget {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 130px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
  animation: pop 0.18s ease-out;
}
.chat-widget[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }

.cw-header {
  background: var(--green);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cw-status { font-size: 0.75rem; opacity: 0.9; display: block; }
.cw-actions { display: flex; align-items: center; gap: 2px; }
.cw-close { background: none; border: none; color: #fff; font-size: 1.1rem; cursor: pointer; }
.cw-reset {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}
.cw-reset:hover, .cw-close:hover { background: rgba(255, 255, 255, 0.15); }

.cw-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.bubble {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.92rem;
}
.msg.bot .bubble { background: var(--green-light); border-bottom-left-radius: 4px; }
/* Highlight trong câu trả lời bot: tên sản phẩm đậm màu thương hiệu, liều
   lượng nền vàng nhạt — khách quét mắt bắt ngay được "dùng gì, pha bao nhiêu". */
.msg.bot .bubble .hl-product { font-weight: 700; color: var(--green-dark); }
.msg.bot .bubble .hl-dose {
  background: #fff3c4;
  color: #6b4d00;
  font-weight: 600;
  padding: 0 4px;
  border-radius: 4px;
}
/* Nút CTA Zalo thay cho URL thô trong câu trả lời — mở tab mới. */
.bubble a.zalo-cta {
  display: inline-block;
  margin: 2px 2px 0;
  padding: 3px 12px;
  background: #0068ff;
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  vertical-align: middle;
  white-space: nowrap;
}
.bubble a.zalo-cta:hover { filter: brightness(1.12); }
/* Nút đặt mua online (link Lazada từ PurchaseAgent) — cùng ngôn ngữ hình
   ảnh với nút Zalo, màu cam sàn TMĐT để phân biệt kênh. */
.bubble a.buy-cta {
  display: inline-block;
  margin: 2px 2px 0;
  padding: 3px 12px;
  background: #f57224;
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  vertical-align: middle;
  white-space: nowrap;
}
.bubble a.buy-cta:hover { filter: brightness(1.08); }
.msg.user .bubble { background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.sources { margin-top: 8px; font-size: 0.72rem; color: var(--muted); }
.sources b { color: var(--green); }
.sources a { color: var(--green-dark); text-decoration: underline; text-underline-offset: 2px; }
.typing { font-style: italic; opacity: 0.7; }

.cw-input { display: flex; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid #e6ece8; }
.cw-compose-box {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 6px;
  border: 1px solid #cdd8d1;
  border-radius: 10px;
  background: #fff;
  padding: 6px 8px;
}
#cw-text {
  width: 100%; min-width: 0; resize: none; border: none;
  padding: 4px 0; font: inherit; font-size: 0.92rem; outline: none; max-height: 100px;
}
.cw-compose-box:focus-within { border-color: var(--green); }
.cw-attach,
#cw-send {
  background: var(--green); color: #fff; border: none; border-radius: 10px;
  width: 42px; cursor: pointer; font-size: 1.1rem;
  min-height: 40px;
  flex: 0 0 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cw-attach {
  background: #eef3ef;
  color: var(--green-dark);
  border: 1px solid #cdd8d1;
}
.cw-attach.is-disabled,
#cw-send:disabled { opacity: 0.5; cursor: not-allowed; }
.cw-image-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 2px 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
}
.cw-image-preview[hidden] {
  display: none;
}
.cw-image-preview img {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #cdd8d1;
}
.cw-image-preview span {
  min-width: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cw-file-clear {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border: 1px solid #cdd8d1;
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.cw-image-preview .cw-file-clear {
  border-color: #cdd8d1;
  background: #fff;
  color: var(--green-dark);
}
.user-image-message {
  display: grid;
  gap: 8px;
}
.user-image-message img {
  width: 120px;
  max-width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.45);
}
