/* mediaxtrade Deal-Portal
   Farben aus der mediaxtrade-Marke (Petrol #2d727e), Systemschrift (keine externen Fonts, DSGVO). */
:root {
  --bg: #eef3f3;
  --paper: #ffffff;
  --ink: #17312f;
  --muted: #5f7472;
  --line: #d6e2e2;
  --teal: #2d727e;
  --teal-deep: #1f5660;
  --teal-wash: #ddebec;
  --on-teal: #ffffff;
  --amber: #9a5f0c;
  --amber-wash: #f7ecd9;
  --red: #a23b32;
  --red-wash: #f6e3e0;
  --demo: #6b4fa3;
  --demo-wash: #ece6f7;
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1a1b; --paper: #162627; --ink: #e4efee; --muted: #9db3b1; --line: #2a4042;
    --teal: #5aaeb9; --teal-deep: #8fd0d8; --teal-wash: #1d3a3d; --on-teal: #06201f;
    --amber: #e3a54a; --amber-wash: #3a2c14; --red: #ec8a80; --red-wash: #3d1f1c;
    --demo: #b9a2ec; --demo-wash: #2a2240;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 17px; line-height: 1.5; font-variant-numeric: tabular-nums;
}
a { color: var(--teal); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Kopfzeile ───────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 980px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 16px; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand span { color: var(--teal); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a, .nav button {
  background: none; border: 0; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--muted);
  text-decoration: none; cursor: pointer; font-size: 15px;
}
.nav a[aria-current="page"] { color: var(--ink); background: var(--paper); }
.nav a:hover, .nav button:hover { color: var(--ink); }

.demo-banner { background: var(--demo-wash); color: var(--demo); text-align: center; font-size: 14px; padding: 6px 16px; font-weight: 600; }

main { max-width: 980px; margin: 0 auto; padding: 28px 20px 80px; }
main.narrow { max-width: 760px; }
h1 { font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 6px; }
h2 { font-size: 20px; margin: 0 0 12px; letter-spacing: -0.01em; }
.lead { color: var(--muted); margin: 0 0 24px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* ── Schaltflächen & Formulare ───────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
  padding: 10px 18px; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer;
  font-weight: 600; text-decoration: none; font-size: 16px; line-height: 1.2;
}
.btn-primary { background: var(--teal); color: var(--on-teal); }
.btn-primary:hover { background: var(--teal-deep); }
.btn-secondary { background: var(--paper); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: var(--teal); }
.btn-quiet { background: none; color: var(--teal); padding-left: 8px; padding-right: 8px; }
.btn-danger { background: none; color: var(--red); border-color: var(--line); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 15px; }
.field .hint { font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url],
input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--paper);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-wash); }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--teal); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.panel { background: var(--paper); border-radius: var(--radius-lg); padding: 24px; }
.panel + .panel { margin-top: 16px; }
.auth { max-width: 420px; margin: 8vh auto 0; }
.auth .brand { display: block; font-size: 22px; margin-bottom: 24px; text-align: center; }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 15px; }
.alert-error { background: var(--red-wash); color: var(--red); }
.alert-ok { background: var(--teal-wash); color: var(--teal-deep); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: var(--radius); font-weight: 600; z-index: 50; max-width: calc(100% - 40px);
}

/* ── Kalender ────────────────────────────── */
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.cal-head h1 { margin: 0 auto 0 0; }
.cal-nav { display: flex; gap: 6px; }
.icon-btn {
  width: 46px; height: 46px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper);
  display: inline-grid; place-items: center; cursor: pointer; font-size: 20px; color: var(--ink);
}
.icon-btn:hover { border-color: var(--teal); }
.sheet-switch { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.sheet-switch button {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 8px 16px; cursor: pointer; font-size: 15px;
}
.sheet-switch button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 13px; color: var(--muted); padding-bottom: 4px; }
.cal-day {
  position: relative; min-height: 96px; border-radius: var(--radius); background: var(--paper);
  border: 1px solid transparent; padding: 10px; text-align: left; display: flex; flex-direction: column;
  justify-content: space-between; color: var(--muted); font-size: 15px;
}
.cal-day.outside { background: transparent; }
.cal-day.today { border-color: var(--ink); color: var(--ink); }
/* Das eine auffällige Element: Tage mit Deals sind gefüllte Petrol-Kacheln mit großer Zahl */
button.cal-day { cursor: pointer; font: inherit; }
.cal-day.has-deals { background: var(--teal); color: var(--on-teal); }
.cal-day.has-deals:hover { background: var(--teal-deep); }
.cal-day.has-deals.today { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--paper); }
.cal-count { display: flex; align-items: baseline; gap: 5px; line-height: 1; }
.cal-count strong { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; }
.cal-count span { font-size: 14px; font-weight: 600; }
.cal-sched { font-size: 12px; opacity: .85; }
.cal-legend { margin-top: 16px; font-size: 14px; color: var(--muted); }

@media (max-width: 640px) {
  main { padding: 20px 12px 64px; }
  h1 { font-size: 24px; }
  .calendar { gap: 4px; }
  .cal-day { min-height: 70px; padding: 6px; font-size: 13px; border-radius: var(--radius-sm); }
  .cal-count { flex-direction: column; align-items: flex-start; gap: 2px; }
  .cal-count strong { font-size: 22px; }
  .cal-count span { font-size: 11px; }
  .cal-sched { display: none; }
  .topbar-inner { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
}

/* ── Tagesansicht ────────────────────────── */
.back {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 18px 10px 14px;
  border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line); color: var(--ink);
  font-weight: 600; text-decoration: none; margin-bottom: 20px; font-size: 16px;
}
.back:hover { border-color: var(--teal); }
.day-title { margin-bottom: 4px; }
.day-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 8px; }

.deal { background: var(--paper); border-radius: var(--radius-lg); padding: 22px; margin-top: 16px; }
.deal.is-expired { opacity: .72; }
.deal-top { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
.deal-img { width: 88px; height: 88px; border-radius: var(--radius); object-fit: contain; background: #fff; border: 1px solid var(--line); }
.deal-title { font-size: 19px; font-weight: 700; line-height: 1.3; margin: 0 0 4px; letter-spacing: -0.01em; }
.deal-meta { font-size: 14px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.badge { display: inline-block; font-size: 13px; font-weight: 600; border-radius: 999px; padding: 2px 10px; }
.badge-available { background: var(--teal-wash); color: var(--teal-deep); }
.badge-limited { background: var(--amber-wash); color: var(--amber); }
.badge-sold_out, .badge-expired { background: var(--red-wash); color: var(--red); }
.badge-demo { background: var(--demo-wash); color: var(--demo); }
.badge-scheduled { background: var(--bg); color: var(--muted); }

.deal-price { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 18px 0 10px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.deal-price .label { color: var(--muted); font-size: 15px; }
.deal-price .value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 14px; font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-all; }
.source-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }

details.calc { border-radius: var(--radius); background: var(--bg); padding: 0 14px; margin: 12px 0; }
details.calc summary { cursor: pointer; padding: 12px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 8px; }
details.calc summary::-webkit-details-marker { display: none; }
details.calc summary::after { content: "anzeigen"; font-weight: 400; color: var(--teal); font-size: 14px; }
details.calc[open] summary::after { content: "ausblenden"; }
.calc-table { width: 100%; border-collapse: collapse; font-size: 15px; margin-bottom: 12px; }
.calc-table td { padding: 5px 0; }
.calc-table td:last-child { text-align: right; white-space: nowrap; }
.calc-table tr.total td { border-top: 1px solid var(--line); font-weight: 700; padding-top: 8px; }
.calc-note { font-size: 13px; color: var(--muted); padding-bottom: 12px; margin: 0; }
.notes { background: var(--amber-wash); color: var(--ink); border-radius: var(--radius); padding: 10px 14px; font-size: 15px; margin: 12px 0; white-space: pre-line; }

.group { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.group-summary { margin: 0 0 4px; font-size: 15px; }
.group-hint { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.mine { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.purchase-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 8px; }
.purchase-form .field { margin: 0; flex: 1 1 140px; max-width: 200px; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); background: var(--paper); border-radius: var(--radius-lg); margin-top: 16px; }

/* ── Buchung ─────────────────────────────── */
.offers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 860px) { .offers { grid-template-columns: 1fr; } }
.offer { background: var(--paper); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.offer h2 { margin: 0; }
.offer .price { font-size: 24px; font-weight: 700; }
.offer .price small { font-size: 14px; font-weight: 400; color: var(--muted); }
.seats { display: flex; gap: 4px; }
.seats i { flex: 1; height: 8px; border-radius: 4px; background: var(--teal); }
.seats i.free { background: var(--line); }
.offer form, .offer > .btn:last-child { margin-top: auto; }

/* ── Verwaltung ──────────────────────────── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--teal); font-weight: 600; }
.row { background: var(--paper); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 10px; }
.row-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-title { font-weight: 600; }
.sub-list { margin: 12px 0 0; padding: 0; list-style: none; font-size: 15px; }
.sub-list li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); align-items: center; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-top: 12px; }
.inline-form .field { margin: 0; flex: 1 1 160px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; background: var(--bg); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.log { font-size: 14px; width: 100%; border-collapse: collapse; }
.log th, .log td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-wrap { overflow-x: auto; background: var(--paper); border-radius: var(--radius); padding: 8px 12px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

@media (prefers-reduced-motion: no-preference) {
  .deal { animation: rise .25s ease-out both; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } }
}

/* Hilfsklassen (keine Inline-Styles wegen Content-Security-Policy) */
.deal-top.no-img { grid-template-columns: 1fr; }
.u-end { align-content: end; }
.u-span2 { grid-column: span 2; }
@media (max-width: 640px) { .u-span2 { grid-column: auto; } }
.u-m0 { margin: 0; }
.u-seats { margin: 12px 0 16px; }
.u-mb0 { margin-bottom: 0; }
.u-mb16 { margin-bottom: 16px; }
.u-mt0 { margin-top: 0; }
.u-mt16 { margin-top: 16px; }

/* Sicherheit & Bilder */
.label-like { font-weight: 600; font-size: 15px; }
.img-row { display: flex; align-items: center; gap: 12px; }
.qr { display: block; width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: var(--radius); margin: 8px 0 12px; }
.codes { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; line-height: 1.8; background: var(--bg); padding: 12px 16px; border-radius: var(--radius); columns: 2; margin: 0 0 16px; }
.u-ml8 { margin-left: 8px; }
label.btn { cursor: pointer; }

/* Logo */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-logo { display: block; height: 32px; width: auto; }
.brand .brand-tag { font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--on-teal); background: var(--teal); border-radius: 999px; padding: 3px 10px; }
.auth .brand.brand-auth { display: flex; justify-content: center; margin-bottom: 24px; }
.auth .brand-auth .brand-logo { height: 40px; }
@media (max-width: 640px) { .brand-logo { height: 26px; } }
/* Im Dunkelmodus steht das Logo auf einer hellen Fläche, damit die dunkle Schrift lesbar bleibt */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo { background: #fff; padding: 4px 8px; border-radius: 8px; box-sizing: content-box; }
}
:root[data-theme="dark"] .brand-logo { background: #fff; padding: 4px 8px; border-radius: 8px; box-sizing: content-box; }
