/* Tischplan: Hallenplan im Shop. Farben über Variablen anpassbar (z.B. im Theme). */
.tp {
  --tp-accent: #111;
  --tp-text: inherit;
  --tp-muted: rgba(0, 0, 0, 0.6);
  --tp-line: rgba(0, 0, 0, 0.12);
  --tp-bg: #fff;
  --tp-radius: 12px;
  color: var(--tp-text);
  font: inherit;
  margin: 0 auto;
}
.tp *, .tp *::before, .tp *::after { box-sizing: border-box; }
.tp-status { padding: 48px 16px; text-align: center; color: var(--tp-muted); }
.tp-error { color: #b42318; }
.tp-title { margin-bottom: 16px; }
.tp-title h1 { margin: 0 0 4px; }
.tp-title p { margin: 0; color: var(--tp-muted); }

.tp-banner { padding: 12px 16px; margin-bottom: 12px; border-radius: var(--tp-radius); background: #fff4e5; color: #6b3d00; }
.tp-banner[hidden] { display: none; }
.tp-banner a { color: inherit; font-weight: 600; }

.tp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .tp-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .tp-stage { min-height: 360px; } .tp-zoom button { width: 44px; height: 44px; } }

/* Regeln bestätigen */
.tp-rules { margin: 14px 0 4px; padding: 12px; border: 1px solid var(--tp-line); border-radius: 10px; font-size: 14px; }
.tp-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; line-height: 1.4; }
.tp-check input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--tp-accent); }
.tp-rules a { display: inline-block; margin: 8px 0 0 30px; color: var(--tp-accent); font-weight: 600; }
.tp-incart { margin-top: 12px; }

.tp-stage { position: relative; width: 100%; min-height: 240px; border: 1px solid var(--tp-line); border-radius: var(--tp-radius); overflow: hidden; background: var(--tp-bg); touch-action: pan-y pinch-zoom; }
.tp-stage.tp-zoomed { touch-action: none; }
.tp-svg { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.tp-zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.tp-zoom button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--tp-line); background: rgba(255, 255, 255, 0.95); color: #111; font-size: 20px; line-height: 1; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.tp-zoom button:hover { background: #f4f4f4; }
.tp-zoom button:focus-visible, .tp-stand:focus-visible, .tp-book:focus-visible, .tp-remove:focus-visible { outline: 3px solid var(--tp-accent); outline-offset: 2px; }

.tp-stand polygon { stroke-width: 1; vector-effect: non-scaling-stroke; transition: fill-opacity 0.15s ease; }
.tp-stand.tp-available { cursor: pointer; }
.tp-stand.tp-available polygon { fill: var(--tp-cat); fill-opacity: 0.55; stroke: var(--tp-cat); }
.tp-stand.tp-available:hover polygon { fill-opacity: 0.85; }
.tp-stand.tp-available.tp-far polygon { fill-opacity: 0.18; stroke-opacity: 0.4; }
.tp-stand.tp-available.tp-far:hover polygon { fill-opacity: 0.3; }
.tp-stand.tp-selected { cursor: pointer; }
.tp-stand.tp-selected polygon { fill: var(--tp-accent); fill-opacity: 0.9; stroke: var(--tp-accent); stroke-width: 2.5; }
.tp-stand.tp-held polygon { fill: var(--tp-hatch, rgba(120, 120, 120, 0.45)); stroke: rgba(80, 80, 80, 0.6); }
.tp-stand.tp-sold polygon, .tp-stand.tp-reserved polygon { fill: #4a4a4a; fill-opacity: 0.55; stroke: #333; }
.tp-stand.tp-unavailable polygon { fill: #bdbdbd; fill-opacity: 0.35; stroke: rgba(0, 0, 0, 0.25); }
.tp-stand.tp-upcoming polygon { fill: var(--tp-cat); fill-opacity: 0.45; stroke: var(--tp-cat); }
.tp-stand:focus { outline: none; }
.tp-labels text.tp-name { font-weight: 500; }
.tp-labels text { fill: #111; font-weight: 600; paint-order: stroke; stroke: rgba(255, 255, 255, 0.85); stroke-width: 2px; pointer-events: none; font-family: inherit; }

.tp-tip { position: absolute; z-index: 2; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; background: rgba(17, 17, 17, 0.92); color: #fff; font-size: 13px; line-height: 1.35; pointer-events: none; max-width: 260px; }
.tp-tip[hidden] { display: none; }
.tp-tip .tp-tip-name { font-weight: 600; }

.tp-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; list-style: none; padding: 0; margin: 12px 0 0; font-size: 14px; font-weight: 500; color: var(--tp-text); }
.tp-legend li { display: inline-flex; align-items: center; gap: 6px; }
.tp-swatch { display: inline-block; width: 18px; height: 12px; border-radius: 3px; opacity: 1; }
.tp-sw-mine { background: var(--tp-accent); opacity: 0.9; }
.tp-sw-held { background: repeating-linear-gradient(45deg, rgba(120, 120, 120, 0.4) 0 3px, rgba(60, 60, 60, 0.55) 3px 5px); }
.tp-sw-sold { background: #4a4a4a; opacity: 0.6; }

.tp-panel { border: 1px solid var(--tp-line); border-radius: var(--tp-radius); padding: 16px; background: var(--tp-bg); position: sticky; top: 16px; }
.tp-panel[hidden] { display: none; }
.tp-panel h3 { margin: 0 0 10px; font-size: 1.05em; }
.tp-hint { margin: 10px 0 0; font-size: 13px; color: var(--tp-muted); }
.tp-selected { list-style: none; margin: 0; padding: 0; }
.tp-selected li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--tp-line); }
.tp-sel-name { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tp-sel-name small { color: var(--tp-muted); }
.tp-sel-price { white-space: nowrap; }
.tp-remove { width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; font-size: 20px; cursor: pointer; color: inherit; }
.tp-remove:hover { background: rgba(0, 0, 0, 0.06); }
.tp-total { display: flex; justify-content: space-between; margin: 12px 0; }
.tp-field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; font-size: 14px; }
.tp-field input { min-height: 44px; padding: 8px 10px; border: 1px solid var(--tp-line); border-radius: 8px; font: inherit; font-size: 16px; }
.tp-book { width: 100%; min-height: 48px; margin-top: 8px; border: 0; border-radius: 10px; background: var(--tp-accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.tp-book:disabled { opacity: 0.45; cursor: not-allowed; }
.tp-message { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: #fdecea; color: #8a1c13; font-size: 14px; }

.tp-main .tp-hint { margin-top: 6px; }
.tp-bar { display: none; }
@media (max-width: 860px) {
  .tp-bar:not([hidden]) { position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px -4px 0; padding: 10px 12px; border-radius: var(--tp-radius); background: #111; color: #fff; box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15); }
  .tp-bar button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 8px; background: #fff; color: #111; font: inherit; font-weight: 600; cursor: pointer; }
}

/* Dunkles Design (data-theme="dark"): Plan als helle Linien auf dunklem Grund */
.tp.tp-dark {
  --tp-text: #eef3f7;
  --tp-muted: #b4c1cc;
  --tp-line: rgba(255, 255, 255, 0.16);
  --tp-bg: #121a22;
  color: var(--tp-text);
}
.tp-dark .tp-svg image { filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9); }
.tp-dark .tp-labels text { fill: #fff; stroke: rgba(0, 0, 0, 0.85); }
.tp-dark .tp-stand.tp-available polygon { fill-opacity: 0.75; }
.tp-dark .tp-stand.tp-available.tp-far polygon { fill-opacity: 0.2; }
.tp-dark .tp-stand.tp-unavailable polygon { fill: #5b6670; fill-opacity: 0.45; stroke: rgba(255, 255, 255, 0.2); }
.tp-dark .tp-stand.tp-sold polygon, .tp-dark .tp-stand.tp-reserved polygon { fill: #2a3138; fill-opacity: 0.9; stroke: #6b7680; }
.tp-dark .tp-zoom button { background: rgba(18, 26, 34, 0.95); color: #fff; }
.tp-dark .tp-zoom button:hover { background: #1d2833; }
.tp-dark .tp-remove:hover { background: rgba(255, 255, 255, 0.08); }
.tp-dark .tp-field input { background: #0c1218; color: #fff; }
.tp-dark .tp-message { background: #3a1513; color: #ffd4cf; }
.tp-dark .tp-banner { background: #3a2a10; color: #ffe2b0; }
.tp-dark .tp-sw-sold { background: #2a3138; opacity: 1; border: 1px solid #6b7680; }
.tp-dark .tp-book { color: #fff; }
.tp-dark .tp-stand.tp-upcoming polygon { fill-opacity: 0.55; }
