/* ===== LANDHAUSSTIL DESIGN TOKENS ===== */
:root {
  --ls-bg:      #fdf5e6;
  --ls-surface: #fffcf4;
  --ls-card:    #fffaf0;
  --ls-border:  #dfc9a8;
  --ls-text:    #3d2b1f;
  --ls-muted:   #8b6f57;
  --ls-accent:  #b8763a;
  --ls-star:    #e8a020;
  --ls-sage:    #6b8f71;
  --ls-sage-bg: #edf4ec;
  --ls-shadow:  rgba(61, 43, 31, 0.10);
}

/* ===== TAB NAVIGATION ===== */
#tabNav {
  display: flex;
  background: var(--ls-surface);
  border-bottom: 1px solid var(--ls-border);
  flex-shrink: 0;
}
.tab-btn {
  flex: 1;
  padding: 14px 8px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ls-muted);
  transition: color 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.tab-btn.active {
  color: var(--ls-accent);
  border-bottom-color: var(--ls-accent);
}

/* ===== TAB CONTAINERS ===== */
#tabCalendar, #tabTasks {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
#tabCalendar.active, #tabTasks.active { display: flex; }

/* ===== TASKS AREA ===== */
#tabTasks { background: var(--ls-bg); }

#tasksView {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ===== PERSON FILTER BAR ===== */
.tasks-filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0 4px;
  flex-shrink: 0;
}
.tasks-filter-bar::-webkit-scrollbar { display: none; }

.tasks-filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 24px;
  border: 2px solid var(--ls-border);
  background: var(--ls-card);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  color: var(--ls-text);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 4px var(--ls-shadow);
}
.tasks-filter-btn.active {
  background: var(--pcolor, var(--ls-accent));
  color: white;
  border-color: var(--pcolor, var(--ls-accent));
}

/* ===== DAY INDICATOR (Tagesnavigation) ===== */
.day-indicator-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 2px 0 4px;
  flex-shrink: 0;
}
.day-indicator-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ls-muted);
}
.day-indicator-today-btn {
  padding: 5px 14px;
  border-radius: 16px;
  border: 2px solid var(--ls-accent);
  background: var(--ls-card);
  color: var(--ls-accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
}
.day-indicator-today-btn:active {
  transform: scale(0.92);
  background: var(--ls-accent);
  color: white;
}

/* ===== PERSON SECTION ===== */
.tasks-person-section { display: flex; flex-direction: column; gap: 12px; }

.person-header {
  background: var(--ls-card);
  border-radius: 20px;
  border-left: 5px solid var(--pcolor, var(--ls-accent));
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 3px 14px var(--ls-shadow);
  transition: background 0.35s;
}
.person-header.all-done {
  background: var(--ls-sage-bg);
  border-left-color: var(--ls-sage);
}

.person-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.person-avatar { font-size: 36px; line-height: 1; }
.person-name   { font-size: 22px; font-weight: 700; flex: 1; color: var(--ls-text); }
.person-stars  { font-size: 26px; font-weight: 800; color: var(--ls-star); letter-spacing: -0.5px; }

/* Week dots row */
.week-dots { display: flex; gap: 5px; }
.wd {
  flex: 1;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  background: var(--ls-border);
  color: var(--ls-muted);
  cursor: pointer;
  transition: background 0.3s, color 0.3s, transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.wd:active { transform: scale(0.92); }
.wd-done   { background: var(--ls-sage);   color: white; }
.wd-today  { background: var(--ls-accent); color: white; }
.wd-missed { background: var(--ls-border); color: var(--ls-muted); opacity: 0.45; }
.wd-future {
  background: transparent;
  border: 1.5px dashed var(--ls-border);
  color: var(--ls-border);
}
.wd-selected {
  box-shadow: 0 0 0 2px var(--ls-text);
  transform: scale(1.12);
  font-weight: 800;
  opacity: 1;
}

/* All-done banner inside section */
.all-done-banner {
  background: var(--ls-sage-bg);
  border: 2px solid var(--ls-sage);
  border-radius: 16px;
  padding: 13px 20px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--ls-sage);
  animation: banner-pop 0.4s ease-out;
}
@keyframes banner-pop {
  0%  { transform: scale(0.88); opacity: 0; }
  65% { transform: scale(1.03); }
  100%{ transform: scale(1);    opacity: 1; }
}

/* Ruhige Variante für vergangene Tage */
.all-done-banner.muted {
  background: var(--ls-card);
  border-color: var(--ls-border);
  color: var(--ls-muted);
  animation: none;
}

/* Vorschau-Banner für zukünftige Tage */
.future-preview-banner {
  background: var(--ls-card);
  border: 2px dashed var(--ls-border);
  border-radius: 16px;
  padding: 13px 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ls-muted);
}

/* ===== EMPTY STATES ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 16px;
  text-align: center;
  color: var(--ls-muted);
  font-size: 14px;
  font-weight: 600;
}
.empty-state-emoji { font-size: 42px; }
.empty-state-small { padding: 12px 16px; }
.empty-state-small .empty-state-emoji { font-size: 28px; }

/* ===== TASK CARDS ===== */
.tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.task-card {
  background: var(--ls-card);
  border-radius: 24px;
  padding: 20px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  border: 2.5px solid var(--ls-border);
  position: relative;
  min-height: 162px;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 3px 14px var(--ls-shadow);
  transition: transform 0.14s, box-shadow 0.14s, background 0.3s, border-color 0.3s;
}
.task-card:active {
  transform: scale(0.90);
  box-shadow: 0 1px 4px var(--ls-shadow);
}
.task-card.done {
  background: var(--ls-sage-bg);
  border-color: var(--ls-sage);
}
.task-card.task-add {
  border-style: dashed;
  opacity: 0.50;
  touch-action: auto;
  min-height: 120px;
}
.task-card.task-add:active { opacity: 1; }

/* Aufgaben-Vorschau für zukünftige Tage */
.task-card.future {
  opacity: 0.55;
  border-style: dashed;
}
.task-future-badge {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 18px;
}

/* Shake animation for already-done tap */
.task-card.card-shake {
  animation: card-shake 0.5s ease;
}
@keyframes card-shake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  20%       { transform: translateX(-6px) rotate(-2.5deg); }
  40%       { transform: translateX(6px)  rotate(2.5deg); }
  60%       { transform: translateX(-4px) rotate(-1.5deg); }
  80%       { transform: translateX(4px)  rotate(1.5deg); }
}

.task-check {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  background: var(--ls-sage);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(107, 143, 113, 0.45);
}

.task-emoji { font-size: 52px; line-height: 1; }
.task-title {
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  color: var(--ls-text);
}

/* Completion dots */
.task-dots-row {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}
.task-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--ls-border);
  background: transparent;
  transition: background 0.22s, border-color 0.22s, box-shadow 0.22s;
}
.task-dot.filled {
  border-color: var(--ls-star);
  background: var(--ls-star);
  box-shadow: 0 0 7px rgba(232, 160, 32, 0.55);
}

.task-stars { font-size: 13px; letter-spacing: 1px; }

/* Streak badge */
.task-streak {
  position: absolute;
  bottom: 8px; left: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ls-accent);
  background: rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  padding: 2px 7px;
  line-height: 1.4;
}

/* ===== REWARDS SECTION ===== */
.rewards-section { display: flex; flex-direction: column; gap: 10px; }
.rewards-heading {
  font-size: 15px;
  font-weight: 700;
  color: var(--ls-muted);
}
.rewards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.reward-card {
  background: var(--ls-card);
  border-radius: 22px;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 2.5px solid var(--ls-border);
  position: relative;
  min-height: 192px;
  box-shadow: 0 3px 14px var(--ls-shadow);
  transition: all 0.2s;
}
.reward-card.can-afford {
  border-color: var(--ls-star);
  background: linear-gradient(155deg, #fffbeb 0%, #fef0c4 100%);
}
.reward-card.reward-add {
  border-style: dashed;
  cursor: pointer;
  opacity: 0.50;
  touch-action: auto;
}
.reward-card.reward-add:active { opacity: 1; transform: scale(0.95); }

.reward-emoji { font-size: 42px; line-height: 1; }
.reward-title { font-size: 13px; font-weight: 600; text-align: center; color: var(--ls-text); }

.reward-progress-wrap { width: 100%; }
.reward-progress-bar {
  width: 100%; height: 9px;
  background: #e5ddd0;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 4px;
}
.reward-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #fcd34d, #f0a030);
  border-radius: 5px;
  transition: width 0.45s ease;
}
.reward-progress-label { font-size: 11px; color: var(--ls-muted); text-align: center; }

.reward-redeem-btn {
  width: 100%;
  padding: 9px 8px;
  background: var(--ls-star);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s;
  animation: pulse-gold 2.4s ease-in-out infinite;
}
.reward-redeem-btn:active { transform: scale(0.93); }
@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0   rgba(232, 160, 32, 0.55); }
  50%       { box-shadow: 0 0 0 9px rgba(232, 160, 32, 0); }
}

.reward-edit-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  background: var(--ls-card);
  border: 1px solid var(--ls-border);
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

/* ===== CELEBRATION ANIMATIONS ===== */

/* Flying stars on task complete */
.star-fly {
  position: fixed;
  font-size: 28px;
  pointer-events: none;
  z-index: 9999;
  animation: star-float 0.95s ease-out forwards;
}
@keyframes star-float {
  0%   { transform: translate(0, 0) scale(1);   opacity: 1; }
  100% { transform: translate(var(--tx, 0px), -120px) scale(1.7); opacity: 0; }
}

/* Confetti rain on all-done */
.confetti-piece {
  position: fixed;
  top: -34px;
  pointer-events: none;
  z-index: 9998;
  animation: confetti-fall var(--cdur, 1.5s) ease-in forwards;
}
@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  82%  { opacity: 1; }
  100% { transform: translateY(100vh) rotate(560deg); opacity: 0; }
}

/* All-done toast overlay */
.all-done-toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(1);
  background: var(--ls-card);
  border: 3px solid var(--ls-sage);
  border-radius: 28px;
  padding: 28px 36px;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  z-index: 9998;
  color: var(--ls-text);
  pointer-events: none;
  animation: toast-in-out 3.6s ease-in-out forwards;
  box-shadow: 0 14px 44px rgba(61, 43, 31, 0.25);
}
.all-done-toast small {
  display: block;
  font-size: 15px;
  font-weight: 500;
  margin-top: 6px;
  color: var(--ls-sage);
}
@keyframes toast-in-out {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.68); }
  12%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  18%  { transform: translate(-50%, -50%) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.90); }
}

/* ===== BOTTOM-SHEET OVERLAYS ===== */
.tasks-overlay {
  position: fixed;
  inset: 0;
  background: rgba(61, 43, 31, 0.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.tasks-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.tasks-sheet {
  background: var(--ls-surface);
  border-radius: 28px 28px 0 0;
  padding: 6px 24px 36px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
}
.tasks-overlay.active .tasks-sheet { transform: translateY(0); }

.sheet-handle {
  width: 44px; height: 4px;
  background: var(--ls-border);
  border-radius: 2px;
  margin: 10px auto 2px;
  flex-shrink: 0;
}
.sheet-title { font-size: 20px; font-weight: 700; color: var(--ls-text); }

.sheet-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ls-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.sheet-emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
}
.sheet-emoji-btn {
  width: 52px; height: 52px;
  font-size: 26px;
  border: 2.5px solid transparent;
  border-radius: 14px;
  background: var(--ls-bg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.sheet-emoji-btn.selected {
  border-color: var(--ls-accent);
  transform: scale(1.1);
}

.sheet-person-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet-person-btn {
  padding: 9px 16px;
  border-radius: 22px;
  border: 2px solid var(--ls-border);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: var(--ls-bg);
  color: var(--ls-text);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.sheet-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 2px solid var(--ls-border);
  font-size: 16px;
  font-family: inherit;
  background: var(--ls-bg);
  color: var(--ls-text);
  outline: none;
}
.sheet-input:focus { border-color: var(--ls-accent); }

/* Times-per-day stepper */
.times-stepper {
  display: flex;
  align-items: center;
  gap: 14px;
}
.times-step-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 2px solid var(--ls-border);
  background: var(--ls-bg);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ls-accent);
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
}
.times-step-btn:disabled { opacity: 0.28; cursor: default; }
.times-step-btn:active:not(:disabled) { transform: scale(0.88); }
.times-step-label {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--ls-text);
}

/* Stars range */
.stars-row { display: flex; align-items: center; gap: 14px; }
.stars-row input[type="range"] {
  flex: 1;
  height: 8px;
  accent-color: var(--ls-star);
  cursor: pointer;
}
.stars-value { font-size: 18px; font-weight: 700; color: var(--ls-star); min-width: 80px; }

/* Sheet action buttons */
.sheet-btn-reset {
  width: 100%;
  padding: 12px;
  background: var(--ls-bg);
  color: var(--ls-accent);
  border: 2px dashed var(--ls-border);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
}
.sheet-btn-reset:active { opacity: 0.7; }

.sheet-actions { display: flex; gap: 10px; }
.sheet-btn {
  flex: 1;
  padding: 15px;
  border-radius: 16px;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.14s;
}
.sheet-btn:active { transform: scale(0.95); }
.sheet-btn-save   { background: var(--ls-accent); color: white; }
.sheet-btn-cancel { background: var(--ls-bg); color: var(--ls-text); }
.sheet-btn-delete {
  flex: 0 0 auto;
  padding: 15px 18px;
  background: #fee2e2;
  color: #dc2626;
}
