/* ============================================================
   COMPONENTS — các thành phần dựng theo 6 màn hình THẬT của
   benchmark (đọc từ ảnh chụp app trên trang của họ, 08/09/2026).
   Nạp sau app.css.
   ============================================================ */

/* ---------------- Dải ngày ngang (Trang chủ) ---------------- */

.datestrip { display: flex; gap: var(--s-2); overflow-x: auto; padding-bottom: var(--s-2);
             scrollbar-width: none; }
.datestrip::-webkit-scrollbar { display: none; }
.dchip {
  flex: 0 0 46px; height: 58px; border-radius: var(--r-md);
  background: var(--cream); display: grid; place-content: center; text-align: center;
  line-height: 1.2;
}
.dchip small { display: block; font-size: 10px; color: var(--ink-4); font-weight: 700; }
.dchip b { font-size: 16px; color: var(--ink-3); }
.dchip.is-on   { background: var(--lime); }
.dchip.is-on b, .dchip.is-on small { color: var(--ink); }
.dchip.is-done { background: var(--lime-wash); }
.dchip.is-done b { color: var(--ink); }

/* ---------------- Băng cuộn ngang ---------------- */

.hscroll {
  display: flex; gap: var(--s-3); overflow-x: auto;
  margin-inline: calc(var(--s-5) * -1); padding-inline: var(--s-5); padding-bottom: var(--s-2);
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { flex: 0 0 78%; scroll-snap-align: start; }
.hscroll--sm > * { flex: 0 0 58%; }

/* ---------------- Thẻ lớn: ảnh tràn, chữ đè lên ---------------- */

.bigcard {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  aspect-ratio: 4 / 5; display: block; width: 100%; text-align: left;
  background: var(--cream);
}
.bigcard__img { position: absolute; inset: 0; }
.bigcard__img .ph { border-radius: 0; height: 100%; }
.bigcard__veil {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(28,24,53,.80) 0%, rgba(28,24,53,.18) 45%, transparent 70%);
}
.bigcard__txt { position: absolute; left: var(--s-4); right: var(--s-4); bottom: var(--s-4); color: #fff; }
.bigcard__txt b { display: block; font-size: 17px; font-weight: 900; line-height: 1.25; }
.bigcard__txt span { font-size: var(--fs-xs); opacity: .82; }
.bigcard__play {
  position: absolute; right: var(--s-4); top: var(--s-4);
  width: 34px; height: 34px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.9); color: var(--ink);
  display: grid; place-items: center; font-size: 13px;
}
.bigcard__done {
  position: absolute; left: var(--s-4); top: var(--s-4);
  background: var(--lime); color: var(--ink); border-radius: var(--r-pill);
  padding: 2px var(--s-3); font-size: var(--fs-xs); font-weight: 900;
}
.bigcard--wide { aspect-ratio: 16 / 10; }

/* ---------------- Chuyển tab BÀI LẺ | KẾ HOẠCH ---------------- */

.seg { display: flex; gap: var(--s-6); border-bottom: 1px solid var(--line); margin-bottom: var(--s-5); }
.seg button {
  padding: var(--s-3) 0; font-weight: 900; font-size: 15px; color: var(--ink-4);
  border-bottom: 3px solid transparent; margin-bottom: -1px; letter-spacing: .03em;
}
.seg button.is-on { color: var(--ink); border-bottom-color: var(--lime-deep); }

/* ---------------- Chip lọc ---------------- */

.chips { display: flex; gap: var(--s-2); overflow-x: auto; padding-bottom: var(--s-3);
         scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; height: 34px; padding-inline: var(--s-4);
  border-radius: var(--r-pill); border: 1px solid var(--line);
  background: var(--white); color: var(--ink-2);
  font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
}
.chip.is-on { background: var(--ink); color: var(--white); border-color: var(--ink); }

/* ---------------- Dòng thời gian kế hoạch ---------------- */

.tl { position: relative; padding-left: var(--s-6); }
.tl::before {
  content: ""; position: absolute; left: 7px; top: 12px; bottom: 12px;
  border-left: 2px dotted var(--line);
}
.tl__row { position: relative; margin-bottom: var(--s-3); }
.tl__dot {
  position: absolute; left: calc(var(--s-6) * -1); top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; border-radius: var(--r-pill);
  border: 3px solid var(--lime-deep); background: var(--white);
}
.tl__row.is-done .tl__dot { background: var(--lime-deep); }
.tl__card {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; text-align: left;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--s-3);
}
.tl__thumb { flex: 0 0 56px; height: 56px; border-radius: var(--r-sm); }
.tl__txt { flex: 1; min-width: 0; }
.tl__txt small { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 800; }
.tl__txt b { display: block; font-size: var(--fs-sm); color: var(--ink); line-height: 1.3; }
.tl__txt span { font-size: var(--fs-xs); color: var(--ink-4); }
/* Nút tròn trên dòng thời gian: nền lime SÁNG, mũi tên màu than.
   Chữ/biểu tượng trắng trên lime là tàng hình — không dùng. */
.tl__go {
  flex: 0 0 34px; height: 34px; border-radius: var(--r-pill);
  background: var(--lime); color: var(--ink); display: grid; place-items: center; font-size: 13px;
}
.tl__row.is-done .tl__go { background: var(--cream); color: var(--ink-2); }

/* ---------------- Màn chi tiết bài tập ---------------- */

.detail { position: fixed; inset: 0; z-index: 90; background: var(--white); overflow-y: auto; }
.detail[hidden] { display: none; }
.detail__inner { max-width: var(--wrap-app); margin-inline: auto; padding-bottom: 120px; }

.detail__hero { position: relative; aspect-ratio: 1 / 1; }
.detail__hero .ph { border-radius: 0; height: 100%; }
.detail__bar {
  position: absolute; top: var(--s-5); left: var(--s-4); right: var(--s-4);
  display: flex; align-items: center; gap: var(--s-3); z-index: 2;
}
.detail__ico {
  width: 38px; height: 38px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.85); color: var(--ink);
  display: grid; place-items: center; font-size: 16px;
}
.detail__bar .spacer { margin-left: auto; }

.detail__title {
  position: absolute; left: var(--s-5); right: var(--s-5); bottom: var(--s-6); z-index: 2; color: #fff;
}
.detail__title h2 { color: #fff; font-size: 26px; }
.detail__meta { display: flex; gap: var(--s-4); margin-top: var(--s-3); font-size: var(--fs-sm); }
.detail__meta span { display: inline-flex; align-items: center; gap: var(--s-1); opacity: .92; }

.detail__body { padding: var(--s-5); }

.tagrow { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-6); }
.tagchip {
  height: 30px; padding-inline: var(--s-3); border-radius: var(--r-pill);
  border: 1px solid var(--lime-deep); background: var(--lime-wash); color: var(--ink);
  font-size: var(--fs-xs); font-weight: 800; display: inline-flex; align-items: center; gap: 4px;
}

.mrow { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0;
        border-bottom: 1px solid var(--line-2); }
.mrow__art { flex: 0 0 40px; height: 40px; border-radius: var(--r-sm); background: var(--cream);
             display: grid; place-items: center; font-size: 16px; }
.mrow__txt { flex: 1; }
.mrow__txt b { display: block; font-size: var(--fs-sm); color: var(--ink); }
.mrow__txt span { font-size: var(--fs-xs); color: var(--ink-4); }

.blockrow { display: flex; justify-content: space-between; padding: var(--s-3) 0;
            border-bottom: 1px solid var(--line-2); font-size: var(--fs-sm); }
.blockrow b { color: var(--ink); font-weight: 600; }
.blockrow span { color: var(--ink-4); }

.detail__cta {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--wrap-app);
  padding: var(--s-4) var(--s-5) calc(var(--s-6) + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--white) 72%, rgba(255,255,255,0));
  z-index: 3;
}

/* ---------------- Huy chương thành tích ---------------- */

.achv { display: flex; gap: var(--s-4); justify-content: space-around; }
.achv__item { text-align: center; flex: 1; }
.achv__medal {
  width: 60px; height: 60px; margin: 0 auto var(--s-3);
  border-radius: 18px; transform: rotate(45deg);
  display: grid; place-items: center;
  box-shadow: inset 0 -6px 12px rgba(0,0,0,.2), var(--sh-md);
}
/* Huy chương nay là tông lime SÁNG -> số phải là chữ than, không phải trắng.
   Chỗ tối nhất của gradient (#7E9617) vẫn đạt 5.09:1 với --ink. */
.achv__medal b { transform: rotate(-45deg); color: var(--ink); font-size: 19px; font-weight: 900; }
.achv__item span { font-size: 10px; color: var(--ink-3); line-height: 1.3; display: block; }
.achv__item.off .achv__medal { filter: grayscale(1); opacity: .3; }

/* ---------------- Theo dõi cân nặng ---------------- */

.wbox { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-5); }
/* Số cân nặng hiện tại: --ink chứ không phải lime (lime trên trắng 1.17:1). */
.wnow { text-align: right; font-size: 26px; font-weight: 900; color: var(--ink); }
.wnow small { font-size: var(--fs-sm); }
.wbar { height: 10px; border-radius: var(--r-pill); background: var(--line-2); margin: var(--s-3) 0 var(--s-4); overflow: hidden; }
.wbar > i { display: block; height: 100%; background: var(--lime); border-radius: inherit; }
.wends { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--ink-4); }
.wends b { display: block; font-size: var(--fs-body); color: var(--ink); }
.btn--warn { background: var(--warn); color: #fff; box-shadow: 0 8px 20px rgba(180,83,10,.28); }
.wchart { margin-top: var(--s-6); }
.wchart svg { width: 100%; height: 110px; display: block; }
/* Nét biểu đồ do app.js vẽ bằng stroke="var(--lime-deep)"; lime trên nền
   trắng chỉ 1.42:1 nên ghi đè sang --ink cho đọc được. Mảng nền giữ lime. */
.wchart svg polyline { stroke: var(--ink); }
.wempty { text-align: center; color: var(--ink-4); font-size: var(--fs-sm); padding: var(--s-8) 0; }
