/* ============================================================
   Spouse Tracker – Apple Light UI
   ============================================================ */

/* ─── CSS Custom Properties ──────────────────────────────── */
:root {
  --bg:          #f2f2f7;
  --bg-card:     #ffffff;
  --bg-card2:    #f9f9fb;
  --border:      rgba(0, 0, 0, 0.08);
  --text:        #1c1c1e;
  --text-2:      #48484a;
  --text-3:      #8e8e93;
  --accent:      #007aff;
  --accent-dark: #0051a8;
  --red:         #ff3b30;
  --green:       #34c759;
  --orange:      #ff9500;
  --yellow:      #ffcc00;
  --purple:      #af52de;
  --pink:        #ff2d55;
  --teal:        #32ade6;
  --nav-bg:      rgba(249, 249, 251, 0.88);
}

/* ─── iOS Safe Area ──────────────────────────────────────── */
.safe-top    { padding-top:    env(safe-area-inset-top); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
.pb-safe     { padding-bottom: max(0.5rem, env(safe-area-inset-bottom)); }

/* ─── Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100svh;
  padding-bottom: 7rem;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}


/* ─── Main Content ───────────────────────────────────────── */
.app-main {
  max-width: 512px;
  margin: 0 auto;
  padding: 0.875rem 0.875rem 0;
}

/* ─── Section Title ──────────────────────────────────────── */
.section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.055em;
  margin: 0.875rem 0 0.375rem 0.125rem;
}

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 0.75rem 0.875rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07), 0 0 0 0.5px var(--border);
}

.card-sm {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07), 0 0 0 0.5px var(--border);
}

/* ─── Stat Grid ──────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 0.625rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07), 0 0 0 0.5px var(--border);
}

.stat-icon {
  font-size: 1.25rem;
  margin-bottom: 0.15rem;
  line-height: 1;
}

.stat-label {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

.stat-value {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}

.stat-unit {
  font-size: 0.75rem;
  color: var(--text-3);
  font-weight: 400;
}

/* ─── Divider inside card ────────────────────────────────── */
.card-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.625rem -0.875rem;
}

/* ─── Greeting ───────────────────────────────────────────── */
.greeting-date {
  font-size: 0.8rem;
  color: var(--text-3);
  font-weight: 500;
  margin-bottom: 0.15rem;
}

.greeting-title {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.2;
}

/* ─── BMI Card ───────────────────────────────────────────── */
.bmi-value {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text);
}

.bmi-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.625rem;
  border-radius: 20px;
  margin-top: 0.375rem;
}

.bmi-normal     { background: rgba(52,199,89,0.12);  color: #1a8c3a; }
.bmi-under      { background: rgba(50,173,230,0.12); color: #1a72a0; }
.bmi-over       { background: rgba(255,149,0,0.12);  color: #b36500; }
.bmi-obese      { background: rgba(255,59,48,0.12);  color: #c0281f; }

/* ─── Trend ──────────────────────────────────────────────── */
.trend-up   { color: var(--red); }
.trend-down { color: var(--green); }
.trend-flat { color: var(--text-3); }

/* ─── Form Elements ──────────────────────────────────────── */
.input-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 0.375rem;
}

.input-field {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,122,255,0.15);
  background: #fff;
}

.input-field::placeholder {
  color: var(--text-3);
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 12px;
  padding: 0.875rem 1rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:active {
  background: var(--accent-dark);
  transform: scale(0.98);
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  background: rgba(0,0,0,0.05);
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  text-decoration: none;
}

.btn-secondary:active { background: rgba(0,0,0,0.09); }

.btn-edit {
  background: rgba(0,122,255,0.1);
  color: var(--accent);
  border: 1px solid rgba(0,122,255,0.2);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  text-decoration: none;
  display: inline-block;
}

.btn-edit:active { background: rgba(0,122,255,0.18); }

.btn-danger {
  background: rgba(255,59,48,0.08);
  color: var(--red);
  border: 1px solid rgba(255,59,48,0.2);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-danger:active { background: rgba(255,59,48,0.16); }

/* ─── Icon Buttons (Bearbeiten / Löschen) ────────────────── */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}

.btn-icon:active { transform: scale(0.92); }

.btn-icon-edit {
  background: rgba(0,122,255,0.1);
  color: var(--accent);
}
.btn-icon-edit:active { background: rgba(0,122,255,0.18); }

.btn-icon-delete {
  background: rgba(255,59,48,0.08);
  color: var(--red);
}
.btn-icon-delete:active { background: rgba(255,59,48,0.16); }

/* ─── Navigation ─────────────────────────────────────────── */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border);
}

.app-nav-inner {
  max-width: 512px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0.375rem 0.5rem max(0.5rem, env(safe-area-inset-bottom));
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  padding: 0.35rem 0.875rem;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.15s;
  border-radius: 10px;
  min-width: 54px;
}

.nav-item.active { color: var(--accent); }
.nav-item:active  { background: rgba(0,0,0,0.05); }

.nav-item span { font-size: 0.6875rem; font-weight: 500; }

/* ─── List Rows ──────────────────────────────────────────── */
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.list-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* ─── Chart ──────────────────────────────────────────────── */
.chart-bar-wrap {
  display: flex;
  align-items: stretch;
  gap: 5px;
  height: 100px;
}

.chart-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  height: 100%;
}

.chart-bar {
  width: 100%;
  border-radius: 5px 5px 0 0;
  min-height: 4px;
  position: relative;
  transition: height 0.5s cubic-bezier(.34,1.56,.64,1);
}

.chart-bar-value {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  position: absolute;
  top: 5px;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  line-height: 1;
}

.chart-labels {
  display: flex;
  gap: 5px;
  margin-top: 5px;
}

.chart-bar-label {
  flex: 1;
  font-size: 0.6rem;
  color: var(--text-3);
  text-align: center;
}

/* ─── Segmented Control ──────────────────────────────────── */
.seg-control {
  display: flex;
  background: rgba(0,0,0,0.06);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  flex: 1;
  text-align: center;
  padding: 0.3rem 0.5rem;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  border: none;
  background: transparent;
  font-family: inherit;
  white-space: nowrap;
}

.seg-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 0 0 0.5px rgba(0,0,0,0.05);
}

/* ─── Toast ──────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 6rem;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(50,50,52,0.92);
  color: #fff;
  padding: 0.625rem 1.25rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s, transform 0.22s;
  z-index: 999;
  backdrop-filter: blur(20px);
  white-space: nowrap;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Onboarding / Alert Cards ───────────────────────────── */
.alert-card {
  border-radius: 14px;
  padding: 0.875rem 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert-blue   { background: rgba(0,122,255,0.08);  border: 1px solid rgba(0,122,255,0.18); }
.alert-orange { background: rgba(255,149,0,0.08);  border: 1px solid rgba(255,149,0,0.2); }
.alert-red    { background: rgba(255,59,48,0.07);  border: 1px solid rgba(255,59,48,0.18); }

/* ─── Steps Preview ──────────────────────────────────────── */
.steps-preview {
  font-size: 0.8125rem;
  color: var(--text-3);
  margin-top: 0.375rem;
  padding-left: 0.125rem;
}

.steps-preview strong { color: var(--text-2); }

/* ─── Animations ─────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeUp 0.3s cubic-bezier(.22,1,.36,1) both;
}

/* Stagger helper – set via inline style="--d:Xs" */
.animate-in { animation-delay: var(--d, 0s); }

/* ─── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-3);
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state p    { font-size: 0.9rem; line-height: 1.5; }
