/* ============================================================
   VS Life — Spotify-Dark Theme
   Basis: Pico CSS v2 (css/vendor/pico.min.css) für Forms/Reset.
   Darauf: unser Token-Set nach Spotify-Design-System.
   Farben: Near-Black #121212 · Surface #181818/#1f1f1f ·
   Green #1ed760 (nur funktional!) · Silver #b3b3b3
   Schrift: DM Sans (Google Fonts, offline via SW gecached)
   ============================================================ */

:root {
  /* Spotify-Tokens */
  --bg: #121212;
  --surface: #181818;
  --surface-2: #1f1f1f;
  --card: #242424;
  --ink: #ffffff;
  --muted: #b3b3b3;
  --faint: #6a6a6a;
  --line: #2a2a2a;
  --accent: #1ed760;
  --accent-ink: #000000;
  --accent-2: #ffa42b;   /* Warning Orange — Sascha-Sekundärfarbe */
  --danger: #f3727f;
  --info: #539df5;
  --g: #1ed760;
  --y: #ffa42b;
  --r: #f3727f;
  --radius: 8px;
  --radius-pill: 9999px;
  --shadow-card: 0 8px 8px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.5);

  /* Pico-Variablen auf unser Theme mappen */
  --pico-background-color: var(--bg);
  --pico-color: var(--ink);
  --pico-muted-color: var(--muted);
  --pico-primary: var(--accent);
  --pico-primary-background: var(--accent);
  --pico-primary-inverse: var(--accent-ink);
  --pico-border-color: var(--line);
  --pico-font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; }

/* ---------- Icons ---------- */
.ic { width: 22px; height: 22px; display: inline-block; vertical-align: -5px; }
.ic.sm { width: 16px; height: 16px; vertical-align: -3px; }
.ic.lg { width: 28px; height: 28px; vertical-align: -7px; }
[data-ic] { display: inline-flex; align-items: center; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(18, 18, 18, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 21px; letter-spacing: -0.02em; }
.brand span { color: var(--accent); }

/* ---------- Tabbar (unten, wie Spotify-Player) ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex;
  background: rgba(18, 18, 18, 0.96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 0 8px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--muted); cursor: pointer;
  text-transform: uppercase;
}
.tabbar button .ic { width: 22px; height: 22px; }
.tabbar button.active { color: var(--ink); }
.tabbar button.active .ic { color: var(--accent); }

/* ---------- Layout ---------- */
main { max-width: 560px; margin: 0 auto; padding: 16px 16px 28px; }
main h1, main h2, main h3, main p, main label { color: var(--ink); }
main h2 { color: var(--muted); }
.section { margin-bottom: 20px; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 14px; }
h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); font-weight: 700; margin: 22px 0 10px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
.card.elev { box-shadow: var(--shadow-card); }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; color: var(--muted); }

/* ---------- Buttons (Pill-Geometrie, Uppercase-Tracking) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; background: var(--surface-2); color: var(--ink);
  border-radius: var(--radius-pill); padding: 11px 18px;
  font-weight: 700; font-size: 13px; letter-spacing: 0.06em;
  text-transform: uppercase; cursor: pointer; min-height: 44px;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.full { width: 100%; }
.btn.big { font-size: 15px; padding: 15px 20px; letter-spacing: 0.08em; }
.btn.small { padding: 7px 13px; min-height: 36px; font-size: 11px; border-radius: var(--radius-pill); }
.btn.danger { color: var(--danger); border: 1px solid rgba(243, 114, 127, 0.35); background: transparent; }

/* ---------- Chips / Badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  background: var(--surface-2); color: var(--muted);
  text-transform: uppercase;
}
.chip.vivi { color: var(--accent); }
.chip.sascha { color: var(--accent-2); }
.chip.green { background: rgba(30, 215, 96, 0.15); color: var(--accent); }
.chip.warn { background: rgba(255, 164, 43, 0.15); color: var(--accent-2); }

/* ---------- Fortschritt ---------- */
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.4s; }

/* ---------- Workout-Karten (das Herzstück) ---------- */
.workout-card {
  cursor: pointer; transition: background 0.15s, transform 0.1s;
}
.workout-card:active { transform: scale(0.985); }
.workout-card:hover { background: var(--card); }
.workout-card .wc-emoji { font-size: 26px; }

.level-cards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.level-card {
  border: 2px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 14px 8px 12px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.level-card .emo { font-size: 22px; }
.level-card .nm { font-weight: 700; font-size: 14px; }
.level-card .du { font-size: 12px; color: var(--muted); }
.level-card.sel-g { border-color: var(--g); background: rgba(30, 215, 96, 0.08); }
.level-card.sel-y { border-color: var(--y); background: rgba(255, 164, 43, 0.08); }
.level-card.sel-r { border-color: var(--r); background: rgba(243, 114, 127, 0.08); }
.level-card.row-layout {
  grid-template-columns: 1fr; flex-direction: row; justify-content: flex-start;
  gap: 14px; padding: 16px; text-align: left; align-items: center;
}

/* ---------- Listen / Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding: 8px 0; align-items: center; }
.timeline .dt { font-size: 12px; color: var(--faint); min-width: 84px; font-variant-numeric: tabular-nums; }
.log-badge { font-size: 13.5px; }
.lvl-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  flex: none;
}
.checkin-date { font-weight: 700; font-variant-numeric: tabular-nums; }

.steps li { margin: 8px 0; }
.steps { padding-left: 20px; margin: 10px 0; }
.steps li::marker { color: var(--accent); }

/* ---------- Einheiten (Sascha-Übersicht) ---------- */
.unit { display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.unit:last-child { border-bottom: 0; }
.unit .t { font-weight: 700; }
.unit .d { font-size: 13.5px; color: var(--muted); }

/* ---------- Auth ---------- */
.auth-card { max-width: 380px; margin: 8vh auto 0; }
.auth-card input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; background: var(--surface-2); color: var(--ink);
  margin-bottom: 10px; min-height: 44px;
}
.auth-card input::placeholder { color: var(--faint); }
.auth-card .error { color: var(--danger); font-size: 13.5px; margin: 8px 0; }
.hint { font-size: 13px; color: var(--muted); margin-top: 12px; }
.hint a { color: var(--accent); }
.warnbox {
  background: rgba(255, 164, 43, 0.1); border: 1px solid rgba(255, 164, 43, 0.3);
  border-radius: var(--radius); padding: 11px 14px; font-size: 13.5px; margin-bottom: 14px;
}

/* ---------- Toast / Banner ---------- */
#toast {
  position: fixed; bottom: calc(88px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent); color: var(--accent-ink);
  font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
  padding: 11px 20px; border-radius: var(--radius-pill); opacity: 0;
  pointer-events: none; transition: all 0.25s; z-index: 50; max-width: 88vw; text-align: center;
  box-shadow: var(--shadow-pop);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#offline-banner {
  position: sticky; top: 0; z-index: 40;
  background: var(--accent-2); color: #000;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  text-align: center; padding: 7px 10px; text-transform: uppercase;
}

@media (min-width: 640px) {
  body { font-size: 17px; }
}
