/* tournament-bracket */
#bracket {
  position: relative;
  width: 100%;
}

.match {
  position: relative;
  width: 180px;
  height: 72px;
  background: #e8f1ff;
  border: 1.5px solid #3f73c3;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.1s;
}

.match:hover {
  transform: scale(1.03);
  background: #dce7ff;
}

/* ===== Player Rows ===== */
.player-row {
  display: flex;
  flex-direction: row;
  height: 40%;
  border-bottom: 1px solid #d0d8ef;
}

.player-row:last-child {
  border-bottom: none;
}

.player-name {
  flex: 7;
  display: flex;
  align-items: center;
  padding-left: 4px;
  font-size: 12px;
  color: #333;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.player-score {
  flex: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  background: #f1f5ff;
  border-left: 1px solid #c5d2f0;
}

.scoreRow span {
  font-weight: 600;
}

.scoreRow span.playerName.winnerName {
  color: #f5c857;
}

.status {
  height: 20%;
  font-size: 11px;
  text-align: center;
  line-height: 14px;
  background: #dfe9ff;
  color: #2c4d8a;
  border-top: 1px solid #c5d2f0;
  font-weight: 600;
}

.connector {
  position: absolute;
  background: #777;
}

.round-label {
  position: absolute;
  font-weight: bold;
  font-size: 14px;
  color: white;
  z-index: 5;
  background: #6e8cfb;
  padding: 2px 40px;
  border-radius: 4px;
}

.bye {
  background: #e8f1ff;
  border: 1.5px solid #3f73c3;
  color: #888;
}

/* ===== Start Time Label ===== */
.start-time-label {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: #2c4d8a;
  background: #f2f6ff;
  border: 1px solid #c5d2f0;
  border-radius: 4px;
  padding: 2px 6px;
  line-height: 1.4;
  font-weight: 500;
  white-space: nowrap;
}

/* ===== Modal ===== */
#modal {
  display: none;
  position: fixed;
  z-index: 100;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  align-items: center;
  justify-content: center;
}

#modalContent {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  width: 480px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  position: relative;
}

#modal h2 {
  text-align: center;
  margin-top: 0;
  color: #2c4d8a;
}

.scoreRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
  font-size: 15px;
  font-weight: 600;
}

.scoreRow span {
  flex: 1;
  text-align: center;
}

.centerText {
  color: #3f73c3;
  font-weight: bold;
}

#closeBtn {
  position: absolute;
  top: 8px;
  right: 12px;
  background: #3f73c3;
  color: #fff;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}

#closeBtn:hover {
  background: #335ea1;
}
/* Giữ nguyên winner style */
.player-row.winner {
  background: linear-gradient(90deg, #d4edda, #f8f9fa);
  font-weight: bold;
  color: #155724;
}

/* Sửa highlight để có độ đặc hiệu cao hơn */
.player-row.highlight {
  background-color: #6e8cfb !important;
  border: 1px solid #6e8cfb;
  transition: background-color 0.25s ease;
}

/* Khi vừa là winner vừa highlight */
.player-row.winner.highlight {
  background: linear-gradient(90deg, #6e8cfb, #6e8cfb) !important;
  border: 1px solid #6e8cfb;
}
.player-name {
  cursor: pointer;
}
.player-row.winner {
  background-color: #13e471ec;
  /* border-left: 3px solid #28a745; */
}

#bracket {
  transition: transform 0.1s ease-out;
  transform-origin: 0 0;
  width: 100%;
  height: 100vh;
  position: relative;
  overflow: visible;
}

/* body {
  overflow: auto;
  margin: 0;
  padding: 20px;
  height: 100vh;
} */

.sub-tab-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.sub-tab {
  padding: 8px 16px;
  background: #e0e0e0;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.3s;
}

.sub-tab.active {
  background: #007bff;
  color: #fff;
  font-weight: bold;
}

/* tournament-bracket.css */

/* Tab bar cho bracket */
.bracket-tab-bar {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
  background: #f8f9fa;
  border-radius: 8px 8px 0 0;
  padding: 0 10px;
}

.bracket-tab {
  padding: 12px 24px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Kanit", sans-serif;
}

.bracket-tab:hover {
  color: #1890ff;
  background: rgba(24, 144, 255, 0.05);
}

.bracket-tab.active {
  color: #1890ff;
  border-bottom-color: #1890ff;
  background: white;
}
.bracket-table-select {
  min-width: 150px;
}
.final-board-btn:hover {
  background-color: #2196F3;
}

.final-board-btn:active {
  background-color: #2196F3;
}

.final-board-btn.active {
  background-color: #2196F3;
}
.bracket-table-select select {
  width: 14%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background-color: white;
  cursor: pointer;
}

.bracket-table-select select:focus {
  outline: none;
  border-color: #0066cc;
  /* box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2); */
}
/* Thêm vào file CSS của bracket */

/* Hiệu ứng khi điểm được cập nhật */
.score-updated {
  animation: scorePulse 1s ease-in-out;
}

@keyframes scorePulse {
  0% { background-color: transparent; }
  50% { background-color: rgba(76, 175, 80, 0.2); }
  100% { background-color: transparent; }
}

/* Style cho winner/loser */
.player-row.winner {
  background-color: rgba(76, 175, 80, 0.1);
  border-left: 3px solid #4CAF50;
}

.player-row.loser {
  background-color: rgba(244, 67, 54, 0.1);
  border-left: 3px solid #F44336;
}

/* Style cho match đang diễn ra */
.match.live {
  box-shadow: 0 0 0 2px #FF9800;
}

/* Thông báo real-time */
.real-time-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #4CAF50;
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  z-index: 1000;
  animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
/* Responsive */
@media (max-width: 768px) {
  .bracket-tab-bar {
    padding: 0;
  }

  .bracket-tab {
    flex: 1;
    border-bottom: none;
    border-left: 3px solid transparent;
    font-size: 0.75rem;
  }

  .bracket-tab.active {
    border-left-color: #1890ff;
    border-bottom-color: transparent;
  }
}
