/* Fitness Tracker — mobile-first, weibliche, sportliche Optik */
:root {
  --bg: #0f172a;
  --bg-2: #1e293b;
  --card: rgba(30, 41, 59, 0.85);
  --card-hover: rgba(51, 65, 85, 0.9);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f1f5f9;
  --dim: #94a3b8;
  --primary: #ec4899;
  --primary-2: #f472b6;
  --accent: #a855f7;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(ellipse at top, #1e1b3a 0%, var(--bg) 60%);
  background-attachment: fixed;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}

main { max-width: 520px; margin: 0 auto; padding: 12px 14px calc(86px + env(safe-area-inset-bottom)); }

/* ----- Topbar ----- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.logo {
  font-weight: 800; font-size: 18px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.user { display: flex; align-items: center; gap: 8px; }

/* ----- Bottom Nav ----- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-around;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.bn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--dim); text-decoration: none; font-size: 10px; font-weight: 500;
  padding: 6px 4px; border-radius: 10px; min-height: 52px; justify-content: center;
  transition: all 0.15s;
}
.bn-item span:first-child { font-size: 22px; line-height: 1; }
.bn-item:active { background: var(--card); color: var(--text); }
.bn-item.active { color: var(--primary-2); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: white; font-size: 14px;
}
.avatar-gross { width: 56px; height: 56px; font-size: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: white; font-weight: 700; }
.logout {
  text-decoration: none; color: var(--dim); font-size: 20px;
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.logout:hover { color: var(--danger); background: var(--card); }

/* ----- Hero ----- */
.hero {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px; margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.15), rgba(168, 85, 247, 0.1));
  border: 1px solid var(--border); border-radius: var(--radius);
}
.hero h1 { font-size: 26px; margin-bottom: 6px; }
.motivation { color: var(--dim); font-size: 14px; max-width: 360px; }
.streak-badge { text-align: center; }
.streak-zahl { font-size: 32px; font-weight: 800; color: var(--warn); }
.streak-label { font-size: 11px; color: var(--dim); }

/* ----- CTA ----- */
.cta-zone { margin-bottom: 24px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 20px; border-radius: 12px; border: none;
  font-family: inherit; font-weight: 600; font-size: 15px; cursor: pointer;
  text-decoration: none; transition: all 0.15s; color: white;
  -webkit-tap-highlight-color: transparent;
}
.btn-block { display: flex; width: 100%; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 4px 14px rgba(236, 72, 153, 0.35); }
.btn-success { background: linear-gradient(135deg, var(--success), #16a34a); }
.btn-danger { background: var(--danger); }
.btn-ghost { background: transparent; color: var(--dim); border: 1px solid var(--border); }
.btn-cta {
  font-size: 19px; padding: 20px 32px; min-height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.35);
  width: 100%; border-radius: 16px;
}
.btn:active { transform: scale(0.97); }
.btn-pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(236, 72, 153, 0.35); }
  50% { box-shadow: 0 8px 32px rgba(236, 72, 153, 0.6); }
}
.btn-mini {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 10px; font-size: 12px; font-weight: 500;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); cursor: pointer;
}
.btn-mini.btn-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); border-color: rgba(239, 68, 68, 0.3); }
.btn-mini.btn-primary { background: var(--primary); color: white; border: none; }
.btn-mini input[type=file] { display: none; }

/* ----- Cards / Stats ----- */
.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 16px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat-zahl { font-size: 22px; font-weight: 700; color: var(--primary-2); }
.stat-label { font-size: 11px; color: var(--dim); margin-top: 2px; }

/* ----- Block ----- */
.block { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.block h2 { font-size: 16px; margin-bottom: 12px; color: var(--text); }
.block.leer { text-align: center; color: var(--dim); padding: 32px; }
.leer { color: var(--dim); text-align: center; padding: 16px; }

/* ----- Partner ----- */
.partner-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.partner-card { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--bg-2); border-radius: 10px; }
.partner-name { font-weight: 600; }
.partner-info { font-size: 12px; color: var(--dim); }

/* ----- Workout-Liste ----- */
.workout-list { display: grid; gap: 8px; }
.workout-row {
  display: grid; grid-template-columns: 80px 1fr; gap: 12px; align-items: center;
  padding: 14px; background: var(--bg-2); border-radius: 10px;
  text-decoration: none; color: var(--text); cursor: pointer;
}
.workout-row:hover { background: var(--card-hover); }
.w-datum { font-weight: 600; font-size: 14px; }
.w-zeit { font-size: 11px; color: var(--dim); }
.w-stats { display: flex; gap: 16px; font-size: 13px; color: var(--dim); }
.w-stats b { color: var(--text); }
.w-notiz { grid-column: 1 / -1; font-size: 12px; color: var(--dim); font-style: italic; margin-top: 4px; }

/* ----- Workout-Seite ----- */
.workout-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.zeit-anzeige { font-size: 18px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

.muskel-tabs {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px;
  scrollbar-width: none;
}
.muskel-tabs::-webkit-scrollbar { display: none; }
.muskel-tab {
  flex-shrink: 0; padding: 8px 14px; background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; color: var(--dim); font-family: inherit; font-size: 13px; cursor: pointer;
  transition: all 0.15s;
}
.muskel-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

.uebungen-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
@media (min-width: 380px) { .uebungen-grid { grid-template-columns: repeat(3, 1fr); } }
.uebung-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px; background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font-family: inherit; font-size: 12px; cursor: pointer;
  transition: all 0.15s; text-align: center; min-height: 110px;
}
.uebung-card.hidden { display: none; }
.uebung-card:active { transform: scale(0.96); }
.uebung-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.uebung-placeholder {
  width: 64px; height: 64px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  font-size: 24px; font-weight: 700; color: white;
}

/* ----- Sätze-Liste ----- */
.satz-row {
  display: grid; grid-template-columns: 40px 1fr auto auto; gap: 10px; align-items: center;
  padding: 10px 12px; background: var(--bg-2); border-radius: 8px; margin-bottom: 6px;
  animation: slideIn 0.25s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.satz-num { color: var(--accent); font-weight: 700; font-size: 13px; }
.satz-name { font-size: 14px; }
.satz-werte { font-size: 13px; color: var(--dim); }
.satz-werte b { color: var(--text); }
.btn-loesch { background: transparent; border: none; color: var(--danger); font-size: 20px; cursor: pointer; padding: 4px 8px; }

/* ----- Modal ----- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal.hidden { display: none; }
.modal-card { background: var(--bg-2); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 360px; }
.modal-card h3 { margin-bottom: 12px; }
.modal-card label { display: block; margin-bottom: 12px; }
.modal-card input { width: 100%; padding: 14px; font-size: 18px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-family: inherit; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.vorschlag { font-size: 12px; color: var(--dim); margin-bottom: 12px; }
.vorschlag b { color: var(--accent); }

/* ----- Forms ----- */
label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--dim); }
label span { display: block; margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-family: inherit; font-size: 14px;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15); }

.form-card { background: var(--bg-2); padding: 16px; border-radius: var(--radius); margin-top: 12px; }
.neu-details summary { list-style: none; cursor: pointer; }
.neu-details summary::-webkit-details-marker { display: none; }

.beenden-form { margin-top: 24px; display: grid; gap: 8px; }
.abbrechen-form { margin-top: 8px; text-align: center; }

/* ----- Geräte ----- */
.geraete-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.geraet-tile { background: var(--bg-2); padding: 12px; border-radius: 12px; text-align: center; }
.geraet-tile img { width: 100%; height: 90px; object-fit: cover; border-radius: 8px; margin-bottom: 6px; }
.geraet-tile .uebung-placeholder { width: 100%; height: 90px; margin-bottom: 6px; border-radius: 8px; }
.geraet-name { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.foto-upload { margin-bottom: 4px; }

/* ----- Login ----- */
.login-wrap { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 32px; width: 100%; max-width: 360px; box-shadow: var(--shadow); text-align: center; }
.login-icon { font-size: 48px; margin-bottom: 12px; }
.login-card h1 { margin-bottom: 4px; }
.login-card .sub { color: var(--dim); margin-bottom: 24px; font-size: 14px; }
.login-form { text-align: left; }

/* ----- Admin / Nutzer-Liste ----- */
.nutzer-grid { display: grid; gap: 10px; }
.nutzer-tile { display: grid; grid-template-columns: 56px 1fr auto auto; gap: 12px; align-items: center; padding: 12px; background: var(--bg-2); border-radius: 12px; }
.nutzer-info { min-width: 0; }
.nutzer-name { font-weight: 600; font-size: 14px; }
.nutzer-email { font-size: 12px; color: var(--dim); }
.nutzer-stats { font-size: 11px; color: var(--accent); }
.badge { background: var(--accent); color: white; font-size: 10px; padding: 2px 6px; border-radius: 4px; margin-left: 4px; }
.inline-form { display: flex; gap: 4px; margin-top: 4px; }
.inline-form input { font-size: 12px; padding: 6px; }

/* ----- Charts ----- */
.chart-container { position: relative; height: 280px; margin: 12px 0; }
.legende { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.legende-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.hinweis { font-size: 11px; color: var(--dim); margin-top: 8px; text-align: center; }

/* ----- Workout-Details ----- */
.workout-details.hidden { display: none; }
.workout-details { padding: 12px; margin-top: 8px; background: var(--bg); border-radius: 8px; font-size: 13px; }

/* ----- Flash ----- */
.flash-zone { max-width: 760px; margin: 12px auto 0; padding: 0 16px; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 6px; font-size: 14px; }
.flash-success { background: rgba(34, 197, 94, 0.2); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.4); }
.flash-error { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); }

/* iOS-Tap-Verbesserungen */
button, a, input, select { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
input[type="number"] { font-size: 20px; }
.modal-card input { font-size: 22px; padding: 16px; }

/* aktive Nav-Item mit JS markieren — fallback per :target */
@supports (-webkit-touch-callout: none) {
  body { padding-bottom: 0; }
}
