/* Pulse Fitness — طراحی رابط
   ساخته‌شده توسط مبین افسرده و ارمیا دهقانی */

:root {
  --bg: #f4f6f3;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f3ee;
  --line: #e2e7dd;
  --line-strong: #cfd6c8;
  --text: #16211a;
  --text-2: #5d6b60;
  --text-3: #8b978d;
  --brand: #4c9a2a;
  --brand-ink: #ffffff;
  --brand-soft: #e8f5dd;
  --accent: #ff7a45;
  --info: #2f80ed;
  --warn: #d99400;
  --danger: #d64545;
  --good: #2f9e6d;
  --ring-track: #e6ebe1;
  --shadow: 0 1px 2px rgba(16, 33, 22, .05), 0 12px 28px -18px rgba(16, 33, 22, .28);
  --shadow-lg: 0 24px 60px -30px rgba(16, 33, 22, .45);
  --radius: 20px;
  --radius-sm: 14px;
  --tap: 44px;
}

[data-theme="dark"] {
  --bg: #0d120f;
  --bg-2: #121814;
  --surface: #161d18;
  --surface-2: #1d2621;
  --line: #263129;
  --line-strong: #334137;
  --text: #eef4ef;
  --text-2: #a7b5ab;
  --text-3: #74847a;
  --brand: #a8e05f;
  --brand-ink: #10180f;
  --brand-soft: #1e2b18;
  --accent: #ff9466;
  --info: #6ab5ff;
  --warn: #f0b429;
  --danger: #ff7b7b;
  --good: #59d3a0;
  --ring-track: #24302a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 18px 36px -24px rgba(0, 0, 0, .8);
  --shadow-lg: 0 30px 70px -34px rgba(0, 0, 0, .9);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", "Vazir", "Segoe UI", Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background .25s ease, color .25s ease;
}

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

svg.ic {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
svg.ic.solid { fill: currentColor; stroke: none; }
svg.ic.sm { width: 16px; height: 16px; }
svg.ic.lg { width: 26px; height: 26px; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--brand); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 20px; border: 3px solid var(--bg); }

/* ——————————————— دکمه‌ها و فرم ——————————————— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 14.5px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  transition: transform .12s ease, background .2s ease, border-color .2s ease, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; box-shadow: 0 10px 24px -14px var(--brand); }
.btn--ghost { background: transparent; }
.btn--danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn--block { width: 100%; }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
.btn--icon { width: var(--tap); min-height: var(--tap); padding: 0; border-radius: 13px; }

.field { display: block; margin-bottom: 14px; }
.field__label { display: block; font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 7px; }
.field__hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.field__wrap { position: relative; display: flex; align-items: center; }
.field__wrap > svg.ic { position: absolute; inset-inline-start: 13px; color: var(--text-3); }
.input, .select {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  transition: border-color .18s ease, background .18s ease;
  outline: none;
}
.field__wrap > svg.ic ~ .input { padding-inline-start: 42px; }
.input:focus, .select:focus { border-color: var(--brand); background: var(--surface); }
.input--num { text-align: center; font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.select { appearance: none; background-image: none; }

.err {
  display: flex;
  gap: 8px;
  align-items: center;
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* ——————————————— ورود / ثبت‌نام ——————————————— */
.auth {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  background:
    radial-gradient(1100px 600px at 85% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%),
    radial-gradient(700px 500px at 10% 110%, color-mix(in srgb, var(--info) 14%, transparent), transparent 60%),
    var(--bg);
}
.auth__hero {
  padding: 34px 22px 8px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand__mark {
  width: 46px; height: 46px;
  border-radius: 15px;
  display: grid; place-items: center;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 900;
  box-shadow: 0 12px 26px -14px var(--brand);
}
.brand__name { font-weight: 900; font-size: 19px; letter-spacing: -.2px; }
.brand__sub { font-size: 12px; color: var(--text-3); margin-top: -4px; }

.auth__title { font-size: clamp(26px, 7vw, 40px); font-weight: 900; line-height: 1.35; margin: 6px 0 0; letter-spacing: -.6px; }
.auth__lead { color: var(--text-2); max-width: 46ch; margin: 0; }
.auth__points { display: grid; gap: 10px; margin: 4px 0 0; padding: 0; list-style: none; }
.auth__points li { display: flex; gap: 10px; align-items: center; font-size: 13.5px; color: var(--text-2); }
.auth__points svg.ic { color: var(--brand); }

.auth__panel { padding: 18px 16px 30px; }
.auth__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 20px 18px;
  box-shadow: var(--shadow-lg);
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
}
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface-2); padding: 5px; border-radius: 15px; margin-bottom: 18px; }
.tabs button { min-height: 40px; border-radius: 11px; font-weight: 700; font-size: 14px; color: var(--text-2); }
.tabs button.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.demo-hint {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.demo-hint code {
  font-family: inherit;
  background: var(--surface);
  border-radius: 7px;
  padding: 1px 7px;
  color: var(--brand);
  direction: ltr;
  display: inline-block;
}
.demo-hint .btn { margin-inline-start: auto; }

.credits {
  margin-top: 18px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 2;
}
.credits strong { color: var(--text-2); font-weight: 800; }

/* ——————————————— آنبوردینگ ——————————————— */
.onb { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.onb__bar { padding: 18px 16px 0; }
.onb__track { height: 6px; border-radius: 99px; background: var(--ring-track); overflow: hidden; }
.onb__fill { height: 100%; background: var(--brand); border-radius: 99px; transition: width .3s ease; }
.onb__step { font-size: 12px; color: var(--text-3); margin-top: 8px; display: flex; justify-content: space-between; }
.onb__body { flex: 1; padding: 12px 16px 20px; max-width: 620px; margin: 0 auto; width: 100%; }
.onb__title { font-size: clamp(21px, 5.5vw, 28px); font-weight: 900; margin: 12px 0 4px; letter-spacing: -.4px; }
.onb__lead { color: var(--text-2); margin: 0 0 18px; font-size: 14px; }
.onb__foot { position: sticky; bottom: 0; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 62%, transparent); display: flex; gap: 10px; max-width: 620px; margin: 0 auto; width: 100%; }
.onb__foot .btn { flex: 1; }

.choice-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.choice {
  text-align: start;
  padding: 14px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  display: flex;
  gap: 12px;
  align-items: center;
  transition: border-color .18s, background .18s, transform .12s;
}
.choice:active { transform: scale(.985); }
.choice.is-on { border-color: var(--brand); background: var(--brand-soft); }
.choice__ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); flex: none; }
.choice.is-on .choice__ic { background: var(--brand); color: var(--brand-ink); }
.choice__t { font-weight: 800; font-size: 14.5px; }
.choice__d { font-size: 12px; color: var(--text-3); line-height: 1.6; }

.dial { display: flex; align-items: center; gap: 12px; }
.dial .btn--icon { flex: none; }
.dial .input { flex: 1; }
.slider { width: 100%; accent-color: var(--brand); margin: 14px 0 2px; height: 30px; }
.two-col { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }

/* ——————————————— اسکلت اپ ——————————————— */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.sidebar { display: none; }  /* فقط در نمایشگر بزرگ نشان داده می‌شود */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { font-weight: 900; font-size: 17px; letter-spacing: -.2px; }
.topbar__sub { font-size: 11.5px; color: var(--text-3); margin-top: -3px; }
.topbar__spacer { flex: 1; }
.avatar {
  width: 40px; height: 40px; border-radius: 13px; flex: none;
  display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink); font-weight: 900;
}

.main { flex: 1; padding: 16px 16px 96px; max-width: 1180px; width: 100%; margin: 0 auto; }
.view { display: grid; gap: 14px; }

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 9px 2px 8px; font-size: 10.5px; font-weight: 700; color: var(--text-3);
  transition: color .18s;
}
.tabbar button.is-on { color: var(--brand); }
.tabbar button.is-on svg.ic { transform: translateY(-1px); }

/* ——————————————— کارت‌ها ——————————————— */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card--flat { box-shadow: none; }
.card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card__title { font-weight: 800; font-size: 15px; }
.card__sub { font-size: 12px; color: var(--text-3); }
.card__head .btn { margin-inline-start: auto; }

.section-title { font-weight: 900; font-size: 16px; margin: 6px 2px -2px; letter-spacing: -.2px; }
.muted { color: var(--text-3); font-size: 12.5px; }

.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 18px;
  color: #fff;
  background: linear-gradient(135deg, #2f6d24, #4c9a2a 55%, #7bc043);
  box-shadow: var(--shadow-lg);
}
[data-theme="dark"] .hero-card { background: linear-gradient(135deg, #1d3a17, #37651f 55%, #6d9c31); }
.hero-card__eyebrow { font-size: 12px; opacity: .85; font-weight: 700; }
.hero-card__title { font-size: 21px; font-weight: 900; margin: 4px 0 6px; letter-spacing: -.3px; }
.hero-card__text { font-size: 13.5px; opacity: .92; margin: 0 0 14px; }
.hero-card__row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hero-card .btn { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .28); backdrop-filter: blur(4px); }
.hero-card .btn--primary { background: #fff; color: #1f3d18; border-color: transparent; }
.hero-card__glow { position: absolute; inset-block-start: -60px; inset-inline-start: -40px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .14); }

/* حلقه‌های پیشرفت */
.rings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ring { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ring__svg { width: 84px; height: 84px; transform: rotate(-90deg); }
.ring__track { stroke: var(--ring-track); }
.ring__val { transition: stroke-dashoffset .6s cubic-bezier(.4, 0, .2, 1); }
.ring__wrap { position: relative; display: grid; place-items: center; }
.ring__center { position: absolute; text-align: center; }
.ring__num { font-weight: 900; font-size: 16px; line-height: 1.1; }
.ring__unit { font-size: 10px; color: var(--text-3); }
.ring__label { font-size: 12px; color: var(--text-2); font-weight: 700; }

.stat-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px; box-shadow: var(--shadow); }
.stat__top { display: flex; align-items: center; gap: 7px; color: var(--text-3); font-size: 12px; font-weight: 700; }
.stat__val { font-size: 20px; font-weight: 900; margin-top: 4px; letter-spacing: -.3px; }
.stat__val small { font-size: 12px; font-weight: 700; color: var(--text-3); }
.stat__foot { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.bar { height: 8px; border-radius: 99px; background: var(--ring-track); overflow: hidden; margin-top: 8px; }
.bar__fill { height: 100%; border-radius: 99px; background: var(--brand); transition: width .5s ease; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 800;
  background: var(--surface-2); color: var(--text-2);
}
.pill--good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.pill--warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill--danger { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.pill--brand { background: var(--brand-soft); color: var(--brand); }

/* لیست‌ها و ردیف‌ها */
.rowlist { display: grid; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: 15px;
  background: var(--surface-2);
  border: 1px solid transparent;
}
.row--card { background: var(--surface); border-color: var(--line); }
.row__ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--surface); color: var(--brand); }
.row__body { flex: 1; min-width: 0; }
.row__t { display: block; font-weight: 700; font-size: 14px; }
.row__d { display: block; font-size: 12px; color: var(--text-3); line-height: 1.6; }
.row__end { font-weight: 800; font-size: 13px; color: var(--text-2); white-space: nowrap; }

.day-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); transition: transform .12s, border-color .18s; }
.day-row:active { transform: scale(.99); }
.day-row.is-today { border-color: var(--brand); background: var(--brand-soft); }
.day-row.is-rest .row__ic { color: var(--text-3); }
.day-row__day { width: 44px; text-align: center; flex: none; }
.day-row__num { font-weight: 900; font-size: 15px; }
.day-row__name { font-size: 11px; color: var(--text-3); }

/* اجرای تمرین */
.runner__head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.block { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--surface); }
.block__head { display: flex; align-items: center; gap: 10px; padding: 13px 14px; background: var(--surface-2); }
.block__badge { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-size: 12px; font-weight: 900; background: var(--brand); color: var(--brand-ink); flex: none; }
.block__t { font-weight: 800; font-size: 14px; }
.block__n { font-size: 11.5px; color: var(--text-3); }
.move { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-top: 1px solid var(--line); }
.move__check {
  width: 26px; height: 26px; border-radius: 9px; flex: none; margin-top: 2px;
  border: 2px solid var(--line-strong); display: grid; place-items: center; color: transparent;
  transition: background .18s, border-color .18s, color .18s;
}
.move.is-done .move__check { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.move.is-done .move__name { text-decoration: line-through; color: var(--text-3); }
.move__name { font-weight: 700; font-size: 14px; }
.move__meta { font-size: 12px; color: var(--text-2); }
.move__cue { font-size: 11.5px; color: var(--text-3); margin-top: 3px; line-height: 1.65; }
.move__dose { font-weight: 800; font-size: 12.5px; color: var(--brand); white-space: nowrap; }

.sticky-cta {
  /* روی موبایل درست بالای نوار پایین می‌نشیند */
  position: fixed; inset-inline: 0; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 45;
  padding: 12px 16px;
  background: linear-gradient(to top, var(--bg) 65%, transparent);
  display: flex; gap: 10px; max-width: 1180px; margin: 0 auto;
}
.sticky-cta .btn { flex: 1; }

/* شمارنده‌ی آب */
.counter { display: flex; align-items: center; gap: 12px; }
.counter__val { font-size: 26px; font-weight: 900; min-width: 3.5ch; text-align: center; }
.glasses { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; }
.glass { width: 20px; height: 26px; border-radius: 5px 5px 8px 8px; border: 2px solid var(--line-strong); }
.glass.is-on { background: var(--info); border-color: var(--info); }

/* نمودارها */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: inherit; font-size: 10px; fill: var(--text-3); }

.macro { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.macro__v { font-weight: 900; font-size: 17px; }
.macro__l { font-size: 11.5px; color: var(--text-3); }

.empty { text-align: center; padding: 26px 14px; color: var(--text-3); }
.empty svg.ic { width: 34px; height: 34px; margin-bottom: 8px; color: var(--line-strong); }

.toast {
  position: fixed; inset-inline: 0; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 90;
  display: flex; justify-content: center; pointer-events: none;
}
.toast__box {
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 99px;
  font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow-lg);
  animation: pop .25s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }

.fade-in { animation: fade .28s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } }

/* ——————————————— دسکتاپ ——————————————— */
@media (min-width: 760px) {
  body { font-size: 15.5px; }
  .auth { grid-template-columns: 1.05fr .95fr; align-items: center; }
  .auth__hero { padding: 40px 40px; gap: 22px; }
  .auth__panel { padding: 40px; }
  .two-col--wide { grid-template-columns: 1fr 1fr; display: grid; gap: 14px; align-items: start; }
  .rings { gap: 18px; }
  .ring__svg { width: 96px; height: 96px; }
}

@media (min-width: 980px) {
  .shell { flex-direction: row; }
  .sidebar {
    position: sticky; top: 0; height: 100dvh;
    width: 244px; flex: none;
    border-inline-end: 1px solid var(--line);
    background: var(--bg-2);
    padding: 22px 14px;
    display: flex; flex-direction: column; gap: 6px;
  }
  .sidebar__nav { display: grid; gap: 4px; margin-top: 18px; }
  .sidebar__nav button {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 13px; border-radius: 13px;
    font-weight: 700; font-size: 14px; color: var(--text-2);
    transition: background .18s, color .18s;
  }
  .sidebar__nav button:hover { background: var(--surface-2); }
  .sidebar__nav button.is-on { background: var(--brand); color: var(--brand-ink); }
  .sidebar__foot { margin-top: auto; font-size: 11.5px; color: var(--text-3); line-height: 1.9; }
  .tabbar { display: none; }
  .main { padding: 22px 28px 40px; }
  .shell__col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .grid-2 { display: grid; grid-template-columns: 1.25fr .85fr; gap: 16px; align-items: start; }
  .sidebar { display: flex; }
  .sticky-cta { inset-inline-start: 244px; bottom: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

@media (min-width: 1240px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
