/* =========================================================================
   Tines Wunschliste – Design nach Oskar Stahl Designrichtlinie
   (Light-Mode, Akzent Rosa statt Lila)
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Flächen */
  --bg: #fdf2f8;
  --bg-soft: #fce7f3;
  --nav-bg: rgba(255, 255, 255, 0.97);
  --card-bg: #ffffff;
  --card-hover: #fdf2f8;
  --border-color: #f0d9e7;

  /* Text */
  --text: #1c1c1e;
  --text-muted: #6b6b72;

  /* Akzent (Rosa wie vorher) */
  --accent: #ec4899;
  --accent-hover: #db2777;
  --accent-tint: rgba(236, 72, 153, 0.08);
  --accent-shadow: rgba(236, 72, 153, 0.15);

  /* Semantisch */
  --up: #1f9d49;
  --down: #e02424;
  --played: #9aa0a8;

  /* Form */
  --radius: 8px;
  --radius-lg: 10px;
  --btn-radius: 6px;
  --font: "Montserrat", "Codec Pro", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }
img { display: block; max-width: 100%; }

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.5px; }

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

/* ------------------------------------------------------------------ Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.topbar__inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}
.brand { min-width: 0; }
.brand__title {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent);
}
.brand__sub { margin: 2px 0 0; font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
.topbar__actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ------------------------------------------------------------------ Layout */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 36px 20px 64px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

.muted { margin: 0; font-size: 0.9rem; color: var(--text-muted); }

/* ------------------------------------------------------------------- Flash */
.flash {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 18px;
  border: 1px solid;
}
.flash--success { color: var(--up); border-color: rgba(31, 157, 73, 0.35); background: rgba(31, 157, 73, 0.08); }
.flash--error { color: var(--down); border-color: rgba(224, 36, 36, 0.35); background: rgba(224, 36, 36, 0.08); }

/* ----------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--btn-radius);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); box-shadow: 0 10px 30px var(--accent-shadow); }
.btn--ghost { background: transparent; color: var(--text-muted); border-color: var(--border-color); }
.btn--ghost:hover { color: var(--accent); border-color: var(--accent); }
.btn--danger { background: transparent; color: var(--down); border-color: var(--border-color); }
.btn--danger:hover { border-color: var(--down); background: rgba(224, 36, 36, 0.06); }
.btn--success { background: var(--up); color: #fff; }
.btn--success:hover { filter: brightness(1.05); box-shadow: 0 10px 30px rgba(31, 157, 73, 0.18); }
.btn--block { width: 100%; }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: 0.85rem; }
.btn--spaced { margin-top: 8px; }
.btn--icon { min-height: 40px; width: 40px; padding: 0; border-radius: var(--radius-lg); }

/* ------------------------------------------------------------ Formularfelder */
.field { margin-bottom: 16px; }
.label {
  display: block;
  margin: 0 0 8px 2px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.input {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 16px; /* verhindert iOS-Zoom */
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--btn-radius);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input::placeholder { color: var(--text-muted); opacity: 0.7; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.input--inline { flex: 1; min-width: 0; }
.input--textarea { min-height: 110px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.input[type="file"] { padding: 10px 12px; font-size: 0.9rem; }

.switch { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
.switch--small { margin: 8px 0; font-size: 0.82rem; font-weight: 500; color: var(--text-muted); }

.popup-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.popup-actions .btn { flex: 1; min-width: 140px; }

.form-inline { display: flex; gap: 8px; margin-bottom: 20px; }

/* ------------------------------------------------------------------- Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.card__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 22px;
}
.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 0.9rem;
  flex-shrink: 0;
}
.card__icon--blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.card--narrow { max-width: 460px; margin: 0 auto; }
.card--full { grid-column: 1 / -1; }

.admin { display: grid; grid-template-columns: 1fr; gap: 24px; margin-bottom: 56px; }
@media (min-width: 720px) { .admin { grid-template-columns: 1fr 1fr; } }

/* --------------------------------------------------------------- Gäste-Liste */
.user-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; padding-right: 6px; }
.user-list::-webkit-scrollbar { width: 6px; }
.user-list::-webkit-scrollbar-track { background: transparent; }
.user-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--card-bg);
}
.user-row__name { font-weight: 600; font-size: 0.95rem; overflow-wrap: anywhere; }
.user-row__actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.link-reset {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.link-reset:hover { text-decoration: underline; }

/* --------------------------------------------------------------- Countdown */
.countdowns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 40px;
}
.countdown {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}
.countdown[hidden] { display: none; }
.countdown--xmas { border-left: 4px solid #16a34a; }
.countdown--birthday { border-left: 4px solid var(--accent); }
.countdown__emoji { font-size: 1.9rem; line-height: 1; flex-shrink: 0; }
.countdown__info { display: flex; flex-direction: column; min-width: 0; }
.countdown__label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.countdown__value { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.countdown__value.is-today { color: var(--accent); }

/* ---------------------------------------------------------- Sektions-Titel */
.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 24px;
}
.section-title span { font-size: 1.8rem; }

/* ------------------------------------------------------------- Geschenkliste */
.gifts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }

.gift {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.gift:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(236, 72, 153, 0.08);
}
.gift__media { width: 100%; }
.gift__img {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--card-hover);
}
.gift__placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px dashed var(--border-color);
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.gift__body { flex: 1; min-width: 0; }
.gift__title { font-size: 1.15rem; font-weight: 700; margin: 0 0 6px; overflow-wrap: anywhere; }
.gift__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.gift__link:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.gift__actions { width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.gift__actions .btn, .gift__actions form { width: 100%; }
.gift__actions .badge { justify-content: center; }

/* Schmale Displays: kompaktere Karten, damit zwei Spalten passen */
@media (max-width: 480px) {
  .container { padding: 24px max(14px, env(safe-area-inset-right)) 48px max(14px, env(safe-area-inset-left)); }
  .gifts { gap: 12px; }
  .gift { padding: 14px; gap: 12px; }
  .gift__title { font-size: 1rem; }
  .gift__link { font-size: 0.82rem; }
  .gift__actions .btn { font-size: 0.85rem; padding: 0 12px; min-height: 42px; }
  .section-title { font-size: 1.6rem; }
  .brand__title { font-size: 1.4rem; }
  .topbar__inner { flex-wrap: wrap; }
  .topbar__actions { margin-left: auto; }
}

/* ------------------------------------------------------------ Badges / Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: var(--accent-tint);
}
.badge--muted { border-color: var(--border-color); color: var(--played); background: var(--card-hover); }

/* ------------------------------------------------------------- Leerer Zustand */
.empty {
  padding: 72px 24px;
  text-align: center;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-weight: 500;
}

/* ------------------------------------------------------------------ Footer */
.footer { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--border-color); text-align: center; }
.footer__copy { margin: 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-muted); }
.footer__link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.footer__link:hover { color: var(--accent-hover); }
.footer__link .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--accent-tint);
  transition: background-color 0.2s ease;
}
.footer__link:hover .icon { background: var(--bg-soft); }

/* ------------------------------------------------------------ Login-Seite */
.login { display: flex; flex-direction: column; min-height: 100vh; padding: 16px; }
.login__main { flex: 1; display: flex; align-items: center; justify-content: center; }
.login__card {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 30px;
  box-shadow: 0 20px 60px rgba(236, 72, 153, 0.08);
}
.login__title { font-size: 1.7rem; font-weight: 800; text-align: center; margin: 0 0 28px; }
.login__footer { padding: 24px 0; text-align: center; }

/* ------------------------------------------------------------------- Modal */
.modal {
  border: none;
  padding: 0;
  background: transparent;
  width: calc(100% - 32px);
  max-width: 420px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.modal::backdrop { background: rgba(28, 28, 30, 0.55); backdrop-filter: blur(2px); }
.modal__card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(28, 28, 30, 0.25);
}
.modal__footer-img { display: block; width: 100%; max-width: 200px; height: auto; margin: 16px auto 0; }
.confetti-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }
.modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.modal__close:hover { background: #ffffff; transform: scale(1.05); }
.modal__body { padding: 24px; }
.modal__title { font-size: 1.4rem; font-weight: 800; margin: 0 0 10px; }
.modal__text { margin: 0 0 20px; color: var(--text-muted); white-space: pre-line; overflow-wrap: anywhere; }

/* --------------------------------------------------------- Barrierefreiheit */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
