/* Fotobox Web-UI: dunkles Thema für Box und Gäste, helles Thema für den Admin-Bereich */

:root {
  --font: Inter, -apple-system, "Segoe UI", Roboto, "DejaVu Sans", system-ui, sans-serif;
  --radius: 12px;
}

body.theme-dark {
  --bg: #12161F;
  --surface: #1B2230;
  --surface-2: #2A3242;
  --border: #3B4558;
  --text: #FFFFFF;
  --muted: #C7CDD8;
  --muted-2: #A3ACBA;
  --accent: #E0457B;
  --accent-text: #FFFFFF;
  --danger: #FF8A8A;
  --ok: #4ADE80;
  color-scheme: dark;
}

body.theme-light {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #F2F4F7;
  --border: #E4E7EC;
  --border-strong: #D0D5DD;
  --text: #101828;
  --text-2: #344054;
  --muted: #5B6474;
  --accent: #C8336A;
  --accent-dark: #A12753;
  --accent-soft: #FCE8EF;
  --accent-text: #FFFFFF;
  --danger: #B42318;
  --ok: #15803D;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.4; }
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 600; font-size: 15px; border: 1px solid transparent; border-radius: 10px;
  padding: 10px 16px; min-height: 44px; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; text-decoration: none; touch-action: manipulation; user-select: none;
  background: var(--surface); color: var(--text);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn:focus-visible, .input:focus-visible, .chip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-dark { background: #101828; color: #fff; }
.theme-dark .btn-ghost { background: var(--surface-2); color: var(--text); }
.theme-light .btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-danger { background: var(--surface); border-color: #F1C0C0; color: var(--danger); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { font-size: 20px; font-weight: 800; padding: 18px 24px; border-radius: 18px; }
.btn-xl { font-size: 30px; font-weight: 800; padding: 22px 52px; border-radius: 999px; }
.btn-block { width: 100%; }
.btn svg { flex: 0 0 auto; }

.chip {
  font: inherit; font-size: 14px; font-weight: 600; border-radius: 999px; padding: 8px 14px; min-height: 40px;
  border: 1px solid var(--border-strong, var(--border)); background: var(--surface); color: var(--text-2, var(--text)); cursor: pointer;
}
.chip.active { background: #101828; color: #fff; border-color: #101828; }
.theme-dark .chip { background: var(--surface-2); border-color: transparent; color: var(--text); }
.theme-dark .chip.active { background: var(--accent); }

.input, select.input, textarea.input {
  font: inherit; font-size: 16px; padding: 10px 12px; min-height: 44px; border-radius: 10px;
  border: 1px solid var(--border-strong, var(--border)); background: var(--surface); color: var(--text); width: 100%;
}
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2, var(--muted)); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; min-height: 44px; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 auto; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--danger); min-height: 1.3em; font-size: 14px; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; background: #EEF2F6; color: #344054; }
.badge.ok { background: #E7F6EC; color: #166534; }
.badge.warn { background: #FEF3C7; color: #92400E; }
.badge.info { background: #E0ECFF; color: #1D4ED8; }
.badge.accent { background: #FCE8EF; color: #A12753; }
.badge.danger { background: #FEE4E2; color: #B42318; }

/* ---------- Toast & Modal ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; max-width: min(92vw, 520px);
  background: #101828; color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
#toast.error { background: #B42318; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); color: var(--text); border-radius: 16px; padding: 24px; width: min(480px, 100%); display: flex; flex-direction: column; gap: 14px; max-height: 92vh; overflow: auto; }

/* ---------- Seiten mit Kopfzeile (Startseite, Anmelden, Foto-Download) ---------- */
.topbar { background: #12161F; color: #fff; }
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: #fff; text-decoration: none; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: #E0457B; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.topbar a.btn { color: #fff; border-color: #3B4558; background: transparent; }
.hero { max-width: 1120px; margin: 0 auto; padding: 32px 16px 72px; color: #fff; }
.hero h1 { font-size: clamp(30px, 6vw, 44px); font-weight: 800; }
.hero p { margin-top: 12px; color: #C7CDD8; font-size: 18px; max-width: 620px; }
.page { max-width: 1120px; margin: -40px auto 0; padding: 0 16px 48px; display: flex; flex-direction: column; gap: 20px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-dark, var(--accent)); }

/* ---------- Gäste-Ansicht (Handy) ---------- */
.mobile { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.mobile .center { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.app-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.print-preview { background: #fff; border-radius: 6px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.dots { display: inline-flex; gap: 4px; }
.dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.dots span.on { background: var(--accent); }
.status-card { background: var(--surface); border-radius: 16px; padding: 16px; display: flex; gap: 12px; align-items: center; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--border); border-top-color: var(--accent); animation: spin 1s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: min(480px, 100%); border-radius: 24px 24px 0 0; padding: 14px 20px max(20px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.sheet .grip { align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--border); }
.hscroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.hscroll > * { flex: 0 0 auto; }
.email-big { font-size: 18px; border: 3px solid var(--accent); background: #fff; color: #101828; border-radius: 14px; min-height: 56px; }

/* ---------- Box (Tablet, Vollbild) ---------- */
.box { position: fixed; inset: 0; overflow: hidden; user-select: none; -webkit-user-select: none; background: #1B2230; }
.box video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); background: #000; }
.box .pill { padding: 10px 22px; border-radius: 999px; background: rgba(0,0,0,.55); font-size: 20px; font-weight: 700; }
.box .top { position: absolute; top: 24px; left: 0; right: 0; display: flex; justify-content: center; pointer-events: none; }
.box .status { position: absolute; top: 24px; right: 24px; display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: rgba(0,0,0,.55); font-size: 14px; font-weight: 600; }
.box .bottom { position: absolute; bottom: 44px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.box .hint { font-size: 17px; font-weight: 500; padding: 6px 14px; border-radius: 999px; background: rgba(0,0,0,.45); }
.box .count { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 40vh; font-weight: 800; text-shadow: 0 0 40px rgba(0,0,0,.7); }
.box .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .4s; }
.box .flash.on { opacity: 1; transition: none; }
.box-screen { position: absolute; inset: 0; background: #12161F; padding: 32px 44px; display: flex; gap: 40px; align-items: center; }
.box-screen .left { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.box-screen .right { flex: 0 0 360px; display: flex; flex-direction: column; gap: 14px; }
.box-screen .print-preview img { max-height: 70vh; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); display: inline-block; }
.dot.off { background: #FCD34D; }

.box-mail { position: absolute; inset: 0; background: #12161F; padding: 20px 32px; display: flex; flex-direction: column; gap: 12px; }
.mail-display { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 16px; padding: 0 20px; min-height: 64px; border: 3px solid var(--accent); color: #101828; font-size: 26px; font-weight: 600; overflow: hidden; }
.mail-display .caret { width: 2px; height: 32px; background: var(--accent); animation: blink 1s step-end infinite; }
.mail-display .placeholder { color: #8A94A6; font-weight: 500; }
@keyframes blink { 50% { opacity: 0; } }
.kbd { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border-radius: 18px; padding: 12px; }
.kbd-row { display: flex; gap: 8px; }
.kbd button { font: inherit; flex: 1 1 0; min-width: 0; height: 56px; border-radius: 10px; border: 0; background: var(--surface-2); color: #fff; font-size: 22px; font-weight: 600; touch-action: manipulation; }
.kbd button.wide { flex: 1.5 1 0; background: var(--border); }
.kbd button:active { background: var(--accent); }
.suggest { border: 2px solid #FCD34D; color: #FCD34D; background: transparent; }
.recip { font-size: 15px; font-weight: 600; padding: 8px 12px; border-radius: 999px; background: var(--surface-2); display: inline-flex; gap: 8px; align-items: center; }
.recip button { font: inherit; background: none; border: 0; color: #fff; font-size: 18px; cursor: pointer; padding: 0 4px; min-height: 32px; }
.qr-card { background: #fff; color: #101828; border-radius: 24px; padding: 28px; display: flex; flex-direction: column; align-items: center; gap: 14px; flex: 0 0 380px; }
.qr-card img { width: 260px; height: 260px; }

/* ---------- Admin ---------- */
.admin { display: flex; min-height: 100vh; }
.side { flex: 0 0 240px; background: #fff; border-right: 1px solid var(--border); padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; }
.side .brand { color: var(--text); padding: 0 8px 20px; }
.side .brand small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 14px; text-decoration: none; }
.nav:hover { background: var(--surface-2); }
.nav.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.side .foot { margin-top: auto; border-top: 1px solid var(--border); padding: 16px 8px 0; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.side .foot button { font: inherit; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }
.main { flex: 1 1 auto; min-width: 0; padding: 32px 40px; display: flex; flex-direction: column; gap: 24px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.head h1 { font-size: 26px; font-weight: 700; }
.head .sub { margin-top: 6px; font-size: 14px; color: var(--muted); }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel h2 { font-size: 16px; font-weight: 600; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.kpi .l { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .v { font-size: 32px; font-weight: 700; margin-top: 8px; }
.kpi .s { font-size: 13px; color: var(--muted); margin-top: 4px; }
.cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.cols > * { flex: 1 1 420px; }
.list-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid #EEF0F3; font-size: 14px; }
.list-row:last-child { border-bottom: 0; }
.mini { width: 54px; height: 36px; border-radius: 4px; object-fit: cover; background: #E9D7DF; flex: 0 0 auto; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.thumb { background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; padding: 0; font: inherit; text-align: left; color: inherit; }
.thumb.sel { outline: 2px solid var(--accent); }
.thumb img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: #EEF2F6; }
.thumb .meta { padding: 8px 10px; font-size: 12px; display: flex; justify-content: space-between; gap: 6px; }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split > .grow { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.detail { flex: 1 1 340px; position: sticky; top: 16px; }
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; font-size: 13px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 2px 0 0; font-weight: 500; word-break: break-word; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; font-weight: 600; font-size: 14px; padding: 0 14px; min-height: 44px; border: 0; background: #fff; color: var(--text-2); cursor: pointer; }
.seg button.on { background: #101828; color: #fff; }
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
table.t th { background: #F9FAFB; text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding: 12px 16px; }
table.t td { padding: 11px 16px; border-top: 1px solid #EEF0F3; vertical-align: middle; }
table.t td.num { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.code-big { font-size: 26px; font-weight: 700; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.printer-card.active { border: 2px solid var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }

@media (max-width: 860px) {
  .admin { flex-direction: column; }
  .side { flex: 0 0 auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); padding: 12px; }
  .side .brand { padding: 0 8px 8px; width: 100%; }
  .side .foot { width: 100%; margin-top: 8px; }
  .main { padding: 20px 16px; }
  .detail { position: static; }
  .box-screen { flex-direction: column; padding: 20px; overflow: auto; }
  .box-screen .right, .qr-card { flex: 0 0 auto; width: 100%; }
}

/* ---------- Druckansicht QR-Aushang ---------- */
.poster { background: #fff; color: #101828; text-align: center; padding: 32px; }
.poster h1 { font-size: 44px; font-weight: 800; }
.poster .grid { display: flex; gap: 48px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }
.poster .grid > div { width: 300px; }
.poster .step { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
@media print {
  .side, .no-print { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
}
a.thumb { text-decoration: none; display: block; }
