:root {
  --green: #2f6b4f;
  --green-dark: #23513c;
  --green-soft: #e8f2ec;
  --ink: #1f2d27;
  --muted: #6b7a72;
  --line: #dfe7e2;
  --bg: #f6f9f7;
  --card: #ffffff;
  --accent: #b4691f;

  /* "Hỏi Linh" widget palette */
  --purple: #7c3aed;
  --purple-dark: #6d28d9;
  --purple-light: #a855f7;
  --purple-soft: #f4ecff;
  --purple-line: #e6d7fb;
  --purple-ink: #3b2a5a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  background-color: var(--green-dark);
  background-image:
    linear-gradient(180deg, rgba(16, 26, 20, .30), rgba(16, 26, 20, .50) 55%, rgba(16, 26, 20, .85)),
    url('/static/banner4.jpg');
  background-size: cover, cover;
  background-position: center, center 30%;
  background-repeat: no-repeat, no-repeat;
  color: #fff;
  padding: 0 0 16px;
  min-height: 280px;
  display: flex;
  align-items: flex-end;
}
.site-header > .wrap { width: 100%; }
.site-header h1 {
  margin: 0;
  font-size: 2rem;
  text-shadow: 0 2px 10px rgba(0,0,0,.6);
}
.tagline { margin: 6px 0 0; opacity: .95; font-size: 1rem; text-shadow: 0 1px 6px rgba(0,0,0,.55); }
@media (max-width: 620px) {
  .site-header { min-height: 180px; }
  .site-header h1 { font-size: 1.5rem; }
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-text { min-width: 0; }
.header-logo {
  flex: 0 0 auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,.7);
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
  background: #fff;
}
@media (max-width: 480px) {
  .header-logo { width: 88px; height: 88px; }
  .site-header h1 { font-size: 1.3rem; }
}

main { padding: 8px 0 40px; }

section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 16px;
  margin: 16px 0;
}
section h2 { margin: 0 0 6px; font-size: 1.2rem; }
.hint { color: var(--muted); font-size: .9rem; margin: 0 0 14px; }
.loading { color: var(--muted); }

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 560px) {
  .gallery { grid-template-columns: repeat(3, 1fr); }
}
.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
a.card { text-decoration: none; color: inherit; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.card.selected { outline: 3px solid var(--green); }
.card img { width: 100%; height: 130px; object-fit: cover; display: block; background: #eee; }
.card .info { padding: 10px; }
.card .name { font-weight: 600; font-size: .95rem; margin: 0 0 4px; }
.card .meta { color: var(--muted); font-size: .8rem; margin: 0; }
.card .price { color: var(--accent); font-weight: 700; font-size: .95rem; margin-top: 6px; }

/* Product sub-page */
.header-home { text-decoration: none; color: inherit; }
.crumbs { margin: 0 0 12px; }
.crumbs a { color: var(--green-dark); text-decoration: none; font-weight: 600; }
.product-hero {
  display: block;
  width: 100%;
  max-height: 340px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #eee;
  margin: 0 0 14px;
}
.product-meta { color: var(--muted); margin: 4px 0 10px; }

/* Chat log bubbles (used inside the "Hỏi Linh" widget) */
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 14px 12px;
  flex: 1 1 auto;
  background: linear-gradient(180deg, #fbf8ff, #f6f1ff);
}
.bubble {
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: .92rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(80,40,140,.06);
}
.bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--purple-light), var(--purple));
  color: #fff;
  border-bottom-right-radius: 5px;
}
.bubble.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--purple-line);
  color: var(--purple-ink);
  border-bottom-left-radius: 5px;
}
.bubble.typing { color: #8b7bb0; font-style: italic; }

button {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: var(--green-dark); }
button:disabled { opacity: .6; cursor: default; }

/* Order form */
.order-form label {
  display: block;
  margin-bottom: 12px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink);
}
.order-form input,
.order-form textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 400;
}
.order-form button { width: 100%; margin-top: 4px; }
.status { font-size: .92rem; margin: 12px 0 0; min-height: 1.2em; }
.status.ok { color: var(--green-dark); font-weight: 600; }
.status.err { color: #b3261e; font-weight: 600; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 18px 0;
  color: var(--muted);
  font-size: .85rem;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: .9rem;
  z-index: 80;
  max-width: 90%;
  text-align: center;
}
/* .hidden must win over component display rules (e.g. .cw-panel { display:flex }) */
.hidden { display: none !important; }

/* ============================================================
   "Hỏi Linh" floating chat widget (flowery purple)
   ============================================================ */
#chat-widget { position: fixed; right: 18px; bottom: 18px; z-index: 70; }

/* Launcher — minimized to a round bubble by default.
   The "Hỏi Linh" label only reveals on hover/focus (and the full card opens on click). */
.cw-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 15px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.45);
  background: linear-gradient(135deg, var(--purple-light), var(--purple) 60%, var(--purple-dark));
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .01em;
  box-shadow: 0 10px 26px rgba(124, 58, 237, .45);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  animation: cw-float 3.4s ease-in-out infinite;
}
.cw-launcher:hover,
.cw-launcher:focus-visible {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 32px rgba(124, 58, 237, .55);
  animation-play-state: paused;
  outline: none;
}
.cw-launcher-flower { font-size: 1.5rem; line-height: 1; }
.cw-launcher-text {
  display: inline-block;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  margin-left: 0;
  transition: max-width .28s ease, opacity .2s ease, margin-left .28s ease;
}
.cw-launcher:hover .cw-launcher-text,
.cw-launcher:focus-visible .cw-launcher-text {
  max-width: 130px;
  opacity: 1;
  margin-left: 8px;
}
@keyframes cw-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
@keyframes cw-pop {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Chat panel */
.cw-panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: min(372px, calc(100vw - 36px));
  height: min(560px, calc(100vh - 130px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--purple-line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(80, 40, 140, .32);
  animation: cw-pop .22s ease-out;
}

/* Header with floral pattern + purple gradient */
.cw-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  color: #fff;
  background-color: var(--purple);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='46' height='46' viewBox='0 0 46 46'%3E%3Cg fill='%23ffffff' fill-opacity='0.13'%3E%3Ccircle cx='23' cy='13' r='6'/%3E%3Ccircle cx='13' cy='23' r='6'/%3E%3Ccircle cx='33' cy='23' r='6'/%3E%3Ccircle cx='23' cy='33' r='6'/%3E%3C/g%3E%3Ccircle cx='23' cy='23' r='4.5' fill='%23ffe08a' fill-opacity='0.55'/%3E%3C/svg%3E"),
    linear-gradient(135deg, var(--purple-light), var(--purple) 55%, var(--purple-dark));
  background-repeat: repeat, no-repeat;
  background-size: 46px 46px, cover;
}
.cw-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.22);
  border: 2px solid rgba(255,255,255,.5);
  font-size: 1.15rem;
  flex: 0 0 auto;
}
.cw-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.cw-title strong { font-size: 1.02rem; }
.cw-sub { font-size: .76rem; opacity: .9; }
.cw-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.16);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 400;
}
.cw-close:hover { background: rgba(255,255,255,.3); }

/* Input row */
.cw-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--purple-line);
  background: #fbf8ff;
}
.cw-form input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--purple-line);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}
.cw-form input:focus { outline: 2px solid var(--purple-light); outline-offset: 0; }
.cw-form button {
  flex: 0 0 auto;
  padding: 0 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--purple-light), var(--purple));
}
.cw-form button:hover { background: linear-gradient(135deg, var(--purple), var(--purple-dark)); }

/* Mobile */
@media (max-width: 480px) {
  #chat-widget { right: 12px; bottom: 12px; }
  .cw-panel {
    width: calc(100vw - 24px);
    height: min(74vh, calc(100vh - 120px));
  }
  .cw-launcher { padding: 14px; }
}
