/* ==========================================================================
   Tickets – Fanclub Trinkpause
   Baut auf css/style.css, admin/admin.css und kasse/kasse.css auf.
   ========================================================================== */

.modal-wide { max-width: 780px; width: 100%; }
/* Ticket-Kategorien-Tabelle hat viele Spalten (inkl. Löschen-Spalte) -
   braucht mehr Platz als die sonst 780px breiten "modal-wide"-Fenster,
   sonst ist die letzte Spalte nur per Scrollen innerhalb der Tabelle
   erreichbar und wirkt wie "fehlt". */
#eventDetailModal { max-width: 1080px; }

/* PDF-/QR-Vorschau im Ticketeingang/-ausgang: Standardmässig sind
   Modals auf "width: min(560px, 100%)" begrenzt (gedacht für normale
   Formulare) - viel zu schmal, um ein PDF-Ticket lesbar darzustellen.
   "width: 100%" ist hier nötig, nicht nur max-width, da eine bereits
   gesetzte feste Breite (560px) sonst gar nicht bis zur max-width
   wachsen würde (gleiches Muster wie .modal-wide oben). */
#intakeViewerModal { width: 100%; max-width: 900px; }

.availability-chip {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.76rem;
  font-weight: 700;
}
.availability-chip.ok { background: #e6f6ea; color: #1e8e3e; }
.availability-chip.warn { background: #fdeaea; color: #b30000; }
/* "Bestätigt" (Ticket zugewiesen, aber noch nicht ausgegeben+bezahlt) -
   bewusst zwischen .ok (grün) und .warn (rot) als eigene Zwischenfarbe
   (orange), siehe Status-Spalte bei Ticket-Buchungen (22.08.2026). */
.availability-chip.pending { background: #fff4e0; color: #b36b00; }
/* "Verfügbar" (noch keiner Bestellung zugewiesenes physisches Ticket,
   Ticketausgang-Tabelle, 23.10.2026) - eigene Farbe (Blau), damit sie
   sich klar von "Bezahlt" (grün), "Offen" (rot) und "Bestätigt"
   (orange) unterscheidet. */
.availability-chip.info { background: #e8f0fe; color: #1a56c4; }
/* Herausgabe-Spalte bei Ticket-Buchungen (22.08.2026): bei bereits
   ausgegebenen Tickets zeigt der Chip 2 Zeilen (Zeile 1 Ausgabeart,
   Zeile 2 Datum+Uhrzeit zusammen) statt nur eines kurzen Worts - etwas
   mehr Zeilenhöhe/Breite als die einzeiligen Chips, damit das nicht
   gequetscht wirkt.
   "white-space: nowrap" ist hier nötig (Bugfix 22.08.2026): ohne das
   konnte Zeile 2 ("22. Aug. 2026, 14:32") bei schmalerem Browserfenster
   selbst noch mitten im Text umbrechen ("22. Aug. 2026," / "14:32"),
   wodurch optisch 3 statt 2 Zeilen sichtbar waren, obwohl im HTML nur
   ein einziges <br> zwischen Ausgabeart und Datum/Uhrzeit steht. Die
   Tabelle liegt in einem horizontal scrollbaren Wrapper
   (overflow-x: auto in admin.css), darum verbreitert eine nicht
   umbrechende Zeile hier nur die Spalte statt das Layout zu sprengen. */
.availability-chip.herausgabe-chip {
  line-height: 1.5;
  padding: 4px 10px;
  text-align: center;
  white-space: nowrap;
}

/* ---------- Schmale Zahlenspalten (Bestellt/Zugewiesen/Offen/Verfügbar/Nachbestellen) ---------- */
.admin-table th.col-narrow, .admin-table td.col-narrow { width: 60px; max-width: 60px; text-align: center; white-space: nowrap; }
.admin-table th.col-center, .admin-table td.col-center { text-align: center; }
.admin-table .kci-meta { font-size: 0.72rem; color: var(--text-muted); }

/* ---------- Spiele & Kontingente: Gruppierung Aktuell/Zukünftig/Vergangen ---------- */
.events-group-header td {
  background: var(--anthracite);
  color: var(--white);
  font-family: var(--font-heavy);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 11px 16px;
  border-left: 4px solid var(--red);
  border-bottom: none !important;
}
.events-group-header:not(:first-child) td {
  border-top: 18px solid var(--white);
}
.events-group-count {
  display: inline-block;
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
  padding: 1px 10px;
  font-size: 0.78rem;
  margin-left: 8px;
  color: var(--white);
}
.events-group-empty {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 12px 14px;
}

.stock-adjust-row { display: flex; gap: 6px; align-items: center; }
.stock-adjust-row input {
  width: 64px; padding: 6px 8px; border-radius: 6px; border: 1.5px solid var(--grey-line); font-size: 0.8rem;
}

.payment-toggle .payment-btn { padding: 9px; font-size: 0.82rem; }

/* Die Kachel-Navigation erbt von stammdaten.css eine max-width:700px
   und width:fit-content, die dort für die nebeneinander liegenden,
   einzeln verschiebbaren Bereichs-Boxen gedacht sind - hier gibt es nur
   eine einzige Navigation, die soll wie bei Stammdaten mehrere Kacheln
   pro Zeile zeigen. width:100% statt fit-content ist nötig, sonst kann
   der Browser bei "auto-fill" nicht berechnen, wie viele Spalten passen,
   und zeigt nur eine einzige Spalte. */
#ticketNavGrid { width: 100%; max-width: none; }

/* ---------- Mitgliedersuche (identisch zu Kasse Mobile) ---------- */
.km-search-input, .km-buyer-select {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1.5px solid var(--grey-line);
  font-family: inherit;
  font-size: 0.86rem;
  box-sizing: border-box;
  margin-bottom: 8px;
}
.km-search-input:focus, .km-buyer-select:focus { outline: none; border-color: var(--red); }
.km-buyer-select.has-selection { border-color: #1e8e3e; border-width: 2px; }
.km-search-results {
  background: var(--white);
  border: 1.5px solid var(--grey-line);
  border-radius: 8px;
  margin: -4px 0 8px;
  max-height: 220px;
  overflow-y: auto;
}
.km-search-results button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--grey-line);
  background: var(--white);
  font-size: 0.86rem;
  font-family: inherit;
  cursor: pointer;
}
.km-search-results button:last-child { border-bottom: none; }
.km-search-results button:hover { background: var(--off-white); }
.km-search-results .km-no-results { padding: 10px 12px; font-size: 0.82rem; color: var(--text-muted); font-style: italic; }

/* ---------- Verkauf: Kachel-Navigation ---------- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
/* Event-Kacheln (Schritt 1) sind breiter als Sektor-/Bereich-Kacheln,
   damit die beiden Team-Logos nebeneinander genug Platz haben.
   #eventTileGrid ist seit der Trennung "Aktuelle/Vergangene Spiele"
   (17.08.2026) nur noch ein reiner Wrapper um bis zu zwei verschachtelte
   .tile-grid-Bereiche - deshalb Nachfahren-Selektor statt direkt auf
   dem Element selbst. */
#eventTileGrid .tile-grid {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
/* Event-Kacheln: Logos + Schrift zentriert statt linksbündig. */
#eventTileGrid .sell-tile {
  text-align: center;
}
.sell-tiles-section-title {
  margin: 28px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--grey-line);
  font-size: 1rem;
  color: var(--text-muted);
}
#eventTileGrid .tile-teams {
  justify-content: center;
}
.sell-tile {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 16px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 160ms, box-shadow 160ms;
  text-align: left;
  min-height: 84px;
}
.sell-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-strong); }
.sell-tile:active { transform: translateY(0); }
.sell-tile h4 { margin: 0 0 4px; font-size: 0.94rem; }
.sell-tile .tile-meta { font-size: 0.76rem; color: var(--text-muted); margin-bottom: 8px; }
.sell-tile .tile-badge {
  display: inline-block; font-size: 0.68rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; background: var(--off-white); color: var(--text-muted);
  margin-right: 4px;
}
.tile-teams {
  display: flex; align-items: center; gap: 8px;
  margin: 8px 0;
}
.tile-team-logo {
  width: 84px; height: 84px; object-fit: contain; flex: none;
}
.tile-team-logo-placeholder {
  display: inline-block; border-radius: 50%; background: var(--off-white);
}
.tile-teams-vs {
  font-size: 0.72rem; color: var(--text-muted); font-weight: 700;
}

/* ---------- Verkauf: Ticket-Kategorie-Liste ---------- */
.ticket-type-list { display: flex; flex-direction: column; gap: 10px; }
.ticket-type-row {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  padding: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer;
  border: 2px solid transparent;
  min-height: 56px;
}
.ticket-type-row.selected { border-color: var(--red); }
.ticket-type-row .ttr-name { font-weight: 700; font-size: 0.94rem; }
.ticket-type-row .ttr-meta { font-size: 0.76rem; color: var(--text-muted); }
.ticket-type-row .ttr-price { font-weight: 700; color: var(--red); font-size: 1rem; white-space: nowrap; }

/* ---------- Kaufleiste ---------- */
.sell-purchase-bar {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-strong);
  padding: 16px 20px;
  margin: 20px 24px 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
}
.sell-purchase-bar[hidden] { display: none; }
.purchase-summary { font-size: 0.86rem; font-weight: 600; flex: 1 1 100%; }
.purchase-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; flex: 1 1 100%; }
.purchase-controls select {
  padding: 9px 10px; border-radius: 8px; border: 1.5px solid var(--grey-line); font-family: inherit; font-size: 0.86rem; flex: 1 1 180px;
}
#sellQtyStepper { display: flex; align-items: center; gap: 8px; }
#sellQtyStepper button {
  width: 32px; height: 32px; border-radius: 8px; border: 1.5px solid var(--grey-line);
  background: var(--white); font-weight: 700; font-size: 1rem;
}
#sellQtyValue { font-weight: 700; min-width: 20px; text-align: center; }
#sellPaymentToggle { display: flex; gap: 6px; flex: 1 1 200px; }
#sellSubmitBtn { flex: 1 1 100%; }

/* ---------- Mobile: Kaufleiste unten fixiert, gut erreichbar ---------- */
@media (max-width: 700px) {
  .sell-purchase-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    margin: 0;
    border-radius: 16px 16px 0 0;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
    z-index: 60;
  }
  .admin-main { padding-bottom: 220px; } /* Platz, damit Inhalt nicht unter der Leiste verschwindet */
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  #sellPaymentToggle { flex: 1 1 100%; }
}

/* ---------- PDF-Upload-Box (Ticketeingang) ---------- */
.pdf-upload-box {
  background: var(--off-white);
  border: 1.5px dashed var(--grey-line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.pdf-upload-box .field-hint { margin: 10px 0 0; white-space: pre-line; }
.pdf-upload-box-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ---------- Ticketeingang: automatischer Zuweisungs-Vorschlag ---------- */
.intake-automatch-box {
  background: #e6f6ea;
  border: 1.5px solid #1e8e3e;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
/* Bugfix (14.09.2026, von Stefan gemeldet: "Nach dem Zuweisen eines
   Tickets, wird die Möglichkeit zur Zuweisung immer noch angezeigt."):
   die Regel oben setzt "display: flex" bedingungslos, das überschreibt
   die Browser-Standardregel "[hidden] { display: none }", sobald das
   Element (wie hier) zusätzlich die Klasse ".intake-automatch-box"
   trägt - JS setzte nach erfolgreicher Zuweisung zwar korrekt
   ".hidden = true" (tickets.js), die Box blieb dadurch aber optisch
   sichtbar stehen (der Zuweisungs-Vorschlag verschwand nie wirklich).
   Gleiches Muster wie bereits bei .sell-purchase-bar[hidden] weiter
   oben in dieser Datei - hier fehlte die entsprechende Override-Regel. */
.intake-automatch-box[hidden] { display: none; }
.intake-automatch-box p { margin: 0; font-size: 0.88rem; color: #1e8e3e; font-weight: 600; }

/* ---------- Ticketeingang: Zuweisungs-Button rot/grün ---------- */
.assign-btn.unassigned { background: #fdeaea; border-color: var(--red); color: #b30000; }
.assign-btn.unassigned:hover { background: var(--red); color: var(--white); }
.assign-btn.assigned { background: #e6f6ea; border-color: #1e8e3e; color: #1e8e3e; }
.assign-btn.assigned:hover { background: #1e8e3e; color: var(--white); }

/* ---------- Ticketeingang: Prioritäts-Kreis bei der Zuweisung ---------- */
.priority-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--white);
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.priority-badge.prio-1 { background: #1e8e3e; }
.priority-badge.prio-2 { background: #d97706; }
.priority-badge.prio-3 { background: var(--red); }
.priority-badge.prio-none { background: #1a1a1a; color: var(--red); font-size: 0.9rem; }

/* ---------- Ticketeingang/-ausgang: andere Kategorie als bestellt ---------- */
.category-mismatch-row td { background: #fff8e1 !important; }
.category-mismatch-row:hover td { background: #fff0c2 !important; }
.category-mismatch-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #92400e;
  background: #ffe9a8;
  border-radius: 999px;
  padding: 1px 8px;
}

/* ---------- Ticketausgang: noch verfügbares (unzugewiesenes) Ticket ----------
   Analog zu .category-mismatch-row oben, aber in Blau statt Gelb, damit
   beide Hervorhebungen klar unterscheidbar bleiben (23.10.2026). */
.ticket-available-row td { background: #eef3fe !important; }
.ticket-available-row:hover td { background: #dde8fc !important; }

/* ---------- Einfacher Ja/Nein-Bestätigungsdialog ---------- */
.btn-secondary {
  background: var(--off-white);
  color: var(--anthracite);
  border: 1.5px solid var(--grey-line);
}
.btn-secondary:hover { background: var(--grey-line); }

/* ---------- Ticketausgang: QR-Code scannen ---------- */
.qr-scan-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}
.qr-scan-video-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.qr-scan-status { font-size: 0.84rem; color: var(--text-muted); text-align: center; margin: 12px 0 0; }

/* ---------- Ticketeingang: Quelle-Auswahl im Batch-Modus (mehrseitiges PDF) ---------- */
.intake-batch-options-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}
@media (max-width: 720px) {
  .intake-batch-options-row { grid-template-columns: 1fr; }
}
.intake-batch-source-step {
  background: var(--off-white);
  border: 1.5px solid var(--grey-line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
}
.intake-batch-source-step h4 { margin: 0 0 4px; font-family: var(--font-heavy); font-size: 1rem; }
.intake-batch-source-step .field-hint { margin: 0 0 14px; }
.intake-batch-source-step .btn { margin-top: auto; }
.intake-batch-source-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.intake-batch-source-row label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 0.8rem; font-weight: 600; color: var(--anthracite);
  flex: 1; min-width: 220px; max-width: 320px;
}
.intake-batch-source-row label[hidden] { display: none; }
.intake-batch-source-row select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--grey-line);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--white);
}
.intake-batch-source-row select:focus { outline: none; border-color: var(--red); }
.intake-pdf-preview {
  width: 110px;
  height: 150px;
  border: 1.5px solid var(--grey-line);
  border-radius: 8px;
  background: var(--white);
}
.intake-pdf-preview-wrap-inner { position: relative; width: 110px; height: 150px; }
.intake-pdf-preview-zoom {
  position: absolute;
  inset: 0;
  background: transparent;
  border: none;
  cursor: zoom-in;
  border-radius: 8px;
}
.intake-pdf-preview-zoom:hover { background: rgba(0,0,0,0.06); }

/* ---------- Ticketeingang: Fortschritt beim einzelnen Durchgehen eines mehrseitigen PDFs ---------- */
.intake-step-progress {
  background: #fff8e6;
  border: 1.5px solid #d97706;
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 14px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #92400e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.intake-step-progress[hidden] { display: none; }

/* ---------- Ticketeingang: Grün/Rot-Markierung nach PDF-Erkennung ---------- */
.intake-field-filled { background: #e6f6ea !important; border-color: #1e8e3e !important; color: #1e8e3e; }
.intake-field-missing { background: #fdeaea !important; border-color: var(--red) !important; color: #b30000; }
.intake-value-invalid { color: var(--red); font-weight: 600; }
.intake-viewer-frame { width: 100%; height: 70vh; border: none; border-radius: 8px; }
.intake-viewer-image { max-width: 100%; display: block; margin: 0 auto; border-radius: 8px; }
/* Gleiches Muster wie bei .intake-automatch-box[hidden] oben in dieser
   Datei (Bugfix 14.09.2026): ".intake-viewer-image" setzt "display: block"
   bedingungslos. openIntakeViewer() (tickets.js) togglet je nach Typ
   (PDF vs. QR/Barcode) ".hidden" auf Frame UND Bild - ohne diese Regel
   würde bei der PDF-Vorschau das (dann leere bzw. noch das vorherige
   QR-Bild zeigende) <img> weiterhin sichtbar bleiben und die PDF-Vorschau
   überlagern/verschieben. Beim Testen dieser Session vorsorglich mit
   behoben, da exakt dieselbe Ursache wie beim gemeldeten Bug. */
.intake-viewer-image[hidden] { display: none; }
.btn-blue { background: #1a73e8; color: #ffffff; border: none; }
.btn-blue:hover { background: #1558b0; }
.pdf-raw-text {
  background: var(--off-white);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
  color: var(--text-muted);
}
.pdf-qr-preview {
  display: block;
  margin-top: 8px;
  max-width: 160px;
  border-radius: 8px;
  border: 1.5px solid var(--grey-line);
}

/* Ticketeingang «Von» (24.11.2026): die Mitglied-Suche steht auf einer Zeile
   (Suchfeld | Liste | gewählte Person) und braucht dafür doppelte Breite. */
.movement-form label.grow#intakeMemberWrap, .intake-batch-source-row label.grow#intakeBatchMemberWrap { flex: 0 1 420px; max-width: 640px; }

/* Zuweisungs-Fenster im Ticketeingang (26.11.2026): die Auswahlliste darf
   nicht breiter werden als das Fenster - mit dem Zusatz "· Sektor ..." bei
   Sammel-Tickets werden die Einträge länger. */
#intakeAssignModal select { display: block; width: 100%; max-width: 100%; }

/* Ticketeingang: Abschnitt «Vergangen – nicht zugewiesen» (30.11.2026, Wunsch
   Stefan) - orange hervorgehoben, damit offene Tickets nicht untergehen */
.events-group-header.events-group-offen td { background: #b45309; border-left-color: #7c2d12; }
.events-group-hinweis { font-family: var(--font-body); font-size: 0.74rem; font-weight: 400; text-transform: none; letter-spacing: 0; opacity: 0.9; }

/* Ticket ausblenden: «Ticket abschreiben» oder «Nur ausblenden» (30.11.2026, Wunsch Stefan) */
.intake-hide-ticket { font-weight: 700; margin: 0 0 6px; }
.intake-hide-wahl { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.intake-hide-option { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 14px; align-items: start; }
.intake-hide-option .btn { width: 100%; padding: 8px 12px; font-size: 0.82rem; }
.intake-hide-option .field-hint { margin: 0; }
.stock-chip.abgeschrieben { background: #fde6d3; color: #b45309; }
@media (max-width: 560px) { .intake-hide-option { grid-template-columns: 1fr; gap: 6px; } }
