/* ============================================
   Cantaloupe - Main Stylesheet
   Theme: dưa lưới (xanh lá + cam melon)
   ============================================ */

:root {
  /* Brand */
  --green-900: #14532d;
  --green-800: #166534;
  --green-700: #15803d;
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-100: #dcfce7;
  --green-50:  #f0fdf4;

  --melon-600: #ea7317;
  --melon-500: #f59e0b;
  --melon-100: #ffedd5;

  /* Calendar color codes */
  --cal-system: #16a34a;   /* 🟢 xanh lá - hệ thống */
  --cal-manual: #2563eb;   /* 🔵 xanh dương - thủ công */
  --cal-alert:  #dc2626;   /* 🔴 đỏ - cảnh báo AI */

  /* Neutrals */
  --ink:     #0f172a;
  --slate-700:#334155;
  --slate-500:#64748b;
  --slate-400:#94a3b8;
  --slate-300:#cbd5e1;
  --slate-200:#e2e8f0;
  --slate-100:#f1f5f9;
  --slate-50: #f8fafc;
  --white:   #ffffff;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.08);
  --shadow-md: 0 4px 12px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.04);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.14);
  --maxw: 1180px;
  --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Nền gradient xanh lá mềm (theo ảnh 1 - GB Kitchen) */
body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 700px at 78% -6%, #b9ecc9 0%, rgba(185,236,201,0) 55%),
    radial-gradient(900px 600px at 8% 4%, #d9f5e2 0%, rgba(217,245,226,0) 60%),
    linear-gradient(155deg, #cdeed8 0%, #e6f8ec 42%, #f3fbf5 100%);
  background-attachment: fixed;
}

a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1,h2,h3,h4 { line-height: 1.25; margin: 0 0 .5em; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; cursor: pointer; font-family: inherit; font-size: 15px;
  font-weight: 600; padding: 11px 20px; border-radius: 999px;
  transition: transform .06s ease, box-shadow .2s ease, background .2s ease;
  text-decoration: none; line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green-600); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--green-700); text-decoration: none; }
.btn-accent { background: var(--melon-600); color: #fff; }
.btn-accent:hover { background: #cf640f; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--green-700); border: 1.5px solid var(--green-600); }
.btn-ghost:hover { background: var(--green-50); text-decoration: none; }
.btn-light { background: #fff; color: var(--ink); border: 1.5px solid var(--slate-200); }
.btn-light:hover { background: var(--slate-50); text-decoration: none; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-danger { background: var(--cal-alert); color: #fff; }
.btn-danger:hover { background: #b91c1c; text-decoration: none; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Public Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.6); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,.55);
}
.site-header .nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 66px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--green-800); }
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: radial-gradient(circle at 30% 30%, var(--melon-500), var(--green-600));
  display: grid; place-items: center; font-size: 20px;
}
.nav-links { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  padding: 9px 14px; border-radius: 9px; color: var(--slate-700); font-weight: 600; font-size: 15px; white-space: nowrap;
}
.nav-links a:hover { background: var(--green-50); color: var(--green-800); text-decoration: none; }
.nav-links a.active { background: var(--green-100); color: var(--green-800); }
.nav-cta { display: flex; align-items: center; gap: 10px; white-space: nowrap; }

.menu-toggle { display: none; background: none; border: none; font-size: 26px; cursor: pointer; color: var(--ink); }

/* ---------- Hero ---------- */
.hero {
  padding: 78px 0 64px;
}
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
.hero h1 { font-size: 46px; letter-spacing: -.5px; color: var(--green-900); }
.hero h1 .accent { color: var(--melon-600); }
.hero p.lead { font-size: 19px; color: var(--slate-700); max-width: 560px; }
.hero-cta { display: flex; gap: 14px; margin-top: 26px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--slate-200);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--green-800); box-shadow: var(--shadow-sm); }

/* Camera illustration */
.cam-illu { position: relative; aspect-ratio: 4/3.4; background: linear-gradient(180deg,#eafff1,#d6f5e3);
  border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--green-100); }

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section-alt { background: rgba(255,255,255,.4); backdrop-filter: blur(6px); }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 42px; }
.section-head .eyebrow { color: var(--melon-600); font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; font-size: 13px; }
.section-head h2 { font-size: 34px; color: var(--green-900); margin-top: 8px; }
.section-head p { color: var(--slate-500); font-size: 17px; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: rgba(255,255,255,.72); border: 1px solid rgba(255,255,255,.7);
  border-radius: 20px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 26px; box-shadow: 0 8px 26px rgba(20,83,45,.08); transition: transform .15s ease, box-shadow .2s ease;
}
.card.hover:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(20,83,45,.14); }
/* Glass helper */
.glass { background: rgba(255,255,255,.72); border: 1px solid rgba(255,255,255,.7);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 20px; box-shadow: 0 8px 26px rgba(20,83,45,.08); }
.glass-solid { background: rgba(255,255,255,.9); border: 1px solid rgba(255,255,255,.8);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-radius: 20px; box-shadow: 0 8px 26px rgba(20,83,45,.08); }
.feature-icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  font-size: 26px; margin-bottom: 16px; background: var(--green-100); color: var(--green-800);
}
.feature-icon.melon { background: var(--melon-100); color: var(--melon-600); }
.card h3 { font-size: 20px; color: var(--ink); }
.card p { color: var(--slate-500); margin: 0; }

/* ---------- Spec strip ---------- */
.spec-item { display: flex; gap: 16px; align-items: flex-start; }
.spec-item .big { font-size: 30px; }

/* ---------- Blog cards ---------- */
.post-card { overflow: hidden; padding: 0; cursor: pointer; }
.post-thumb { aspect-ratio: 16/9; display: grid; place-items: center; font-size: 52px; color: #fff; }
.post-body { padding: 20px 22px 24px; }
.post-tag { font-size: 12px; font-weight: 700; color: var(--melon-600); text-transform: uppercase; letter-spacing: .5px; }
.post-card h3 { font-size: 19px; margin: 8px 0; }
.post-meta { color: var(--slate-400); font-size: 13px; margin-top: 12px; }

/* ---------- Forum ---------- */
.forum-item { display: flex; align-items: center; gap: 18px; padding: 18px 22px; border: 1px solid rgba(255,255,255,.7);
  border-radius: 18px; background: rgba(255,255,255,.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  margin-bottom: 12px; transition: box-shadow .2s, transform .15s; box-shadow: 0 6px 20px rgba(20,83,45,.06); }
.forum-item:hover { box-shadow: var(--shadow-md); }
.forum-avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; flex-shrink: 0; }
.forum-main { flex: 1; min-width: 0; }
.forum-main h3 { font-size: 17px; margin: 0 0 3px; }
.forum-main .muted { color: var(--slate-500); font-size: 13px; }
.forum-stat { text-align: center; color: var(--slate-500); font-size: 13px; min-width: 64px; }
.forum-stat b { display: block; font-size: 20px; color: var(--green-700); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--slate-700); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 14px; border: 1.5px solid rgba(148,163,184,.4); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 15px; background: rgba(255,255,255,.85); color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 3px var(--green-100); }
.field textarea { min-height: 110px; resize: vertical; }
.form-note { font-size: 13px; color: var(--slate-400); margin-top: 4px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--green-900); color: #cfeeda; padding: 52px 0 28px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.site-footer h4 { color: #fff; font-size: 15px; margin-bottom: 14px; }
.site-footer a { color: #a7d8bb; display: block; padding: 4px 0; font-size: 14px; }
.site-footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 34px; padding-top: 20px; text-align: center; font-size: 13px; color: #8fc4a5; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.badge-green { background: var(--green-100); color: var(--green-800); }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-amber { background: var(--melon-100); color: var(--melon-600); }
.badge-gray { background: var(--slate-100); color: var(--slate-500); }

/* dot */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--green-500); }
.dot-red { background: var(--cal-alert); }
.dot-gray { background: var(--slate-300); }

/* ---------- Toast / Push notification ---------- */
#toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 12px; max-width: 380px; }
.toast {
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); padding: 16px 18px;
  border-left: 5px solid var(--green-500); animation: toastIn .3s ease;
}
.toast.alert { border-left-color: var(--cal-alert); animation: toastIn .3s ease, blinkBorder 1s ease-in-out 3; }
.toast .t-title { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.toast .t-body { font-size: 14px; color: var(--slate-600); margin: 6px 0 10px; }
.toast .t-actions { display: flex; gap: 8px; }
.toast .t-close { position: absolute; top: 8px; right: 10px; cursor: pointer; color: var(--slate-400); background: none; border: none; font-size: 18px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes blinkBorder { 50% { border-left-color: #fca5a5; } }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 1500; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 18px; max-width: 540px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); animation: toastIn .25s ease; }
.modal-head { padding: 22px 26px; border-bottom: 1px solid var(--slate-200); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 20px; }
.modal-body { padding: 24px 26px; }
.modal-foot { padding: 18px 26px; border-top: 1px solid var(--slate-200); display: flex; justify-content: flex-end; gap: 10px; }
.modal .close-x { background: none; border: none; font-size: 26px; cursor: pointer; color: var(--slate-400); line-height: 1; }

/* utilities */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.muted { color: var(--slate-500); }
.hidden { display: none !important; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .gap-2 { gap: 16px; } .gap-1 { gap: 8px; }
.wrap { flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 36px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
/* Menu trên có 6 mục: thu thành nút ☰ khi màn hình hẹp hơn 1100px để chữ không bị xuống dòng */
@media (max-width: 1100px) {
  .nav-links { display: none; position: absolute; top: 66px; left: 0; right: 0; background: #fff; flex-direction: column;
    padding: 12px; border-bottom: 1px solid var(--slate-200); box-shadow: var(--shadow-md); }
  .nav-links.open { display: flex; }
  .nav-links a { width: 100%; }
  .menu-toggle { display: block; }
}
@media (max-width: 620px) {
  .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 30px; }
  .section-head h2 { font-size: 26px; }
}

/* ---------- Trợ lý AI (ai.html) ---------- */
.ai-wrap { max-width: 880px; }
.ai-chat { display: flex; flex-direction: column; height: min(72vh, 760px); min-height: 460px; padding: 0; overflow: hidden; }
.ai-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid rgba(148,163,184,.25); }
.ai-chat-head b { color: var(--green-800); }
.ai-msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.ai-msg { max-width: 86%; padding: 12px 16px; border-radius: 16px; font-size: 15px; line-height: 1.6; word-wrap: break-word; }
.ai-msg.user { align-self: flex-end; background: var(--green-600); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.model { align-self: flex-start; background: #fff; border: 1px solid var(--slate-200); border-bottom-left-radius: 4px; }
.ai-msg.error { align-self: flex-start; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.ai-msg img { max-width: 240px; max-height: 240px; border-radius: 10px; margin-bottom: 6px; }
.ai-msg h4 { font-size: 15px; color: var(--green-800); margin: 12px 0 4px; }
.ai-msg h4:first-child { margin-top: 0; }
.ai-msg p { margin: 0 0 8px; color: inherit; }
.ai-msg ul, .ai-msg ol { margin: 0 0 8px; padding-left: 20px; }
.ai-msg .ai-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--slate-200); }
.ai-typing { color: var(--slate-500); font-style: italic; }
.ai-typing::after { content: "…"; animation: aiDots 1.2s steps(3) infinite; }
@keyframes aiDots { 0% { content: "."; } 33% { content: ".."; } 66% { content: "..."; } }
.ai-empty { margin: auto; text-align: center; color: var(--slate-500); max-width: 460px; }
.ai-empty .big { font-size: 46px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.ai-chips button { border: 1px solid var(--green-100); background: var(--green-50); color: var(--green-800); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 13px; cursor: pointer; }
.ai-chips button:hover { background: var(--green-100); }
.ai-composer { border-top: 1px solid rgba(148,163,184,.25); padding: 12px 14px; background: rgba(255,255,255,.6); }
.ai-preview { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ai-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 2px solid var(--green-500); }
.ai-row { display: flex; gap: 8px; align-items: flex-end; }
.ai-row textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; padding: 11px 14px; border: 1.5px solid rgba(148,163,184,.4); border-radius: 14px; font: inherit; font-size: 15px; background: #fff; }
.ai-row textarea:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 3px var(--green-100); }
.ai-tool { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--slate-200); background: #fff; font-size: 20px; cursor: pointer; flex-shrink: 0; }
.ai-tool:hover { background: var(--green-50); }
.ai-send { height: 44px; }
.ai-note { font-size: 12px; color: var(--slate-400); margin: 8px 2px 0; }
.ai-webcam video { width: 100%; border-radius: 12px; background: #0f172a; }
@media (max-width: 620px) {
  .ai-chat { height: calc(100vh - 150px); }
  .ai-msg { max-width: 94%; }
  .ai-msgs { padding: 14px; }
}

/* ---------- 6 giai đoạn sinh trưởng (dùng chung) ---------- */
:root { --cal-ai: #8b5cf6; /* 🟣 tím - sự kiện do AI phát hiện giai đoạn */ }
.stage-legend { display: flex; flex-wrap: wrap; gap: 8px; }
.stage-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px 4px 8px;
  border-radius: 999px; background: color-mix(in srgb, var(--c) 14%, #fff); color: color-mix(in srgb, var(--c) 75%, #000); white-space: nowrap; }
.stage-chip i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); display: inline-block; }
.stage-photo { aspect-ratio: 4/3; border-radius: 16px; overflow: hidden; position: relative; background: #dcfce7; }
.stage-card { padding: 0; overflow: hidden; }
.stage-card .stage-photo { border-radius: 0; aspect-ratio: 16/10; }
.stage-card .sc-body { padding: 16px 18px 20px; }
.stage-card .sc-num { font-size: 12px; font-weight: 800; color: var(--slate-400); }
.stage-card h3 { font-size: 17px; margin: 6px 0; }
.stage-card p { font-size: 14px; }
.toast.stage { border-left-color: var(--cal-ai); }
.demo-banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: #fffbeb; border: 1px solid #fde68a; font-size: 13px; color: #92400e; }
.upload-box { border: 2px dashed var(--green-500); border-radius: 18px; padding: 26px; text-align: center; background: rgba(240,253,244,.6); }
.upload-box img { max-height: 260px; margin: 0 auto 12px; border-radius: 12px; }
.det-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(148,163,184,.2); font-size: 14px; }
.det-row:last-child { border-bottom: none; }
.det-steps { margin: 6px 0 0; padding-left: 20px; color: var(--slate-700); font-size: 14px; line-height: 1.8; }
