/* PartyGuard Gast-Seiten: Bausteine für Formular, Muttizettel-Karten und Ticket.
   Benötigt pg-base.css (Tokens) und pg-site.css (Kopf, Fußzeile). Präfix .pgg-
   Handy zuerst: Eingaben 16 px (kein iOS-Zoom), Tippflächen ab 44 px. */

:root {
  /* Statusfarben wie im Admin (pg-admin.css, dunkles Theme) */
  --pgg-green: var(--ok);
  --pgg-amber: #f2c94c;
  --pgg-orange: #ff9f43;
  --pgg-red: #ff4d4d;
  --pgg-blue: #6cb2ff;
}

/* ── Seite und Kopf ─────────────────────────────────── */
.pgg-page { width: 100%; max-width: 760px; margin-inline: auto; }
.pgg-w-narrow { max-width: 600px; }
.pgg-w-wide { max-width: none; }

.pgg-head { margin: 8px 0 24px; }
.pgg-head-back { margin-bottom: 10px; }
.pgg-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  margin-left: -10px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.pgg-back:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.pgg-back .pg-icon { width: 18px; height: 18px; }
.pgg-eyebrow {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pgg-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.pgg-lead { margin: 10px 0 0; max-width: 56ch; color: var(--text-muted); font-size: 15.5px; }

/* ── Karte ──────────────────────────────────────────── */
.pgg-card { border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.pgg-card-pad { padding: 24px; }
.pgg-card + .pgg-card { margin-top: 14px; }
.pgg-card-title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.pgg-card-sub { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }
.pgg-stack > * + * { margin-top: 16px; }
.pgg-btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.pgg-btn-row .pg-btn { width: auto; flex: 1 1 200px; height: 50px; }

/* Hinweis-Kasten (neutral) */
.pgg-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 14px;
}
.pgg-note .pg-icon { color: var(--text); margin-top: 1px; }
.pgg-note b { color: var(--text); font-weight: 600; }

/* Leere Seite / Fehlerseite */
.pgg-empty { margin-top: 24px; padding-block: 40px; text-align: center; }
.pgg-empty .pgg-lead { margin-inline: auto; }
.pgg-empty-code {
  display: block;
  margin-bottom: 14px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 96px;
  line-height: 0.9;
  letter-spacing: -0.05em;
  color: rgba(255, 255, 255, 0.1);
}
.pgg-empty .pgg-btn-row { justify-content: center; }

/* ── Status-Pill (Farben wie im Admin) ──────────────── */
.pgg-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}
.pgg-status::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pgg-status.is-ready, .pgg-status.is-confirmed, .pgg-status.is-approved { color: var(--pgg-green); background: rgba(61, 220, 132, 0.12); }
.pgg-status.is-parents { color: var(--pgg-amber); background: rgba(242, 201, 76, 0.13); }
.pgg-status.is-supervisor { color: var(--pgg-orange); background: rgba(255, 159, 67, 0.13); }
.pgg-status.is-rejected { color: var(--pgg-red); background: rgba(252, 0, 0, 0.13); }
.pgg-status.is-checked_in { color: var(--pgg-blue); background: rgba(108, 178, 255, 0.13); }
.pgg-status.is-lg { height: 32px; padding: 0 14px; font-size: 14px; }

/* ── Schritt-Anzeige ────────────────────────────────── */
.pgg-steps { margin: 0 0 24px; }
.pgg-steps ol {
  display: grid;
  grid-template-columns: repeat(var(--pgg-steps, 4), minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pgg-steps li { display: flex; flex-direction: column; gap: 9px; min-width: 0; color: var(--text-muted); font-size: 13px; font-weight: 500; }
.pgg-steps li::before { content: ''; height: 4px; border-radius: 2px; background: var(--border-strong); }
.pgg-steps li.is-done::before { background: rgba(245, 245, 244, 0.55); }
.pgg-steps li.is-current::before { background: var(--text); }
.pgg-steps li.is-current { color: var(--text); font-weight: 600; }
.pgg-steps a { color: inherit; text-decoration: none; }
.pgg-steps a:hover { color: var(--text); }
.pgg-step-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pgg-steps-caption { display: none; margin: 10px 0 0; font-size: 13px; color: var(--text-muted); }
.pgg-steps-caption b { color: var(--text); font-weight: 600; }

/* ── Formularfelder ─────────────────────────────────── */
.pgg-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.pgg-legend { margin: 0 0 4px; padding: 0; font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.pgg-fields { display: grid; gap: 18px; }
.pgg-fields.is-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pgg-fields .is-full { grid-column: 1 / -1; }

.pgg-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.pgg-label { font-size: 14px; font-weight: 600; color: var(--text); }
.pgg-optional { font-weight: 400; color: var(--text-muted); }
.pgg-input {
  width: 100%;
  min-height: 52px;
  padding: 13px 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.3;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pgg-input::placeholder { color: var(--text-muted); opacity: 0.75; }
.pgg-input:hover { border-color: rgba(255, 255, 255, 0.28); }
.pgg-input:focus, .pgg-input:focus-visible { outline: 0; border-color: var(--text); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12); }
.pgg-input[type="date"] { display: block; }
.pgg-input[type="date"]::-webkit-date-and-time-value { text-align: left; }
textarea.pgg-input { min-height: 110px; resize: vertical; }
select.pgg-input {
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b9b9f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
}
.pgg-hint { margin: 0; color: var(--text-muted); font-size: 13px; }
.pgg-error { display: flex; gap: 7px; align-items: flex-start; margin: 0; color: var(--pgg-red); font-size: 13.5px; font-weight: 500; }
.pgg-error::before {
  content: '!';
  display: grid;
  flex: none;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--pgg-red);
  color: var(--bg);
  font-size: 11px;
  font-weight: 800;
}
.pgg-error[hidden] { display: none; }
.pgg-field.has-error .pgg-input, .pgg-input[aria-invalid="true"] { border-color: var(--pgg-red); }
.pgg-field.has-error .pgg-input:focus { box-shadow: 0 0 0 3px rgba(255, 77, 77, 0.22); }

/* Häkchen (z. B. Einverständnis) */
.pgg-check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 14.5px;
  line-height: 1.45;
  cursor: pointer;
}
.pgg-check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--ink); }
.pgg-check.has-error, .pgg-field.has-error .pgg-check { border-color: var(--pgg-red); }

/* Auswahl-Karten (z. B. Aufsicht jetzt / später) */
.pgg-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pgg-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 16px 16px 50px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.pgg-choice input { position: absolute; top: 17px; left: 16px; width: 20px; height: 20px; margin: 0; accent-color: var(--ink); }
.pgg-choice b { font-size: 15px; font-weight: 600; }
.pgg-choice span { color: var(--text-muted); font-size: 13.5px; }
.pgg-choice:hover { border-color: rgba(255, 255, 255, 0.28); }
.pgg-choice:has(input:checked), .pgg-choice.is-selected { border-color: var(--text); background: rgba(255, 255, 255, 0.06); }
.pgg-choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Foto-Kachel für Ausweise ───────────────────────── */
.pgg-photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pgg-photo { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pgg-photo-drop {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1.586;            /* Ausweisformat */
  overflow: hidden;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.pgg-photo-drop:hover { border-color: rgba(255, 255, 255, 0.32); background: rgba(255, 255, 255, 0.05); }
.pgg-photo-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.pgg-photo-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.pgg-photo-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; text-align: center; pointer-events: none; }
.pgg-photo-empty .pg-icon { width: 26px; height: 26px; margin-bottom: 4px; color: var(--text); }
.pgg-photo-empty b { color: var(--text); font-size: 14px; font-weight: 600; }
.pgg-photo-empty small { font-size: 12px; }
.pgg-photo-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; pointer-events: none; }
.pgg-photo.is-filled .pgg-photo-drop { border-style: solid; border-color: var(--border); }
.pgg-photo.is-filled .pgg-photo-empty { visibility: hidden; }
.pgg-photo.is-busy .pgg-photo-drop::after {
  content: 'Wird vorbereitet …';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(11, 11, 12, 0.7);
  color: var(--text);
  font-size: 13px;
}
.pgg-photo.has-error .pgg-photo-drop { border-color: var(--pgg-red); }
.pgg-photo-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 8px; min-height: 28px; }
.pgg-photo-foot .pgg-textbtn { margin-right: 0; white-space: nowrap; }
.pgg-photo-done { display: none; align-items: center; gap: 5px; color: var(--pgg-green); font-size: 13px; font-weight: 600; }
.pgg-photo-done .pg-icon { width: 16px; height: 16px; stroke-width: 2.4; }
.pgg-photo.is-filled .pgg-photo-done { display: inline-flex; }
.pgg-photo .pgg-photo-retake { display: none; }
.pgg-photo.is-filled .pgg-photo-retake { display: inline-flex; }

/* Kleiner Text-Button (Neu aufnehmen, Löschen, Ändern) */
.pgg-textbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  margin: -4px -8px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 3px;
  cursor: pointer;
}
.pgg-textbtn:hover { text-decoration-color: currentColor; background: rgba(255, 255, 255, 0.05); }
.pgg-textbtn .pg-icon { width: 16px; height: 16px; }

/* ── Unterschriftenfeld ─────────────────────────────── */
.pgg-sign { display: flex; flex-direction: column; gap: 8px; }
.pgg-sign-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pgg-sign-pad {
  position: relative;
  height: 180px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;               /* Papier: schwarze Schrift auf Weiß, wie später im PDF */
  touch-action: none;
  cursor: crosshair;
}
.pgg-sign-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pgg-sign-line { position: absolute; left: 22px; right: 22px; bottom: 44px; height: 1px; background: #c9c9cc; pointer-events: none; }
.pgg-sign-hint {
  position: absolute;
  left: 22px;
  bottom: 18px;
  color: #6b6b70;
  font-size: 13px;
  pointer-events: none;
  transition: opacity 0.15s;
}
.pgg-sign.is-signed .pgg-sign-hint { opacity: 0; }
.pgg-sign-clear[disabled] { visibility: hidden; }
.pgg-sign.has-error .pgg-sign-pad { border-color: var(--pgg-red); box-shadow: 0 0 0 1px var(--pgg-red); }
.pgg-sign-pad:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Zusammenfassung vor dem Absenden ───────────────── */
.pgg-summary { border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.pgg-summary + .pgg-summary { margin-top: 12px; }
.pgg-card + .pgg-summary, .pgg-summary + .pgg-card { margin-top: 14px; }
.pgg-summary-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.pgg-summary-head h3 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.pgg-summary-list { margin: 0; padding: 6px 20px; }
.pgg-summary-list > div { display: grid; grid-template-columns: minmax(110px, 0.8fr) minmax(0, 2fr); gap: 12px; padding: 10px 0; }
.pgg-summary-list > div + div { border-top: 1px solid var(--border); }
.pgg-summary-list dt { color: var(--text-muted); font-size: 13.5px; }
.pgg-summary-list dd { margin: 0; font-size: 14.5px; font-weight: 500; overflow-wrap: anywhere; }
.pgg-summary-list dd.is-missing { color: var(--pgg-orange); }
.pgg-summary-thumbs { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 16px; }
.pgg-summary-thumbs img { width: 96px; aspect-ratio: 1.586; object-fit: cover; border: 1px solid var(--border); border-radius: 8px; background: #000; }

/* ── Aktionsleiste (Handy: bleibt unten sichtbar) ───── */
.pgg-actionbar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 28px; }
.pgg-actionbar .pg-btn { width: auto; min-width: 140px; height: 50px; padding: 0 22px; }
.pgg-actionbar .pgg-actionbar-start { margin-right: auto; }

/* ── Assistent (Muttizettel-Formular) ───────────────── */
/* Ohne JS stehen alle Schritte untereinander; mit JS (html.js) nur der aktuelle. */
.pgg-wizard-step + .pgg-wizard-step { margin-top: 14px; }
/* Beim Schrittwechsel springt die Seite zur Schritt-Anzeige; die feste Kopfzeile (68 px) soll sie nicht verdecken */
.pgg-steps, .pgg-wizard-step { scroll-margin-top: 84px; }
.pgg-wizard-step > * + * { margin-top: 24px; }
.js .pgg-wizard-step:not(.is-current) { display: none; }
html:not(.js) .pgg-wizard-nav, html:not(.js) .pgg-steps { display: none; }
.pgg-wizard-head .pgg-card-title:focus { outline: 0; }
.pgg-wizard-kicker { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.js .pgg-wizard-kicker { display: none; }
.pgg-wizard-sub { margin: 0 0 12px; padding: 0; font-size: 15px; font-weight: 600; }
.pgg-wizard-alert { margin-bottom: 20px; }
.pgg-wizard-summary > * + * { margin-top: 12px; }
.pgg-wizard-signhint { margin-top: -8px; }
.pgg-wizard .pgg-note[hidden], .pgg-wizard [data-mzw-now][hidden], .pgg-wizard [data-mzw-later][hidden] { display: none; }
.pgg-wizard .pgg-check a { color: var(--text); text-underline-offset: 3px; }
.pgg-actionbar [hidden] { display: none; }
.pgg-actionbar .pg-btn[aria-busy="true"] { cursor: progress; }

/* „Wie letztes Mal“ */
.pgg-prefill {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 14.5px;
}
.pgg-prefill > .pg-icon { flex: none; width: 20px; height: 20px; margin-top: 2px; }
.pgg-prefill p { margin: 0; color: var(--text-muted); }
.pgg-prefill b { color: var(--text); font-weight: 600; }
.pgg-prefill-btn { margin-top: 12px; }
.pgg-prefill-done { display: none; }
.pgg-prefill.is-done { border-color: rgba(61, 220, 132, 0.4); background: rgba(61, 220, 132, 0.07); }
.pgg-prefill.is-done > .pg-icon { color: var(--pgg-green); }
.pgg-prefill.is-done .pgg-prefill-todo, .pgg-prefill.is-done .pgg-prefill-btn { display: none; }
.pgg-prefill.is-done .pgg-prefill-done { display: block; }

/* ── Handy ──────────────────────────────────────────── */
@media (max-width: 760px) {
  .pgg-head { margin: 4px 0 20px; }
  .pgg-card-pad { padding: 20px 18px; }
  .pgg-fields.is-2 { grid-template-columns: minmax(0, 1fr); }
  .pgg-choices { grid-template-columns: minmax(0, 1fr); }
  .pgg-steps .pgg-step-label { display: none; }
  .pgg-steps-caption { display: block; }
  .pgg-photos { gap: 10px; }
  .pgg-summary-list > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .pgg-empty-code { font-size: 76px; }

  .pgg-actionbar {
    position: sticky;
    bottom: 0;
    z-index: 30;
    flex-wrap: nowrap;
    margin: 24px -16px 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: rgba(11, 11, 12, 0.92);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
  }
  .pgg-actionbar .pg-btn { flex: 1 1 0; min-width: 0; padding: 0 14px; }
  .pgg-actionbar .pgg-actionbar-start { margin-right: 0; flex: 0 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .pgg-input, .pgg-choice, .pgg-photo-drop, .pgg-sign-hint { transition: none; }
}

/* Aufsicht ergänzt fehlende Angaben selbst; Warnung (z. B. unter 18 am Eventtag) */
.pgg-sv-missing { display: grid; gap: 14px; margin: 0 0 18px; }
.pgg-note.is-danger { border-color: rgba(255, 77, 77, 0.45); background: rgba(252, 0, 0, 0.1); color: var(--text); }
