/* Calogym — components: cards, rings, lists, forms, charts */

/* ---------- Cards ---------- */
.card {
  background: var(--bg-elev);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 12px;
}
.card.tight { padding: 12px 14px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-head h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.card-head .hint { color: var(--label-3); font-size: 12px; }

/* ---------- Rings card ---------- */
.rings-card {
  display: flex;
  align-items: center;
  gap: 18px;
}
.rings-stats { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.ring-stat .ring-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--label-2);
}
.ring-stat .ring-value {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.ring-stat .ring-value small {
  font-size: 13px;
  font-weight: 600;
  color: var(--label-2);
  margin-inline-start: 3px;
}
.ring-stat.move .ring-value { color: var(--move-2); }
.ring-stat.exercise .ring-value { color: var(--exercise-2); }
.ring-stat.stand .ring-value { color: var(--stand-2); }

.rings-svg { width: 140px; height: 140px; flex: none; }
.rings-svg .track { opacity: 0.2; }
.rings-svg .arc {
  transition: stroke-dashoffset 0.9s cubic-bezier(0.32, 0.72, 0, 1);
}

/* ---------- Metric tiles ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.tiles.three .tile-value { font-size: 20px; }
.tiles.three .tile { padding: 11px 10px; }
.tile {
  background: var(--bg-elev);
  border-radius: var(--radius-tile);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: start;
}
.tile .tile-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--label-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tile .tile-value {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.tile .tile-value small { font-size: 13px; font-weight: 600; color: var(--label-2); margin-inline-start: 3px; }
.tile .tile-sub { font-size: 12px; color: var(--label-3); }
.tile .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.tile.steps .tile-label { color: var(--orange); }
.tile.distance .tile-label { color: var(--stand-2); }
.tile.energy .tile-label { color: var(--move-2); }
.tile.intake .tile-label { color: var(--exercise-2); }
.tile.heart .tile-label { color: var(--red); }
.tile.net .tile-label { color: var(--purple); }

/* ---------- Lists ---------- */
.list {
  background: var(--bg-elev);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  text-align: start;
  border-bottom: 0.5px solid var(--separator);
}
.row:last-child { border-bottom: 0; }
.row:active { background: var(--bg-elev-2); }
.row .row-main { flex: 1; min-width: 0; }
.row .row-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row .row-sub {
  font-size: 13px;
  color: var(--label-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row .row-value {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--label-2);
  flex: none;
}
.row .chev { color: var(--label-3); flex: none; }
.row .chev svg { display: block; }

.icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 17px;
  background: var(--bg-elev-2);
}
.icon-badge.move { background: rgba(250, 17, 79, 0.18); color: var(--move-2); }
.icon-badge.exercise { background: rgba(125, 255, 47, 0.16); color: var(--exercise-2); }
.icon-badge.stand { background: rgba(8, 232, 242, 0.16); color: var(--stand-2); }
.icon-badge.food { background: rgba(255, 159, 10, 0.18); color: var(--orange); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  background: var(--bg-elev-2);
  color: var(--label);
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.btn:active { transform: scale(0.97); opacity: 0.85; }
.btn.block { width: 100%; }
.btn.primary { background: linear-gradient(140deg, var(--move-1), var(--move-2)); color: #fff; }
.btn.green { background: var(--green); color: #04240f; }
.btn.blue { background: var(--blue); color: #fff; }
.btn.danger { background: rgba(255, 69, 58, 0.18); color: var(--red); }
.btn.ghost { background: transparent; color: var(--blue); }
.btn:disabled { opacity: 0.4; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--label-2);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.chip[aria-pressed="true"] { background: #fff; color: #000; }

/* ---------- Forms ---------- */
.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--label-2);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-elev-2);
  color: var(--label);
  font-size: 16px;
}
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.search-bar svg { color: var(--label-3); flex: none; }
.search-bar input { flex: 1; background: none; font-size: 16px; }

.segmented {
  display: flex;
  background: var(--bg-elev);
  border-radius: 10px;
  padding: 2px;
  margin-bottom: 14px;
}
.segmented button {
  flex: 1;
  padding: 8px 4px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--label-2);
}
.segmented button[aria-pressed="true"] { background: var(--bg-elev-2); color: var(--label); }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .bar { fill: var(--bg-elev-2); }
.chart .bar.move { fill: url(#gMove); }
.chart .bar.exercise { fill: url(#gExercise); }
.chart .grid-line { stroke: var(--separator); stroke-width: 0.5; }
.chart .axis-label { fill: var(--label-3); font-size: 9px; font-weight: 600; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.legend span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--label-2); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: block; }

/* ---------- Macro bars ---------- */
.macro { margin-top: 10px; }
.macro-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
}
.macro-line span:last-child { color: var(--label-2); font-variant-numeric: tabular-nums; }
.bar-track {
  height: 7px;
  border-radius: 4px;
  background: var(--bg-elev-2);
  overflow: hidden;
}
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s cubic-bezier(0.32, 0.72, 0, 1); }
.bar-fill.carbs { background: linear-gradient(90deg, #ff9f0a, #ffd60a); }
.bar-fill.protein { background: linear-gradient(90deg, #0a84ff, #4df3ff); }
.bar-fill.fat { background: linear-gradient(90deg, #bf5af2, #ff375f); }

/* ---------- Live session ---------- */
.session-live { text-align: center; padding: 8px 0 0; }
.session-metric-main {
  font-size: 72px;
  font-weight: 800;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--exercise-2);
}
.session-metric-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--label-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 6px;
}
.session-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 22px 0;
}
.session-grid .cell { background: var(--bg-elev); border-radius: var(--radius-tile); padding: 12px 8px; }
.session-grid .cell b {
  display: block;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.session-grid .cell span { font-size: 11px; color: var(--label-2); font-weight: 600; }

.gps-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--label-2);
}
.gps-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--label-3); }
.gps-dot.good i { background: var(--green); box-shadow: 0 0 8px var(--green); }
.gps-dot.weak i { background: var(--yellow); }
.gps-dot.off i { background: var(--red); }

.route-map { width: 100%; height: 170px; background: var(--bg-elev); border-radius: var(--radius-card); display: block; }

/* ---------- Misc ---------- */
.empty {
  text-align: center;
  color: var(--label-3);
  font-size: 14px;
  padding: 26px 14px;
}
.muted { color: var(--label-2); font-size: 13px; }
.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-elev-2);
  color: var(--label-2);
}
.pill.live { background: rgba(255, 69, 58, 0.2); color: var(--red); }
.pill.ok { background: rgba(48, 209, 88, 0.18); color: var(--green); }

.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid var(--bg-elev-2);
  border-top-color: var(--label-2);
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(10, 132, 255, 0.14);
  border-radius: var(--radius-tile);
  padding: 12px 14px;
  font-size: 13px;
  color: #cfe6ff;
  margin-bottom: 12px;
}
.banner.warn { background: rgba(255, 159, 10, 0.14); color: #ffe0b0; }
.banner b { display: block; margin-bottom: 2px; color: #fff; font-size: 13px; }

.source-note {
  font-size: 11px;
  color: var(--label-3);
  text-align: center;
  margin: 18px 0 4px;
  line-height: 1.6;
}
.source-note a { color: var(--label-2); }

.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-elev-2); font-size: 20px; font-weight: 700;
  display: grid; place-items: center;
}
.stepper b { font-size: 18px; min-width: 62px; text-align: center; font-variant-numeric: tabular-nums; }

video.scanner { width: 100%; border-radius: var(--radius-card); background: #000; aspect-ratio: 4/3; object-fit: cover; }
