/* ============================================
   TOURNAMENT LOBBY & BRACKET UI
   ============================================ */

.tournament-lobby-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tournament-lobby-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
}

.tournament-lobby-content {
  position: relative;
  width: 95%;
  max-width: 1000px;
  max-height: 90vh;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 20px;
  border: 2px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tournament-lobby-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tournament-lobby-header h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
}

.tournament-status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tournament-status-badge.status-upcoming { background: rgba(59, 130, 246, 0.3); color: #60a5fa; }
.tournament-status-badge.status-active { background: rgba(34, 197, 94, 0.3); color: #4ade80; }
.tournament-status-badge.status-completed { background: rgba(148, 163, 184, 0.3); color: #94a3b8; }

.tournament-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tournament-close-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  transform: rotate(90deg);
}

.tournament-lobby-tabs {
  display: flex;
  gap: 4px;
  padding: 16px 24px 0;
  background: rgba(0, 0, 0, 0.2);
}

.tournament-tab {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: all 0.2s;
}

.tournament-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.tournament-tab.active {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white;
  border-bottom: 2px solid #06d6a0;
}

.tournament-lobby-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.tournament-tab-content {
  display: none;
}

.tournament-tab-content.active {
  display: block;
}

/* Bracket Styles */
.bracket-container {
  overflow-x: auto;
  padding-bottom: 20px;
}

.bracket-rounds {
  display: flex;
  gap: 40px;
  min-width: max-content;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 200px;
}

.bracket-round-label {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: #06d6a0;
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.bracket-matches {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.bracket-match {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px;
  min-width: 200px;
}

.bracket-match.completed {
  border-color: rgba(6, 214, 160, 0.3);
}

.bracket-match-player {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  margin-bottom: 4px;
  transition: all 0.2s;
}

.bracket-match-player:last-of-type {
  margin-bottom: 0;
}

.bracket-match-player.winner {
  background: linear-gradient(135deg, rgba(6, 214, 160, 0.2), rgba(8, 145, 178, 0.2));
  border: 1px solid rgba(6, 214, 160, 0.5);
}

.player-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
}

.player-score {
  font-size: 0.9rem;
  font-weight: 700;
  color: #06d6a0;
}

.bracket-match-vs {
  text-align: center;
  font-size: 0.7rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  padding: 4px 0;
}

.bracket-empty {
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
}

.bracket-empty p {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.empty-hint {
  font-size: 0.85rem !important;
  color: #475569 !important;
}

/* Tournament Chat */
.tournament-chat {
  display: flex;
  flex-direction: column;
  height: 500px;
}

.tournament-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  margin-bottom: 16px;
}

.chat-message {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.chat-message-content {
  flex: 1;
  min-width: 0;
}

.chat-message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.chat-username {
  font-weight: 600;
  color: white;
  font-size: 0.85rem;
}

.chat-timestamp {
  font-size: 0.7rem;
  color: #64748b;
}

.chat-message-text {
  margin: 0;
  font-size: 0.9rem;
  color: #cbd5e1;
  word-wrap: break-word;
}

.tournament-chat-input {
  display: flex;
  gap: 12px;
}

.tournament-chat-input input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: white;
  font-size: 0.9rem;
}

.tournament-chat-input input:focus {
  outline: none;
  border-color: #06d6a0;
}

.tournament-chat-input button {
  padding: 12px 24px;
}

/* Tournament Rules */
.tournament-rules {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tournament-info-section {
  background: rgba(255, 255, 255, 0.05);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tournament-info-section h4 {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 700;
  color: white;
}

.tournament-info-section p {
  margin: 0;
  color: #cbd5e1;
  line-height: 1.6;
}

.tournament-info-section ul {
  margin: 0;
  padding-left: 24px;
  color: #cbd5e1;
  line-height: 1.8;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 0.75rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.info-value {
  font-size: 0.95rem;
  color: white;
  font-weight: 600;
}

/* Participants */
.tournament-participants {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.participants-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.participants-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
}

.participant-count {
  padding: 6px 14px;
  background: rgba(6, 214, 160, 0.2);
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #06d6a0;
}

.participants-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .tournament-lobby-content {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .tournament-lobby-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .bracket-rounds {
    gap: 20px;
  }

  .bracket-round {
    min-width: 180px;
  }

  .bracket-match {
    min-width: 180px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}
