/* ---------- Schriften (lokal, keine Verbindung zu Google) ---------- */
@font-face {
  font-family: "Fredoka";
  src: url("fonts/fredoka.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

/* ---------- Farben & Maße ---------- */
:root {
  --bg: #F3F5F9;          /* kühles Schneeweiß */
  --surface: #FFFFFF;
  --tile: #E8ECF2;        /* Hintergrund der Produktbilder */
  --ink: #1A2233;
  --ink-soft: #545E72;
  --line: #D9DFE8;
  --holly: #A3221B;       /* Stechpalmen-Rot: Aktionen */
  --holly-hover: #861A15;
  --holly-soft: #FBECEA;
  --pine: #1D5A47;        /* Tannengrün: besorgt */
  --pine-soft: #E3F0EA;
  --night: #1C2349;       /* Banner */
  --focus: #2350D6;

  --radius-l: 22px;
  --radius-m: 16px;
  --radius-s: 12px;
  --font-head: "Fredoka", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
}

img { max-width: 100%; display: block; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--holly); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.page {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 16px 56px;
}
@media (min-width: 768px) { .page { padding: 24px 32px 72px; } }

/* ---------- Banner ---------- */
.banner {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: clamp(220px, 30vw, 330px);
  border-radius: var(--radius-l);
  overflow: hidden;
  background: var(--night) url("winterszene.svg") center bottom / cover no-repeat;
  isolation: isolate;
}
.banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(12, 16, 40, 0.78) 0%, rgba(12, 16, 40, 0.35) 38%, rgba(12, 16, 40, 0) 64%);
  z-index: 1;
  pointer-events: none;
}
.snow { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.banner-text {
  position: relative;
  z-index: 3;
  padding: clamp(20px, 3.2vw, 36px);
  color: #fff;
}
.banner h1 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(1.875rem, 4.6vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
  text-shadow: 0 2px 18px rgba(8, 10, 30, 0.45);
}
.banner .meta { margin: 0.5rem 0 0; font-weight: 700; font-size: 1rem; color: rgba(255, 255, 255, 0.9); }
.banner .meta:empty { display: none; }
.banner-tools { position: absolute; top: 12px; right: 12px; z-index: 3; }

.intro {
  max-width: 62ch;
  margin: 18px 4px 0;
  font-size: 1.0625rem;
  color: var(--ink-soft);
  white-space: pre-line;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.btn-primary { background: var(--holly); color: #fff; }
.btn-primary:hover { background: var(--holly-hover); }
.btn-outline { background: var(--surface); color: var(--holly); border-color: var(--holly); }
.btn-outline:hover { background: var(--holly-soft); }
.btn-quiet { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { background: var(--tile); }
.btn-glass {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.btn-glass:hover { background: rgba(255, 255, 255, 0.28); }
.btn-block { width: 100%; }
.icon-btn { width: 44px; padding: 0; }
.icon-btn.danger:hover { color: var(--holly); border-color: var(--holly); background: var(--holly-soft); }

.link-btn {
  justify-self: start;
  padding: 10px 0;
  background: none;
  border: 0;
  color: var(--holly);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- Verwaltungsleiste ---------- */
.owner-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
.owner-note { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--ink-soft); font-weight: 600; }
.owner-note svg { width: 20px; height: 20px; flex: none; color: var(--pine); }
.owner-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Raster ---------- */
.grid {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 28px 18px;
}
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
}

.card { display: flex; flex-direction: column; min-width: 0; }

.card-media {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-m);
  background: var(--tile);
  overflow: hidden;
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 9%;
  mix-blend-mode: multiply; /* weiße Shop-Hintergründe verschmelzen mit der Kachel */
  transition: transform 0.3s ease, opacity 0.2s ease;
}
a.card-media:hover img { transform: scale(1.04); }
.card-media .placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; color: #A7B0BF;
}
.card-media .placeholder svg { width: 34%; height: 34%; stroke-width: 1.4; }

.card.is-taken .card-media img { opacity: 0.42; filter: grayscale(0.5); }

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: calc(100% - 20px);
  padding: 5px 11px 5px 8px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}
.badge svg { width: 14px; height: 14px; flex: none; stroke-width: 3; }
.badge.mine { background: var(--pine); }

.card-body { display: flex; flex-direction: column; gap: 6px; flex: 1; padding: 12px 2px 0; }

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-title a { color: inherit; text-decoration: none; }
.card-title a:hover { text-decoration: underline; text-underline-offset: 3px; }

.price-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.price { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 1.1875rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.shop { font-size: 0.875rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.variants { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 0; padding: 0; }
.variants li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.875rem;
  line-height: 1.3;
}
.variants .k { color: var(--ink-soft); }
.variants .v { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.swatch { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.18); flex: none; }

.taken-note { margin: 2px 0 0; font-size: 0.875rem; color: var(--ink-soft); }

.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.card-actions .btn-grow { flex: 1 1 auto; }
@media (max-width: 560px) {
  .card-actions .btn { padding: 0 12px; font-size: 0.875rem; }
  .card-actions .icon-btn { padding: 0; }
}

.status { margin: 32px 0; color: var(--ink-soft); }
.status:empty { display: none; }
.empty {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 48px 16px;
  border: 2px dashed var(--line);
  border-radius: var(--radius-l);
  text-align: center;
  color: var(--ink-soft);
}
.empty h2 { margin: 0; font-family: var(--font-head); font-weight: 600; color: var(--ink); }
.empty p { margin: 0; max-width: 42ch; }

/* ---------- Dialoge ---------- */
dialog {
  width: min(580px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-l);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 28px 70px rgba(16, 22, 48, 0.3);
}
dialog::backdrop { background: rgba(16, 22, 48, 0.55); }
dialog[open] { animation: dlg-in 0.2s ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }

.dlg { display: flex; flex-direction: column; max-height: inherit; margin: 0; }
.dlg-head { padding: 22px 24px 6px; }
.dlg-head h2 { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 1.5rem; line-height: 1.2; }
.dlg-body { display: grid; gap: 16px; padding: 12px 24px 18px; overflow-y: auto; }
.dlg-body > p { margin: 0; }
.dlg-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--line);
}
@media (max-width: 480px) {
  .dlg-head, .dlg-body, .dlg-foot { padding-left: 18px; padding-right: 18px; }
  .dlg-foot .btn { flex: 1 1 auto; }
}

.field { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field label, .field legend { font-weight: 700; font-size: 0.9375rem; padding: 0; }
.optional { font-weight: 600; color: var(--ink-soft); }
.hint { margin: 0; font-size: 0.875rem; color: var(--ink-soft); }

input[type="text"], input[type="url"], input[type="password"], input[type="date"], textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-s);
  background: #fff;
  font-size: 1rem;
  transition: border-color 0.15s ease;
}
textarea { resize: vertical; min-height: 88px; }
input:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(35, 80, 214, 0.18); }
input[aria-invalid="true"] { border-color: var(--holly); }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .row-2 { grid-template-columns: 1fr; } }

.image-pick { display: grid; grid-template-columns: 128px 1fr; gap: 16px; align-items: start; margin-top: 4px; }
@media (max-width: 480px) { .image-pick { grid-template-columns: 96px 1fr; gap: 12px; } }
.image-preview {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-s);
  background: var(--tile);
  overflow: hidden;
}
.image-preview img { width: 100%; height: 100%; object-fit: contain; padding: 8%; mix-blend-mode: multiply; }
.image-preview .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #A7B0BF; }
.image-preview .placeholder svg { width: 40%; height: 40%; stroke-width: 1.4; }
.image-inputs { display: grid; gap: 12px; min-width: 0; }
.file-btn { justify-self: start; position: relative; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

.form-error { margin: 0; color: var(--holly); font-weight: 700; }

/* ---------- Hinweis-Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 50;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(16, 22, 48, 0.3);
  transform: translate(-50%, 140%);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--holly); }

/* ---------- Anmeldeseite ---------- */
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(440px, 100%);
  border-radius: var(--radius-l);
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 20px 50px rgba(16, 22, 48, 0.14);
}
.login-scene { height: 120px; background: var(--night) url("winterszene.svg") center bottom / cover no-repeat; }
.login-content { padding: 24px 24px 20px; display: grid; gap: 16px; }
.login-content h1 { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 1.75rem; line-height: 1.15; }
.login-lead { margin: 0; color: var(--ink-soft); }
.login-form { display: grid; gap: 16px; }
.login-back { margin: 0; text-align: center; font-weight: 700; }

/* ---------- Weniger Bewegung ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .snow { display: none; }
}
