/* ==========================================================================
   Aufstieg – Design-Tokens
   Farbwelt: Radtour in der Dämmerung – kühles Graphit + warmes Bergsonnen-Amber
   ========================================================================== */

:root {
  --bg: #14171c;
  --bg-elevated: #191d24;
  --surface: #1d2129;
  --surface-alt: #242933;
  --border: #2a2f3a;
  --border-soft: #22262f;

  --text: #edeff2;
  --text-secondary: #9aa3b2;
  --text-muted: #6b7280;

  --accent: #ff9f5b;       /* warmes Amber – Motivation, Energie */
  --accent-strong: #ff8a38;
  --accent-2: #2fbfa3;     /* Teal – Erfolg, Streaks, Fortschritt */
  --accent-2-strong: #23a58c;
  --danger: #f2726b;

  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 20px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: 84px;
}

h1, h2, h3 {
  margin: 0 0 4px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; color: var(--text-secondary); font-weight: 600; }

p { margin: 0; color: var(--text-secondary); font-size: 14px; }

button {
  font-family: var(--font);
  cursor: pointer;
}

/* ---------- Layout ---------- */

.app-header {
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 20px 12px;
}

.app-header .date {
  color: var(--text-secondary);
  font-size: 13px;
  text-transform: capitalize;
}

.view {
  padding: 0 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hidden { display: none !important; }

/* ---------- Karten ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 16px;
}

.card + .card { margin-top: 0; }

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* ---------- Streak-Leiste ---------- */

.streak-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.streak-chip {
  flex: 0 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 10px 14px;
  min-width: 84px;
  text-align: center;
}

.streak-chip .count {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-2);
  line-height: 1.1;
}

.streak-chip .count.zero { color: var(--text-muted); }

.streak-chip .label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---------- Buttons / Choice-Gruppen ---------- */

.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.choice-btn {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.choice-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1206;
  font-weight: 700;
}

.choice-btn.active.alt {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #06211c;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--border-soft);
}

.toggle-row:first-of-type { border-top: none; }

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch .track {
  position: absolute;
  inset: 0;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.15s;
}

.switch .thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.15s, background 0.15s;
}

.switch input:checked + .track { background: rgba(47, 191, 163, 0.18); border-color: var(--accent-2); }
.switch input:checked + .track .thumb { transform: translateX(20px); background: var(--accent-2); }

/* ---------- Primär-Button (Impuls) ---------- */

.primary-btn {
  width: 100%;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #1a1206;
  font-weight: 700;
  font-size: 15px;
  padding: 14px;
  border-radius: var(--radius-m);
}

.secondary-btn {
  width: 100%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  padding: 10px;
  border-radius: var(--radius-m);
}

/* ---------- Input-Felder ---------- */

input[type="number"], input[type="time"], input[type="password"], select {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 14px;
  width: 100%;
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---------- Bottom Nav ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 8px 6px calc(env(safe-area-inset-bottom, 0px) + 6px);
}

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
}

.nav-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-btn.active { color: var(--accent); }

/* ---------- Datums-Navigation ---------- */

.date-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.date-nav button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-s);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.date-nav button:disabled {
  opacity: 0.3;
}

.date-nav .date-label,
.app-header .date {
  cursor: pointer;
}

.status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-badge.open {
  background: rgba(255, 159, 91, 0.15);
  color: var(--accent);
}

.status-badge.completed {
  background: rgba(47, 191, 163, 0.15);
  color: var(--accent-2);
}

/* ---------- Übungs-Zähler ---------- */

.exercise-today-count {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-2);
  background: rgba(47, 191, 163, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
}

.exercise-weekly-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-2);
}

/* ---------- Login ---------- */

.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 24px calc(env(safe-area-inset-bottom, 0px) + 24px);
  gap: 18px;
  text-align: center;
}

.login-screen .mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
}

.login-screen form {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.error-text {
  color: var(--danger);
  font-size: 13px;
  min-height: 16px;
}

/* ---------- Quota-Balken ---------- */

.quota-bar-track {
  height: 8px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.quota-bar-fill {
  height: 100%;
  background: var(--accent-2);
  border-radius: 999px;
}

/* ---------- Exercise-Karte ---------- */

.exercise-card {
  text-align: center;
  padding: 20px 16px;
}

.exercise-card .name {
  font-size: 19px;
  font-weight: 800;
  margin: 10px 0 4px;
}

.exercise-card .duration {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
}

/* ---------- Utility ---------- */

.stat-value { font-size: 26px; font-weight: 800; }
.stat-value.accent { color: var(--accent); }
.muted { color: var(--text-muted); font-size: 12px; }
.spacer { height: 4px; }

@media (min-width: 640px) {
  .view { max-width: 480px; margin: 0 auto; width: 100%; }
  .app-header { max-width: 480px; margin: 0 auto; width: 100%; }
}
