/* Tournament System Styles */

.tournaments-dashboard {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
}

.tournaments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tournaments-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

/* Stat Pills */
.stat-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: #e5e7eb;
  color: #374151;
}

.active-pill { background: #fecaca; color: #991b1b; }
.gold-pill { background: #fef3c7; color: #92400e; }

/* Tournament Cards */
.tournament-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.tournament-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  background: #fff;
}

.tournament-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.tournament-card.active { border-left: 4px solid #ef4444; }
.tournament-card.registration { border-left: 4px solid #3b82f6; }
.tournament-card.round_break { border-left: 4px solid #f59e0b; }
.tournament-card.completed { border-left: 4px solid #10b981; }

.tournament-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.tournament-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.tournament-format {
  font-size: 0.8rem;
  color: #6b7280;
}

.tournament-winner {
  font-size: 0.9rem;
  color: #b45309;
  font-weight: 600;
}

.tournament-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.tournament-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.registration { background: #dbeafe; color: #1e40af; }
.status-badge.active { background: #fee2e2; color: #991b1b; }
.status-badge.round_break { background: #fef3c7; color: #92400e; }
.status-badge.completed { background: #d1fae5; color: #065f46; }

.tournament-creator {
  font-size: 0.8rem;
  color: #9ca3af;
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: #9ca3af;
  font-size: 0.95rem;
}

/* Tournament Detail Overlay */
.tournament-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.tournament-detail {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 700px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.detail-header h2 { margin: 0; }

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
  padding: 0.5rem;
}

.close-btn:hover { color: #111; }

.detail-info {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: #4b5563;
}

.detail-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.detail-section {
  margin-bottom: 1.5rem;
}

.detail-section h3 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

/* Round Scores */
.round-scores {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background: #f9fafb;
}

.score-row.leading {
  background: #fef3c7;
}

.score-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(59, 130, 246, 0.1);
  z-index: 0;
  transition: width 0.3s;
}

.score-row > * { position: relative; z-index: 1; }

.rank {
  font-weight: 700;
  color: #6b7280;
  min-width: 2rem;
}

.name { flex: 1; font-weight: 500; }
.score { font-weight: 700; color: #1e40af; }

/* Participants Grid */
.participants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.participant-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: #f9fafb;
  font-size: 0.85rem;
}

.participant-card.eliminated {
  opacity: 0.5;
  text-decoration: line-through;
}

.p-rank { font-weight: 700; color: #b45309; }
.p-name { font-weight: 600; }
.p-score { color: #1e40af; }
.p-wins { color: #059669; }
.p-elim { color: #dc2626; font-size: 0.8rem; }
.p-prize { color: #b45309; font-weight: 600; }

/* Dark Mode */
.dark-mode .tournament-card {
  background: #1f2937;
  border-color: #374151;
}

.dark-mode .tournament-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.dark-mode .pill { background: #374151; color: #d1d5db; }
.dark-mode .active-pill { background: #7f1d1d; color: #fca5a5; }
.dark-mode .gold-pill { background: #78350f; color: #fde68a; }

.dark-mode .tournament-detail {
  background: #1f2937;
  color: #e5e7eb;
}

.dark-mode .close-btn { color: #9ca3af; }
.dark-mode .close-btn:hover { color: #f9fafb; }

.dark-mode .score-row { background: #111827; }
.dark-mode .score-row.leading { background: #422006; }
.dark-mode .participant-card { background: #111827; }

.dark-mode .detail-info { color: #9ca3af; }
.dark-mode .tournament-meta { color: #9ca3af; }
.dark-mode .tournament-creator { color: #6b7280; }
.dark-mode .empty-state { color: #6b7280; }

/* Mobile Responsive */
@media (max-width: 768px) {
  .tournaments-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .tournament-meta {
    flex-direction: column;
    gap: 0.25rem;
  }

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

  .tournament-detail {
    max-height: 90vh;
    border-radius: 12px;
  }

  .detail-info {
    flex-direction: column;
    gap: 0.25rem;
  }
}
