/* ==========================================================
   Green SM Platform – nền tảng chung (tokens, reset, nút, ô nhập)
   Mobile-first: style gốc khớp Figma 390px, @media (min-width:1024px) khớp 1440px
   ========================================================== */

/* Montserrat tự host (bản variable 400–800, nguồn Google Fonts, giấy phép OFL) */
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/montserrat-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/montserrat-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/montserrat-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Màu – lấy từ Figma variables */
  --nen-trang: #ffffff;
  --xanh-thuong-hieu: #28bdbf;
  --xanh-chu: #209799;
  --xanh-nhan: #1a7f81;
  --chu-tieu-de: #111827;
  --chu-noi-dung: #374151;
  --chu-phu: #6b7280;
  --nen-xam-nhat: #f9fafb;
  --duong-ke: #e5e7eb;
  --xanh-ngoc-nhat: #d5feff;
  --vang-nhan-chu: #e3bb42;
  --do-bat-buoc: #ef4444;
  --vien-o-nhap: #d1d5db;

  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --header-h: 64px;
  --container: 1200px;
  --gutter: 20px;

  --shadow-float: 0 2px 8px rgba(0, 0, 0, 0.12);
  --shadow-menu: 0 4px 16px rgba(0, 0, 0, 0.08);
}

@media (min-width: 1200px) {
  :root {
    --header-h: 80px;
    --gutter: 120px;
  }
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 24px;
  color: var(--chu-noi-dung);
  background: var(--nen-trang);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.is-locked {
  overflow: hidden;
}

h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

img, svg {
  display: block;
  max-width: 100%;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

input, select, textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--xanh-thuong-hieu);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

@media (min-width: 768px) and (max-width: 1199.98px) {
  :root { --gutter: 40px; }
}

/* Khoảng đệm dưới header cố định */
.header-spacer {
  height: var(--header-h);
}

/* ---------- Icon đổi màu theo trạng thái ----------
   Mỗi trạng thái dùng đúng file SVG Figma xuất ra:
   <img class="i-def"> mặc định, <img class="i-hov"> khi trỏ, <img class="i-act"> khi nhấn (tuỳ chọn) */
.i-def,
.i-hov,
.i-act {
  flex-shrink: 0;
}
.i-hov,
.i-act {
  display: none;
}
/* chỉ ẩn icon mặc định khi có icon thay thế đi kèm (tránh mất mũi tên trong thẻ chỉ có i-def) */
:is(.btn, .text-link, .hov):hover .i-def:has(~ .i-hov) { display: none; }
:is(.btn, .text-link, .hov):hover .i-hov { display: block; }
:is(.btn, .text-link, .hov):active:has(.i-act) .i-hov { display: none; }
:is(.btn, .text-link, .hov):active .i-act { display: block; }

/* ---------- Nút (component "Nút" 3:21) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: 0;
  border-radius: 8px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 16px;
  line-height: 24px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s, box-shadow .15s, color .15s;
}

/* Kích thước theo Figma (viền nằm trong, vẽ bằng box-shadow inset để Chrome không làm tròn 1.5px → 1px):
   Chính 52px (không viền) · Phụ 54px (viền 1px + đệm 14/24) · Viền 55px (viền 1.5px + đệm 14/24) */

/* Chính (3:9): nền xanh, chữ trắng → Trỏ (166:1261): nền trắng, viền 1.5px xanh, chữ xanh → Nhấn (166:1265): viền/chữ xanh đậm */
.btn--primary {
  background: var(--xanh-thuong-hieu);
  color: var(--nen-trang);
}
.btn--primary:hover {
  background: var(--nen-trang);
  box-shadow: inset 0 0 0 1.5px var(--xanh-thuong-hieu);
  color: var(--xanh-chu);
}
.btn--primary:active {
  background: var(--nen-trang);
  box-shadow: inset 0 0 0 1.5px var(--xanh-nhan);
  color: var(--xanh-nhan);
}

/* Phụ (3:13): nền trắng, viền xám 1px, chữ đen → Trỏ (166:1272): nền xanh, chữ trắng → Nhấn (166:1276): nền xanh đậm */
.btn--secondary {
  padding: 15px 25px;
  background: var(--nen-trang);
  box-shadow: inset 0 0 0 1px var(--duong-ke);
  color: var(--chu-tieu-de);
}
.btn--secondary:hover {
  background: var(--xanh-thuong-hieu);
  box-shadow: inset 0 0 0 1px var(--xanh-thuong-hieu);
  color: var(--nen-trang);
}
.btn--secondary:active {
  background: var(--xanh-nhan);
  box-shadow: inset 0 0 0 1px var(--xanh-nhan);
  color: var(--nen-trang);
}

/* Viền (3:17): viền 1.5px xanh chữ, chữ xanh → Trỏ (166:1283): nền xanh, chữ trắng → Nhấn (166:1287): nền xanh đậm */
.btn--outline {
  padding: 15.5px 25.5px;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--xanh-chu);
  color: var(--xanh-chu);
}
.btn--outline:hover {
  background: var(--xanh-thuong-hieu);
  box-shadow: inset 0 0 0 1.5px var(--xanh-thuong-hieu);
  color: var(--nen-trang);
}
.btn--outline:active {
  background: var(--xanh-nhan);
  box-shadow: inset 0 0 0 1.5px var(--xanh-nhan);
  color: var(--nen-trang);
}

.btn--block {
  width: 100%;
}

/* ---------- Liên kết chữ (177:2543) ---------- */
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 16px;
  line-height: 24px;
  color: var(--xanh-chu);
  white-space: nowrap;
  transition: gap .15s, color .15s;
}
.text-link:hover {
  gap: 10px;
  color: var(--xanh-nhan);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Tích xanh (3:5) ---------- */
.check-ico {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* ---------- Ô nhập (Hàng – ô nhập 3:22) ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field__label {
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  color: var(--chu-noi-dung);
}

.field__label .req {
  color: var(--do-bat-buoc);
}

.field__control {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  background: var(--nen-trang);
  border: 1px solid var(--vien-o-nhap);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}

/* Trạng thái "Đang nhập" (194:2317…): viền 2px xanh thương hiệu, không đổi kích thước ô */
.field__control:focus-within {
  border-color: var(--xanh-thuong-hieu);
  box-shadow: inset 0 0 0 1px var(--xanh-thuong-hieu);
}

.field.is-invalid .field__control {
  border-color: var(--do-bat-buoc);
}

.field__error {
  font-size: 13px;
  line-height: 18px;
  color: var(--do-bat-buoc);
}

.field__control input,
.field__control select,
.field__control textarea {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
  line-height: 24px;
  color: var(--chu-tieu-de);
}

.field__control input::placeholder,
.field__control textarea::placeholder {
  color: var(--chu-phu);
  opacity: 1;
}

/* select: dùng icon mũi tên gốc */
.field__control--select {
  position: relative;
  padding: 0;
}
.field__control--select select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 40px 0 12px;
  cursor: pointer;
}
.field__control--select select:invalid,
.field__control--select select.is-placeholder {
  color: var(--chu-phu);
}
.field__control--select select option {
  color: var(--chu-tieu-de);
}
.field__control--select img {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* textarea */
.field__control--textarea {
  height: 104px;
  align-items: flex-start;
  padding: 10px 12px 0;
}
.field__control--textarea textarea {
  resize: none;
  height: 100%;
}

/* số điện thoại có mã vùng */
.field__prefix {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 8px;
  font-size: 16px;
  line-height: 24px;
  color: var(--chu-tieu-de);
  white-space: nowrap;
}

/* ---------- Ô đồng ý (194:2347) ---------- */
.agree {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 20px;
  color: var(--chu-noi-dung);
  cursor: pointer;
}
.agree input {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1px solid var(--vien-o-nhap);
  border-radius: 4px;
  background: var(--nen-trang) -1px -1px / 16px 16px no-repeat;
  cursor: pointer;
}
.agree input:checked {
  background-color: var(--xanh-thuong-hieu);
  border-color: var(--xanh-thuong-hieu);
  background-image: url(../img/common/icon-checkbox-tick.svg);
}
.agree.is-invalid input {
  border-color: var(--do-bat-buoc);
}
.agree a,
.agree strong {
  font-weight: 600;
  color: var(--xanh-chu);
}

/* ---------- Nhãn "Ảnh tạm – thay ảnh thật" (ghi chú trên ảnh trong Figma) ----------
   Khi đã có ảnh thật: thêm `display: none;` vào rule dưới đây để ẩn toàn bộ. */
.img-note {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .55);
  font-weight: 600;
  font-size: 11px;
  line-height: 16px;
  color: var(--nen-trang);
  white-space: nowrap;
  pointer-events: none;
}
