/* =============================================
   FITNESS TRACKER – style.css
   ============================================= */
:root {
  --sidebar-width: 240px;
  --sidebar-bg: #0f172a;
  --sidebar-header-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-hover-bg: rgba(255,255,255,0.06);
  --sidebar-active-bg: rgba(37,99,235,0.85);
  --sidebar-text-active: #fff;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --card-shadow: 0 1px 4px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.04);
  --card-shadow-hover: 0 4px 20px rgba(37,99,235,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  height: 100dvh;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  overflow: hidden;
}

.sidebar.closed { transform: translateX(-100%); }

.sidebar-header {
  background: var(--sidebar-header-bg);
  padding: 1.4rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  min-height: 64px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-header::before {
  content: '🏋️';
  font-size: 1.3rem;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  gap: 0.15rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  font-size: 0.925rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-link:hover { background: var(--sidebar-hover-bg); color: #e2e8f0; }

.sidebar-link.active-sidebar-link {
  background: var(--sidebar-active-bg) !important;
  color: var(--sidebar-text-active) !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.sidebar-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
  width: 1.4em;
  text-align: center;
}

/* ===== SIDEBAR TOGGLE ===== */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 1100;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 2rem;
  min-height: 100vh;
}

/* ===== CARDS ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-2px); }

.stat-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.4rem; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--text-main); line-height: 1.1; }
.stat-sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.3rem; }

/* ===== TRAINING CARDS ===== */
.training-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 1.25rem 1.5rem;
  transition: box-shadow var(--transition), transform var(--transition);
  border-left: 4px solid var(--accent);
}
.training-card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-2px); }

/* ===== FORM ELEMENTS ===== */
.form-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 1.75rem;
}

.form-label { font-weight: 500; font-size: 0.9rem; color: var(--text-main); margin-bottom: 0.35rem; }

.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 1.5px solid #e2e8f0;
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
  transition: border var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
  outline: none;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 600;
  padding: 0.55rem 1.25rem;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: 1.75rem;
}
.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.3rem;
}
.page-header p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.9rem;
}

/* ===== BADGES ===== */
.badge-muskel {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(37,99,235,0.1);
  color: var(--accent);
}

.badge-cat {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16,185,129,0.1);
  color: #059669;
}

/* ===== SATZ-ZEILE (Training aktiv) ===== */
.satz-row {
  display: grid;
  grid-template-columns: 40px 1fr 1fr auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.4rem;
}
.satz-nr {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}
.satz-done {
  opacity: 0.5;
  text-decoration: line-through;
}
.satz-done .form-control { background: #f8fafc; }

/* ===== FORTSCHRITT CHART ===== */
.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
}
.chart-wrapper { position: relative; height: 280px; }

/* ===== TABLE ===== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { font-weight: 600; color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; border-bottom: 2px solid #e2e8f0; padding: 0.6rem 0.75rem; text-align: left; }
td { padding: 0.75rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tr:hover td { background: #f8fafc; }

/* ===== ALERT ===== */
.alert { border-radius: var(--radius-sm); padding: 0.75rem 1rem; font-size: 0.88rem; }
.alert-danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ===== SPINNER ===== */
.spinner { width: 24px; height: 24px; border: 3px solid #e2e8f0; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVE ===== */
@media (min-width: 901px) {
  .sidebar-toggle { display: none !important; }
  .sidebar-overlay { display: none !important; }
  .sidebar { transform: translateX(0) !important; }
  .sidebar.closed { transform: translateX(-100%) !important; }
  .main-content { margin-left: var(--sidebar-width) !important; }
}

@media (max-width: 900px) {
  .sidebar-toggle { display: flex !important; }
  .sidebar { transform: translateX(-100%); width: min(280px, 85vw); }
  .sidebar.opened-mobile { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.25); }
  body.sidebar-open { overflow: hidden; touch-action: none; }
  .main-content { margin-left: 0 !important; padding: 1rem; padding-top: 4rem; }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .page-header h1 { font-size: 1.3rem; padding-top: 0.25rem; }
  .satz-row { grid-template-columns: 32px 1fr 1fr auto; gap: 0.35rem; }
}

@media (max-width: 480px) {
  .card-grid { grid-template-columns: 1fr; }
}

.d-none { display: none !important; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.text-muted { color: var(--text-muted) !important; }
.fw-bold { font-weight: 700; }
