/* Giess-Erinnerung – eigenes Design: Pflanzen-Grün + Erdton, natürlich */
:root {
  --green-900: #14532d;
  --green-800: #166534;
  --green-700: #15803d;
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-100: #dcfce7;
  --green-050: #f0fdf4;

  --earth-900: #3a2c1d;
  --earth-700: #6b4f31;
  --earth-500: #8b6b43;
  --earth-100: #efe6d8;

  --amber-600: #d97706;
  --amber-100: #fef3c7;
  --red-600: #dc2626;
  --red-100: #fee2e2;

  /* Light theme (Default) */
  --bg: #f4f7f1;
  --bg-soft: #eaf1e4;
  --surface: #ffffff;
  --surface-2: #f7faf4;
  --text: #1c2b1c;
  --text-soft: #4b5b48;
  --text-mute: #6b7a68;
  --border: #d9e3d2;
  --border-strong: #c2d2b8;

  --accent: var(--green-700);
  --accent-strong: var(--green-800);
  --accent-soft: var(--green-100);
  --on-accent: #ffffff;

  --status-ok: var(--green-700);
  --status-ok-bg: var(--green-100);
  --status-due: var(--amber-600);
  --status-due-bg: var(--amber-100);
  --status-over: var(--red-600);
  --status-over-bg: var(--red-100);

  --shadow-sm: 0 1px 2px rgba(28, 43, 28, 0.08);
  --shadow-md: 0 6px 18px rgba(28, 43, 28, 0.12);
  --shadow-lg: 0 18px 48px rgba(20, 41, 20, 0.28);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;

  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --maxw: 760px;
}

[data-theme="dark"] {
  --bg: #11180f;
  --bg-soft: #161f13;
  --surface: #1b2618;
  --surface-2: #212e1d;
  --text: #e8f0e3;
  --text-soft: #bcc9b5;
  --text-mute: #8fa088;
  --border: #2e3c28;
  --border-strong: #3b4c33;

  --accent: var(--green-600);
  --accent-strong: var(--green-500);
  --accent-soft: #1f3320;
  --on-accent: #07210f;

  --status-ok: #4ade80;
  --status-ok-bg: #14321d;
  --status-due: #fbbf24;
  --status-due-bg: #3a2c0c;
  --status-over: #f87171;
  --status-over-bg: #3a1414;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.65);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(circle at 0% 0%, var(--bg-soft) 0%, transparent 38%),
    radial-gradient(circle at 100% 0%, var(--bg-soft) 0%, transparent 30%);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

h1, h2 { margin: 0; line-height: 1.2; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--on-accent);
  padding: 10px 14px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 200;
}
.skip-link:focus { left: 0; }

/* Header */
.app-header {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--on-accent);
  background: linear-gradient(150deg, var(--green-600), var(--green-800));
  box-shadow: var(--shadow-sm);
}
.brand-text { min-width: 0; }
.brand-text h1 { font-size: 1.32rem; letter-spacing: -.01em; }
.tagline { margin: 0; font-size: .82rem; color: var(--text-mute); }

/* Buttons */
.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease, border-color .15s ease;
  min-height: 44px;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--text-soft); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--status-over); color: #fff; }
.btn-danger:hover { filter: brightness(.94); }

.icon-btn {
  font: inherit;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: background .15s ease, transform .08s ease;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: translateY(1px); }

/* Main */
.app-main {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px 16px 24px;
  flex: 1 0 auto;
}

/* Summary stats */
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 8px 0 18px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--border);
}
.stat-overdue { border-top-color: var(--status-over); }
.stat-due { border-top-color: var(--status-due); }
.stat-ok { border-top-color: var(--status-ok); }
.stat-num { display: block; font-size: 1.7rem; font-weight: 800; line-height: 1; }
.stat-overdue .stat-num { color: var(--status-over); }
.stat-due .stat-num { color: var(--status-due); }
.stat-ok .stat-num { color: var(--status-ok); }
.stat-label { display: block; font-size: .76rem; color: var(--text-mute); margin-top: 4px; }

.toolbar { margin-bottom: 16px; }
.toolbar .btn { width: 100%; }

/* Plant list */
.plant-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

.plant-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.plant-card.is-over { border-left-color: var(--status-over); }
.plant-card.is-due { border-left-color: var(--status-due); }
.plant-card.is-ok { border-left-color: var(--status-ok); }

.plant-top { display: flex; gap: 12px; align-items: flex-start; }
.plant-emoji {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.plant-info { min-width: 0; flex: 1 1 auto; }
.plant-name {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 0 0 2px;
  overflow-wrap: anywhere;
}
.plant-meta {
  font-size: .82rem;
  color: var(--text-mute);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0;
}
.plant-meta span { display: inline-flex; align-items: center; gap: 4px; overflow-wrap: anywhere; }

.plant-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  font-size: .8rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.is-over .plant-status { color: var(--status-over); background: var(--status-over-bg); }
.is-due .plant-status { color: var(--status-due); background: var(--status-due-bg); }
.is-ok .plant-status { color: var(--status-ok); background: var(--status-ok-bg); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }

/* Progress bar until next watering */
.plant-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.plant-progress > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--status-ok);
  transition: width .3s ease;
}
.is-due .plant-progress > i { background: var(--status-due); }
.is-over .plant-progress > i { background: var(--status-over); }

.plant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.plant-actions .btn { flex: 1 1 auto; padding: 9px 12px; min-height: 42px; }
.plant-actions .btn-water { flex: 2 1 140px; }
.plant-actions .btn-mini { flex: 1 1 90px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 18px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.empty-emoji { font-size: 3rem; }
.empty-state h2 { font-size: 1.2rem; margin: 8px 0 6px; }
.empty-state p { color: var(--text-mute); margin: 0 0 16px; }

/* Footer */
.app-footer {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom));
  text-align: center;
  flex-shrink: 0;
}
.app-footer p { margin: 0; font-size: .76rem; color: var(--text-mute); }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 22, 10, 0.55);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative;
  background: var(--surface);
  width: 100%;
  max-width: 520px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  max-height: 92dvh;
  overflow-y: auto;
  animation: slideUp .22s ease;
}
.modal-card-sm { max-width: 420px; }
@keyframes slideUp { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 18px 6px;
}
.modal-head h2 { font-size: 1.18rem; }
.modal-body { padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label { font-size: .85rem; font-weight: 600; color: var(--text-soft); }
.req { color: var(--status-over); }
.field input {
  font: inherit;
  padding: 12px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  width: 100%;
}
.field input::placeholder { color: var(--text-mute); }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-hint { font-size: .76rem; color: var(--text-mute); }
.field-error { font-size: .78rem; color: var(--status-over); font-weight: 600; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1 1 auto; }
.field-emoji { flex: 0 0 84px; }
.field-emoji input { text-align: center; font-size: 1.2rem; }

.emoji-suggest { margin: -4px 0 16px; }
.emoji-suggest-label { font-size: .8rem; color: var(--text-mute); display: block; margin-bottom: 6px; }
.emoji-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-chip {
  font-size: 1.2rem;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .08s ease, border-color .15s ease;
}
.emoji-chip:hover { border-color: var(--accent); }
.emoji-chip:active { transform: scale(.92); }
.emoji-chip.is-active { border-color: var(--accent); background: var(--accent-soft); }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.modal-actions .btn { flex: 1 1 auto; }

/* Toast */
.toast-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 12px;
}
.toast {
  background: var(--earth-900);
  color: #fdf6ec;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  font-size: .9rem;
  font-weight: 600;
  max-width: 480px;
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn .2s ease;
}
[data-theme="dark"] .toast { background: var(--green-800); color: #f0fdf4; }
.toast.toast-success { background: var(--green-700); color: #fff; }
.toast.is-leaving { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { to { transform: translateY(16px); opacity: 0; } }

/* Focus visibility */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Responsive: tablet/desktop */
@media (min-width: 620px) {
  .modal { align-items: center; }
  .modal-card { border-radius: var(--radius-lg); }
  .toolbar .btn { width: auto; }
  .toolbar { display: flex; justify-content: flex-end; }
  .plant-list { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
