/* assets/css/bracket.css */

.bp-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(200px, 1fr)); /* Achtel, Viertel, Halb, Final, Champ */
  gap: 28px;
  align-items: start;
  position: relative;
  margin: 20px 0;
}

.bp-column { display:flex; flex-direction:column; align-items: stretch; }
.bp-col-title { font-weight:700; color: #e6f0ea; margin-bottom:10px; text-align:center; }
.bp-match {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.03));
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  cursor: pointer;
}
.bp-players { display:flex; justify-content:space-between; font-weight:600; }
.bp-players .vs { color: rgba(255,255,255,0.5); margin: 0 6px; font-weight:400; }
.bp-score { margin-top:6px; font-size:0.9rem; color: #cbd5c5; }
.bp-winner { margin-top:6px; color: #9ae6b4; font-weight:700; }

/* champion box on the rightmost column */
.bp-champion {
  text-align:center;
  padding:16px;
  border-radius:10px;
  background: linear-gradient(180deg,#fff9ed,#fff);
  color: #0b3a1f;
  border: 2px solid #f6ad55;
}

.bp-champion-label {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #8a5b13;
  font-weight: 700;
}

.bp-champion-trophy {
  font-size: 2.4rem;
  margin: 8px 0 10px;
}

.bp-champion-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0b3a1f;
}

.bp-column--champion {
  justify-content: center;
  align-items: center;
}

.bp-match--champion {
  position: relative;
  overflow: hidden;
  width: 220px;
  min-height: 150px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,248,225,0.98), rgba(255,252,244,0.96));
  border: 2px solid rgba(246,173,85,0.95);
  color: #0b3a1f;
  box-shadow: 0 0 0 2px rgba(246,173,85,0.2), 0 14px 36px rgba(0,0,0,0.28);
  cursor: default;
  animation: bpChampionGlow 3.2s ease-in-out infinite;
}

.bp-match--champion:hover {
  transform: none;
  background: linear-gradient(180deg, rgba(255,248,225,1), rgba(255,252,244,0.99));
}

.bp-champion-content {
  position: relative;
  z-index: 2;
  min-height: 116px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 10px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.93), rgba(251,246,235,0.96));
  box-shadow:
    inset 0 0 0 1px rgba(122,79,17,0.14),
    0 4px 14px rgba(255,255,255,0.18);
}

.bp-champion-fireworks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 18%, rgba(255,215,0,0.92) 0 3px, transparent 4px),
    radial-gradient(circle at 16% 82%, rgba(255,94,77,0.78) 0 2px, transparent 3px),
    radial-gradient(circle at 90% 18%, rgba(255,255,255,0.92) 0 2px, transparent 3px),
    radial-gradient(circle at 86% 84%, rgba(255,215,0,0.8) 0 3px, transparent 4px),
    radial-gradient(circle at 50% 10%, rgba(255,187,0,0.66) 0 2px, transparent 3px),
    radial-gradient(circle at 8% 50%, rgba(255,255,255,0.62) 0 2px, transparent 3px),
    radial-gradient(circle at 94% 52%, rgba(255,94,77,0.62) 0 2px, transparent 3px);
  background-size: 42px 42px, 36px 36px, 32px 32px, 42px 42px, 24px 24px, 24px 24px, 24px 24px;
  animation: bpFireworks 3s ease-in-out infinite;
  opacity: 0.42;
}

.bp-champion-fireworks::before,
.bp-champion-fireworks::after {
  content: '';
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.75;
  background:
    radial-gradient(circle, rgba(255,215,0,0.95) 0 3px, transparent 4px),
    radial-gradient(circle, rgba(255,255,255,0.9) 0 2px, transparent 3px),
    radial-gradient(circle, rgba(255,94,77,0.78) 0 2px, transparent 3px);
  background-size: 26px 26px, 20px 20px, 18px 18px;
}

.bp-champion-fireworks::before {
  top: -10px;
  left: -12px;
  animation: bpFireworkBurstLeft 2.6s ease-in-out infinite;
}

.bp-champion-fireworks::after {
  right: -14px;
  bottom: -12px;
  animation: bpFireworkBurstRight 2.9s ease-in-out infinite;
}

@keyframes bpFireworks {
  0%, 100% {
    transform: scale(0.94);
    opacity: 0.42;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.98;
  }
}

@keyframes bpFireworkBurstLeft {
  0%, 100% {
    transform: scale(0.72) rotate(0deg);
    opacity: 0.35;
  }
  50% {
    transform: scale(1.04) rotate(12deg);
    opacity: 0.88;
  }
}

@keyframes bpFireworkBurstRight {
  0%, 100% {
    transform: scale(0.76) rotate(0deg);
    opacity: 0.32;
  }
  50% {
    transform: scale(1.08) rotate(-10deg);
    opacity: 0.86;
  }
}

@keyframes bpChampionGlow {
  0%, 100% {
    box-shadow:
      0 0 0 2px rgba(246,173,85,0.2),
      0 14px 36px rgba(0,0,0,0.28),
      0 0 18px rgba(255,215,0,0.12);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(246,173,85,0.28),
      0 16px 38px rgba(0,0,0,0.3),
      0 0 28px rgba(255,215,0,0.24);
  }
}

/* responsive: scroll horizontally on small screens */
@media (max-width: 900px) {
  .bp-grid {
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 1fr);
    grid-template-columns: none;
    overflow-x: auto;
  }
}
/* ========== TURNIERBAUM (ZENTRIERT & VERJÜNGT) ========== */

body.bracket-page .container {
  max-width: 1680px;
}

.bracket-panel {
  overflow-x: auto;
  padding-left: 32px;
  padding-right: 32px;
}

#bracketWrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center; /* zentriert vertikal */
  width: max-content;
  min-width: 100%;
  margin: 0 auto;
  padding: 80px 24px;
  min-height: 100vh;
  box-sizing: border-box;
}

.bp-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 160px;
  position: relative;
}

.bp-column {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 80px;
  position: relative;
}

.bp-col-title {
  font-weight: 600;
  margin-bottom: 20px;
  color: #ffd700;
  font-size: 1.3em;
  text-shadow: 0 0 10px rgba(255,255,255,0.2);
}

.bp-match {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 12px 18px;
  text-align: center;
  width: 180px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
}

.bp-slot-label {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  margin-bottom: 8px;
}

.bp-match--placeholder {
  background: rgba(255,255,255,0.04);
  border-style: dashed;
  border-color: rgba(255,255,255,0.18);
  box-shadow: none;
}

.bp-match--placeholder:hover {
  background: rgba(255,255,255,0.04);
  transform: none;
}

.bp-placeholder-text {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.45);
  font-style: italic;
}

.bp-match:hover {
  background: rgba(255,255,255,0.15);
  transform: scale(1.05);
}

.bp-players {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bp-player-name {
  display: block;
}

.bp-player-handicap {
  display: block;
  font-weight: 400;
  color: rgba(255,255,255,0.78);
}

.bp-score {
  margin-top: 6px;
  font-size: 0.9em;
  color: #66ff99;
}

.bp-winner {
  margin-top: 4px;
  font-size: 0.85em;
  color: #ffd700;
}

.bp-svg {
  z-index: 0;
}

/* Runde optisch verjüngen */
.bp-column:nth-child(1) { margin-top: 0; }
.bp-column:nth-child(2) { margin-top: 40px; }
.bp-column:nth-child(3) { margin-top: 80px; }
.bp-column:nth-child(4) { margin-top: 120px; }
.bp-column:nth-child(5) { margin-top: 160px; }

/* responsive layout */
@media (max-width: 900px) {
  #bracketWrap {
    align-items: flex-start;
  }
  .bp-grid {
    flex-direction: column;
    align-items: center;
    gap: 60px;
  }
  .bp-column {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0 !important;
  }
  .bp-match {
    width: 130px;
  }
  .bp-match--champion {
    width: 180px;
  }
}
/* ========= MODAL ========= */
.modal.hidden { display: none; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-content {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.3);
  backdrop-filter: blur(8px);
  padding: 20px 30px;
  border-radius: 16px;
  color: #fff;
  text-align: center;
  width: 300px;
}
.modal-content h3 {
  margin-top: 0;
  margin-bottom: 10px;
}
.modal-content input,
.modal-content select {
  width: 100%;
  margin: 8px 0;
  padding: 8px;
  border-radius: 6px;
  border: none;
}
.modal-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}
.modal-actions button {
  flex: 1;
  margin: 0 5px;
  padding: 8px;
  background: #007bff;
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
}
.modal-actions button:hover {
  background: #339cff;
}
