/* ═══════════════════════════════════════════════════════════════
   WM 2026 — MANNSCHAFTEN
   Pitch Visualisierung + Kader-Seite
   UI/UX: touch-target ≥44px, spring-physics, color-contrast 4.5:1
   ═══════════════════════════════════════════════════════════════ */

/* ── Team Grid ──────────────────────────────────────────────── */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.team-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-3);
  cursor: pointer;
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 200ms ease,
              border-color 160ms ease;
  text-align: center;
  min-height: 100px;
  /* UI/UX: touch-target minimum */
  min-width: 44px;
  will-change: transform;
}

.team-card:hover {
  transform: perspective(400px) translateZ(8px) scale(1.04);
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.team-card:active {
  transform: perspective(400px) translateZ(3px) scale(1.01);
  transition-duration: 80ms;
}

.team-card-flag {
  font-size: 2rem;
  line-height: 1;
  /* Kein Kreis, direkte Flagge */
}

.team-card-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--fg-1);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.team-card-group {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--fg-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Status Badges */
.team-card-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
}

.team-card-badge.confirmed {
  background: rgba(34,197,94,0.15);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.3);
}

.team-card-badge.pending {
  background: rgba(251,191,36,0.12);
  color: #fbbf24;
  border: 1px solid rgba(251,191,36,0.25);
}

/* Gruppe-Filter-Tabs */
/* ── Toolbar: Suche + Gruppenfilter ── */
.teams-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

/* Suche: volle Breite, gleiche Optik wie Spiele-Suche */
.teams-search-box {
  min-width: 100%;
}

.teams-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.teams-no-results {
  grid-column: 1 / -1;
  padding: 40px 0;
  color: var(--fg-3);
  font-size: 0.9rem;
  text-align: center;
}

.teams-filter-btn {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
  color: var(--fg-2);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms;
  min-height: 36px; /* Touch target */
}

.teams-filter-btn:hover,
.teams-filter-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--fg-on-yellow, #002b1a);
}

/* ── Team Detail View ───────────────────────────────────────── */
.team-detail {
  animation: team-detail-in 280ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes team-detail-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.team-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}

.team-detail-flag {
  font-size: 3rem;
  line-height: 1;
  flex-shrink: 0;
}

.team-detail-meta { flex: 1; }

.team-detail-meta h2 {
  margin: 0 0 4px;
  font-size: 1.6rem;
  font-weight: 800;
}

.team-detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.team-detail-group {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(253,211,1,0.1);
  border: 1px solid rgba(253,211,1,0.25);
  padding: 2px 10px;
  border-radius: var(--r-pill);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.team-detail-status {
  font-size: 0.72rem;
  padding: 2px 10px;
  border-radius: var(--r-pill);
}
.team-detail-status.confirmed {
  background: rgba(34,197,94,0.12);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.25);
}
.team-detail-status.pending {
  background: rgba(251,191,36,0.1);
  color: #fbbf24;
  border: 1px solid rgba(251,191,36,0.22);
}

.team-detail-note {
  font-size: 0.82rem;
  color: var(--fg-2);
  margin-top: 6px;
  line-height: 1.45;
}

/* Back Button */
.team-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 8px 16px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
  color: var(--fg-2);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms, color 150ms;
  min-height: 44px; /* Touch target */
}
.team-back-btn:hover { background: var(--panel-strong); color: var(--fg-1); }

/* ── Pitch Visualization ─────────────────────────────────────── */
/* UI/UX §7: spring-physics Hover auf Spieler-Chips */

.pitch-section {
  margin-bottom: 32px;
}

.pitch-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.pitch-section-title {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.pitch-formation-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(253,211,1,0.1);
  border: 1px solid rgba(253,211,1,0.2);
  padding: 3px 12px;
  border-radius: var(--r-pill);
}

.pitch-tactics-note {
  font-size: 0.8rem;
  color: var(--fg-2);
  line-height: 1.5;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--r-2) var(--r-2) 0;
}

/* ── Das Spielfeld ─────────────────────────────────────── */
.pitch {
  position: relative;
  width: 100%;
  max-width: 520px;
  /* Aspect ratio 68:105 (Feldbreite:Feldlänge) — etwas kompakter */
  aspect-ratio: 7 / 10;
  margin: 0 auto;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    #1a5c2e 0%,
    #1e6633 14.3%,
    #1a5c2e 14.3%,
    #1a5c2e 28.6%,
    #1e6633 28.6%,
    #1e6633 42.9%,
    #1a5c2e 42.9%,
    #1a5c2e 57.2%,
    #1e6633 57.2%,
    #1e6633 71.5%,
    #1a5c2e 71.5%,
    #1a5c2e 85.8%,
    #1e6633 85.8%
  );
  box-shadow: 0 4px 24px rgba(0,0,0,0.5),
              inset 0 0 0 3px rgba(255,255,255,0.12);
}

/* Mittelline */
.pitch::before {
  content: "";
  position: absolute;
  left: 5%;
  right: 5%;
  top: 50%;
  height: 1.5px;
  background: rgba(255,255,255,0.5);
  transform: translateY(-50%);
}

/* Mittelkreis */
.pitch::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.45);
}

/* Strafräume als CSS via ::before/::after auf Pseudo-Elementen */
.pitch-markings {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Oberer Strafraum */
.pitch-box-top {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 4%;
  height: 21%;
  border: 1.5px solid rgba(255,255,255,0.45);
  border-top: none;
}

/* Kleines Tor oben */
.pitch-box-top::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 30%;
  height: 28%;
  border: 1.5px solid rgba(255,255,255,0.35);
  border-top: none;
}

/* Oberer Halbkreis */
.pitch-box-top::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translateX(-50%) translateY(50%);
  width: 30%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.3);
  border-top: none;
  border-left: none;
  border-right: none;
  clip-path: ellipse(50% 50% at 50% 0%);
}

/* Unterer Strafraum */
.pitch-box-bottom {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 4%;
  height: 21%;
  border: 1.5px solid rgba(255,255,255,0.45);
  border-bottom: none;
}

.pitch-box-bottom::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 30%;
  height: 28%;
  border: 1.5px solid rgba(255,255,255,0.35);
  border-bottom: none;
}

/* Feldlinien links & rechts */
.pitch-outline {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 4px;
  pointer-events: none;
}

/* Mittelpunkt */
.pitch-center-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  transform: translate(-50%, -50%);
}

/* ── Spieler-Chip ───────────────────────────────────────── */
.player-chip {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: default;
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
  z-index: 2;
}

.player-chip:hover {
  transform: translate(-50%, -50%) scale(1.22) translateZ(0);
  z-index: 10;
}

/* ── Wrapper: positioniert Badge AUSSERHALB des overflow:hidden Kreises ── */
.player-chip-wrap {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

/* ── Chip-Kreis mit Foto oder Silhouette ── */
.player-chip-circle {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  /* Silhouette als Standard-Hintergrund (FIFA-Style) */
  background-color: #1c2f3e;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Crect width='100' height='100' fill='%231c2f3e'/%3E%3Ccircle cx='50' cy='36' r='20' fill='%234a6478'/%3E%3Cellipse cx='50' cy='92' rx='34' ry='28' fill='%234a6478'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center top;
  box-shadow: 0 2px 8px rgba(0,0,0,0.55),
              0 0 0 2px rgba(255,255,255,0.18);
  flex-shrink: 0;
  transition: box-shadow 200ms ease;
}

/* GK: orangefarbener Ring */
.player-chip[data-role="TW"] .player-chip-circle {
  box-shadow: 0 2px 8px rgba(0,0,0,0.55),
              0 0 0 2.5px #FF7C3A;
}

/* Foto geladen → kein fallback-background mehr */
.player-chip-circle.has-photo {
  background-image: none;
}

/* Foto-Element innerhalb des Kreises */
.player-chip-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  border-radius: 50%;
}

/* Trikot-Nummer Badge — relativ zu .player-chip-wrap (NICHT zum Kreis!)
   So wird er nie von overflow:hidden abgeschnitten.
   UI/UX §6: color-accessible-pairs ≥4.5:1, number-tabular, weight 900 */
.player-chip-number {
  position: absolute;
  bottom: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 10px;             /* Pill — passt sich an 1- & 2-stellige Zahlen an */
  background: #0d1b2a;             /* Dark Navy — Kontrast ~10:1 mit Gold */
  color: #FDD301;                  /* Gold — WCAG AAA */
  font-size: 10px;
  font-weight: 900;
  font-family: var(--font-condensed, 'Oswald', sans-serif);
  font-variant-numeric: tabular-nums;  /* UI/UX §6: number-tabular */
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid rgba(255,255,255,0.95);  /* Weißer Ring — trennt von jedem Hintergrund */
  box-shadow: 0 2px 4px rgba(0,0,0,0.65);
  z-index: 4;
  white-space: nowrap;
}

/* GK: Orange — visuell sofort erkennbar */
.player-chip[data-role="TW"] .player-chip-number {
  background: #c74f00;
  color: #fff;
}

/* Name + Verein unter dem Chip */
.player-chip-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.player-chip-name {
  font-size: 0.58rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0,0,0,0.95), 0 0 8px rgba(0,0,0,0.8);
  line-height: 1.1;
  letter-spacing: 0.01em;
}

/* Hover-Tooltip: Voller Name + Verein */
.player-chip-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5, 10, 18, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 6px 10px;
  pointer-events: none;
  z-index: 30;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 150ms ease;
  backdrop-filter: blur(8px);
  min-width: 120px;
  text-align: center;
}

.player-chip:hover .player-chip-tooltip {
  opacity: 1;
}

.player-chip-tooltip-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  display: block;
}

.player-chip-tooltip-club {
  font-size: 0.62rem;
  color: rgba(255,255,255,0.6);
  display: block;
  margin-top: 2px;
}

/* Pending State: kein Kader */
.pitch-pending {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  color: rgba(255,255,255,0.4);
  font-size: 0.85rem;
  text-align: center;
  padding: 24px;
}

.pitch-pending-icon {
  font-size: 2.5rem;
  opacity: 0.5;
}

/* ── Ersatzbank ─────────────────────────────────────────── */
.bench-section {
  margin-top: 16px;
}

.bench-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 10px;
}

.bench-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bench-player {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
  font-size: 0.76rem;
  color: var(--fg-2);
  white-space: nowrap;
  transition: background 150ms, color 150ms;
}

.bench-player:hover {
  background: var(--panel-strong);
  color: var(--fg-1);
}

.bench-player-pos {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Kader-Liste ────────────────────────────────────────── */
.squad-section {
  margin-top: 24px;
}

.squad-section-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}

.squad-position-group {
  margin-bottom: 16px;
}

.squad-pos-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.squad-players {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.squad-player-chip {
  font-size: 0.78rem;
  padding: 4px 10px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  color: var(--fg-1);
  transition: background 150ms;
}

.squad-player-chip.is-starter {
  background: rgba(253,211,1,0.1);
  border-color: rgba(253,211,1,0.3);
  color: var(--gold);
  font-weight: 700;
}

/* ── Quellen ─────────────────────────────────────────────── */
.team-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.team-source-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  width: 100%;
}

.team-source-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  color: var(--wm-blue-bright, #1E78C8);
  border: 1px solid rgba(30,120,200,0.3);
  padding: 3px 10px;
  border-radius: var(--r-pill);
  text-decoration: none;
  transition: background 150ms;
}

.team-source-link:hover {
  background: rgba(30,120,200,0.1);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .teams-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .team-card { padding: 12px 8px 10px; }
  .team-card-flag { font-size: 1.6rem; }
  .pitch { max-width: 100%; }
  .player-chip-circle { width: 28px; height: 28px; font-size: 0.6rem; }
  .player-chip-name { font-size: 0.52rem; max-width: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .team-card:hover,
  .player-chip:hover,
  .team-detail { transform: none; animation: none; }
}
