/* ============================================================
   DHC App — nen tang giao diene
   Bang mau / font / chuyen dong lay tu templete (Helix Drift)
   ============================================================ */

:root {
  --canvas: #f4f7fa;
  --sunk: #dde7f2;
  --pastel: #b9cde5;
  --pastel-deep: #96b1d0;
  --ink: #1b2233;
  --ink-2: #5b6879;
  --ink-3: #93a0b2;
  --accent: #4a6e96;
  --accent-deep: #35506f;

  --ok: #2f7d62;
  --ok-soft: rgba(47, 125, 98, 0.12);
  --danger: #a8443f;
  --danger-soft: rgba(168, 68, 63, 0.1);

  --bar: 70px;
  --radius: 10px;
  --radius-lg: 16px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.6s;

  --glass: rgba(255, 255, 255, 0.82);
  --glass-line: rgba(255, 255, 255, 0.9);
  --shadow-soft:
    -6px -6px 16px rgba(255, 255, 255, 0.9),
    6px 6px 20px rgba(150, 177, 208, 0.34);
  --shadow-lift: 0 18px 40px -18px rgba(27, 34, 51, 0.38);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--ink);
  font-family:
    "Albert Sans",
    system-ui,
    -apple-system,
    sans-serif;
  font-weight: 300;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* ---- lop khong khi: wash + luoi + hat nhieu (nhu template) ---- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(
      120vw 90vh at 8% -10%,
      rgba(185, 205, 229, 0.55),
      transparent 62%
    ),
    radial-gradient(
      110vw 80vh at 98% 108%,
      rgba(221, 231, 242, 0.85),
      transparent 60%
    );
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.34' numOctaves='2' stitchTiles='stitch'/></filter><rect width='320' height='320' filter='url(%23n)' opacity='0.10'/></svg>"),
    linear-gradient(to right, rgba(150, 177, 208, 0.3) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(150, 177, 208, 0.3) 1px, transparent 1px);
  background-size:
    320px 320px,
    72px 72px,
    72px 72px;
  mix-blend-mode: overlay;
  opacity: 0.5;
  -webkit-mask-image: radial-gradient(
    80vw 80vh at 50% 42%,
    #000 20%,
    transparent 82%
  );
  mask-image: radial-gradient(80vw 80vh at 50% 42%, #000 20%, transparent 82%);
}

/* ---------------- chu ---------------- */
h1,
h2,
h3,
h4,
.serif {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 300;
  letter-spacing: 0.01em;
}

.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 400;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* ---------------- truong nhap ---------------- */
.field {
  position: relative;
  margin-bottom: 1.1rem;
}

.field > label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.5rem;
  transition: color 0.3s var(--ease);
}

.field:focus-within > label {
  color: var(--accent);
}

.control {
  position: relative;
  display: flex;
  align-items: center;
}

.control > svg.lead {
  position: absolute;
  left: 14px;
  width: 17px;
  height: 17px;
  stroke: var(--ink-3);
  fill: none;
  stroke-width: 1.4;
  pointer-events: none;
  transition: stroke 0.3s var(--ease);
}

.field:focus-within .control > svg.lead {
  stroke: var(--accent);
}

input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(150, 177, 208, 0.45);
  border-radius: var(--radius);
  padding: 0.92rem 2.9rem 0.92rem 2.8rem;
  outline: none;
  transition:
    border-color 0.34s var(--ease),
    box-shadow 0.34s var(--ease),
    background 0.34s var(--ease),
    transform 0.34s var(--ease);
}

input::placeholder {
  color: var(--ink-3);
  opacity: 0.75;
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover {
  border-color: var(--pastel-deep);
  background: rgba(255, 255, 255, 0.86);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(74, 110, 150, 0.14);
}

.field.invalid input {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

/* hien / an mat khau */
.peek {
  position: absolute;
  right: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  color: var(--ink-3);
  transition:
    background 0.28s var(--ease),
    color 0.28s var(--ease),
    transform 0.28s var(--ease);
}

.peek:hover {
  background: rgba(185, 205, 229, 0.45);
  color: var(--accent);
  transform: scale(1.08);
}

.peek:active {
  transform: scale(0.94);
}

.peek svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}

/* ---------------- checkbox ghi nho ---------------- */
.check {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.82rem;
  color: var(--ink-2);
  transition: color 0.28s var(--ease);
}

.check:hover {
  color: var(--ink);
}

/* input nam dung vi tri o vuong de van bam duoc truc tiep */
.check input {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 19px;
  height: 19px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.check .box {
  width: 19px;
  height: 19px;
  flex: none;
  border-radius: 6px;
  border: 1px solid var(--pastel-deep);
  background: rgba(255, 255, 255, 0.8);
  display: grid;
  place-items: center;
  transition:
    background 0.3s var(--ease),
    border-color 0.3s var(--ease),
    transform 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}

.check:hover .box {
  border-color: var(--accent);
  transform: scale(1.06);
}

.check .box svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 16;
  stroke-dashoffset: 16;
  transition: stroke-dashoffset 0.34s var(--ease) 0.04s;
}

.check input:checked + .box {
  background: var(--accent);
  border-color: var(--accent);
}

.check input:checked + .box svg {
  stroke-dashoffset: 0;
}

.check input:focus-visible + .box {
  box-shadow: 0 0 0 4px rgba(74, 110, 150, 0.18);
}

/* ---------------- nut ---------------- */
.btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.95rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform 0.32s var(--ease),
    box-shadow 0.32s var(--ease),
    color 0.32s var(--ease),
    border-color 0.32s var(--ease),
    background 0.32s var(--ease);
}

.btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  transition: transform 0.36s var(--ease);
}

/* lop sang quet qua khi hover */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    120deg,
    transparent 20%,
    rgba(255, 255, 255, 0.28) 50%,
    transparent 80%
  );
  transform: translateX(-120%);
  transition: transform 0.72s var(--ease);
}

.btn:hover::before {
  transform: translateX(120%);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-deep) 100%
  );
  box-shadow: 0 10px 24px -12px rgba(53, 80, 111, 0.75);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px -14px rgba(53, 80, 111, 0.7);
}

.btn-primary:active {
  transform: translateY(0) scale(0.99);
}

.btn-primary:hover svg {
  transform: translateX(3px);
}

.btn-ghost {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(150, 177, 208, 0.5);
}

.btn-ghost:hover {
  color: var(--accent-deep);
  background: #fff;
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px -16px rgba(27, 34, 51, 0.45);
}

.btn-ghost:active {
  transform: translateY(0) scale(0.99);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.68;
  transform: none !important;
  box-shadow: none;
}

.btn.loading .btn-label {
  opacity: 0.45;
}

/* vong xoay cho nut dang xu ly */
.spin {
  width: 15px;
  height: 15px;
  flex: none;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  display: none;
  animation: spin 0.72s linear infinite;
}

.btn.loading .spin {
  display: block;
}

.btn.loading svg {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* lien ket chu nho co gach chan truot */
.link-sly {
  position: relative;
  font-size: 0.82rem;
  color: var(--accent);
  transition: color 0.3s var(--ease);
}

.link-sly::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}

.link-sly:hover {
  color: var(--accent-deep);
}

.link-sly:hover::after {
  transform: scaleX(1);
}

/* ---------------- thong bao ---------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.85rem;
  line-height: 1.5;
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  margin-bottom: 1.1rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  margin-bottom: 0;
  border-width: 0;
  transition:
    max-height 0.42s var(--ease),
    opacity 0.32s var(--ease),
    padding 0.42s var(--ease),
    margin 0.42s var(--ease),
    transform 0.42s var(--ease);
  transform: translateY(-6px);
}

.alert.show {
  max-height: 220px;
  opacity: 1;
  padding: 0.8rem 0.95rem;
  margin-bottom: 1.1rem;
  border-width: 1px;
  transform: none;
}

.alert svg {
  width: 17px;
  height: 17px;
  flex: none;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.alert-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(168, 68, 63, 0.28);
}

.alert-ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(47, 125, 98, 0.28);
}

.alert-info {
  color: var(--accent-deep);
  background: rgba(74, 110, 150, 0.1);
  border-color: rgba(74, 110, 150, 0.26);
}

.shake {
  animation: shake 0.42s var(--ease);
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-7px);
  }
  45% {
    transform: translateX(6px);
  }
  70% {
    transform: translateX(-3px);
  }
}

/* toast noi goc phai */
.toast-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 230px;
  max-width: min(360px, calc(100vw - 36px));
  font-size: 0.86rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(16px) saturate(124%);
  -webkit-backdrop-filter: blur(16px) saturate(124%);
  box-shadow: var(--shadow-soft);
  transform: translateY(16px) scale(0.96);
  opacity: 0;
  transition:
    transform 0.42s var(--ease),
    opacity 0.32s var(--ease);
}

.toast.in {
  transform: none;
  opacity: 1;
}

.toast.out {
  transform: translateX(28px);
  opacity: 0;
}

.toast .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--accent);
}

.toast.ok .dot {
  background: var(--ok);
}

.toast.err .dot {
  background: var(--danger);
}

/* ---------------- xuat hien dan ---------------- */
.rise {
  opacity: 0;
  transform: translateY(16px);
  animation: rise 0.78s var(--ease) forwards;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

.d1 {
  animation-delay: 0.06s;
}
.d2 {
  animation-delay: 0.14s;
}
.d3 {
  animation-delay: 0.22s;
}
.d4 {
  animation-delay: 0.3s;
}
.d5 {
  animation-delay: 0.38s;
}
.d6 {
  animation-delay: 0.46s;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
