/* ============================================================
   K-FIT — Design Tokens
   Nguồn cảm hứng: Material Design 3 (shape/elevation/type scale),
   Radix Colors (12-step semantic scale: bg → border → solid → text),
   Tailwind/Refactoring UI (4px spacing grid, hierarchy-first).
   Dark theme. Mọi component tham chiếu token, không hard-code.
   ============================================================ */
:root {
  /* ——— COLOR: neutral scale (Radix step 1→12, dark) ——— */
  --bg: #090a0f;              /* step 1: app background */
  --bg-alt: #0f1117;          /* step 2: substrate */
  --card: #14161f;            /* step 3: component */
  --card-hover: #1a1d29;      /* step 4: component hover */
  --card-active: #20242f;     /* step 5: active/pressed */
  --line: #232735;            /* step 6: border low */
  --line-strong: #313850;     /* step 7: border high */
  --text: #eef0f6;            /* step 12: text high */
  --muted: #9aa1b5;           /* step 11: text low */
  --faint: #6b7288;           /* step 10: disabled */

  /* ——— BRAND ——— */
  --accent: #6366f1;
  --accent-hover: #7c7ff5;
  --accent-2: #22d3ee;
  --accent-soft: rgba(99, 102, 241, 0.14);
  --accent-soft-2: rgba(34, 211, 238, 0.10);
  --grad: linear-gradient(90deg, #6366f1, #22d3ee);

  /* ——— SEMANTIC ——— */
  --success: #34d399;      --success-soft: rgba(52, 211, 153, 0.14);
  --warning: #fbbf24;      --warning-soft: rgba(251, 191, 36, 0.14);
  --danger: #f87171;       --danger-soft: rgba(248, 113, 113, 0.14);

  /* ——— SPACING (4px grid) ——— */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;

  /* ——— RADIUS (M3 shape scale) ——— */
  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px; --r-full: 999px;

  /* ——— ELEVATION (M3 5 levels) ——— */
  --e-1: 0 2px 8px rgba(0, 0, 0, 0.25);
  --e-2: 0 6px 20px rgba(0, 0, 0, 0.32);
  --e-3: 0 12px 40px rgba(0, 0, 0, 0.45);

  /* ——— TYPE SCALE ——— */
  --fs-xs: 12px; --fs-sm: 13.5px; --fs-base: 15px; --fs-md: 16.5px;
  --fs-lg: 19px; --fs-xl: 23px; --fs-2xl: 28px;
  --fs-hero: clamp(40px, 7vw, 68px);

  /* ——— MOTION ——— */
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --t-fast: 120ms var(--ease);
  --t-med: 200ms var(--ease);
  --t-slow: 320ms var(--ease);

  /* ——— Back-compat aliases (component cũ tham chiếu) ——— */
  --radius: var(--r-lg);
  --shadow: var(--e-3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: "Sora", "Be Vietnam Pro", sans-serif; line-height: 1.15; }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50;
  background: rgba(10, 11, 16, 0.75);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1120px; margin: auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 28px;
}
.logo { font-family: "Sora"; font-weight: 800; font-size: 22px; color: var(--text); text-decoration: none; letter-spacing: 0.5px; }
.logo span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links { display: flex; gap: 22px; margin-left: auto; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 14.5px; font-weight: 500; transition: color 0.15s; }
.nav-links a:hover { color: var(--text); }
@media (max-width: 760px) { .nav-links { display: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; font-family: inherit;
  font-weight: 600; font-size: 15px;
  border-radius: 12px; padding: 11px 20px;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover { box-shadow: 0 8px 32px rgba(99, 102, 241, 0.55); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--card); }
.btn-lg { padding: 15px 30px; font-size: 16.5px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- hero ---------- */
.hero { position: relative; padding: 150px 24px 90px; overflow: hidden; }
.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(700px 340px at 15% -5%, rgba(99, 102, 241, 0.22), transparent 65%),
    radial-gradient(640px 320px at 88% 8%, rgba(34, 211, 238, 0.16), transparent 65%),
    radial-gradient(900px 500px at 50% 110%, rgba(52, 211, 153, 0.07), transparent 70%);
}
.hero-inner { max-width: 880px; margin: auto; text-align: center; }
.hero-badge {
  display: inline-block; padding: 7px 16px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--accent-2); font-size: 13.5px; font-weight: 600; margin-bottom: 26px;
}
.hero h1 { font-size: clamp(40px, 7vw, 68px); font-weight: 800; letter-spacing: -1.5px; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { max-width: 640px; margin: 22px auto 34px; color: var(--muted); font-size: 17.5px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-stats {
  display: flex; gap: 8px; justify-content: center; margin-top: 52px; flex-wrap: wrap;
}
.hero-stats > div {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 28px; min-width: 120px;
}
.hero-stats b { display: block; font-family: "Sora"; font-size: 26px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-stats span { color: var(--muted); font-size: 13px; }

/* ---------- sections ---------- */
.section { max-width: 1120px; margin: auto; padding: 90px 24px; }
.section-alt {
  max-width: none; background: var(--bg-alt);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.section-alt > * { max-width: 1120px; margin-left: auto; margin-right: auto; }
.section-head { text-align: center; margin-bottom: 54px; }
.section-head h2 { font-size: clamp(28px, 4.4vw, 42px); letter-spacing: -1px; }
.section-head p { color: var(--muted); margin-top: 14px; font-size: 16.5px; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; transition: transform 0.2s, border-color 0.2s, background 0.2s;
}
.card:hover { transform: translateY(-4px); background: var(--card-hover); }
.card-icon { font-size: 34px; margin-bottom: 14px; }
.card h3 { font-size: 18px; margin-bottom: 10px; }
.card p { color: var(--muted); font-size: 14.5px; }

/* ---------- data grid ---------- */
.data-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.data-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; }
.data-box h3 { margin-bottom: 16px; font-size: 19px; }
.data-box ul { list-style: none; }
.data-box li { padding: 7px 0; color: var(--muted); font-size: 14.5px; border-bottom: 1px dashed var(--line); }
.data-box li:last-child { border-bottom: none; }
.data-box li b { color: var(--text); }

/* ---------- steps ---------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-bottom: 44px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; position: relative; }
.step-n {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--grad); color: #fff; font-family: "Sora"; font-weight: 700; font-size: 18px;
  margin-bottom: 16px;
}
.step h3 { font-size: 17px; margin-bottom: 8px; }
.step p { color: var(--muted); font-size: 14.5px; }
.center { text-align: center; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 44px 24px; text-align: center; font-size: 14.5px; }
.footer .muted { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* ---------- quiz modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 6, 10, 0.72); backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  padding: 36px; box-shadow: var(--shadow);
  animation: pop 0.25s ease;
}
@keyframes pop { from { transform: scale(0.94) translateY(10px); opacity: 0; } }
.modal h2 { font-size: 24px; margin-bottom: 6px; }
.modal-x {
  position: absolute; top: 16px; right: 16px; width: 36px; height: 36px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg-alt);
  color: var(--muted); cursor: pointer; font-size: 15px;
}
.modal-x:hover { color: var(--text); }

.q-progress { height: 6px; border-radius: 99px; background: var(--bg-alt); overflow: hidden; margin-bottom: 10px; }
#q-progress-fill { height: 100%; width: 0%; background: var(--grad); border-radius: 99px; transition: width 0.3s; }
.q-count { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

.q-options { display: grid; gap: 10px; margin-top: 20px; }
.q-opt {
  text-align: left; padding: 15px 18px; border-radius: 14px;
  background: var(--bg-alt); border: 1.5px solid var(--line);
  color: var(--text); cursor: pointer; font-family: inherit; font-size: 15.5px;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.q-opt:hover { border-color: var(--accent); transform: translateX(3px); }
.q-opt.sel { border-color: var(--accent); background: rgba(99, 102, 241, 0.12); }
.q-opt .q-opt-sub { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }

.q-input {
  width: 100%; padding: 15px 18px; font-size: 22px; font-family: "Sora";
  background: var(--bg-alt); border: 1.5px solid var(--line); border-radius: 14px;
  color: var(--text); margin: 18px 0; outline: none; text-align: center;
}
.q-input:focus { border-color: var(--accent); }
#q-input-wrap { margin-top: 20px; }
.q-nav { margin-top: 26px; display: flex; justify-content: space-between; align-items: center; }

/* loading */
#q-loading { text-align: center; padding: 30px 0; }
.loader-ring {
  width: 58px; height: 58px; margin: 0 auto 24px;
  border: 5px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- dashboard ---------- */
.dash-topbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(10, 11, 16, 0.85); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.dash-topbar-inner {
  max-width: 1120px; margin: auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 18px;
}
.dash-tabs { display: flex; gap: 6px; margin-left: auto; }
.dash-tab {
  padding: 8px 16px; border-radius: 10px; border: none; cursor: pointer;
  background: transparent; color: var(--muted); font-family: inherit; font-weight: 600; font-size: 14px;
}
.dash-tab.active { background: var(--card); color: var(--text); }
.dash-wrap { max-width: 1120px; margin: auto; padding: 34px 24px 90px; }

.dash-hero {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px;
  margin-bottom: 34px;
}
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.stat-card .label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.6px; }
.stat-card .value { font-family: "Sora"; font-size: 27px; font-weight: 700; margin-top: 6px; }
.stat-card .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat-card.hl .value { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.dash-section { margin-bottom: 44px; }
.dash-section > h2 { font-size: 22px; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.day-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.day-tab {
  padding: 9px 18px; border-radius: 11px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--muted); cursor: pointer; font-family: inherit; font-weight: 600; font-size: 14px;
}
.day-tab.active { border-color: var(--accent); color: var(--text); background: rgba(99, 102, 241, 0.12); }
.day-tab.rest { opacity: 0.55; }

.ex-list { display: grid; gap: 12px; }
.ex-card {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 16px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px;
}
.ex-num {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: rgba(99, 102, 241, 0.14); color: var(--accent-2); font-family: "Sora"; font-weight: 700; font-size: 17px;
}
.ex-card h4 { font-size: 15.5px; }
.ex-meta { color: var(--muted); font-size: 13px; margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.tag { padding: 2px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 600; background: var(--bg-alt); border: 1px solid var(--line); }
.tag.compound { color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); }
.tag.isolation { color: var(--accent-2); border-color: rgba(34, 211, 238, 0.3); }
.tag.technical { color: var(--danger); border-color: rgba(248, 113, 113, 0.3); }
.ex-links { display: flex; gap: 8px; }
.mini-btn {
  padding: 8px 13px; border-radius: 9px; font-size: 12.5px; font-weight: 600;
  background: var(--bg-alt); border: 1px solid var(--line); color: var(--text);
  text-decoration: none; cursor: pointer; font-family: inherit; white-space: nowrap;
}
.mini-btn:hover { border-color: var(--accent); }
.mini-btn.yt { color: var(--danger); border-color: rgba(248, 113, 113, 0.35); }

.meal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.meal-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.meal-cat { color: var(--accent-2); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; }
.meal-card h4 { font-size: 16px; margin: 6px 0 10px; }
.meal-kcal { font-family: "Sora"; font-size: 21px; font-weight: 700; }
.meal-kcal small { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.macro-row { display: flex; gap: 6px; margin: 12px 0; }
.macro { flex: 1; text-align: center; background: var(--bg-alt); border-radius: 9px; padding: 7px 4px; }
.macro b { display: block; font-size: 14px; }
.macro span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; }
.macro.p b { color: var(--danger); } .macro.c b { color: #fbbf24; } .macro.f b { color: #34d399; }
.meal-ingredients { color: var(--muted); font-size: 13px; line-height: 1.7; }
.meal-recipe { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 13px; }
.meal-recipe summary { cursor: pointer; color: var(--accent-2); font-weight: 600; font-size: 13px; }
.meal-recipe ol { padding-left: 18px; margin-top: 8px; }

/* weight tracker */
.weight-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.weight-row input {
  flex: 1; min-width: 160px; padding: 13px 16px; font-size: 17px; font-family: "Sora";
  background: var(--bg-alt); border: 1.5px solid var(--line); border-radius: 12px; color: var(--text); outline: none;
}
.weight-row input:focus { border-color: var(--accent); }
.wlog { margin-top: 16px; display: grid; gap: 8px; }
.wlog-row {
  display: flex; justify-content: space-between; background: var(--card);
  border: 1px solid var(--line); border-radius: 11px; padding: 11px 16px; font-size: 14px;
}
.wlog-row b { font-family: "Sora"; }
.wlog-row .diff { font-size: 12.5px; }
.diff.down { color: var(--success); } .diff.up { color: var(--danger); } .diff.same { color: var(--muted); }
.goal-progress { height: 12px; border-radius: 99px; background: var(--bg-alt); overflow: hidden; margin-top: 14px; }
.goal-progress > div { height: 100%; background: var(--grad); border-radius: 99px; transition: width 0.4s; }

@media (max-width: 640px) {
  .ex-card { grid-template-columns: 40px 1fr; }
  .ex-links { grid-column: 1 / -1; }
  .hero { padding-top: 120px; }
}

/* Additional K-FIT styles */
.dash-welcome { margin-bottom: 28px; }
.dash-welcome h2 { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
#q-subtitle { color: var(--muted); font-size: 14px; margin-top: 6px; line-height: 1.4; }
.meal-card .meal-ingredients {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bg-alt);
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
}
.meal-card .meal-ingredients b { color: var(--text); }
.meal-recipe summary { font-size: 13.5px; user-select: none; }
.meal-recipe ol { margin-top: 10px; line-height: 1.6; }
.meal-recipe li { margin-bottom: 6px; }
.dash-topbar .logo { font-size: 20px; }

/* ---------- exercise how-to & thumbs (bước nâng cấp thư viện) ---------- */
.ex-card { position: relative; }
.ex-thumbs { grid-column: 3; display: flex; gap: 8px; margin-top: 6px; grid-row: 2; }
.ex-thumb {
  width: 92px; height: 70px; object-fit: cover; object-position: top;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg-alt);
  cursor: zoom-in; transition: transform 0.15s;
}
.ex-thumb:hover { transform: scale(1.05); border-color: var(--accent); }
.tag.diff-beginner { color: var(--success); border-color: rgba(52, 211, 153, 0.35); }
.tag.diff-intermediate { color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); }
.tag.diff-expert { color: var(--danger); border-color: rgba(248, 113, 113, 0.35); }
.howto-steps { padding-left: 20px; display: grid; gap: 10px; color: var(--text); font-size: 14.5px; line-height: 1.65; }
.howto-steps li::marker { color: var(--accent-2); font-weight: 700; }
.howto-en { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--line); }
.howto-en summary { cursor: pointer; color: var(--muted); font-size: 13px; user-select: none; }
.howto-steps.en { color: var(--muted); font-size: 13px; }
.video-embed {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border-radius: 12px; overflow: hidden; border: 1px solid var(--line);
  background: #000; margin-bottom: 4px;
}
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-modal { max-width: 720px; }

@media (max-width: 640px) {
  .ex-thumbs { grid-column: 1 / -1; grid-row: auto; }
}

/* ---------- warm-up & prehab cards ---------- */
.warmup-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(34, 211, 238, 0.06));
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.warmup-card.prehab {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.10), rgba(52, 211, 153, 0.04));
  border-color: rgba(52, 211, 153, 0.35);
}
.warmup-title { font-weight: 700; font-size: 14.5px; margin-bottom: 8px; }
.warmup-steps { padding-left: 20px; display: grid; gap: 6px; font-size: 13.5px; color: var(--text); }
.warmup-steps .muted { font-size: 12.5px; }
.link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent-2); font-weight: 600; font-family: inherit; font-size: 13.5px;
  text-decoration: underline dotted;
}
.link-btn:hover { color: var(--text); }

/* ---------- lift logger ---------- */
.lift-sets { display: grid; gap: 8px; margin-top: 14px; }
.lift-set-row {
  display: grid; grid-template-columns: 70px 1fr 1fr; gap: 10px; align-items: center;
  font-size: 14px; color: var(--muted);
}
.lift-set-row input {
  padding: 10px 12px; font-size: 15px; font-family: "Sora";
  background: var(--bg-alt); border: 1.5px solid var(--line); border-radius: 10px;
  color: var(--text); outline: none; width: 100%;
}
.lift-set-row input:focus { border-color: var(--accent); }

/* ---------- K-FIT Academy ---------- */
.academy-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px; margin-bottom: 26px;
}
.academy-card {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.academy-icon { font-size: 26px; line-height: 1; margin-top: 2px; }
.academy-card h4 { font-size: 14.5px; margin-bottom: 4px; }
.academy-card p { color: var(--muted); font-size: 13px; line-height: 1.55; }

/* ============================================================
   UX UPGRADES (design tokens round — M3 state layers + a11y)
   ============================================================ */

/* — Focus ring cho keyboard users (a11y) — */
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
.btn:focus-visible, .q-opt:focus-visible, .mini-btn:focus-visible, .day-tab:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

/* — Anchor không bị nav che — */
section[id], header[id] { scroll-margin-top: 76px; }

/* — Button: state layer kiểu M3 (elevation + tint) — */
.btn { transition: transform var(--t-fast), box-shadow var(--t-med), background var(--t-med), border-color var(--t-med); }
.btn-primary:hover { box-shadow: var(--e-2), 0 6px 24px rgba(99, 102, 241, 0.35); }
.btn-ghost:hover { background: var(--card); border-color: var(--line-strong); }

/* — Quiz option: check mark khi chọn + hover mượt — */
.q-opt { position: relative; transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast); }
.q-opt:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateX(3px); }
.q-opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.q-opt.sel::after {
  content: "✓";
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--accent-2); font-weight: 800; font-size: 15px;
}

/* — Stat card: hover lift nhẹ (elevation step) — */
.stat-card { transition: transform var(--t-med), border-color var(--t-med), box-shadow var(--t-med); }
.stat-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--e-1); }

/* — Card component: hover nâng elevation — */
.card, .data-box, .step { transition: transform var(--t-med), border-color var(--t-med), box-shadow var(--t-med); }
.card:hover, .data-box:hover { box-shadow: var(--e-1); }

/* — Day tabs: scroll ngang trên mobile, không wrap — */
.day-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.day-tab { white-space: nowrap; flex-shrink: 0; }

/* — Modal: entering animation dùng motion token — */
.modal { animation: pop var(--t-slow); }

/* — Progress bar khi quiz — */
#q-progress-fill { transition: width 280ms var(--ease); }

/* — Logo hover gradient shift — */
.logo { transition: opacity var(--t-fast); }
.logo:hover { opacity: 0.85; }

/* — Nav-link gạch chân gradient khi hover — */
.nav-links a { position: relative; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -4px; height: 2px;
  background: var(--grad); border-radius: var(--r-full);
  transition: right var(--t-med);
}
.nav-links a:hover::after { right: 0; }

/* — Hiệu ứng reduced-motion cho người nhạy cảm chuyển động — */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* — Mobile fine-tuning — */
@media (max-width: 640px) {
  .hero-cta .btn { width: 100%; }
  .dash-tabs { overflow-x: auto; }
  .dash-topbar-inner { gap: 10px; padding: 12px 16px; }
  .modal { padding: 26px 20px; border-radius: var(--r-xl); }
}

/* — Health screening & recovery banners (PAR-Q+ / autoregulation) — */
.health-banner {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: var(--r-lg);
  padding: 16px 20px; margin-bottom: var(--sp-5);
}
.recovery-banner {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--warning-soft);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: var(--r-lg);
  padding: 16px 20px; margin-bottom: var(--sp-5);
}
.health-banner-icon { font-size: 24px; line-height: 1; margin-top: 2px; }
.health-banner b, .recovery-banner b { display: block; margin-bottom: 4px; }
.health-banner p, .recovery-banner p { color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.health-banner p b, .recovery-banner p b { display: inline; color: var(--text); }

/* ============================================================
   ROUND 7 — Visual layer "wow" (Aceternity-style effects)
   + Lưu hồ sơ (resume banner/strip) + Toast (shadcn-style)
   ============================================================ */

/* — Aurora hero background: 2 khối sáng blur trôi chậm — */
.hero-bg::before,
.hero-bg::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(90px);
  opacity: 0.5; pointer-events: none; will-change: transform;
}
.hero-bg::before {
  width: 560px; height: 560px; left: -80px; top: -120px;
  background: radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.45), transparent 70%);
  animation: auroraDrift 16s var(--ease) infinite alternate;
}
.hero-bg::after {
  width: 520px; height: 520px; right: -100px; top: -40px;
  background: radial-gradient(circle at 60% 40%, rgba(34, 211, 238, 0.35), transparent 70%);
  animation: auroraDrift 20s var(--ease) infinite alternate-reverse;
}
@keyframes auroraDrift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(60px, 40px) scale(1.12); }
  100% { transform: translate(-40px, 70px) scale(0.96); }
}

/* — Gradient text chạy chậm trên hero — */
.hero h1 .grad {
  background-size: 200% auto;
  animation: gradShift 7s var(--ease) infinite alternate;
}
@keyframes gradShift {
  from { background-position: 0% center; }
  to   { background-position: 100% center; }
}

/* — Gradient border glow khi hover (stat-card / card / academy) — */
.stat-card, .card, .academy-card, .data-box {
  transition: transform var(--t-med), border-color var(--t-med), box-shadow var(--t-med), background var(--t-med);
}
.stat-card:hover, .academy-card:hover, .data-box:hover {
  border-color: transparent;
  background: linear-gradient(var(--card), var(--card)) padding-box,
              linear-gradient(135deg, rgba(99, 102, 241, 0.55), rgba(34, 211, 238, 0.45)) border-box;
  box-shadow: var(--e-2);
}

/* — Scroll reveal — */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* — Shimmer skeleton cho ảnh demo đang tải — */
.ex-thumb {
  background: linear-gradient(100deg, var(--bg-alt) 30%, var(--card-hover) 50%, var(--bg-alt) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.ex-thumb.loaded { animation: none; background: var(--bg-alt); }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* — Toast (thay alert) — */
#toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 300;
  display: grid; gap: 10px; max-width: 340px;
}
.toast {
  background: var(--card); border: 1px solid var(--line-strong);
  border-radius: var(--r-md); padding: 12px 16px; font-size: 14px;
  box-shadow: var(--e-2); color: var(--text);
  opacity: 0; transform: translateX(24px);
  transition: opacity var(--t-med), transform var(--t-med);
}
.toast.in { opacity: 1; transform: none; }
.toast-success { border-left: 3px solid var(--success); }
.toast-danger { border-left: 3px solid var(--danger); }
.toast-info { border-left: 3px solid var(--accent); }

/* — Banner khôi phục hồ sơ trên landing — */
.resume-banner {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap; justify-content: center;
  margin: 26px auto 0; max-width: 720px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(34, 211, 238, 0.06));
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: var(--r-lg); padding: 16px 22px;
  text-align: left; font-size: 14.5px;
}
.resume-banner b { display: block; margin-bottom: 2px; }
.resume-banner p { color: var(--muted); font-size: 13px; }
.resume-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
  animation: pulse 2s ease-out infinite; flex-shrink: 0;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* — Strip tiếp tục khảo sát trong modal — */
.resume-strip {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--accent-soft);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: var(--r-md); padding: 12px 16px; margin-bottom: 18px;
  font-size: 13.5px;
}
.resume-strip b { color: var(--accent-2); }

/* — Tab content fade — */
.dash-section { animation: fadeUp var(--t-slow); }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* — Stagger cho thẻ bài tập — */
.ex-card { animation: fadeUp var(--t-slow) both; }
.ex-card:nth-child(2) { animation-delay: 40ms; }
.ex-card:nth-child(3) { animation-delay: 80ms; }
.ex-card:nth-child(4) { animation-delay: 120ms; }
.ex-card:nth-child(5) { animation-delay: 160ms; }
.ex-card:nth-child(6) { animation-delay: 200ms; }

/* ============================================================
   VIDEO INSTANT — thumbnail tức thì + iframe phía sau
   ============================================================ */
.video-embed { position: relative; }
.video-embed .video-thumb {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 2;
  opacity: 0; transition: opacity var(--t-med);
  background: #000;
}
.video-embed.thumb-up .video-thumb { opacity: 1; }  /* thumbnail đã tải xong → phủ lên */
.video-embed .video-thumb.hide { opacity: 0; pointer-events: none; } /* iframe sẵn sàng → gỡ */
.video-embed .video-loading {
  position: absolute; inset: 0; z-index: 3;
  display: grid; place-content: center; justify-items: center; gap: 10px;
  color: var(--muted); font-size: 13px; pointer-events: none;
}
.video-embed .video-loading .loader-ring {
  margin: 0; border-top-color: var(--accent-2);
}
