/* 275 Body Recomp — Mobile-First Dashboard */
:root {
  --bg: #0a0a0f;
  --surface: #141420;
  --surface2: #1c1c2e;
  --border: #2a2a3e;
  --text: #e8e8f0;
  --text-dim: #8888a0;
  --accent: #4f8eff;
  --accent-glow: rgba(79, 142, 255, 0.15);
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.15);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.15);
  --yellow: #fbbf24;
  --yellow-dim: rgba(251, 191, 36, 0.15);
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header h1 { font-size: 20px; font-weight: 700; }
.header .day-badge {
  background: var(--accent-glow);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

/* Phase bar */
.phase-bar {
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.phase-label { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.phase-progress {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.phase-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s;
}

/* Main content */
.content { padding: 16px; max-width: 480px; margin: 0 auto; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card-title {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* Weight card */
.weight-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.weight-display .big { font-size: 36px; font-weight: 700; }
.weight-display .unit { font-size: 16px; color: var(--text-dim); }
.weight-display .change {
  font-size: 14px;
  padding: 2px 8px;
  border-radius: 12px;
}
.change-down { background: var(--green-dim); color: var(--green); }
.change-up { background: var(--red-dim); color: var(--red); }
.change-flat { background: var(--yellow-dim); color: var(--yellow); }
.rolling-avg { font-size: 14px; color: var(--text-dim); }

/* Macro rings */
.macros-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  text-align: center;
}
.macro-item { display: flex; flex-direction: column; align-items: center; }
.macro-ring {
  width: 64px; height: 64px;
  border-radius: 50%;
  position: relative;
  margin-bottom: 6px;
}
.macro-ring svg { transform: rotate(-90deg); width: 64px; height: 64px; }
.macro-ring circle {
  fill: none;
  stroke-width: 5;
  cx: 32; cy: 32; r: 28;
}
.macro-ring .bg { stroke: var(--border); }
.macro-ring .fill { stroke-linecap: round; transition: stroke-dashoffset 0.5s; }
.macro-ring .value {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  font-weight: 600;
}
.macro-label { font-size: 12px; color: var(--text-dim); }
.macro-target { font-size: 11px; color: var(--text-dim); }

/* Calorie budget */
.cal-budget {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
}
.cal-budget .consumed { font-size: 24px; font-weight: 600; }
.cal-budget .remaining {
  font-size: 14px;
  padding: 4px 12px;
  border-radius: 20px;
}

/* Quick log buttons */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.btn {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn-full { grid-column: 1 / -1; }
.btn-small { padding: 10px 14px; font-size: 14px; }

/* Input */
.input-group { margin-bottom: 12px; }
.input-group label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.input-group input, .input-group select, .input-group textarea {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 16px; /* prevents zoom on iOS */
}
.input-group textarea { resize: vertical; min-height: 60px; }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-header h2 { font-size: 18px; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}

/* Meals list */
.meal-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.meal-entry:last-child { border-bottom: none; }
.meal-name { font-size: 14px; }
.meal-cals { font-size: 14px; color: var(--text-dim); }
.meal-delete {
  background: none;
  border: none;
  color: var(--red);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}

/* Health pills */
.health-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pill {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface2);
}
.pill.active { border-color: var(--accent); background: var(--accent-glow); color: var(--accent); }
.pill.good { border-color: var(--green); background: var(--green-dim); color: var(--green); }
.pill.bad { border-color: var(--red); background: var(--red-dim); color: var(--red); }

/* Weight chart */
.chart-container {
  width: 100%;
  height: 200px;
  position: relative;
}
.chart-container canvas { width: 100% !important; height: 100% !important; }

/* Nav tabs */
.nav {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 50;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 12px;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 20px; }

/* Login */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 360px;
}
.login-box h1 {
  font-size: 28px;
  text-align: center;
  margin-bottom: 8px;
}
.login-box p {
  text-align: center;
  color: var(--text-dim);
  margin-bottom: 24px;
}

/* Utilities */
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 13px; }
.text-center { text-align: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* Bottom padding for nav */
.content { padding-bottom: 80px; }

/* Score selector buttons */
.score-buttons {
  display: flex;
  gap: 8px;
}
.score-btn {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-align: center;
}
.score-btn.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}
