/* Livestream-Event – Grundlayout. Markenfarbe kommt per --brand aus der Konfiguration. */
:root {
  --brand: #0057A4;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1b2430;
  --muted: #5d6b7c;
  --border: #dde3ea;
  --ok: #1f7a3f;
  --ok-bg: #e7f5ec;
  --err: #b42318;
  --err-bg: #fdecea;
  --live: #c2410c;
  --live-bg: #fff3e8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1.5rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.wrap { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 24px; padding-bottom: 40px; }

/* Kopfzeile */
.site-header { background: var(--surface); border-bottom: 3px solid var(--brand); }
.header-inner { display: flex; align-items: center; gap: 20px; min-height: 72px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.logo { height: 40px; width: auto; }
.header-title { display: flex; flex-direction: column; flex: 1; min-width: 180px; }
.header-title strong { font-size: 1.15rem; }
.header-title span { color: var(--muted); font-size: .9rem; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.header-actions form { margin: 0; }
.who { color: var(--muted); font-size: .9rem; }

.site-footer { padding: 16px 0 24px; font-size: .85rem; }
.site-footer a { color: var(--muted); margin-right: 16px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: .9rem; text-decoration: none; cursor: pointer;
  border-radius: 8px; border: 1px solid transparent; padding: 9px 16px;
}
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; color: var(--brand); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-link { background: none; border: none; color: var(--muted); padding: 0; font-weight: 400; text-decoration: underline; }
.btn-block { width: 100%; }
.btn-small { padding: 5px 12px; font-size: .85rem; }

/* Karten & Formulare */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.narrow { max-width: 560px; margin: 24px auto; }
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=search], input:not([type]), textarea {
  font: inherit; font-weight: 400; color: var(--text); background: #fff;
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
textarea { resize: vertical; min-height: 120px; }
.form label.check, label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; cursor: pointer; }
label.check input { margin-top: 4px; width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--brand); }
.field-error { color: var(--err); font-weight: 400; font-size: .85rem; }
.counter { text-align: right; margin-top: -10px; }
.alert { border-radius: 8px; padding: 10px 14px; margin: 0; font-size: .9rem; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--err-bg); color: var(--err); }
.live-details { background: var(--live-bg); border-radius: 8px; padding: 12px 14px; margin-top: -4px; }
.live-details p { margin: 0 0 8px; }

/* Bühne: Video + Fragen */
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.stage-single { grid-template-columns: minmax(0, 1fr); max-width: 1200px; margin: 0 auto; }
.intro { margin: 16px 0 0; }
.qa { position: sticky; top: 16px; }

.player { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; box-shadow: var(--shadow); }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; color: #fff; background: rgba(0, 0, 0, .75); text-align: center; padding: 24px;
}
.player-overlay-text { margin: 0; font-size: 1.1rem; max-width: 520px; }
.spinner { width: 36px; height: 36px; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; }
.player-overlay.no-spin .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.unmute {
  position: absolute; left: 16px; top: 16px; font: inherit; font-weight: 600; cursor: pointer;
  background: rgba(255, 255, 255, .95); color: #000; border: none; border-radius: 999px; padding: 8px 16px;
}

.my-questions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.my-questions li { border-left: 3px solid var(--border); padding-left: 10px; }
.my-questions p { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }

/* Admin */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; display: flex; flex-direction: column; }
.stat span { font-size: 1.8rem; font-weight: 700; line-height: 1.2; }
.stat small { color: var(--muted); }
.stat-live span { color: var(--live); }

.tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { font: inherit; font-weight: 600; background: none; border: none; border-bottom: 3px solid transparent; padding: 10px 14px; cursor: pointer; color: var(--muted); }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.live-dot { margin-left: auto; color: var(--ok); font-size: .85rem; }
.live-dot.is-offline { color: var(--err); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.chip { font: inherit; font-size: .875rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.filters input[type=search] { margin-left: auto; max-width: 300px; padding: 7px 12px; }

.questions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.question { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 14px 18px; }
.question.is-live { border-left-color: var(--live); }
.question.is-new { animation: flash 2s ease-out; box-shadow: 0 0 0 2px var(--brand); }
.question.is-done { opacity: .65; }
@keyframes flash { from { background: #fff7d6; } to { background: var(--surface); } }
.q-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.q-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.q-company { color: var(--muted); }
.q-contact { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; }
.q-text { font-size: 1.1rem; margin: 10px 0 12px; white-space: pre-wrap; word-break: break-word; }
.q-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.q-actions .check { margin-right: auto; }
.badge { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; background: var(--bg); color: var(--muted); border-radius: 4px; padding: 2px 8px; }
.badge-live { background: var(--live-bg); color: var(--live); }
.empty { text-align: center; padding: 40px 0; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { background: var(--bg); font-weight: 600; }

@media (max-width: 960px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .qa { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .row-2 { grid-template-columns: 1fr; }
  .logo { height: 30px; }
  .card { padding: 18px; }
  .filters input[type=search] { margin-left: 0; max-width: none; }
}

/* Admin: Zugänge */
.account-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.account-form { padding: 18px; }
.account-form h2 { font-size: 1rem; margin-bottom: 10px; }
.account-form p { margin: 0 0 10px; }
.account-fields { display: flex; flex-wrap: wrap; gap: 8px; }
.account-fields input { flex: 1 1 140px; padding: 8px 10px; }
.account-fields input[type=file] { border: none; padding: 6px 0; }
#account-feedback { margin-bottom: 16px; }
.credentials { margin-bottom: 20px; border-color: var(--brand); }
.credentials .alert { margin-bottom: 12px; }
.credentials .table-wrap { margin-bottom: 12px; max-height: 360px; overflow-y: auto; }
.skipped { color: var(--err); padding-left: 18px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95rem; }
.row-actions { display: flex; gap: 6px; }
#accounts td { white-space: normal; }
#accounts td.row-actions { white-space: nowrap; }
.btn-danger { background: transparent; color: var(--err); border-color: var(--border); }
.btn-danger:hover { background: var(--err-bg); }
tr.is-inactive td { color: var(--muted); }
@media (max-width: 960px) { .account-tools { grid-template-columns: 1fr; } }

.stat-reset { align-self: flex-start; font-size: .8rem; margin-top: 4px; cursor: pointer; }
