/* ============================================================
   Shared UI Components
   ============================================================ */

/* ============================================================
   DRAWING INDICATOR
   ============================================================ */
#drawing-indicator {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--bg-elevated); border: 1px solid var(--brand-glow);
  color: var(--brand); padding: 7px 10px 7px 16px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 600; pointer-events: none;
  display: none; box-shadow: var(--shadow-md); white-space: nowrap;
  z-index: 300;
}
#drawing-indicator.visible { display: flex; align-items: center; gap: 10px; }
/* Fertig/Abbrechen — nur während des aktiven Zeichnens; klickbar (Banner selbst
   ist pointer-events:none). Ersetzt Rechtsklick/Enter auf Touch/Stift. */
.draw-ind-btn {
  display: none; pointer-events: auto; cursor: pointer;
  border: none; border-radius: var(--r-full); padding: 6px 14px;
  font-size: 12px; font-weight: 700; min-height: 32px; line-height: 1;
  background: var(--brand); color: #1B1206;
}
.draw-ind-btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
#drawing-indicator.is-drawing .draw-ind-btn { display: inline-flex; align-items: center; }

/* ============================================================
   TOAST
   ============================================================ */
/* z-index bewusst über allen Overlays (Library 400, Onboarding 850, Status-Pill 1200,
   Vollbild-Player): Toasts sind reines Feedback ohne Interaktion und müssen sichtbar
   bleiben, auch wenn die Vollbild-Bibliothek o.ä. offen ist. */
#toast-container { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; z-index: 2000; pointer-events: none; }
.toast { background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-primary); padding: 7px 16px; border-radius: var(--r-full); font-size: 13px; box-shadow: var(--shadow-lg); animation: toast-in .2s ease-out, toast-out .3s ease-in 2.2s forwards; }
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger); color: var(--danger); }
@keyframes toast-in  { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
@keyframes toast-out { from{opacity:1} to{opacity:0} }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 24px 12px; color: var(--text-muted); }
.empty-state p { font-size: 12px; line-height: 1.6; margin-top: 6px; }

/* ============================================================
   LIBRARY TABS
   ============================================================ */
/* Library Tabs */
.lib-tabs { display:flex; border-bottom:1px solid var(--border); flex-shrink:0; }
.lib-tab {
  flex:1; padding:10px 4px; font-size:13px; font-weight:500;
  color:var(--text-secondary); cursor:pointer; border:none; background:none;
  border-bottom:2px solid transparent; margin-bottom:-1px;
  transition:color .12s, border-color .12s;
}
.lib-tab:hover { color:var(--text-primary); }
.lib-tab.active { color:var(--brand); border-bottom-color:var(--brand); font-weight:600; }

.lib-tab-content { display:none; flex:1; overflow:hidden; flex-direction:column; min-height:0; }
.lib-tab-content.active { display:flex; }
.lib-list { flex:1; overflow-y:auto; padding:10px; display:flex; flex-direction:column; gap:6px; }

/* Formation card in library */
.lib-fm-card {
  background:var(--bg-elevated); border:1px solid var(--border);
  border-radius:var(--r-md); padding:10px;
  display:flex; align-items:center; gap:10px;
  cursor:pointer; transition:background .12s, border-color .12s;
}
.lib-fm-card:hover { background:var(--bg-hover); border-color:var(--brand-glow); }
.lib-fm-thumb { flex-shrink:0; }
.lib-fm-name { flex:1; font-size:13px; font-weight:600; color:var(--text-primary); }
.lib-fm-actions { display:flex; gap:4px; }

/* Route grid in library panel */
.lib-rt-grid {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; padding: 12px; align-content: start;
}

/* Route card in library */
.lib-rt-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden;
  cursor: default; transition: border-color .12s, background .12s;
}
.lib-rt-card:hover { background: var(--bg-hover); border-color: var(--brand-glow); }
.lib-rt-thumb {
  width: 100%; aspect-ratio: 4/3;
  display: flex; align-items: center; justify-content: center;
  padding: 6px; color: var(--text-primary); min-height: 56px;
}
.lib-rt-footer {
  padding: 5px 7px; display: flex; align-items: center; gap: 4px;
  border-top: 1px solid var(--border-muted);
  background: var(--bg-surface);
}
.lib-rt-name {
  flex: 1; font-size: 11px; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.lib-rt-actions { display: flex; gap: 2px; flex-shrink: 0; }

/* Playbook card */
.lib-pb-card {
  background:var(--bg-elevated); border:1px solid var(--border);
  border-radius:var(--r-md); padding:12px;
  display:flex; align-items:center; gap:10px;
  transition:background .12s;
}
.lib-pb-card:hover { background:var(--bg-hover); }
.lib-pb-name { flex:1; font-size:14px; font-weight:600; color:var(--text-primary); }
.lib-pb-count { font-size:12px; color:var(--text-muted); }
.lib-pb-actions { display:flex; gap:4px; }
.lib-empty { color:var(--text-muted); font-size:13px; text-align:center; padding:24px 12px; }

/* Small icon button */
.lib-btn {
  width:28px; height:28px; border-radius:var(--r-sm);
  display:flex; align-items:center; justify-content:center;
  font-size:12px; cursor:pointer; border:none;
  background:var(--bg-hover); color:var(--text-secondary);
  transition:background .1s, color .1s;
}
.lib-btn:hover { color:var(--text-primary); }
.lib-btn.danger:hover { background:rgba(248,113,113,.2); color:var(--danger); }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .no-print { display: none !important; }
}


/* ============================================================
   Route count badge */
.rl-badge {
  position: absolute; top: 3px; right: 3px;
  background: var(--brand); color: white;
  font-size: 9px; font-weight: 700; font-family: var(--font-ui);
  border-radius: var(--r-full);
  padding: 1px 4px; line-height: 1.4;
  pointer-events: none;
}

/* Inline annotation editor */
#ann-editor-wrap {
  pointer-events: all;
}
#ann-editor-wrap input {
  display: block;
  font-family: 'Barlow Condensed', Impact, sans-serif !important;
  font-weight: 700 !important;
}
#ann-editor-wrap input::placeholder { opacity: 0.5; }

/* Snap Mode Buttons */
.snap-mode-row {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.snap-btn {
  flex: 1; min-width: 0;
  padding: 5px 4px;
  font-size: 11px; font-weight: 600;
  font-family: var(--font-ui);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .13s, color .13s, border-color .13s;
  white-space: nowrap;
}
.snap-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.snap-btn.active {
  background: var(--brand-subtle);
  border-color: var(--brand);
  color: var(--brand);
}

/* ============================================================
   Tag-Filter-Leiste (Playbook-Panel)
   ============================================================ */
.playbook-tag-filter {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 0 12px 8px;
}
.playbook-tag-filter:empty { display: none; }
.pb-tag-pill {
  padding: 2px 9px;
  border-radius: var(--r-full);
  font-size: 11px; font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .13s, color .13s, border-color .13s;
  white-space: nowrap;
}
.pb-tag-pill:hover { background: var(--bg-hover); color: var(--text-primary); }
.pb-tag-pill.active {
  background: var(--brand-subtle);
  border-color: var(--brand);
  color: var(--brand);
}

/* ── Play-Karte: Tag-Chips ──────────────────────────────────── */
.play-card-tags {
  display: flex; flex-wrap: wrap; gap: 3px;
  padding: 2px 8px 5px;
}
.play-card-tag {
  font-size: 9px; font-weight: 700;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  color: var(--text-muted);
  padding: 1px 5px;
  letter-spacing: .03em;
}

/* ── Play-Karte: Notiz-Vorschau ─────────────────────────────── */
.play-card-notes {
  font-size: 10px; color: var(--text-muted);
  padding: 0 8px 5px;
  line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}

/* ============================================================
   Animation-Overlay (Play-Abspielen)
   ============================================================ */
#anim-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 400;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
}
#anim-overlay svg {
  max-width: min(90vw, 720px);
  max-height: min(80vh, 560px);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
}
.anim-controls {
  display: flex; gap: 12px; align-items: center;
}
.anim-btn {
  padding: 8px 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-size: 13px; font-weight: 600; font-family: var(--font-ui);
  cursor: pointer;
  transition: background .13s;
}
.anim-btn:hover { background: var(--bg-hover); }
.anim-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.anim-btn.primary:hover { background: var(--brand-hover); }
.anim-speed-label {
  font-size: 12px; color: var(--text-muted); font-family: var(--font-ui);
}
#anim-speed {
  width: 90px; accent-color: var(--brand);
}

/* ============================================================
   Props-Feld: Notizen-Textarea & Tag-Eingabe
   ============================================================ */
.props-notes-area {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.5;
  padding: 6px 8px;
  resize: vertical;
  min-height: 60px;
  outline: none;
  transition: border-color .13s;
  box-sizing: border-box;
}
.props-notes-area:focus { border-color: var(--brand); }

.props-tags-wrap {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-top: 4px;
}
.props-tag-chip {
  display: flex; align-items: center; gap: 3px;
  background: var(--brand-subtle);
  border: 1px solid var(--brand);
  border-radius: var(--r-full);
  color: var(--brand);
  font-size: 10px; font-weight: 700;
  padding: 2px 8px 2px 10px;
  cursor: default;
}
.props-tag-chip button {
  background: none; border: none; cursor: pointer;
  color: var(--brand); font-size: 12px; line-height: 1;
  padding: 0; margin: 0; opacity: .7;
}
.props-tag-chip button:hover { opacity: 1; }
.props-tag-presets {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 4px;
}
.props-tag-preset {
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 10px; font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.props-tag-preset:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--brand);
}
.props-tag-preset.used {
  background: var(--brand-subtle);
  border-color: var(--brand);
  color: var(--brand);
}

/* ── Route-Farb-Zeile (Toolbar: Route zeichnen → Standardfarbe) ── */
.route-color-row {
  display: flex; align-items: center; gap: 5px;
  padding: 2px 8px 8px;
}
.route-color-label {
  font-size: 11px; color: var(--text-muted); font-weight: 600; flex-shrink: 0;
}
.route-color-dots {
  display: flex; gap: 3px; flex-wrap: wrap; flex: 1;
}
.mini-color-dot {
  width: 14px; height: 14px; border-radius: 50%;
  cursor: pointer; flex-shrink: 0;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18);
  transition: border-color .1s, transform .1s, box-shadow .1s;
}
.mini-color-dot:hover { transform: scale(1.18); }
.mini-color-dot.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand-glow), inset 0 0 0 1px rgba(0,0,0,0.18);
}
.route-color-picker {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--border); padding: 1px; background: transparent;
  flex-shrink: 0;
}
.route-color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.route-color-picker::-webkit-color-swatch { border: none; border-radius: 50%; }

/* ── Draw-Side Toggle (Toolbar: Spieler setzen → Offense / Defense) ── */
.draw-side-row {
  display: flex; gap: 4px; padding: 2px 8px 8px;
}
.draw-side-btn {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 5px; padding: 5px 4px;
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px; font-weight: 700; letter-spacing: .03em;
  transition: background .12s, color .12s, border-color .12s;
}
.draw-side-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
/* Offense aktiv: grün */
#ds-offense.active {
  background: rgba(74,222,128,0.12);
  border-color: rgba(74,222,128,0.4);
  color: var(--success);
}
/* Defense aktiv: rot */
#ds-defense.active {
  background: rgba(248,113,113,0.12);
  border-color: rgba(248,113,113,0.4);
  color: var(--danger);
}

/* Defense-Spieler-Badge (kleiner Indikator in der Spielerkarte) */
.player-side-badge {
  display: inline-block;
  font-size: 9px; font-weight: 700; font-family: var(--font-ui);
  border-radius: var(--r-full);
  padding: 1px 6px;
  letter-spacing: .04em;
  vertical-align: middle;
  margin-left: 4px;
}
.player-side-badge.offense {
  background: rgba(74,222,128,.15);
  color: var(--success);
  border: 1px solid rgba(74,222,128,.35);
}
.player-side-badge.defense {
  background: rgba(248,113,113,.15);
  color: var(--danger);
  border: 1px solid rgba(248,113,113,.35);
}


