/* ===================== Mussie Fitness — Stylesheet ===================== */

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c2330;
  --border: #2a3242;
  --text: #e6edf3;
  --text-muted: #8b96a5;
  --accent: #39e58c;
  --accent-dark: #1fae66;
  --danger: #ef5766;
  --blue: #4d9dff;
  --yellow: #f0c419;
  --red: #ef5766;
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { margin: 0; }

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 520px;
  margin: 0 auto;
}
.logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  flex-shrink: 0;
}
.app-header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* ---------- Layout ---------- */
#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 90px 16px;
}
.view { display: block; }
.view.hidden { display: none; }
.view-title {
  font-size: 22px;
  margin-bottom: 14px;
  font-weight: 700;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

/* ---------- Welcome ---------- */
.welcome-text {
  font-size: 17px;
  color: var(--text-muted);
  margin: 4px 0 16px 0;
}

/* ---------- Stat grid ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.stats-grid.two-col { grid-template-columns: 1fr 1fr; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.stat-value.small { font-size: 15px; font-weight: 600; }

/* ---------- Week progress ---------- */
.week-card-header {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.progress-bar-track {
  width: 100%;
  height: 10px;
  background: var(--surface-2);
  border-radius: 6px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  border-radius: 6px;
  transition: width 0.3s ease;
}

/* ---------- Next workout ---------- */
.next-workout-box {
  font-size: 17px;
  font-weight: 700;
}

/* ---------- Tip / feedback ---------- */
.tip-card p, .feedback-card p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}
.feedback-card {
  border-color: var(--accent-dark);
  background: rgba(57, 229, 140, 0.08);
}

/* ---------- Mini calendar ---------- */
.mini-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  text-align: center;
}
.cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.cal-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.cal-dot.done { outline: 2px solid var(--accent); }
.cal-dot.today { border-color: var(--accent); }

/* ---------- Workout list ---------- */
.workout-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}
.workout-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.workout-card-info h3 {
  font-size: 16px;
  margin-bottom: 4px;
}
.workout-card-info p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.workout-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  margin-bottom: 6px;
}
.tag-a { background: rgba(239,87,102,0.18); color: var(--red); }
.tag-b { background: rgba(57,229,140,0.18); color: var(--accent); }
.tag-c { background: rgba(77,157,255,0.18); color: var(--blue); }

/* ---------- History ---------- */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.history-item:last-child { border-bottom: none; padding-bottom: 0; }
.history-item-header {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.history-item-details {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.empty-text {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 10px 0;
}

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}
.btn-primary { background: var(--accent); color: #06210f; }
.btn-primary:active { background: var(--accent-dark); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:active { background: var(--border); }
.btn-danger { background: rgba(239,87,102,0.15); color: var(--danger); border: 1px solid var(--danger); }
.btn-large { width: 100%; padding: 16px; font-size: 16px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }
.btn-icon {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

/* ---------- Forms ---------- */
label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  margin: 12px 0 6px 0;
}
label:first-child { margin-top: 0; }
input[type="number"], input[type="text"], select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  color: var(--text);
  font-size: 16px;
}
input:focus, select:focus { outline: 2px solid var(--accent); }
.inline-form { display: flex; gap: 10px; align-items: stretch; }
.inline-form input { flex: 1; }
.muted-text { color: var(--text-muted); font-size: 13px; margin: 6px 0 0 0; }

/* ---------- Session (workout tracker) ---------- */
.session-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.session-header h2 { font-size: 19px; }
.session-exercise-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.exercise-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.exercise-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.exercise-muscle { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.exercise-image-wrap {
  width: 100%;
  max-width: 220px;
  margin: 0 auto 10px auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.exercise-svg {
  width: 100%;
  height: auto;
  display: block;
}
.exercise-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.exercise-tip {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 10px;
  line-height: 1.4;
}
.exercise-variants {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}
.suggestion-box {
  font-size: 13px;
  background: rgba(57,229,140,0.1);
  border: 1px solid var(--accent-dark);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 10px;
  line-height: 1.5;
}
.set-row {
  display: grid;
  grid-template-columns: 34px 1fr 1fr 40px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.set-row span { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.set-row input {
  padding: 10px;
  font-size: 15px;
  text-align: center;
}
.set-check {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
}
.set-check.checked {
  background: var(--accent);
  color: #06210f;
  border-color: var(--accent);
}
.add-set-btn {
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 8px;
  width: 100%;
  font-size: 13px;
  cursor: pointer;
  margin-top: 4px;
}

/* ---------- Weight chart ---------- */
.weight-chart { width: 100%; height: auto; display: block; }

/* ---------- PR list ---------- */
.pr-list { display: flex; flex-direction: column; gap: 8px; }
.pr-item { display: flex; justify-content: space-between; font-size: 14px; }
.pr-item span:first-child { color: var(--text-muted); }
.pr-item span:last-child { font-weight: 700; }

/* ---------- Danger ---------- */
.danger-card { border-color: rgba(239,87,102,0.4); }
.disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  padding: 0 10px;
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)) 6px;
  z-index: 30;
}
.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 0;
  cursor: pointer;
}
.nav-btn.active { color: var(--accent); }
.nav-icon { font-size: 20px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Responsive tweak for small phones ---------- */
@media (max-width: 360px) {
  .stat-value { font-size: 20px; }
  .set-row { grid-template-columns: 28px 1fr 1fr 36px; }
}
