/* ===== Gieß-Planer – Design-Tokens ===== */
:root {
  --bg: #f2f6ef;
  --surface: #ffffff;
  --surface-2: #e9f0e4;
  --text: #22301f;
  --text-muted: #5f6f58;
  --border: #d5e0cd;
  --primary: #2e7d4f;
  --primary-contrast: #ffffff;
  --primary-soft: #dcefe3;
  --accent: #c96f3b;
  --winter: #3a6ea5;
  --winter-soft: #dfeaf6;
  --ok: #2e7d4f;
  --ok-soft: #dcefe3;
  --due: #a8720a;
  --due-soft: #fbeecb;
  --overdue: #b3372f;
  --overdue-soft: #f9dcd8;
  --shadow: 0 2px 10px rgba(34, 48, 31, 0.08);
  --radius: 14px;
  --radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131a11;
    --surface: #1c2619;
    --surface-2: #243020;
    --text: #e6eee1;
    --text-muted: #9fb096;
    --border: #34432e;
    --primary: #5cbf85;
    --primary-contrast: #10190d;
    --primary-soft: #24382b;
    --accent: #e0925f;
    --winter: #7aa7d8;
    --winter-soft: #22303f;
    --ok: #5cbf85;
    --ok-soft: #21362a;
    --due: #e0b452;
    --due-soft: #3a3218;
    --overdue: #e07a70;
    --overdue-soft: #402220;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { line-height: 1.2; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 0.75rem; font-weight: 800; }
h3 { font-size: 1.05rem; margin: 0 0 0.25rem; }

.muted { color: var(--text-muted); font-weight: 400; font-size: 0.85em; }
.hidden { display: none !important; }
.spacer { flex: 1; }

/* ===== Header ===== */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem 0.4rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.brand { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.brand-icon { flex-shrink: 0; }
.brand h1 { margin: 0; font-size: 1.25rem; font-weight: 800; color: var(--primary); }
.tagline { margin: 0; font-size: 0.75rem; color: var(--text-muted); }

.tabs {
  display: flex;
  gap: 0.25rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 0 0.5rem;
  overflow-x: auto;
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 700;
  padding: 0.55rem 0.5rem;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover { color: var(--primary); }

/* ===== Main / Views ===== */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0.75rem 1rem 2rem;
}

.view { display: none; }
.view.is-active { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.9rem 1rem;
}

.hint { color: var(--text-muted); font-size: 0.85rem; margin: 0.4rem 0; }
.notice { margin-top: 1.5rem; }

/* ===== Banner ===== */
.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}
.banner-info { background: var(--winter-soft); color: var(--text); border: 1px solid var(--winter); }
.banner-winter { background: var(--winter-soft); color: var(--text); border: 1px solid var(--winter); }
.banner-actions { display: flex; gap: 0.4rem; margin-left: auto; }

/* ===== Saison-Karte ===== */
.season-card { margin: 0.75rem 0; }
.season-row { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.switch-label { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; cursor: pointer; }
.switch-label input { width: 1.15rem; height: 1.15rem; accent-color: var(--winter); }
.factor-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--text-muted); }
.factor-label input {
  width: 4.5rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

/* ===== Aufgabenlisten (Heute) ===== */
.task-list { display: flex; flex-direction: column; gap: 0.5rem; }

.task {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  box-shadow: var(--shadow);
}
.task-emoji { font-size: 1.6rem; }
.task-info { flex: 1; min-width: 0; }
.task-info .task-name { font-weight: 700; }
.task-info .task-meta { font-size: 0.8rem; color: var(--text-muted); }
.task.is-overdue { border-left: 4px solid var(--overdue); }
.task.is-due { border-left: 4px solid var(--due); }
.task.is-soon { border-left: 4px solid var(--ok); }

.btn-done {
  border: 1px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn-done:hover { background: var(--primary); color: var(--primary-contrast); }

.empty-state {
  text-align: center;
  padding: 1.5rem 1rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
}
.empty-state .big { font-size: 2rem; display: block; margin-bottom: 0.25rem; }

/* ===== Wochenübersicht ===== */
.week-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
@media (min-width: 700px) {
  .week-grid { grid-template-columns: repeat(7, 1fr); }
}
.week-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
  min-height: 4rem;
}
.week-day.is-today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.week-day-head { font-weight: 800; font-size: 0.85rem; margin-bottom: 0.35rem; }
.week-day-head .muted { display: block; }
.week-chip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.4rem;
  margin-bottom: 0.25rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.week-chip.chip-overdue { background: var(--overdue-soft); }
.week-chip.chip-fert { background: var(--due-soft); }

/* ===== Toolbar / Filter ===== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 0.5rem;
}
.toolbar h2 { margin: 0; }
.toolbar-secondary { margin-top: 0.25rem; }
.filter-label { font-size: 0.9rem; color: var(--text-muted); }
.toolbar select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

/* ===== Pflanzen-Grid ===== */
.plant-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
@media (min-width: 560px) { .plant-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 820px) { .plant-grid { grid-template-columns: 1fr 1fr 1fr; } }

.plant-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.8rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.plant-card:hover { transform: translateY(-2px); }
.plant-card-top { display: flex; align-items: center; gap: 0.6rem; }
.plant-card-top .task-emoji { font-size: 1.8rem; }
.plant-card .meta { font-size: 0.8rem; color: var(--text-muted); }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  align-self: flex-start;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-due { background: var(--due-soft); color: var(--due); }
.badge-overdue { background: var(--overdue-soft); color: var(--overdue); }

/* ===== Bibliothek ===== */
.library-list { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.75rem; }
.library-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.8rem 0.9rem;
}
.library-head { display: flex; align-items: center; gap: 0.6rem; }
.library-head .task-emoji { font-size: 1.6rem; }
.library-head h3 { flex: 1; }
.library-meta { font-size: 0.85rem; color: var(--text-muted); margin: 0.3rem 0 0; }
.library-tips { margin: 0.4rem 0 0; padding-left: 1.2rem; font-size: 0.85rem; }
.library-tips li { margin-bottom: 0.15rem; }

/* ===== Buttons ===== */
.btn {
  font: inherit;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
}
.btn:hover { border-color: var(--primary); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: var(--overdue); color: var(--overdue); }
.btn-danger:hover { background: var(--overdue-soft); }
.btn-small { padding: 0.3rem 0.65rem; font-size: 0.85rem; }

.help-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--text-muted);
  flex-shrink: 0;
}
.help-btn:hover { color: var(--primary); }

.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 0 0.25rem;
}
.link-btn:hover { color: var(--primary); }

/* ===== Ad-Slot ===== */
.ad-slot {
  margin: 2rem auto 0;
  max-width: 728px;
  min-height: 90px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
}
.ad-placeholder { color: var(--text-muted); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; }

/* ===== Footer ===== */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== Modals ===== */
.modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 1.25rem;
  width: min(92vw, 540px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.modal::backdrop { background: rgba(15, 25, 12, 0.55); backdrop-filter: blur(2px); }
.modal h2 { margin-top: 0; }
.modal-body p { margin: 0.5rem 0; }
.modal-actions { display: flex; gap: 0.5rem; margin-top: 1rem; align-items: center; }
.modal-actions .btn:last-child { margin-left: auto; }
.modal-actions .spacer + .btn { margin-left: 0; }

.feature-list { list-style: none; padding: 0; margin: 0.75rem 0; }
.feature-list li { margin-bottom: 0.35rem; }

/* ===== Hilfe / Erste Schritte ===== */
.help-steps { margin: 0.5rem 0 0; padding-left: 1.3rem; }
.help-steps li { margin-bottom: 0.6rem; }
.help-subtitle { margin: 1rem 0 0.25rem; }
.help-know { margin: 0.25rem 0 0; padding-left: 1.2rem; font-size: 0.85rem; color: var(--text-muted); }
.help-know li { margin-bottom: 0.25rem; }

/* ===== Formular ===== */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0.7rem; }
@media (min-width: 480px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.form-grid label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; font-weight: 700; }
.form-grid input, .form-grid select {
  font: inherit;
  font-weight: 400;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
}
.form-grid input:focus, .form-grid select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

.emoji-fieldset {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem 0.6rem;
}
.emoji-fieldset legend { font-size: 0.85rem; font-weight: 700; padding: 0 0.25rem; }
.emoji-grid { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.emoji-option {
  font-size: 1.35rem;
  padding: 0.25rem 0.4rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  line-height: 1;
}
.emoji-option.is-selected { border-color: var(--primary); background: var(--primary-soft); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  z-index: 50;
  max-width: 90vw;
}
