/* BodyKind Coach — Mobile-first stylesheet
   Calm, warm, clean. No red/green moralizing. */

/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream:    #FAF7F2;
  --warm-bg:  #F4EFE6;
  --card-bg:  #FFFFFF;
  --border:   #E8E0D4;
  --text:     #2C2825;
  --muted:    #7A6F65;
  --accent:   #7C9E87;   /* sage green — calm, not clinical */
  --accent2:  #C2956A;   /* warm terracotta for secondary actions */
  --link:     #5A7A64;
  --radius:   14px;
  --shadow:   0 2px 12px rgba(60,40,20,0.07);
  --font:     'Georgia', 'Times New Roman', serif;
  --sans:     system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; }

body {
  font-family: var(--sans);
  background: var(--warm-bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 3rem;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ── Header / nav ─────────────────────────────────────────────────────────── */
.site-header {
  background: var(--cream);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header a {
  text-decoration: none;
  color: var(--text);
}

.site-title {
  font-family: var(--font);
  font-size: 1.25rem;
  font-weight: normal;
  letter-spacing: 0.02em;
  color: var(--text);
}

.site-subtitle {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.account-controls {
  position: absolute;
  right: 0.75rem;
  top: 0.55rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.account-name {
  color: var(--muted);
  font-size: 0.68rem;
  max-width: 5.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-form button {
  border: 1px solid var(--border);
  background: var(--cream);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  cursor: pointer;
}

/* ── Page heading ─────────────────────────────────────────────────────────── */
.page-heading {
  margin: 1.5rem 0 0.25rem;
}

.page-heading h1 {
  font-family: var(--font);
  font-size: 1.4rem;
  font-weight: normal;
  color: var(--text);
}

.page-heading .sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.25rem;
  margin: 1rem 0;
}

.card-title {
  font-family: var(--font);
  font-size: 1rem;
  font-weight: normal;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  margin-bottom: 0.5rem;
}

.card-body {
  font-size: 0.95rem;
  color: var(--text);
}

.card-body p { margin-bottom: 0.5rem; }
.card-body p:last-child { margin-bottom: 0; }

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover,
.card-clickable:focus-visible {
  box-shadow: 0 3px 16px rgba(60, 40, 20, 0.1);
  outline: 2px solid rgba(196, 126, 92, 0.35);
  outline-offset: 2px;
}

/* Card with a colored left accent */
.card-accent-green { border-left: 4px solid var(--accent); }
.card-accent-warm  { border-left: 4px solid var(--accent2); }

/* ── Action links (home nav) ──────────────────────────────────────────────── */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 1rem 0;
}

.action-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
  gap: 0.4rem;
}

.action-link:hover {
  background: var(--cream);
  border-color: var(--accent);
}

.action-link .icon {
  font-size: 1.4rem;
}

/* Full-width action link */
.action-link.full {
  grid-column: 1 / -1;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: opacity 0.15s, transform 0.1s;
  font-family: var(--sans);
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
  background: var(--cream);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--warm-bg); }

.btn-full { width: 100%; display: block; }
.btn-sm   { padding: 0.5rem 1rem; font-size: 0.85rem; }

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.support-stack {
  margin-top: 1rem;
}

.support-card {
  background: #FFFDF8;
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

label .hint {
  font-weight: normal;
  font-style: italic;
  color: var(--muted);
  font-size: 0.8rem;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="password"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--sans);
  background: var(--cream);
  color: var(--text);
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.3rem;
  font-style: italic;
}

.form-error {
  color: #8A3D33;
  background: #F8ECE8;
  border: 1px solid rgba(138, 61, 51, 0.18);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.movement-entry {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--cream);
  color: var(--text);
  padding: 0.65rem 0.75rem;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  font-weight: 500;
}

.checkbox-line input {
  accent-color: var(--accent);
}

.care-window-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.care-window-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: var(--cream);
}

.care-window-row .form-group {
  margin-bottom: 0.75rem;
}

/* ── Radio / option group ─────────────────────────────────────────────────── */
.option-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  background: var(--cream);
  transition: border-color 0.15s, background 0.15s;
}

.option-label:has(input:checked) {
  border-color: var(--accent);
  background: #EEF5F0;
}

.option-label input[type="radio"],
.option-label input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

/* ── Tag chips ────────────────────────────────────────────────────────────── */
.tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.tag-chip {
  position: relative;
}

.tag-chip input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.tag-chip label {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: 0.82rem;
  font-weight: normal;
  color: var(--muted);
  background: var(--cream);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  margin: 0;
}

.tag-chip input:checked + label {
  border-color: var(--accent);
  background: #EEF5F0;
  color: var(--accent);
  font-weight: 600;
}

.tag-grid.compact {
  gap: 0.35rem;
}

.tag-grid.compact .tag-chip label {
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
}

/* ── Weight display (neutral) ─────────────────────────────────────────────── */
.weight-neutral {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

/* ── Blockquote / coach voice ─────────────────────────────────────────────── */
.coach-quote {
  border-left: 3px solid var(--accent);
  padding: 0.6rem 1rem;
  margin: 0.75rem 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-style: italic;
  background: var(--cream);
  border-radius: 0 8px 8px 0;
}

/* ── Photo grid ───────────────────────────────────────────────────────────── */
.photo-grid-scroll {
  max-height: 16rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.15rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
}

.date-picker-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.date-picker-form a:last-child {
  grid-column: 1 / -1;
}

.inline-settings-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: end;
}

.inline-settings-form label {
  grid-column: 1 / -1;
  margin-bottom: -0.25rem;
}

.food-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.food-entry {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem;
  background: var(--cream);
}

.food-entry img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.food-entry-edit {
  margin: 0.5rem 0;
}

.food-entry-edit summary {
  color: var(--link);
  cursor: pointer;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.food-entry-edit textarea {
  min-height: 4.5rem;
  margin: 0.4rem 0;
}

.food-entry-edit .btn {
  margin-top: 0.5rem;
}

.known-food-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: var(--cream);
  margin: 0.5rem 0;
}

.known-food-form .option-label {
  margin-bottom: 0;
}

.btn-danger {
  color: #8A3D33;
  border-color: rgba(138, 61, 51, 0.25);
}

.photo-placeholder {
  aspect-ratio: 1;
  background: var(--warm-bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
  padding: 0.5rem;
}

/* ── Stat row ─────────────────────────────────────────────────────────────── */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.stat-row:last-child { border-bottom: none; }

.stat-row .label { color: var(--muted); }
.stat-row .value { font-weight: 600; }

/* ── Insights block ───────────────────────────────────────────────────────── */
.insights-text {
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
}

/* ── Section divider ──────────────────────────────────────────────────────── */
.section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 1.5rem 0 0.5rem;
  font-weight: 600;
}

/* ── Export list ──────────────────────────────────────────────────────────── */
.export-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.export-list a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  background: var(--cream);
  font-size: 0.9rem;
  transition: border-color 0.15s, background 0.15s;
}

.export-list a:hover {
  border-color: var(--accent);
  background: #fff;
}

.export-list .icon { font-size: 1.2rem; }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.mt-1  { margin-top: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mb-1  { margin-bottom: 0.5rem; }
.mb-2  { margin-bottom: 1rem; }
.text-muted  { color: var(--muted); }
.text-center { text-align: center; }
.text-small  { font-size: 0.82rem; }

/* ── Responsive: tablets & up ─────────────────────────────────────────────── */
@media (min-width: 600px) {
  .container { padding: 0 1.5rem; }
  .page-heading h1 { font-size: 1.6rem; }
}
