/* Ceke — Caregiver web · design tokens mirror the iOS asset catalog.
   Light = "Any Appearance", Dark = "Dark Appearance". Auto via prefers-color-scheme.
   Layout/components mirror the iOS app (Figma 2232-8052): hero + page heading,
   Today's care card with PlantTaskCard rows, calendar (PlantScheduleView), and
   the limited plant profile (identification card + care summary + activity). */

:root {
  /* Surface */
  --surface-page: #FAFAFA;
  --surface-primary: #FFFFFF;
  --surface-secondary: #F4F4F4;
  --surface-action: #12C763;
  --surface-action-pressed-1: #E8FAF0;
  --surface-action-pressed-2: #F3FCF7;
  --surface-info-light: #E7F8FF;
  /* Text */
  --text-headings: #2D2D2D;
  --text-body: #575757;
  --text-muted: #ABABAB;
  --text-on-action: #FFFFFF;
  --text-error: #EA1F22;
  --text-warning: #DC8C2A;
  --text-information: #6BB0CA;
  --text-action-pressed: #0E9F4F;
  /* Icon */
  --icon-default: #575757;
  --icon-information: #6BB0CA;
  /* Border */
  --border-action: #71DDA1;
  --border-information: #9EE3FD;
  --border-hairline: rgba(0,0,0,0.12);
  /* Semantic soft surfaces for badges */
  --error-light-2: #FFFAFA;
  --warning-light-2: #FFFCFA;
  --information-light-2: #F9FDFF;

  /* Radius / spacing (CekeRadius / CekeSpacing) */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xlg: 16px; --r-xxlg: 32px;
  --sp-xxs: 2px; --sp-xs: 8px; --sp-sm: 12px; --sp-md: 16px; --sp-lg: 24px; --sp-xl: 32px;

  --shadow-card: 0 8px 20px rgba(0,0,0,0.12);
  --shadow-toast: 0 4px 16px rgba(0,0,0,0.08);

  --font-head: "Baloo 2", "Baloo", system-ui, sans-serif;
  --font-body: Inter, -apple-system, system-ui, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface-page: #0F0F0F;
    --surface-primary: #1C1C1E;
    --surface-secondary: #2C2C2E;
    --surface-action: #0FA854;
    --surface-action-pressed-1: #0D331E;
    --surface-action-pressed-2: #0A2619;
    --surface-info-light: #05131F;
    --text-headings: #F0F0F0;
    --text-body: #ABABAB;
    --text-muted: #6B6B6B;
    --text-error: #F04E50;
    --text-warning: #E5A045;
    --text-information: #7EC6E0;
    --text-action-pressed: #14C265;
    --icon-default: #ABABAB;
    --icon-information: #7EC6E0;
    --border-action: #1E6B42;
    --border-information: #1E5A6E;
    --border-hairline: rgba(255,255,255,0.14);
    --error-light-2: #2C1010;
    --warning-light-2: #2C2110;
    --information-light-2: #0D1E29;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--surface-page);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
img { -webkit-user-drag: none; user-select: none; }
button { font-family: inherit; cursor: pointer; }

/* Mobile-first, capped to a phone width and centered on larger screens */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--surface-page);
  position: relative;
}

/* ── Loading / error states ─────────────────────────────────────────── */
.state { min-height: 100dvh; padding: var(--sp-lg); text-align: center; }
.state--center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-md); }
.state__art { width: 96px; height: 96px; opacity: 0.9; }
.state__title { font-family: var(--font-head); font-size: 26px; color: var(--text-headings); margin: 0; }
.state__text { color: var(--text-body); margin: 0; max-width: 28ch; }
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 5px solid color-mix(in srgb, var(--surface-action) 18%, transparent);
  border-top-color: var(--surface-action);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Views ──────────────────────────────────────────────────────────── */
.view[hidden] { display: none; }

/* ── Home hero (mascots, like the app's HomePageImage) ──────────────── */
/* Sky-blue fill behind the SVG so any letterboxing blends into the artwork
   (SVGs don't always crop under object-fit like raster images do). */
.hero { position: relative; width: 100%; aspect-ratio: 405 / 250; overflow: hidden; background: #CDE9F6; }
.hero__img { width: 100%; height: 100%; object-fit: cover; object-position: bottom; display: block; }

/* Page content slides up over the hero with the big top radius */
.page {
  position: relative;
  background: var(--surface-page);
  border-radius: var(--r-xxlg) var(--r-xxlg) 0 0;
  padding: var(--sp-lg) var(--sp-md) calc(var(--sp-xl) + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: var(--sp-md);
}
#view-home .page { margin-top: -40px; }
.page--over-hero { margin-top: -48px; }
.page--toolbar { border-radius: 0; min-height: 100dvh; padding-top: calc(var(--sp-md) + env(safe-area-inset-top)); }

/* ── Page heading (mirrors PageHeading: two-tone Baloo + subtitle) ──── */
.heading { padding: 0 var(--sp-xs); }
.heading__title {
  margin: 0; font-family: var(--font-head); font-weight: 600;
  font-size: 28px; line-height: 1.15; color: var(--text-headings);
}
.heading__hi { color: var(--text-muted); }
.heading__sub { margin: 4px 0 0; font-size: 16px; color: var(--text-body); }
.heading__range { margin: 2px 0 0; font-size: 14px; color: var(--text-muted); }

/* ── Card (Surface/Primary, radius 16, padding 16 — app card) ───────── */
.card {
  background: var(--surface-primary);
  border-radius: var(--r-xlg);
  padding: var(--sp-md);
}
.card__head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 var(--sp-xs); margin-bottom: var(--sp-sm); }
.card__title { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 20px; color: var(--text-headings); }
.link {
  background: none; border: 0; padding: 0;
  font-size: 14px; font-weight: 600; color: var(--text-information);
}

/* ── Task rows (mirror PlantTaskCard) ───────────────────────────────── */
.tasks { display: flex; flex-direction: column; gap: var(--sp-sm); }
.task {
  display: flex; align-items: center; gap: var(--sp-sm);
  width: 100%; text-align: left;
  background: var(--surface-primary);
  border: 1.5px solid transparent;
  border-radius: var(--r-lg);
  padding: 0;
}
.task__thumb-btn { flex: 0 0 auto; border: 0; background: none; padding: 0; line-height: 0; }
.task__thumb { width: 56px; height: 56px; border-radius: var(--r-md); object-fit: cover; background: var(--surface-action-pressed-1); }
.task__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.task__type { font-size: 12px; color: var(--text-muted); }
.task__need { font-size: 16px; font-weight: 700; color: var(--text-headings); line-height: 1.2; }
.task__done {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--icon-default);
  border: 1.6px solid var(--border-hairline);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.task__done svg { width: 20px; height: 20px; }

/* Profile-style task row: icon tile instead of photo */
.task__tile {
  flex: 0 0 auto; width: 48px; height: 48px; border-radius: var(--r-md);
  display: grid; place-items: center;
}
.task__tile svg { width: 20px; height: 20px; }
.task__tile--water { background: var(--surface-info-light); color: var(--icon-information); }
.task__tile--fert  { background: var(--error-light-2); color: var(--text-error); }
.task__tile--light { background: var(--warning-light-2); color: var(--text-warning); }

/* Completion phases (mirrors PlantTaskCard fade → green → pop) */
.task.is-fading { opacity: 0.45; }
.task.is-done {
  border-color: var(--border-action);
  background: var(--surface-action-pressed-2);
}
.task.is-done .task__done { background: var(--surface-action); border-color: var(--surface-action); color: #fff; }
.task__done.pop { animation: pop 0.22s ease; }
@keyframes pop { 50% { transform: scale(1.25); } }

/* ── Badges (StatusBadge) ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600;
  border-radius: 999px; padding: 3px 8px;
  width: fit-content;
}
.badge svg { width: 12px; height: 12px; }
.badge--error   { color: var(--text-error); background: var(--error-light-2); }
.badge--warning { color: var(--text-warning); background: var(--warning-light-2); }
.badge--info    { color: var(--text-information); background: var(--information-light-2); }

/* ── Empty state ────────────────────────────────────────────────────── */
.empty { text-align: center; padding: var(--sp-md) 0; }
.empty__art { width: 72px; height: 72px; }
.empty__title { margin: var(--sp-xs) 0 2px; font-family: var(--font-head); font-weight: 600; font-size: 18px; color: var(--text-headings); }
.empty__text { margin: 0; font-size: 14px; color: var(--text-body); }

.foot-note { margin: 0; padding: 0 var(--sp-xs); font-size: 12px; color: var(--text-muted); }

/* ── Toolbar (schedule view) ────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: var(--sp-sm); margin-bottom: var(--sp-xs); }
.toolbar__title { flex: 1; margin: 0; text-align: center; font-family: var(--font-head); font-weight: 600; font-size: 20px; color: var(--text-headings); }
.toolbar__spacer { width: 44px; height: 44px; }

/* Frosted glass circle button (back) — mirrors the app's glass buttons */
.glass-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; display: grid; place-items: center;
  background: color-mix(in srgb, var(--surface-primary) 78%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  color: var(--icon-default);
}
.glass-btn::before {
  content: ""; display: block; width: 10px; height: 10px;
  border-left: 2.4px solid currentColor; border-bottom: 2.4px solid currentColor;
  transform: rotate(45deg) translate(1px, -1px);
}
.glass-btn--overlay { position: absolute; top: calc(var(--sp-md) + env(safe-area-inset-top)); left: var(--sp-md); }

/* ── Calendar (mirrors PlantScheduleView) ───────────────────────────── */
.cal__head { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--sp-xs); margin-bottom: var(--sp-sm); }
.cal__month { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 18px; color: var(--text-headings); }
.cal__nav {
  width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: var(--surface-secondary); color: var(--icon-default);
  display: grid; place-items: center;
}
.cal__nav::before {
  content: ""; width: 8px; height: 8px;
  border-left: 2.2px solid currentColor; border-bottom: 2.2px solid currentColor;
  transform: rotate(45deg) translateX(1px);
}
#cal-next.cal__nav::before { transform: rotate(225deg) translateX(1px); }
.cal__week { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
.cal__week span { text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted); }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 4px; }
.cal__day {
  position: relative; border: 0; background: none;
  height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 14px; color: var(--text-headings); border-radius: 50%;
}
.cal__day:disabled { color: var(--text-muted); opacity: 0.45; cursor: default; }
.cal__day .num {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
}
.cal__day.is-today .num { border: 1.5px solid var(--surface-action); }
.cal__day.is-selected .num { background: var(--surface-action); color: var(--text-on-action); }
.cal__dots { display: flex; gap: 2px; height: 4px; }
.cal__dots i { width: 4px; height: 4px; border-radius: 50%; display: block; }
.cal__dots .d-water { background: var(--text-information); }
.cal__dots .d-fert  { background: var(--text-error); }
.cal__dots .d-light { background: var(--text-warning); }

/* ── Plant profile ──────────────────────────────────────────────────── */
.pf-hero { position: relative; width: 100%; height: 280px; overflow: hidden; background: var(--surface-action-pressed-1); }
.pf-hero__img { width: 100%; height: 100%; object-fit: cover; display: block; }

.id-card { display: flex; align-items: center; gap: var(--sp-sm); }
.id-card__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding-left: var(--sp-xs); }
.id-card__name { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 22px; line-height: 1.1; color: var(--text-headings); }
.id-card__species { margin: 0; font-size: 13px; color: var(--text-body); }
.id-card__img { flex: 0 0 auto; width: 104px; height: 104px; border-radius: var(--r-md); object-fit: cover; background: var(--surface-action-pressed-1); }

/* Care summary row: 💧 Every 7d | ☀ Indirect | 🍂 Wk 4 */
.care-row { display: flex; align-items: center; padding: var(--sp-sm) var(--sp-xs); }
.care-row__cell {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text-body);
}
.care-row__cell + .care-row__cell { border-left: 1px solid var(--border-hairline); }
.care-row__cell svg { width: 15px; height: 15px; flex: 0 0 auto; }
.care-row__cell.c-water svg { color: var(--text-information); }
.care-row__cell.c-light svg { color: var(--text-warning); }
.care-row__cell.c-fert  svg { color: var(--text-error); }

/* Recent activity rows */
.activity { display: flex; flex-direction: column; }
.activity__row { display: flex; align-items: center; gap: var(--sp-sm); padding: 10px var(--sp-xs); }
.activity__row + .activity__row { border-top: 1px solid var(--border-hairline); }
.activity__icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; }
.activity__icon svg { width: 14px; height: 14px; }
.activity__icon.c-water { background: var(--surface-info-light); color: var(--icon-information); }
.activity__icon.c-fert  { background: var(--error-light-2); color: var(--text-error); }
.activity__title { flex: 1; font-size: 14px; font-weight: 600; color: var(--text-headings); }
.activity__when { font-size: 12px; color: var(--text-muted); }

.pf-readonly { display: flex; align-items: center; gap: 6px; }
.pf-readonly svg { width: 13px; height: 13px; flex: 0 0 auto; }

/* ── Scrim + bottom sheet (Mark as done?) ───────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(45,45,45,0); transition: background 0.3s;
}
.scrim.show { background: rgba(45,45,45,0.4); }
.bottomsheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-width: 480px; margin: 0 auto;
  background: var(--surface-primary);
  border-radius: 38px 38px 0 0;
  transform: translateY(105%); transition: transform 0.32s cubic-bezier(0.3, 0.9, 0.4, 1);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomsheet.show { transform: translateY(0); }
.bottomsheet__grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--border-hairline); margin: 8px auto 3px; }
.bottomsheet__body { padding: var(--sp-lg); display: flex; flex-direction: column; gap: var(--sp-md); }
.bs-task { display: flex; align-items: center; gap: var(--sp-sm); }
.bs-task__thumb { width: 64px; height: 64px; border-radius: var(--r-lg); object-fit: cover; background: var(--surface-action-pressed-1); }
.bs-task__title { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 20px; color: var(--text-headings); }
.bs-task__sub { margin: 2px 0 0; font-size: 14px; color: var(--text-body); }
.bs-actions { display: flex; gap: var(--sp-sm); }
.btn {
  flex: 1; border-radius: 999px; padding: 14px; font-size: 16px; font-weight: 600; border: 0;
}
.btn--ghost { background: var(--surface-page); color: var(--text-body); border: 1px solid var(--border-hairline); }
.btn--primary { background: var(--surface-action); color: var(--text-on-action); }

/* ── Undo toast (mirrors CekeUndoSnackbar) ──────────────────────────── */
.toast {
  position: fixed; left: var(--sp-md); right: var(--sp-md);
  bottom: calc(var(--sp-md) + env(safe-area-inset-bottom)); z-index: 60;
  max-width: 448px; margin: 0 auto;
  background: var(--surface-primary);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-toast);
  overflow: hidden;
  transform: translateY(16px); opacity: 0; transition: transform 0.25s, opacity 0.25s;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast__row { display: flex; align-items: center; gap: var(--sp-xs); padding: var(--sp-sm) var(--sp-md); }
.toast__icon { color: var(--surface-action); flex: 0 0 auto; }
.toast__msg { flex: 1; font-size: 13px; color: var(--text-body); }
.toast__undo { background: none; border: 0; font-size: 14px; font-weight: 700; color: var(--text-action-pressed); padding: 4px; }
.toast__track { height: 3px; background: var(--surface-secondary); }
.toast__bar { height: 100%; background: var(--surface-action); transform-origin: left; }
