/* style.css */
body {
  font-family: 'Chakra Petch', sans-serif;
  background-color: #0b1120;
}

/* Base scrollbar */
.custom-scrollbar::-webkit-scrollbar { width: 8px; height: 8px; }
.custom-scrollbar::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

.bracket-container {
  cursor: grab;
}
.bracket-container:active {
  cursor: grabbing;
}

/* Perspective Grid Background */
.background-grid {
  background-image: 
    linear-gradient(rgba(0, 120, 215, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 120, 215, 0.15) 1px, transparent 1px);
  background-size: 60px 60px;
  background-position: center bottom;
  transform: perspective(600px) rotateX(60deg) scale(2);
  transform-origin: center 100%;
  opacity: 0.8;
}

/* Side Glows */
.side-glows {
  background: 
    radial-gradient(ellipse at 0% 50%, rgba(0, 120, 215, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 50%, rgba(255, 125, 0, 0.1) 0%, transparent 50%);
}

/* Glassmorphism Node */
.match-node {
  width: 100%;
  background: rgba(15, 20, 35, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 6px;
  position: relative;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  margin-bottom: 1rem;
}

.match-node.editable:hover {
  transform: translateY(-2px) scale(1.02);
  cursor: pointer;
  z-index: 10;
}

/* Upper Bracket Neon */
#upperBracket .match-node {
  border: 1px solid rgba(0, 120, 215, 0.4);
  box-shadow: 0 0 10px rgba(0, 120, 215, 0.1), inset 0 0 10px rgba(0, 120, 215, 0.05);
}
#upperBracket .match-node.editable:hover {
  border-color: rgba(0, 120, 215, 0.8);
  box-shadow: 0 0 20px rgba(0, 120, 215, 0.4), inset 0 0 15px rgba(0, 120, 215, 0.2);
}

/* Lower Bracket Neon */
#lowerBracket .match-node {
  border: 1px solid rgba(255, 125, 0, 0.4);
  box-shadow: 0 0 10px rgba(255, 125, 0, 0.1), inset 0 0 10px rgba(255, 125, 0, 0.05);
}
#lowerBracket .match-node.editable:hover {
  border-color: rgba(255, 125, 0, 0.8);
  box-shadow: 0 0 20px rgba(255, 125, 0, 0.4), inset 0 0 15px rgba(255, 125, 0, 0.2);
}

/* Header */
.match-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #777;
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  justify-content: space-between;
  letter-spacing: 1px;
}

/* Team Rows */
.team-row {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.team-row:last-child {
  border-bottom: none;
}

.team-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 8px 0 8px 12px;
  flex: 1;
  color: #bbb;
  transition: color 0.2s, text-shadow 0.2s;
}

/* Score styling */
.team-score {
  background: rgba(0, 0, 0, 0.4);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  font-weight: 700;
  font-size: 18px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #777;
  padding: 0 12px;
}

/* Conditional Styling for winners/losers */
.team-row.winner .team-name { 
  color: #fff; 
  text-shadow: 0 0 10px rgba(255,255,255,0.3); 
}
.team-score.score-winner { 
  color: #fff; 
  background: rgba(255,255,255,0.1); 
  text-shadow: 0 0 10px rgba(255,255,255,0.3);
}
.team-row.loser .team-name { color: #555; }
.team-score.score-loser { color: #555; background: rgba(0, 0, 0, 0.4); }
.tbd { color: #555; font-style: italic; }

/* Glowing Logos */
.team-row img, .team-row .flex-shrink-0 {
  margin-left: 12px;
  border-radius: 4px;
}
#upperBracket .team-row.winner img, #upperBracket .team-row.winner .flex-shrink-0 { 
  filter: drop-shadow(0 0 6px rgba(0, 120, 215, 0.8));
}
#lowerBracket .team-row.winner img, #lowerBracket .team-row.winner .flex-shrink-0 { 
  filter: drop-shadow(0 0 6px rgba(255, 125, 0, 0.8));
}

/* Champion Panel Gloss */
/* This ensures the Champion box generated in JS has the same glassmorphism vibe */
.champion-box {
  background: rgba(30, 30, 40, 0.65) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}

/* Removed ::after connector lines in favor of SVG paths */

/* Glowing Connector Path */
#upperBracket .match-node.has-winner::after {
  background: linear-gradient(90deg, rgba(0, 120, 215, 0.8), transparent);
  box-shadow: 0 0 8px rgba(0, 120, 215, 0.5);
}
#lowerBracket .match-node.has-winner::after {
  background: linear-gradient(90deg, rgba(255, 125, 0, 0.8), transparent);
  box-shadow: 0 0 8px rgba(255, 125, 0, 0.5);
}

/* Optional simple animated flow */
@keyframes flowLight {
  0% { opacity: 0.5; background-position: 0% 50%; }
  50% { opacity: 1; background-position: 100% 50%; }
  100% { opacity: 0.5; background-position: 0% 50%; }
}
.match-node.has-winner::after {
  background-size: 200% 200%;
  animation: flowLight 2s ease infinite;
}
