/* styles.css — das Aussehen der App
   Mobil zuerst gedacht (Handy), funktioniert aber auch am Rechner. */

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1a1d24;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #3e63dd;
  --accent-soft: #eaeeff;
  --danger: #e5484d;
  --ok: #30a46c;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(20, 25, 40, 0.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161c;
    --card: #1e2129;
    --text: #eef0f4;
    --muted: #9aa1ad;
    --line: #2c303a;
    --accent: #7f9cf5;
    --accent-soft: #232a44;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.4;
}

.hidden { display: none !important; }

.center-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

/* ---------- Kopfzeile ---------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  padding: 0 16px;
  max-width: 680px;
  margin: 0 auto;
}
#app-title { font-weight: 700; font-size: 19px; }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.icon-btn:active { background: var(--line); }

/* ---------- Inhaltsbereich ---------- */
#view {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px 120px;
}

.view-title { font-size: 22px; font-weight: 700; margin: 4px 0 14px; }
.section-label { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin: 22px 0 8px; }

/* ---------- Karten ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.card .grow { flex: 1; min-width: 0; }
.card .title { font-weight: 600; }
.card .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
}
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* Farb-Punkt für Personen */
.dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex: 0 0 auto;
  border: 2px solid rgba(0,0,0,.08);
}
.person-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--muted);
}

/* Abhak-Kreis */
.check {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: transparent;
  cursor: pointer;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff;
  transition: background .15s, border-color .15s;
}
.check.done { background: var(--ok); border-color: var(--ok); }

/* Badges */
.badge {
  display: inline-block;
  font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.badge.timer { background: #fff2e0; color: #b4530f; }
.badge.rot { background: #e7f7ef; color: #157a4d; }
@media (prefers-color-scheme: dark) {
  .badge.timer { background: #3a2a17; color: #f2a25f; }
  .badge.rot { background: #143026; color: #5fd39b; }
}

/* ---------- Knöpfe ---------- */
button, input, select, textarea { font-family: inherit; font-size: 16px; }

.btn {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 13px 18px;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
}
.btn:active { opacity: .85; }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn.small { width: auto; padding: 8px 14px; font-size: 14px; border-radius: 10px; }

.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; padding: 6px; font-size: 15px; }

/* ---------- Formulare ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
}
.input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* Farb-Auswahl */
.color-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.color-opt {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid transparent; cursor: pointer;
  position: relative;
}
.color-opt.selected { border-color: var(--text); }
.color-opt.taken { opacity: .28; cursor: not-allowed; }
.color-opt.taken::after { content: "✕"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }

/* Personen-Auswahl (Chips) */
.people-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.person-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 12px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--card);
  cursor: pointer; font-size: 15px;
}
.person-pill.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* Typ-Auswahl beim Erstellen */
.type-card {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  background: var(--card);
}
.type-card.on { border-color: var(--accent); background: var(--accent-soft); }
.type-card .t { font-weight: 700; }
.type-card .d { color: var(--muted); font-size: 14px; margin-top: 3px; }

/* ---------- Schwebender Plus-Knopf ---------- */
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(74px + var(--safe-bottom));
  width: 58px; height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 30px; line-height: 1;
  box-shadow: 0 6px 18px rgba(62, 99, 221, .4);
  cursor: pointer;
  z-index: 30;
}
.fab:active { transform: scale(.95); }

/* ---------- Untere Tab-Leiste ---------- */
#tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex;
  padding-bottom: var(--safe-bottom);
  z-index: 25;
}
.tab {
  flex: 1;
  background: none; border: none; cursor: pointer;
  padding: 8px 0 10px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted);
  font-size: 11px;
}
.tab .tab-ic { font-size: 22px; }
.tab.active { color: var(--accent); }

/* ---------- Kalender ---------- */
.cal-day {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 10px;
  overflow: hidden;
}
.cal-day.today { border-color: var(--accent); }
.cal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.cal-head .date-sub { color: var(--muted); font-weight: 400; font-size: 14px; }
.cal-body { padding: 6px 14px 12px; }
.cal-entry { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 15px; }
.cal-empty { color: var(--muted); font-size: 14px; padding: 6px 0; }
.add-wash { margin-top: 6px; }

/* ---------- Overlay / Modal ---------- */
#modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 12, 20, .45);
  z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
#modal {
  background: var(--card);
  width: 100%;
  max-width: 680px;
  max-height: 92dvh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(24px + var(--safe-bottom));
}
@media (min-width: 640px) {
  #modal-overlay { align-items: center; }
  #modal { border-radius: 20px; max-height: 88dvh; }
}
.modal-title { font-size: 20px; font-weight: 700; margin: 2px 0 16px; }
.modal-close { float: right; }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(90px + var(--safe-bottom));
  background: #1a1d24; color: #fff;
  padding: 11px 18px; border-radius: 12px;
  font-size: 15px; z-index: 60;
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
  max-width: 90%;
}

/* ---------- Login-Bildschirme ---------- */
.gate-wrap {
  max-width: 460px; margin: 0 auto;
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 32px 22px;
}
.gate-logo { font-size: 52px; text-align: center; margin-bottom: 8px; }
.gate-title { font-size: 26px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.gate-sub { text-align: center; color: var(--muted); margin-bottom: 26px; }

.list-inline { display: flex; flex-direction: column; gap: 8px; }

hr.sep { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.muted { color: var(--muted); font-size: 14px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }
