/* Paklijst-app — mobile-first, gericht op iPhone-snellink (standalone). */

:root {
  --groen: #0d7a5f;
  --groen-donker: #0a5f4a;
  --grijs-licht: #f2f4f3;
  --grijs: #9aa5a1;
  --rood: #c0392b;
  --tekst: #1c2422;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--grijs-licht);
  color: var(--tekst);
  /* Safe areas voor iPhone-notch in standalone-modus */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 14px 40px;
}

.loading, .empty { color: var(--grijs); text-align: center; padding: 20px 0; }
.error { color: var(--rood); text-align: center; }

/* ---------- Koppen ---------- */

.app-header { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; flex-wrap: wrap; }
.app-header h1 { font-size: 1.4rem; margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }

.back-link {
  text-decoration: none;
  color: var(--groen);
  font-weight: 600;
  font-size: 1.05rem;
  padding: 6px 10px 6px 0;
  flex-shrink: 0;
}

.section-heading {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--groen-donker);
  margin: 22px 0 8px;
}
.section-count {
  background: var(--groen);
  color: #fff;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.75rem;
  vertical-align: 2px;
}
.items.packed + .section-heading, .section-heading + .items.packed { color: var(--grijs); }

/* ---------- Formulieren ---------- */

.add-form { display: flex; gap: 8px; margin-bottom: 4px; }
.add-form input {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  padding: 12px 14px;
  border: 1px solid #d5dbd8;
  border-radius: 12px;
  background: #fff;
}
.add-form input:focus { outline: 2px solid var(--groen); border-color: var(--groen); }

.btn {
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--groen);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.btn:active { background: var(--groen-donker); }

.edit-input {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  padding: 8px 10px;
  border: 1px solid var(--groen);
  border-radius: 8px;
}

/* ---------- Lijstenoverzicht ---------- */

.list-overview, .items { list-style: none; margin: 0; padding: 0; }

.list-row, .item-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border-radius: 12px;
  padding: 6px 8px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.list-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  padding: 10px 6px;
}
.list-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.list-counter {
  background: var(--grijs-licht);
  color: var(--grijs);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}
.list-counter.done { background: var(--groen); color: #fff; }

/* ---------- Items ---------- */

.item-name {
  flex: 1;
  min-width: 0;
  padding: 10px 4px;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.btn-check {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--groen);
  background: #fff;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-icon {
  border: 0;
  background: none;
  font-size: 1.05rem;
  padding: 8px;
  cursor: pointer;
  color: var(--grijs);
  flex-shrink: 0;
  border-radius: 8px;
}
.btn-delete { color: var(--rood); }
.btn-delete.armed {
  background: var(--rood);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 10px;
}

/* ---------- Drag & drop ---------- */

.drag-handle {
  border: 0;
  background: var(--grijs-licht);
  color: var(--grijs);
  font-size: 1.25rem;
  line-height: 1;
  padding: 9px 12px;
  border-radius: 8px;
  flex-shrink: 0;
  cursor: grab;
  /* Essentieel op iOS: voorkomt dat slepen de pagina scrollt of tekst selecteert */
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.item-row.dragging {
  position: relative;
  z-index: 10;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  opacity: 0.97;
}
.item-row.dragging .drag-handle { cursor: grabbing; background: var(--groen); color: #fff; }

body.drag-actief {
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

/* Ingepakte items: grijs en doorgestreept, vinkje gevuld */
.items.packed .item-row { background: #e9edeb; box-shadow: none; }
.items.packed .item-name { color: var(--grijs); text-decoration: line-through; }
.items.packed .btn-check { background: var(--grijs); border-color: var(--grijs); }
