/* ==========================================================================
   Gartenpflege — Optik angelehnt an "Two Point Campus": knallige Farben,
   dicke runde Formen, verspielte 3D-Buttons mit Schlagschatten-Kante.
   Eigenständiges Design, keine Assets aus dem Spiel übernommen.
   ========================================================================== */

:root {
  /* Palette */
  --grass:        #4CAF50;
  --grass-dark:   #2E7D32;
  --leaf:         #8BC34A;
  --leaf-dark:    #689F38;
  --sun:          #FFC93C;
  --sun-dark:     #E0A400;
  --sky:          #4FC3F7;
  --sky-dark:     #0288D1;
  --coral:        #FF6B6B;
  --coral-dark:   #D84343;
  --soil:         #A9713F;
  --soil-dark:    #7A4E28;
  --lilac:        #B47EE5;
  --lilac-dark:   #8A4FC0;

  --ink:          #2B2B2B;
  --paper:        #FFFDF6;
  --cream:        #FFF7E6;
  --muted:        #6b6558;
  --line:         #E7DFC9;
  --bg-top:       #CDEFFF;
  --bg-bottom:    #E4F8E0;

  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;

  --shadow-card: 0 10px 0 rgba(43,43,43,0.08), 0 14px 24px rgba(43,43,43,0.10);
  --shadow-pop: 0 6px 0 rgba(43,43,43,0.85);

  --font-display: 'Baloo 2', 'Segoe UI Rounded', system-ui, sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, #ffffff55, transparent),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: 24px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--grass-dark);
  margin: 0 0 10px;
  line-height: 1.2;
}
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; margin-top: 18px; color: var(--ink); }

p { line-height: 1.5; }
.hint { color: var(--muted); font-size: 0.9rem; }
.hidden { display: none !important; }
.grow { flex: 1 1 auto; }

a { color: var(--sky-dark); }

/* ---------------------------- Kopfzeile ---------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
  max-width: 1100px;
  margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-emoji { font-size: 1.8rem; filter: drop-shadow(0 3px 0 rgba(0,0,0,0.15)); }
.brand-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--grass-dark);
  text-shadow: 2px 2px 0 #ffffffaa;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.storage-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid var(--line);
  color: var(--muted);
}
.storage-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.storage-pill.storage-cloud { color: var(--grass-dark); border-color: var(--grass); }
.storage-pill.storage-cloud .dot { background: var(--grass); box-shadow: 0 0 0 3px #4caf5033; }
.storage-pill.storage-error { color: var(--coral-dark); border-color: var(--coral); }
.storage-pill.storage-error .dot { background: var(--coral); }

.icon-btn {
  width: 42px; height: 42px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fff;
  font-size: 1.2rem;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
}
.icon-btn:active { transform: translateY(2px); box-shadow: none; }
.icon-btn.danger { border-color: #f3c3c3; color: var(--coral-dark); }

/* ---------------------------- Navigation ---------------------------- */

.tabs {
  display: flex;
  gap: 10px;
  max-width: 1100px;
  margin: 6px auto 18px;
  padding: 0 16px;
}

.tab-btn {
  flex: 1 1 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--muted);
  background: #fff;
  border: 3px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 6px 8px;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--line);
  transition: transform .08s ease;
}
.tab-icon { font-size: 1.4rem; }
.tab-btn:active { transform: translateY(3px); box-shadow: none; }
.tab-btn.active {
  color: #fff;
  background: var(--grass);
  border-color: var(--grass-dark);
  box-shadow: 0 5px 0 var(--grass-dark);
}

main { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.view { display: none; }
.view.active { display: block; }

/* ---------------------------- Karten / Buttons ---------------------------- */

.card {
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}
.card.small { max-width: 420px; }

.btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 999px;
  border: none;
  padding: 11px 20px;
  cursor: pointer;
  color: #fff;
  transition: transform .08s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(3px); }

.btn-primary { background: var(--grass); box-shadow: 0 5px 0 var(--grass-dark); }
.btn-primary:active { box-shadow: 0 2px 0 var(--grass-dark); }

.btn-ghost {
  background: #fff; color: var(--ink);
  border: 2px solid var(--line);
  box-shadow: 0 4px 0 var(--line);
}
.btn-ghost:active { box-shadow: 0 1px 0 var(--line); }

.btn-danger { background: var(--coral); box-shadow: 0 5px 0 var(--coral-dark); }
.btn-danger:active { box-shadow: 0 2px 0 var(--coral-dark); }

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ---------------------------- Formulare ---------------------------- */

.input {
  font-family: var(--font-body);
  font-size: 0.98rem;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.input:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px #4fc3f733; }
textarea.input { resize: vertical; font-family: var(--font-body); }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-weight: 700; font-size: 0.88rem; margin-bottom: 5px; color: var(--grass-dark); }
.field em { font-weight: 400; color: var(--muted); font-style: normal; }

.check-row { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 14px 0; cursor: pointer; }
.check-row input { width: 22px; height: 22px; accent-color: var(--grass); cursor: pointer; }

/* ---------------------------- Toolbar / Filter ---------------------------- */

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar-filters { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.toolbar-filters .input { width: auto; flex: 1 1 150px; }

.todo-toolbar { flex-direction: column; align-items: stretch; }
.todo-date-select { display: flex; gap: 8px; }
.todo-date-select .input { flex: 1; }

.segmented { display: flex; gap: 6px; background: var(--cream); padding: 5px; border-radius: 999px; }
.segmented-btn {
  flex: 1; border: none; background: transparent; padding: 9px 10px;
  border-radius: 999px; font-family: var(--font-display); font-weight: 700;
  font-size: 0.85rem; color: var(--muted); cursor: pointer;
}
.segmented-btn.active { background: var(--sun); color: var(--ink); box-shadow: 0 3px 0 var(--sun-dark); }

/* ---------------------------- Kartenraster ---------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 4px;
}

.plant-card, .todo-card {
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform .1s ease;
  display: flex; flex-direction: column;
}
.plant-card:hover, .todo-card:hover { transform: translateY(-3px); }
.plant-card:active, .todo-card:active { transform: translateY(1px); }

.card-photo {
  width: 100%; height: 150px;
  background: linear-gradient(160deg, #dff3e0, #cdeccd);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border-bottom: 3px solid var(--line);
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.card-photo .placeholder-emoji { font-size: 2.6rem; opacity: 0.55; }

.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.card-sub { font-size: 0.85rem; color: var(--muted); }

.badge-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.badge {
  font-size: 0.72rem; font-weight: 700; font-family: var(--font-display);
  background: var(--leaf); color: #fff; padding: 3px 9px; border-radius: 999px;
}
.badge.badge-loc { background: var(--sky); }
.badge.badge-group { background: var(--lilac); }
.badge.badge-done { background: var(--muted); }

.todo-card.is-done { opacity: 0.65; }
.todo-card .card-body .care-type-line { font-weight: 700; color: var(--soil-dark); }

/* ---------------------------- Leerer Zustand / FAB ---------------------------- */

.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-emoji { font-size: 3rem; margin-bottom: 8px; }

.fab {
  position: fixed; right: 20px; bottom: 24px;
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--sun); color: var(--ink);
  border: 3px solid var(--sun-dark);
  font-size: 2rem; font-family: var(--font-display); font-weight: 800;
  box-shadow: 0 6px 0 var(--sun-dark), 0 10px 18px rgba(0,0,0,0.2);
  cursor: pointer; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.fab:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--sun-dark); }

/* ---------------------------- Verwaltung ---------------------------- */

.admin-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.admin-tab-btn {
  font-family: var(--font-display); font-weight: 700; font-size: 0.88rem;
  border: 2px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 16px; cursor: pointer; box-shadow: 0 3px 0 var(--line);
}
.admin-tab-btn.active { background: var(--sky); color: #fff; border-color: var(--sky-dark); box-shadow: 0 3px 0 var(--sky-dark); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.admin-hint { color: var(--muted); margin-bottom: 10px; }

.admin-add-row { display: flex; gap: 10px; align-items: center; }

.taxonomy-list { display: flex; flex-direction: column; gap: 12px; }
.taxonomy-main-group {
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius-md);
  padding: 12px 14px;
}
.taxonomy-main-header { display: flex; align-items: center; gap: 10px; }
.taxonomy-main-header strong { font-family: var(--font-display); font-size: 1.02rem; flex: 1; }
.taxonomy-sub-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 8px; }
.taxonomy-sub-add { display: flex; gap: 8px; }
.taxonomy-sub-add .input { flex: 1; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--cream); border: 2px solid var(--sun-dark);
  border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 0.85rem; font-weight: 700;
}
.chip .chip-x {
  width: 20px; height: 20px; border-radius: 50%; border: none; background: #fff;
  cursor: pointer; font-size: 0.75rem; line-height: 1; color: var(--coral-dark);
}
.chip .chip-x:disabled { opacity: 0.3; cursor: not-allowed; }

.chip-manage-list { display: flex; flex-wrap: wrap; gap: 10px; }
.chip-manage {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.chip-manage input { border: none; font-family: var(--font-body); font-weight: 700; font-size: 0.92rem; width: 140px; background: transparent; }
.chip-manage input:focus { outline: none; }
.chip-manage button { border: none; background: transparent; cursor: pointer; font-size: 1rem; }

/* ---------------------------- Vollbild-Screen (Pflanzendetail) ---------------------------- */

.screen {
  position: fixed; inset: 0; background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  z-index: 100; display: flex; flex-direction: column;
}
.screen-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--paper); border-bottom: 3px solid var(--line);
}
.screen-header h2 { flex: 1; margin: 0; font-size: 1.2rem; text-align: center; }
.screen-body { flex: 1; overflow-y: auto; padding: 16px; max-width: 720px; margin: 0 auto; width: 100%; }
.screen-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 16px; background: var(--paper); border-top: 3px solid var(--line);
}

.photo-block { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 18px; }
.photo-frame {
  width: 160px; height: 160px; border-radius: var(--radius-lg);
  border: 3px solid var(--line); background: linear-gradient(160deg, #dff3e0, #cdeccd);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.photo-frame.small { width: 56px; height: 56px; border-radius: var(--radius-sm); flex-shrink: 0; }
.photo-placeholder { font-size: 3rem; opacity: 0.5; }
.photo-frame.small .photo-placeholder { font-size: 1.5rem; }

.lookup-card h3 { margin-bottom: 4px; }
.lookup-row { display: flex; gap: 8px; margin: 10px 0; }
.lookup-status { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--cream); font-size: 0.88rem; margin-bottom: 8px; }
.lookup-status.error { background: #ffe3e3; color: var(--coral-dark); }
.lookup-results { display: flex; flex-direction: column; gap: 8px; }
.lookup-result {
  display: flex; gap: 10px; align-items: center; text-align: left;
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 10px; cursor: pointer; width: 100%;
}
.lookup-result:hover { border-color: var(--sky); }
.lookup-result img { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: #eee; }
.lookup-result .lr-title { font-weight: 700; font-size: 0.92rem; }
.lookup-result .lr-snippet { font-size: 0.78rem; color: var(--muted); }
.lookup-result .lr-source { font-size: 0.68rem; color: var(--sky-dark); font-weight: 700; }

.taxonomy-row-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.taxonomy-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.taxonomy-row select { flex: 1 1 140px; }
.taxonomy-row .row-x { flex-shrink: 0; }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 10px; }
.care-tile {
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius-md);
  padding: 12px; cursor: pointer; position: relative;
}
.care-tile:hover { border-color: var(--sun); }
.care-tile .ct-type { font-family: var(--font-display); font-weight: 700; color: var(--grass-dark); font-size: 0.95rem; }
.care-tile .ct-label { font-size: 0.85rem; color: var(--muted); margin: 2px 0 6px; }
.care-tile .ct-months { display: flex; flex-wrap: wrap; gap: 4px; }
.ct-month-pill { font-size: 0.68rem; font-weight: 700; background: var(--leaf); color: #fff; padding: 2px 7px; border-radius: 999px; }
.care-tile .ct-edit-hint { position: absolute; top: 8px; right: 10px; font-size: 0.75rem; color: var(--sky-dark); font-weight: 700; }

.month-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.month-chip {
  text-align: center; padding: 8px 4px; border-radius: var(--radius-sm); border: 2px solid var(--line);
  background: #fff; font-size: 0.82rem; font-weight: 700; cursor: pointer; user-select: none;
}
.month-chip.selected { background: var(--grass); color: #fff; border-color: var(--grass-dark); }

/* ---------------------------- Modale ---------------------------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(30,40,20,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 200;
  padding: 16px;
}
.modal { width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; }
.modal-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; }

.todo-detail-header { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.todo-detail-body p { margin: 4px 0; }

.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

/* ---------------------------- Toasts ---------------------------- */

#toast-container {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 300; align-items: center;
  pointer-events: none;
}
.toast {
  font-family: var(--font-display); font-weight: 700; font-size: 0.9rem;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  animation: toast-in .2s ease;
}
.toast.error { background: var(--coral-dark); }
.toast.success { background: var(--grass-dark); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------------------- Responsive / Mobile ---------------------------- */

@media (max-width: 640px) {
  .brand-text { font-size: 1.25rem; }
  .tab-label { font-size: 0.78rem; }
  .tabs { gap: 6px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .card-photo { height: 120px; }
  .toolbar-filters .input { flex: 1 1 100%; }
  .screen-body { padding: 14px; }
  .modal { max-width: 100%; }
  .fab { right: 14px; bottom: 18px; }
  .month-picker { grid-template-columns: repeat(3, 1fr); }
}
