/* ============================================================
   Umzugsplaner – Stylesheet
   Mobile-first, Light/Dark über prefers-color-scheme
   ============================================================ */

:root {
  /* Farbpalette: Petrol + Terracotta ("Karton & Küste") */
  --bg: #f5f2ec;
  --surface: #ffffff;
  --surface-alt: #ede8de;
  --text: #22303a;
  --text-muted: #5d6b76;
  --accent: #0f4c5c;
  --accent-strong: #093542;
  --accent-soft: #cfe3e8;
  --highlight: #e36414;
  --highlight-soft: #fbe4d4;
  --success: #2e7d32;
  --success-soft: #dcebdc;
  --danger: #b3261e;
  --danger-soft: #f6dcda;
  --border: #d8d2c6;
  --shadow: 0 2px 10px rgba(34, 48, 58, 0.08);
  --radius: 12px;
  --font-head: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10181e;
    --surface: #1a252d;
    --surface-alt: #22303a;
    --text: #e8ecef;
    --text-muted: #9fb0bb;
    --accent: #4fa3b8;
    --accent-strong: #7fc4d4;
    --accent-soft: #12333d;
    --highlight: #f0854a;
    --highlight-soft: #3d2415;
    --success: #7fc383;
    --success-soft: #1c2f1d;
    --danger: #e57373;
    --danger-soft: #3a1d1b;
    --border: #31414d;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
}

h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.4rem; margin: 0 0 0.5rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.75rem; }

/* ---------- Header ---------- */
.app-header {
  background: var(--accent);
  color: #fff;
  padding: 1rem 1rem 0;
  box-shadow: var(--shadow);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 960px;
  margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand-icon { width: 44px; height: 44px; flex: none; background: #fff; border-radius: 10px; padding: 4px; }
.tagline { margin: 0; font-size: 0.8rem; opacity: 0.85; }

.header-right { display: flex; align-items: center; gap: 0.9rem; }

.countdown { display: flex; flex-direction: column; align-items: center; min-width: 90px; }
.countdown-number { font-family: var(--font-head); font-size: 1.7rem; font-weight: 700; }
.countdown-label { font-size: 0.7rem; opacity: 0.85; text-align: center; max-width: 150px; }

.btn-premium {
  background: var(--highlight);
  color: #fff;
  border: none;
  font-weight: 600;
}
.btn-premium:hover { filter: brightness(1.08); }

.help-btn {
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}
.help-btn:hover { background: rgba(255, 255, 255, 0.22); }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 0.25rem;
  max-width: 960px;
  margin: 0.9rem auto 0;
  overflow-x: auto;
}

.tab {
  flex: 1;
  min-width: 84px;
  padding: 0.6rem 0.5rem;
  border: none;
  border-radius: 10px 10px 0 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.tab.active { background: var(--bg); color: var(--text); font-weight: 600; }

/* ---------- Layout ---------- */
.app-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.section-intro { color: var(--text-muted); margin: 0 0 1rem; font-size: 0.95rem; }
.hint { color: var(--text-muted); font-size: 0.85rem; }
.hidden { display: none !important; }

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

/* ---------- Formulare ---------- */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0.9rem; }
.form-grid label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; font-weight: 500; }
.form-grid .checkbox-label { flex-direction: row; align-items: center; gap: 0.5rem; }
.form-actions { display: flex; gap: 0.5rem; }

input, select, textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
input[type="checkbox"] { width: auto; accent-color: var(--accent); transform: scale(1.2); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.inline-form { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.inline-form input { flex: 1 1 180px; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, filter 0.15s;
}
.btn:hover { background: var(--surface-alt); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-small { padding: 0.25rem 0.6rem; font-size: 0.8rem; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: underline;
  padding: 0.25rem;
}

/* ---------- Überblick ---------- */
.overview-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.overview-item {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.overview-value { font-family: var(--font-head); font-size: 1.25rem; font-weight: 700; color: var(--accent); overflow-wrap: anywhere; }
.overview-label { font-size: 0.78rem; color: var(--text-muted); }

.tools-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }

/* ---------- Fortschritt ---------- */
.progress-wrap { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.progress-bar {
  flex: 1;
  height: 12px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--highlight));
  border-radius: 999px;
  transition: width 0.3s ease;
}
.progress-text { font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; }

/* ---------- Checkliste ---------- */
.phase { margin-bottom: 1.25rem; }
.phase-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.3rem;
  margin-bottom: 0.6rem;
}
.phase-title { font-family: var(--font-head); font-size: 1rem; font-weight: 700; }
.phase-due { font-size: 0.8rem; color: var(--text-muted); }

.task {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.4rem;
}
.task input[type="checkbox"] { margin-top: 0.25rem; }
.task-main { flex: 1; }
.task-text { display: block; }
.task.done .task-text { text-decoration: line-through; color: var(--text-muted); }
.task-due { font-size: 0.78rem; color: var(--text-muted); }
.task.overdue { border-color: var(--danger); background: var(--danger-soft); }
.task.overdue .task-due { color: var(--danger); font-weight: 600; }
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  vertical-align: middle;
}
.badge-overdue { background: var(--danger); color: #fff; }
.badge-firstnight { background: var(--highlight); color: #fff; }

.task-delete, .row-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}
.task-delete:hover, .row-delete:hover { color: var(--danger); background: var(--danger-soft); }

.phase-add { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.phase-add input { flex: 1; font-size: 0.9rem; padding: 0.4rem 0.6rem; }

/* ---------- Ummelde-Manager ---------- */
.contact-group-title {
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 1.1rem 0 0.4rem;
}
.contact {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.4rem;
}
.contact.status-done { border-left: 4px solid var(--success); }
.contact.status-skip { opacity: 0.6; }
.contact.status-open { border-left: 4px solid var(--highlight); }
.contact-name { font-weight: 500; align-self: center; }
.contact-controls { display: flex; align-items: center; gap: 0.35rem; }
.contact select { width: auto; font-size: 0.82rem; padding: 0.3rem 0.4rem; }
.contact-note { grid-column: 1 / -1; }
.contact-note input { font-size: 0.85rem; padding: 0.35rem 0.6rem; }

/* ---------- Kartons ---------- */
.box-stats { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.stat-chip {
  background: var(--surface-alt);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
}
.box-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.box-filters input { flex: 2 1 200px; }
.box-filters select { flex: 1 1 130px; width: auto; }

.boxes-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.box-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
}
.box-card.first-night { border-color: var(--highlight); box-shadow: 0 0 0 1px var(--highlight); }
.box-card-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.35rem; }
.box-number { font-family: var(--font-head); font-weight: 700; color: var(--accent); }
.box-room { font-size: 0.82rem; color: var(--text-muted); }
.box-items { margin: 0.3rem 0 0.5rem; padding-left: 1.1rem; font-size: 0.9rem; }
.box-items li { margin-bottom: 0.1rem; }
.box-items mark { background: var(--highlight-soft); color: inherit; border-radius: 3px; padding: 0 2px; }
.box-actions { display: flex; gap: 0.4rem; }
.empty-note { color: var(--text-muted); font-size: 0.9rem; padding: 1rem 0; text-align: center; }

/* ---------- Budget ---------- */
.budget-summary { display: flex; flex-wrap: wrap; gap: 1.25rem; justify-content: space-around; text-align: center; }
.budget-summary .sum-block { display: flex; flex-direction: column; }
.sum-value { font-family: var(--font-head); font-size: 1.3rem; font-weight: 700; }
.sum-label { font-size: 0.78rem; color: var(--text-muted); }
.sum-ok { color: var(--success); }
.sum-over { color: var(--danger); }

.budget-row {
  display: grid;
  grid-template-columns: 1fr 90px 90px auto;
  gap: 0.5rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}
.budget-row input { font-size: 0.88rem; padding: 0.3rem 0.45rem; text-align: right; }
.budget-head { font-weight: 600; background: transparent; border: none; color: var(--text-muted); font-size: 0.8rem; padding: 0 0.7rem; margin-bottom: 0.15rem; }

/* ---------- Ad-Slot ---------- */
.ad-slot {
  margin-top: 2rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
  text-align: center;
  background: var(--surface-alt);
}
.ad-hint { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.ad-placeholder { margin: 0.3rem 0 0; font-size: 0.85rem; color: var(--text-muted); }

/* ---------- Footer ---------- */
.app-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1rem 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.footer-links { display: flex; justify-content: center; gap: 1rem; }

/* ---------- Modale ---------- */
.modal { border: none; border-radius: var(--radius); padding: 0; max-width: 420px; width: calc(100% - 2rem); background: var(--surface); color: var(--text); box-shadow: 0 10px 40px rgba(0,0,0,0.3); }
.modal::backdrop { background: rgba(10, 20, 26, 0.55); }
.modal-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.modal-body h2 { margin: 0; }
.modal-body p { margin: 0; }
.feature-list { margin: 0; padding-left: 1.2rem; }
.price { font-size: 1.15rem; }

.help-steps { margin: 0; padding-left: 1.25rem; display: flex; flex-direction: column; gap: 0.55rem; }
.help-steps li::marker { font-weight: 600; color: var(--accent); }
.help-subtitle { margin: 0.25rem 0 0; }
.help-know { margin: 0; padding-left: 1.25rem; font-size: 0.9rem; color: var(--text-muted); }
.help-know li { margin-bottom: 0.2rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent-strong);
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 50;
  max-width: calc(100% - 2rem);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Druck ---------- */
.print-only { display: none; }

@media print {
  body * { visibility: hidden; }
  .print-only, .print-only * { visibility: visible; }
  .print-only {
    display: block;
    position: absolute;
    inset: 0;
    background: #fff;
    color: #000;
    padding: 1cm;
    font-size: 11pt;
  }
  .print-only h1 { font-size: 16pt; margin-bottom: 0.2cm; }
  .print-only h2 { font-size: 13pt; margin: 0.5cm 0 0.15cm; border-bottom: 1pt solid #000; }
  .print-only ul { margin: 0.1cm 0; padding-left: 0.6cm; }
  .print-only li { margin-bottom: 0.08cm; }
  .print-checkbox { font-family: monospace; }
}

/* ---------- Größere Screens ---------- */
@media (min-width: 640px) {
  h1 { font-size: 1.6rem; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .span-2 { grid-column: 1 / -1; }
  .overview-grid { grid-template-columns: repeat(4, 1fr); }
  .boxes-grid { grid-template-columns: repeat(2, 1fr); }
  .countdown-number { font-size: 2.1rem; }
}

@media (min-width: 900px) {
  .boxes-grid { grid-template-columns: repeat(3, 1fr); }
}
