/* ===========================================================
   Jolas Geburtstag – Stylesheet
   Mobil-first, kindgerecht & verspielt für die Gäste;
   aufgeräumt für den Admin-Bereich.
   =========================================================== */

:root {
  --pink: #ff5d8f;
  --pink-dark: #e23e74;
  --purple: #7b5cff;
  --yellow: #ffd23f;
  --mint: #2ec4b6;
  --ink: #2b2244;
  --muted: #7a7390;
  --bg: #fff7fb;
  --card: #ffffff;
  --line: #efe7f3;
  --radius: 18px;
  --shadow: 0 8px 24px rgba(123, 92, 255, 0.12);
  --font: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

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

/* Admin neutraler Hintergrund */
body.admin { background: #f4f3f8; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
a { color: var(--purple); }
p { margin: .4em 0; }
.muted { color: var(--muted); font-size: .95em; }

/* ---------- Hero (Gäste) ---------- */
.hero {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
  text-align: center;
  padding: 2.2rem 1rem 3.2rem;
  border-bottom-left-radius: 40% 24px;
  border-bottom-right-radius: 40% 24px;
}
.hero__balloons { font-size: 2rem; letter-spacing: .2rem; }
.hero__title { font-size: 2rem; margin: .3rem 0 .2rem; text-shadow: 0 2px 6px rgba(0,0,0,.15); }
.hero__date { font-size: 1.05rem; opacity: .95; margin: 0; }

/* ---------- Admin-Topbar ---------- */
.topbar--admin {
  background: #2b2244;
  color: #fff;
}
.topbar__inner {
  max-width: 980px; margin: 0 auto; padding: .7rem 1rem;
  display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: space-between;
}
.topbar__brand { font-weight: 800; }
.adminnav { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; }
.adminnav a { color: #d9d2ff; text-decoration: none; padding: .25rem .4rem; border-radius: 8px; font-weight: 700; }
.adminnav a:hover { background: rgba(255,255,255,.12); }
.adminnav a.is-active { background: var(--purple); color: #fff; }
.adminnav__logout { margin-left: .3rem; }

/* ---------- Layout ---------- */
.container { max-width: 760px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
body.admin .container { max-width: 980px; margin-top: -.2rem; padding-top: 1.4rem; }

/* Gäste-Karten ragen leicht in den Hero */
body.guest .container { margin-top: -1.6rem; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.2rem 1.4rem;
  margin: 0 0 1.1rem;
}
.card--center { text-align: center; }
.card h2 { font-size: 1.3rem; }
.greeting { background: linear-gradient(135deg, #fff, #fff4fa); }

.infobox p { margin: .25rem 0; }
.infobox__notes { white-space: pre-line; }

/* ---------- Formulare ---------- */
.form { display: flex; flex-direction: column; gap: .9rem; margin-top: .6rem; }
label { font-weight: 700; display: flex; flex-direction: column; gap: .35rem; }
input[type=text], input[type=password], input[type=url], input[type=date],
input[type=time], textarea, select {
  font: inherit; padding: .7rem .8rem; border: 2px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--ink); width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--purple); }
textarea { resize: vertical; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; cursor: pointer; border: none;
  background: var(--pink); color: #fff; font: inherit; font-weight: 800;
  padding: .7rem 1.2rem; border-radius: 999px; text-decoration: none;
  box-shadow: 0 4px 0 var(--pink-dark); transition: transform .05s, box-shadow .05s;
}
.btn:hover { filter: brightness(1.03); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--pink-dark); }
.btn--big { font-size: 1.15rem; padding: .9rem 1.6rem; align-self: flex-start; }
.btn--small { padding: .45rem .85rem; font-size: .9rem; box-shadow: 0 3px 0 var(--pink-dark); }
.btn--ghost { background: #fff; color: var(--purple); border: 2px solid var(--line); box-shadow: none; }
.btn--ghost:active { transform: none; }
.btn--danger { background: #e23e3e; box-shadow: 0 4px 0 #b32a2a; }
.linkbtn { background: none; border: none; color: var(--purple); font: inherit; font-weight: 800; cursor: pointer; text-decoration: underline; padding: 0; }

/* ---------- Flash ---------- */
.flash { padding: .8rem 1rem; border-radius: 12px; font-weight: 700; margin: 0 0 1rem; }
.flash--ok { background: #e3f9ec; color: #1f7a4d; }
.flash--err { background: #ffe3e3; color: #b32a2a; }

/* ---------- Pizza-Auswahl ---------- */
.pizzaliste { display: grid; gap: .6rem; }
.choice {
  display: flex; flex-direction: column; gap: .15rem;
  border: 2px solid var(--line); border-radius: 14px; padding: .75rem .9rem; cursor: pointer;
  font-weight: 700; position: relative;
}
.choice input { position: absolute; opacity: 0; }
.choice--on, .choice:has(input:checked) { border-color: var(--pink); background: #fff3f8; }
.choice__name { font-size: 1.05rem; }
.choice__desc { font-weight: 500; color: var(--muted); font-size: .9rem; }

/* ---------- Geschenke ---------- */
.gift-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: .6rem; }
.gift {
  border: 2px solid var(--line); border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column; background: #fff;
}
.gift__img { aspect-ratio: 3 / 2; background-size: cover; background-position: center; background-color: #f3eef9; }
.gift__body { padding: .8rem .9rem .4rem; flex: 1; }
.gift__title { font-size: 1.1rem; margin: 0 0 .2rem; }
.gift__price { display: inline-block; background: var(--yellow); color: #6b5300; font-weight: 800; padding: .1rem .5rem; border-radius: 999px; font-size: .85rem; }
.gift__desc { color: var(--muted); margin: .4rem 0; }
.gift__link { font-weight: 800; text-decoration: none; }
.gift__action { padding: .4rem .9rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.gift--mine { border-color: var(--mint); background: #effbf9; }
.gift--taken { opacity: .55; }
.gift--taken .gift__img { filter: grayscale(1); }

.badge { font-weight: 800; font-size: .85rem; padding: .25rem .6rem; border-radius: 999px; }
.badge--mine { background: var(--mint); color: #fff; }
.badge--taken { background: #e7e2ef; color: var(--muted); }

.abmelden { text-align: center; color: var(--muted); margin-top: 1.4rem; }
.abmelden a { font-weight: 800; text-decoration: none; }

/* ---------- Auswahl-Kacheln (Startseite) ---------- */
.bigchoice { display: grid; gap: 1rem; margin-top: 1rem; }
.choicecard {
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  text-decoration: none; color: var(--ink);
  border: 2px solid var(--line); border-radius: 18px; padding: 1.4rem 1rem;
  background: #fff; transition: transform .06s, border-color .06s;
}
.choicecard:hover { border-color: var(--pink); transform: translateY(-2px); }
.choicecard__emoji { font-size: 2.6rem; }
.choicecard__title { font-size: 1.25rem; font-weight: 800; }
.choicecard__desc { color: var(--muted); font-size: .9rem; }

/* ---------- Pizza-Eintragsliste ---------- */
.order-row {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .6rem 0; border-bottom: 1px solid var(--line);
}
.order-row:last-child { border-bottom: none; }
.order-row__name { font-weight: 800; min-width: 6rem; }
.order-row__edit { display: flex; gap: .4rem; align-items: center; }
.order-row__edit select { padding: .4rem .5rem; border: 2px solid var(--line); border-radius: 10px; font: inherit; }

/* Pizza-Eintrag bearbeiten (Zeile mit Name, Auswahl, Notiz, Buttons) */
.order-edit {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .6rem 0; border-bottom: 1px solid var(--line);
}
.order-edit:last-child { border-bottom: none; }
.order-edit__name { font-weight: 800; min-width: 5rem; }
.order-edit select, .order-edit input[type=text] {
  padding: .45rem .55rem; border: 2px solid var(--line); border-radius: 10px; font: inherit;
}
.order-edit input[type=text] { flex: 1; min-width: 8rem; }

/* Flyer-Bild (groß, z.B. Pizza-Menü) – klickbar zum Vergrößern */
.flyer-img {
  display: block; width: 100%; max-height: 70vh; object-fit: contain;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: zoom-in;
}

/* Flyer als kleines Vorschaubild neben der Überschrift */
.titel-flyer { display: flex; flex-direction: column; align-items: center; gap: .15rem; }
.titel-flyer__label { font-size: .7rem; color: var(--muted); font-weight: 700; }
.flyer-thumb {
  display: block; width: 56px; height: 56px; object-fit: cover;
  border-radius: 10px; border: 2px solid var(--line); cursor: zoom-in;
  transition: transform .06s, border-color .06s;
}
.flyer-thumb:hover { transform: scale(1.05); border-color: var(--pink); }

/* Lightbox-Overlay */
.lightbox {
  position: fixed; inset: 0; z-index: 1000; cursor: zoom-out;
  background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }

@media (min-width: 480px) { .bigchoice { grid-template-columns: 1fr 1fr; } }

/* ---------- Tabellen (Admin) ---------- */
.tbl { width: 100%; border-collapse: collapse; margin-top: .6rem; font-size: .95rem; }
.tbl th, .tbl td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.tbl tr:last-child td { border-bottom: none; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: .8rem; margin: .4rem 0 0; }
.stat { background: #faf8ff; border: 1px solid var(--line); border-radius: 14px; padding: .8rem; text-align: center; }
.stat__num { font-size: 1.8rem; font-weight: 800; color: var(--purple); }
.stat__label { color: var(--muted); font-size: .85rem; }

.pill { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.pill--free { background: #e3f9ec; color: #1f7a4d; }
.pill--taken { background: #fff0f3; color: var(--pink-dark); }
.pill--off { background: #eee; color: #888; }

.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.adminbox { display: grid; gap: 1.1rem; }
.danger-zone { border: 2px dashed #e7a; border-radius: var(--radius); padding: 1rem 1.2rem; background: #fff5f8; }

hr.sep { border: none; border-top: 1px solid var(--line); margin: 1.1rem 0; }

/* ---------- Login ---------- */
.login-wrap { max-width: 380px; margin: 3rem auto; }

/* ---------- Größere Screens ---------- */
@media (min-width: 560px) {
  .gift-grid { grid-template-columns: 1fr 1fr; }
  .hero__title { font-size: 2.4rem; }
}

/* ---------- Druckansicht ---------- */
@media print {
  body { background: #fff; }
  .noprint, .topbar { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ---------- Bild-Zuschnitt (Geschenke) ---------- */
.crop-preview {
  display: none; width: 240px; max-width: 100%; aspect-ratio: 3 / 2;
  border: 2px dashed var(--line); border-radius: 12px; background: #f3eef9;
  background-size: cover; background-position: center;
  align-items: flex-end; justify-content: center; overflow: hidden;
}
.crop-preview.has-img { display: flex; border-style: solid; }
.crop-preview__hint {
  width: 100%; text-align: center; font-size: .72rem; font-weight: 700;
  color: #fff; background: rgba(0,0,0,.42); padding: .2rem .3rem;
}

.cropmodal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(20,12,30,.72); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.cropmodal[hidden] { display: none; }
.cropmodal__box {
  background: #fff; border-radius: 18px; width: 100%; max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4); overflow: hidden;
  display: flex; flex-direction: column;
}
.cropmodal__head {
  padding: .8rem 1rem; border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: .15rem;
}
.cropmodal__head .muted { font-size: .78rem; }
.cropmodal__stage { position: relative; height: 56vh; max-height: 440px; background: #2a2233; }
.cropmodal__stage img { display: block; max-width: 100%; }
.cropmodal__busy {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .8rem; background: #2a2233; color: #fff; font-weight: 700; text-align: center; padding: 1rem;
}
.cropmodal__busy[hidden] { display: none; }
.cropmodal__spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.25); border-top-color: #fff;
  animation: cropspin .8s linear infinite;
}
@keyframes cropspin { to { transform: rotate(360deg); } }
.cropmodal__tools {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  padding: .7rem 1rem; border-top: 1px solid var(--line);
}
.cropmodal__tools #cropperZoom { flex: 1; min-width: 90px; accent-color: var(--mint); }
.cropmodal__sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 .2rem; }
.cropmodal__actions {
  display: flex; justify-content: flex-end; gap: .6rem;
  padding: .8rem 1rem 1rem; border-top: 1px solid var(--line);
}
