/* «Bộ thẻ buổi hẹn» bản web — docs/design/bo-the-web.md §3. Token chép từ brand-kit.md §9.1, tên biến = tên token app. */

:root {
  --nen: #FFF9F3;
  --nenPhu: #F6ECE3;
  --nenAm: #FCE6D6;
  --chu: #2A1B24;
  --chuPhu: #6A5761;
  --vien: #E5D6CA;
  --vienManh: #8F776C;
  --nhan: #8C2F57;
  --chuTrenNhan: #FFFFFF;
  --lienKet: #8C2F57;
  --logoTren: #8C2F57;
  --logoDuoi: #3A1838;
  --fontTron: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  --fontThan: -apple-system, system-ui, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --nen: #19131B;
    --nenPhu: #261E29;
    --nenAm: #3A2630;
    --chu: #F6EEE7;
    --chuPhu: #B9AAB1;
    --vien: #3B303F;
    --vienManh: #8A7A85;
    --nhan: #F4B183;
    --chuTrenNhan: #2A1320;
    --lienKet: #F4B183;
    --logoTren: #F4B183;
    --logoDuoi: #FFF3E8;
  }
}

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

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--nen);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--nen);
  color: var(--chu);
  font-family: var(--fontThan);
  font-size: 1.0625rem;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, p, ul, fieldset, legend { margin: 0; padding: 0; }
ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--lienKet); }
svg { flex: none; }

:focus-visible { outline: 2px solid var(--nhan); outline-offset: 2px; }
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }

/* ---- Cấp chữ (§3.2) ---- */
.tieu-de { font-family: var(--fontTron); font-size: 2.125rem; font-weight: 600; line-height: 1.25; }
.lon { font-family: var(--fontTron); font-size: 1.375rem; font-weight: 600; line-height: 1.25; }
.than { font-family: var(--fontThan); font-size: 1.0625rem; font-weight: 400; line-height: 1.45; }
.than-dam { font-family: var(--fontThan); font-size: 1.0625rem; font-weight: 600; line-height: 1.45; }
.chu-nut { font-family: var(--fontTron); font-size: 1.0625rem; font-weight: 600; line-height: 1.3; }
.nho { font-family: var(--fontThan); font-size: 0.875rem; font-weight: 400; line-height: 1.4; }
.nho-dam { font-family: var(--fontThan); font-size: 0.875rem; font-weight: 600; line-height: 1.4; }
.chu-phu { color: var(--chuPhu); }
.giua { text-align: center; }

/* ---- Khung trang (§3.1) ---- */
.cot {
  width: 100%;
  padding: calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}
@media (min-width: 600px) {
  .cot { max-width: 480px; margin: 0 auto; padding: 48px 0; }
}
.cot.o-b { padding-top: 0; }

/* ---- Hàng thương hiệu + logo ---- */
.thuong-hieu { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.logo { height: 24px; width: auto; }
.logo-tren { fill: var(--logoTren); }
.logo-duoi { fill: var(--logoDuoi); }

#a-h1 { margin-top: 8px; }

/* ---- Nhóm danh sách + hàng (§3.3) ---- */
.a-muc { margin-top: 24px; }
.nhom {
  background: var(--nenPhu);
  border: 1px solid var(--vien);
  border-radius: 20px;
  overflow: hidden;
}
.nhom + .nhom { margin-top: 24px; }
.hang {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 64px;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  text-align: left;
}
.hang + .hang::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  height: 1px;
  background: var(--vien);
}
.hang:focus-visible { outline-offset: -3px; border-radius: 20px; }
.hang-chu { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hang-ten { font-family: var(--fontThan); font-size: 1.0625rem; font-weight: 600; line-height: 1.45; color: var(--chu); }
.hang-phu { font-family: var(--fontThan); font-size: 0.875rem; line-height: 1.4; color: var(--chuPhu); }
.ic-phai { color: var(--chuPhu); }

.a-thong-bao { margin-top: 24px; display: flex; flex-direction: column; gap: 16px; }
.a-thong-bao p + p { margin-top: -8px; }

/* ---- Dòng nhắc ---- */
.nhac { margin-top: 24px; display: flex; flex-direction: column; gap: 8px; }
.dong-nhac {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--chuPhu);
  font-size: 0.875rem;
  line-height: 1.4;
}
.ic-nhac { margin-top: 0.12rem; }

.a-tien-do { margin-top: 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

/* ---- Nút (§3.3) ---- */
.nut {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 0;
  border-radius: 14px;
  font-family: var(--fontTron);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.nut-chinh { background: var(--nhan); color: var(--chuTrenNhan); }
.nut-phu { background: var(--nenPhu); color: var(--chu); border: 1px solid var(--vienManh); padding: 11px 15px; }
.nut-chu { background: transparent; color: var(--lienKet); padding: 8px 16px; }
.nut-trai { width: auto; padding-left: 0; padding-right: 0; text-align: left; }
a.nut { display: flex; align-items: center; justify-content: center; }
a.nut-trai { justify-content: flex-start; }
.nut[aria-disabled="true"] { cursor: default; }

/* ---- B: thanh trên (§4.2) ---- */
.thanh-tren {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr minmax(0, max-content) 1fr;
  align-items: center;
  gap: 8px;
  min-height: calc(56px + env(safe-area-inset-top));
  margin: 0 calc(-16px - env(safe-area-inset-right)) 0 calc(-16px - env(safe-area-inset-left));
  padding: env(safe-area-inset-top) calc(8px + env(safe-area-inset-right)) 0 calc(8px + env(safe-area-inset-left));
  background: var(--nen);
  border-bottom: 1px solid var(--vien);
}
@media (min-width: 600px) {
  .thanh-tren { margin: 0; padding: 0; }
}
.nut-lui {
  justify-self: start;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--lienKet);
}
.thanh-ten {
  min-width: 0;
  color: var(--chu);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nut-dung {
  justify-self: end;
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  white-space: nowrap;
}
.nut-dung:focus-visible { outline: none; }
.nut-dung:focus-visible .vien-thuoc { outline: 2px solid var(--nhan); outline-offset: 2px; }
.vien-thuoc {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--vienManh);
  border-radius: 999px;
  background: var(--nenPhu);
  color: var(--lienKet);
  font-family: var(--fontTron);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
}

/* ---- B: vùng thẻ ---- */
.b-vung { padding-top: 16px; }
.b-chuyen-may { margin-bottom: 8px; }

.khung-the {
  transform: scaleX(1);
  opacity: 1;
  transition: transform 120ms ease-out, opacity 150ms linear;
}
.khung-the.co-lai { transform: scaleX(0); transition: transform 120ms ease-in, opacity 150ms linear; }
.khung-the.moi, .khung-the.moi .hinh-up { transition: none; }
.khung-the.moi { opacity: 0; }
.khung-the.moi .hinh-up { transform: translateY(6px); }

.the {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 280px;
  padding: 24px;
  border-radius: 20px;
  text-align: left;
  color: var(--chu);
}
.the-up {
  align-items: center;
  justify-content: center;
  background: var(--nenPhu);
  border: 1px solid var(--vienManh);
}
.the-ngua {
  gap: 16px;
  background: var(--nenAm);
  border: 1px solid var(--vien);
}
.hinh-up {
  display: block;
  width: 168px;
  height: 112px;
  margin-bottom: 16px;
  transition: transform 150ms cubic-bezier(0.33, 1, 0.68, 1);
}
.hinh-up img { display: block; width: 168px; height: 112px; }
.chu-lon .hinh-up { display: none; }
@media (max-width: 339.98px) {
  .hinh-up { display: none; }
}
.the-up .so-the { margin-top: 8px; }

.hang-l { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; column-gap: 8px; row-gap: 4px; color: var(--chuPhu); }
.hang-l .nho-dam { flex: 1 1 auto; min-width: 0; }
.noi-dung-the { display: flex; flex-direction: column; overflow-wrap: anywhere; }
.noi-dung-the .dau-chon-mot { margin-bottom: 8px; }
.cac-lua-chon { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }

/* ---- B: khối hết thẻ (§4.4) ---- */
.b-ket { display: flex; flex-direction: column; }
.b-ket h2 { margin-bottom: 16px; }
.b-ket .nut + .nut { margin-top: 8px; }

/* ---- B: thanh nút ---- */
.thanh-ghim { margin-top: 24px; display: flex; flex-direction: column; gap: 8px; }
#b.ghim .thanh-ghim {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  margin: 0;
  padding: 12px calc(16px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  background: var(--nen);
  border-top: 1px solid var(--vien);
}

/* ---- K (§4.5) ---- */
.k-quay-lai { margin-top: 8px; }
.tham-do { margin-top: 32px; }
.tham-do h2 { margin-bottom: 16px; }
.tham-do fieldset + fieldset { margin-top: 24px; }
.tham-do legend { margin-bottom: 8px; font-family: var(--fontThan); font-size: 1.0625rem; font-weight: 600; line-height: 1.45; }
.cac-vien { display: flex; flex-wrap: wrap; gap: 8px; }
.vien-chon {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 48px;
  padding: 8px 17px 8px 13px;
  border: 1px solid var(--vienManh);
  border-radius: 24px;
  background: var(--nenPhu);
  color: var(--chu);
  cursor: pointer;
}
.vien-chon.dang-chon { border: 2px solid var(--nhan); padding: 7px 16px 7px 12px; font-weight: 600; }
.vien-chon:has(input:focus-visible) { outline: 2px solid var(--nhan); outline-offset: 2px; }
.dau-tich { visibility: hidden; color: var(--nhan); }
.vien-chon.dang-chon .dau-tich { visibility: visible; }
.an-mat {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.tham-do .dong-nhac { margin-top: 24px; }
.hai-nut { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.hai-nut .nut { flex: 1 1 9.75rem; width: auto; }
.tham-do-loi { margin-top: 8px; color: var(--chu); }
.cam-on { margin-top: 32px; }
.vach { margin: 32px 0; height: 1px; border: 0; background: var(--vien); }
.k-moi-tieu-de { display: flex; align-items: center; gap: 8px; }
.k-moi-cau { margin-top: 8px; }
.k-moi .nut { margin-top: 16px; }
.k-tuoi { margin-top: 16px; }

/* ---- Chân trang (§4.7) ---- */
.chan { margin-top: 32px; }
.ban-quyen { white-space: nowrap; }
.lien-ket-chan { display: inline-flex; align-items: center; min-height: 48px; vertical-align: middle; color: var(--lienKet); }
.cot.o-b .chan { display: none; }

/* ---- Trang 404 ---- */
.trang-404 h1 { margin-top: 8px; }
.trang-404 .nut { margin-top: 24px; }

/* Không chạy JS (§4.6): hai nhóm mức nhường chỗ cho câu lỗi trong <noscript>. */
@media (scripting: none) {
  .a-muc { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .khung-the, .khung-the.co-lai, .hinh-up { transition: none; }
}
