/* ============================================================
   Bracket Visualization Styles — bracket.css
   Used by static/js/bracket-viz.js
   ============================================================ */

/* ----- Outer wrapper ----- */
.bv-wrap {
  overflow-x: auto;
  overflow-y: visible;
  padding: 1rem 0 1.5rem;
  position: relative;
}

/* ----- Tree layout (SE / DE) ----- */
.bv-tree {
  display: flex;
  flex-direction: row;
  gap: 0;
  align-items: flex-start;
  position: relative;
  min-width: max-content;
}

.bv-col {
  display: flex;
  flex-direction: column;
  min-width: 180px;
  max-width: 210px;
  flex: 0 0 auto;
}

.bv-col-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #7c3aed;
  padding: 0 0 .6rem .5rem;
  white-space: nowrap;
}

.bv-col-matches {
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
}

/* spacer divs inserted between cards to handle vertical centering */
.bv-spacer {
  flex: 1;
  min-height: 12px;
}

/* ----- Match card ----- */
.bv-card {
  background: #1a1f2e;
  border: 1px solid rgba(124, 58, 237, .3);
  border-radius: 7px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  text-decoration: none;
  display: block;
  position: relative;
  z-index: 1;
  margin: 0 8px;
}

.bv-card:hover {
  border-color: rgba(124, 58, 237, .7);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, .15);
}

.bv-card--bye {
  opacity: .45;
  cursor: default;
  pointer-events: none;
}

.bv-card--gf {
  border-color: rgba(234, 179, 8, .6);
  background: #1c1a0e;
  box-shadow: 0 0 12px rgba(234, 179, 8, .12);
}
.bv-card--gf:hover {
  border-color: rgba(234, 179, 8, 1);
}

.bv-card--pending  { border-left: 3px solid #64748b; }
.bv-card--ongoing  { border-left: 3px solid #f59e0b; }
.bv-card--completed { border-left: 3px solid #10b981; }
.bv-card--disputed { border-left: 3px solid #ef4444; }

/* ----- Team row inside card ----- */
.bv-team {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .35rem .6rem;
  min-height: 34px;
  gap: .4rem;
  color: #94a3b8;
  font-size: .82rem;
  line-height: 1.2;
}

.bv-team-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bv-team--winner .bv-team-name {
  color: #22d3ee;
  font-weight: 700;
}

.bv-team--loser .bv-team-name {
  color: #475569;
  text-decoration: line-through;
}

.bv-team--tbd .bv-team-name {
  color: #475569;
  font-style: italic;
}

.bv-score {
  font-size: .75rem;
  font-weight: 700;
  color: #e2e8f0;
  background: rgba(255,255,255,.06);
  border-radius: 3px;
  padding: .05rem .3rem;
  min-width: 18px;
  text-align: center;
}

.bv-team--winner .bv-score { color: #22d3ee; }
.bv-team--loser  .bv-score { color: #475569; }

/* divider between two team rows */
.bv-divider {
  height: 1px;
  background: rgba(124, 58, 237, .15);
  margin: 0;
}

/* bye card single row */
.bv-bye-row {
  padding: .4rem .6rem;
  font-size: .72rem;
  color: #475569;
  font-style: italic;
  min-height: 40px;
  display: flex;
  align-items: center;
}

/* match id / round info at bottom of card */
.bv-card-footer {
  padding: .2rem .6rem;
  font-size: .65rem;
  color: #4b5563;
  border-top: 1px solid rgba(255,255,255,.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bv-status-chip {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: .1rem .35rem;
  border-radius: 3px;
}
.bv-status-pending   { background: rgba(100,116,139,.2); color: #94a3b8; }
.bv-status-ongoing   { background: rgba(245,158,11,.15); color: #f59e0b; }
.bv-status-completed { background: rgba(16,185,129,.15); color: #10b981; }
.bv-status-disputed  { background: rgba(239,68,68,.15);  color: #ef4444; }
.bv-status-cancelled { background: rgba(100,116,139,.1); color: #64748b; }

/* ----- SVG connector overlay ----- */
.bv-connectors {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

/* ----- DE section labels ----- */
.bv-section-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #7c3aed;
  padding: 1.2rem 0 .5rem .5rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.bv-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(124,58,237,.25);
  margin-left: .5rem;
}

.bv-section-label--losers { color: #f59e0b; }
.bv-section-label--losers::after { background: rgba(245,158,11,.25); }
.bv-section-label--gf { color: #eab308; }
.bv-section-label--gf::after { background: rgba(234,179,8,.25); }

.bv-gf-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .5rem 0 1rem;
}

.bv-gf-inner {
  min-width: 220px;
  max-width: 280px;
  width: 100%;
}

/* ----- Standings table (RR / Swiss / League) ----- */
.bv-standings-wrap {
  margin-bottom: 1.5rem;
}

.bv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.bv-table th {
  text-align: left;
  padding: .45rem .6rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #7c3aed;
  border-bottom: 1px solid rgba(124,58,237,.2);
  white-space: nowrap;
}

.bv-table td {
  padding: .4rem .6rem;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255,255,255,.04);
  white-space: nowrap;
}

.bv-table tr:first-child td { color: #22d3ee; font-weight: 700; }
.bv-table tr:nth-child(2) td { color: #a78bfa; }
.bv-table tr:nth-child(3) td { color: #fb923c; }

.bv-table td.bv-rank {
  color: #4b5563;
  font-size: .72rem;
  font-weight: 700;
  width: 28px;
}
.bv-table td.bv-pts { color: #e2e8f0; font-weight: 700; }

/* ----- Head-to-head grid ----- */
.bv-hth-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.bv-hth-title {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #7c3aed;
  margin-bottom: .5rem;
}

.bv-hth-grid {
  border-collapse: collapse;
  font-size: .75rem;
}
.bv-hth-grid th,
.bv-hth-grid td {
  padding: .3rem .5rem;
  text-align: center;
  white-space: nowrap;
  min-width: 42px;
  border: 1px solid rgba(255,255,255,.05);
}
.bv-hth-grid th {
  color: #7c3aed;
  font-weight: 600;
  background: rgba(124,58,237,.08);
}
.bv-hth-grid td { color: #64748b; }
.bv-hth-cell--self  { background: rgba(255,255,255,.03); color: #1e293b; }
.bv-hth-cell--win   { background: rgba(16,185,129,.18); color: #34d399; font-weight: 700; }
.bv-hth-cell--loss  { background: rgba(239,68,68,.13); color: #f87171; }
.bv-hth-cell--tbd   { color: #374151; }
.bv-hth-row-label   { text-align: left !important; color: #94a3b8 !important; font-weight: 600; min-width: 110px; }

/* ----- Accordion (RR / Swiss rounds) ----- */
.bv-accordion {
  border: 1px solid rgba(124,58,237,.18);
  border-radius: 7px;
  margin-bottom: .6rem;
  overflow: hidden;
}

.bv-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem 1rem;
  cursor: pointer;
  background: rgba(124,58,237,.07);
  user-select: none;
  gap: .5rem;
}
.bv-accordion-header:hover { background: rgba(124,58,237,.13); }

.bv-accordion-label {
  font-size: .8rem;
  font-weight: 700;
  color: #c4b5fd;
  letter-spacing: .04em;
}

.bv-accordion-meta {
  font-size: .7rem;
  color: #64748b;
  margin-left: auto;
}

.bv-accordion-chevron {
  width: 14px;
  height: 14px;
  color: #7c3aed;
  flex-shrink: 0;
  transition: transform .15s;
}
.bv-accordion--open .bv-accordion-chevron { transform: rotate(180deg); }

.bv-accordion-body {
  display: none;
  padding: .75rem;
  gap: .6rem;
  flex-wrap: wrap;
}
.bv-accordion--open .bv-accordion-body { display: flex; }

/* cards inside accordion are smaller */
.bv-accordion-body .bv-card {
  min-width: 160px;
  max-width: 220px;
  flex: 0 0 auto;
  margin: 0;
}

/* ----- Swiss progress bar ----- */
.bv-progress-wrap {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}

.bv-progress-label {
  font-size: .75rem;
  color: #94a3b8;
  white-space: nowrap;
  flex-shrink: 0;
}

.bv-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(124,58,237,.15);
  border-radius: 3px;
  overflow: hidden;
}

.bv-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #22d3ee);
  border-radius: 3px;
  transition: width .4s;
}

/* ----- Two_Stage panels ----- */
.bv-two-stage-group,
.bv-two-stage-playoff {
  margin-bottom: 2rem;
}

.bv-playoff-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  border: 1px dashed rgba(124,58,237,.3);
  border-radius: 10px;
  color: #475569;
  font-size: .85rem;
  gap: .5rem;
}

.bv-playoff-placeholder svg {
  width: 40px;
  height: 40px;
  opacity: .3;
}

/* ----- Grand Final standalone ----- */
.bv-gf-card-wrap {
  display: flex;
  justify-content: center;
  padding: 0 1rem 1rem;
}

/* ----- Responsive / Mobile ----- */
@media (max-width: 640px) {
  .bv-col { min-width: 150px; }
  .bv-team { font-size: .75rem; }
  .bv-table { font-size: .75rem; }
}
