/* Reise-Packliste — eigenes Design: Reise-Blau + Sonnengelb, leicht & luftig */

:root {
  --rp-blue: #0ea5e9;
  --rp-blue-dark: #0284c7;
  --rp-blue-deep: #075985;
  --rp-sun: #facc15;
  --rp-sun-dark: #eab308;

  --bg: #f0f9ff;
  --bg-grad-1: #e0f2fe;
  --bg-grad-2: #f0f9ff;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eff6ff;
  --border: #d7e9f5;
  --text: #0f2433;
  --text-soft: #4b6478;
  --text-faint: #7c93a3;
  --accent: var(--rp-blue);
  --accent-contrast: #ffffff;
  --sun: var(--rp-sun);
  --sun-text: #5c4a04;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --ok: #16a34a;

  --shadow-sm: 0 1px 2px rgba(15, 36, 51, 0.06);
  --shadow-md: 0 6px 22px rgba(8, 89, 133, 0.10);
  --shadow-lg: 0 18px 48px rgba(8, 89, 133, 0.18);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --ring: 0 0 0 3px rgba(14, 165, 233, 0.40);

  --maxw: 760px;
}

[data-theme="dark"] {
  --bg: #061320;
  --bg-grad-1: #082136;
  --bg-grad-2: #061320;
  --surface: #0f2436;
  --surface-2: #102b40;
  --surface-3: #133349;
  --border: #1d4259;
  --text: #e8f4fb;
  --text-soft: #a4c1d4;
  --text-faint: #6f93a8;
  --accent: #38bdf8;
  --accent-contrast: #04222f;
  --sun: #fde047;
  --sun-text: #3b2f04;
  --danger: #f87171;
  --danger-soft: #2a1314;
  --ok: #4ade80;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 22px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.55);
  --ring: 0 0 0 3px rgba(56, 189, 248, 0.45);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 100% -10%, var(--bg-grad-1), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, var(--bg-grad-1), transparent 55%),
    var(--bg-grad-2);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  overflow-x: hidden;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

.visually-hidden,
.visually-hidden-select {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ---------- Header ---------- */
.app-header {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.app-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.app-header__logo {
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(140deg, var(--rp-blue), var(--rp-blue-deep));
  box-shadow: var(--shadow-md);
  flex: none;
}
.app-header h1 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.app-header__subtitle {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--text-soft);
}

.icon-btn {
  flex: none;
  width: 44px; height: 44px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 1.2rem;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, background .2s ease;
}
.icon-btn:hover { transform: translateY(-1px); }
.icon-btn__moon { display: none; }
[data-theme="dark"] .icon-btn__sun { display: none; }
[data-theme="dark"] .icon-btn__moon { display: block; }

/* ---------- Layout ---------- */
.app-main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 18px;
}
.card__title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

/* ---------- Builder ---------- */
.builder { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-pill);
  padding: 9px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform .12s ease, background .2s ease, border-color .2s ease, color .2s ease;
  white-space: nowrap;
}
.chip:hover { transform: translateY(-1px); }
.chip[aria-checked="true"] {
  background: linear-gradient(140deg, var(--rp-blue), var(--rp-blue-dark));
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.chip__emoji { font-size: 1rem; }

/* Stepper */
.stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  width: fit-content;
}
.stepper__btn {
  border: none;
  background: var(--surface-3);
  color: var(--rp-blue-dark);
  font-size: 1.3rem;
  width: 46px;
  cursor: pointer;
  line-height: 1;
  transition: background .15s ease;
}
[data-theme="dark"] .stepper__btn { color: var(--accent); }
.stepper__btn:hover { background: var(--border); }
.stepper__input {
  width: 64px;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper__input::-webkit-outer-spin-button,
.stepper__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.builder__hint {
  margin: -2px 0 0;
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, filter .2s ease, background .2s ease;
  font-family: inherit;
  line-height: 1.2;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--block { width: 100%; }
.btn--sm { padding: 9px 14px; font-size: 0.85rem; }

.btn--primary {
  background: linear-gradient(140deg, var(--rp-blue), var(--rp-blue-dark));
  color: #fff;
  box-shadow: var(--shadow-md);
}
.btn--primary:hover { filter: brightness(1.05); }

.btn--accent {
  background: var(--sun);
  color: var(--sun-text);
  font-weight: 700;
}
.btn--accent:hover { filter: brightness(1.04); }

.btn--ghost {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-soft);
}
.btn--ghost:hover { background: var(--surface-3); }

.btn--danger {
  background: var(--danger);
  color: #fff;
}

/* ---------- List ---------- */
.list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.list-head__meta {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--text-soft);
}

.progress { margin-bottom: 16px; }
.progress__bar {
  height: 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--rp-blue), var(--rp-sun));
  transition: width .35s cubic-bezier(.22,.61,.36,1);
  min-width: 0;
}
.progress__label {
  margin-top: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
}

.add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.add-form__input {
  flex: 1 1 160px;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.95rem;
  color: var(--text);
  font-family: inherit;
}
.add-form__input::placeholder { color: var(--text-faint); }

.filter-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.filter-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.filter-btn.is-active {
  background: var(--rp-blue-deep);
  color: #fff;
  border-color: transparent;
}
[data-theme="dark"] .filter-btn.is-active { background: var(--accent); color: var(--accent-contrast); }

.list-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.group__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--rp-blue-dark);
}
[data-theme="dark"] .group__head { color: var(--accent); }
.group__count {
  font-weight: 600;
  color: var(--text-faint);
  text-transform: none;
  letter-spacing: 0;
}

.group__items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: background .2s ease, opacity .2s ease;
}
.item.is-done {
  background: var(--surface-3);
}
.item__check {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 7px;
  border: 2px solid var(--rp-blue);
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #fff;
  transition: background .15s ease, border-color .15s ease;
  padding: 0;
}
.item.is-done .item__check {
  background: var(--rp-blue);
  border-color: var(--rp-blue);
}
.item__check svg { width: 14px; height: 14px; opacity: 0; transition: opacity .15s ease; }
.item.is-done .item__check svg { opacity: 1; }

.item__label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.95rem;
  cursor: pointer;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.item.is-done .item__label {
  text-decoration: line-through;
  color: var(--text-faint);
}
.item__qty {
  flex: none;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--sun-text);
  background: var(--sun);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
}
.item.is-done .item__qty { opacity: .5; }
.item__del {
  flex: none;
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 1.1rem;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  transition: background .15s ease, color .15s ease;
}
.item__del:hover { background: var(--danger-soft); color: var(--danger); }

.empty-hint {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.9rem;
  padding: 12px 0;
  margin: 0;
}

/* ---------- Empty state ---------- */
.card--empty { text-align: center; }
.empty-state { padding: 18px 8px; }
.empty-state__icon { font-size: 2.6rem; display: block; margin-bottom: 8px; }
.empty-state h2 { margin: 0 0 6px; font-size: 1.1rem; }
.empty-state p { margin: 0 auto; max-width: 360px; color: var(--text-soft); font-size: 0.92rem; }

/* ---------- Footer ---------- */
.app-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px 16px 24px;
  text-align: center;
}
.app-footer p { margin: 0; font-size: 0.78rem; color: var(--text-faint); }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 89, 133, 0.35);
  backdrop-filter: blur(2px);
}
[data-theme="dark"] .modal__backdrop { background: rgba(0,0,0,0.55); }
.modal__box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  max-width: 380px;
  width: 100%;
  animation: pop .18s ease;
}
.modal__title { margin: 0 0 8px; font-size: 1.1rem; }
.modal__text { margin: 0 0 18px; color: var(--text-soft); font-size: 0.95rem; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  background: var(--rp-blue-deep);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 600;
  animation: toastIn .25s ease;
  max-width: 100%;
  text-align: center;
}
.toast--sun { background: var(--sun); color: var(--sun-text); }
.toast.is-out { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { to { transform: translateY(14px); opacity: 0; } }

/* ---------- Focus ---------- */
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 8px;
}
.chip:focus-visible,
.filter-btn:focus-visible { border-radius: var(--radius-pill); }

/* ---------- Responsive ---------- */
@media (max-width: 460px) {
  .field-row { grid-template-columns: 1fr; }
  .app-header h1 { font-size: 1.25rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
