/* Match Display */
.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.match-card {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--color-lines);
  border-radius: 4px;
  overflow: hidden;
  background-color: var(--color-bg);
  height: 5rem;
}

.match-number {
  flex-shrink: 0;
  width: 5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-bg-secondary);
  font-weight: bold;
  font-size: 1.4rem;
  border-right: 1px solid var(--color-lines);
}

.match-players {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.match-player {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 1rem;
  font-size: 1.6rem;
  border-bottom: 1px solid var(--color-lines);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.player-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.match-player:last-child {
  border-bottom: none;
}

/* Large screen: side-by-side players */
@media (min-width: 750px) {
  .match-players {
    flex-direction: row;
  }
  
  .match-player {
    border-bottom: none;
    border-right: 1px solid var(--color-lines);
  }
  
  .match-player:last-child {
    border-right: none;
  }
}

.match-player--winner {
  font-weight: bold;
  background-color: var(--color-bg);
}

.match-player--winner:after {
  content: "✓";
  color: var(--color-text-success);
  font-weight: bold;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.match-player--loser {
  color: var(--color-text-muted);
}

.match-player--bye {
  font-style: italic;
  color: var(--color-text-muted);
}

.match-player--pending {
  background-color: var(--color-bg);
}

/* Match Score Display */
.match-score {
  margin-left: 0 0.3rem;
  font-weight: normal;
  color: var(--color-text-muted);
}

.match-score--winner {
  color: var(--color-text);
}

.match-score--loser {
  color: var(--color-text-muted);
}

.match-score--tie {
  color: var(--color-text);
}

.match-player {
  position: relative;
}

.match-player:has(.match-score) {
  padding-right: 3rem;
}

.match-score {
  position: absolute;
  right: 1rem;
}

/* Desktop: Position scores toward center */
@media (min-width: 750px) {
  .match-score {
    position: absolute;
    right: 1rem;
  }

  .match-player + .match-player:has(.match-score) {
    padding-right: 1rem;
    padding-left: 3rem;
  }

  .match-player + .match-player .match-score {
    right: auto;
    left: 1rem;
  }
}

.match-actions {
  flex-shrink: 0;
  width: 5rem;
  border-left: 1px solid var(--color-lines);
}

.match-edit-btn {
  width: 100%;
  height: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background-color: var(--color-bg-secondary);
  cursor: pointer;
  text-decoration: none;
  color: var(--color-text);
}

.match-edit-btn:hover {
  background-color: var(--color-primary);
  color: var(--color-bg);
}

.match-edit-btn:before {
  content: "✎";
  font-size: 1.4rem;
}

/* Player Management Cards */
/* Players List */
.players-list {
  list-style: none;
  margin: 2rem 0;
  padding: 0;
  border: 1px solid var(--color-lines);
  border-radius: 4px;
  background-color: var(--color-bg);
}

.player-item {
  margin: 0;
  padding: 1rem;
  border-bottom: 1px solid var(--color-lines);
  transition: background-color 0.2s;
}

.player-item:last-child {
  border-bottom: none;
}

.player-item:hover {
  background-color: var(--color-bg-secondary);
}

/* Line 1: Name (username) <spacer> Registration Date */
.player-line-1 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.player-name {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--color-text-active);
  flex: 1;
  min-width: 0;
}

.player-username {
  color: var(--color-text-muted);
  font-size: 1.2rem;
  font-weight: normal;
  margin-left: 0.5rem;
}

.player-guest-badge {
  font-size: 1.6rem;
  font-weight: normal;
  color: var(--color-primary);
  margin-left: 0.5rem;
}

.player-guest-badge:before {
  content: "(G)";
}

.player-registered {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  white-space: nowrap;
  margin-left: 1rem;
}

/* Line 2: Status <spacer> Action Button */
.player-line-2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-status {
  font-size: 1.1rem;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  white-space: nowrap;
}

.player-status--active {
  background-color: var(--color-text-success);
  color: var(--color-bg);
}

.player-status--dropped {
  background-color: var(--color-text-danger);
  color: var(--color-text-active);
}

.player-actions {
  flex-shrink: 0;
}

.player-actions form {
  margin: 0;
}

.player-actions .button {
  font-size: 1.1rem;
  padding: 0.3rem 0.8rem;
  height: auto;
  line-height: 1.2;
}

/* Mobile optimizations */
@media (max-width: 549px) {
  .player-line-1 {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .player-registered {
    margin-left: 0;
  }

  .player-actions .button {
    font-size: 1.2rem;
    padding: 0.5rem 1rem;
  }
}

/* Unmatched Players Section */
.unmatched-players-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-lines);
}

.unmatched-players-section h3 {
  margin: 0 0 1.5rem 0;
  color: var(--color-text);
  font-size: 1.8rem;
}

.unmatched-players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.unmatched-player-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border: 1px solid var(--color-lines);
  border-radius: 4px;
  background-color: var(--color-bg-secondary);
}

.unmatched-player-card .player-name {
  font-weight: bold;
  font-size: 1.4rem;
  flex-grow: 1;
}

.unmatched-player-card .player-seed {
  font-size: 1.2rem;
  color: var(--color-text-muted);
  margin-left: 0.5rem;
}

.unmatched-player-card .player-guest-badge {
  font-size: 1.1rem;
  margin-left: 0.5rem;
}

/* Pending Matches Section */
.match-info {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 1.2rem;
  margin-top: 0.5rem;
}

/* Stage and Round Selection */
.stage-round-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.stage-round-item {
  flex: 1;
}

/* Mobile: Stack vertically */
@media (max-width: 549px) {
  .stage-round-controls {
    flex-direction: column;
    gap: 1.5rem;
  }

  .stage-round-item {
    flex: none;
  }
}

.seeding-confirmation {
    max-width: 600px;
    margin: 0 auto;
}

.seeding-controls {
    margin-bottom: 1rem;
    text-align: center;
}

.seeding-actions {
    margin-top: 2rem;
    text-align: center;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

tr.with-actions td {
  border-bottom: none;
}

.actions-column {
    padding: 0;
}
.actions-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1rem;
  justify-content: flex-start;
}

/* Tournament Detail Tab Navigation */
.nav.short {
  justify-content: center;
}

/* Modal Form Elements */
.modal #scoreInputs {
  margin-top: 1rem;
}

.modal #scoreInputs h4 {
  margin-bottom: 1rem;
  text-align: center;
  color: var(--color-text-muted);
}

.modal #scoreInputs > div {
  display: flex;
  gap: 1rem;
}

.modal #scoreInputs > div > div {
  flex: 1;
  min-width: 0;
}

.modal #scoreInputs input {
  width: 100%;
}

.modal #scoreInputs label {
  width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal .modal-actions {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.modal .modal-danger-zone {
  margin-top: 2rem;
}

.modal .modal-danger-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.modal #addMatchForm .modal-actions {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.modal #playerScoreInputs {
  margin-top: 1rem;
  display: none;
}

.modal #playerScoreInputs h4 {
  margin-bottom: 1rem;
  text-align: center;
  color: var(--color-text-muted);
}

.modal #playerScoreInputs > div {
  display: flex;
  gap: 1rem;
}

.modal #playerScoreInputs > div > div {
  flex: 1;
}

.modal #playerScoreInputs input {
  width: 100%;
}

/* Subheading Actions */
.subheading-separator {
  margin: 0 0.5rem;
  color: var(--color-text-muted);
}

/* Tournament Admin Page */
.tournament-logs {
  margin-top: 2rem;
  font-family: monospace;
  font-size: 0.9rem;
  line-height: 1.4;
}

.log-entry {
  padding: 0.25rem 0;
}

/* Standings */
.standings-table th, .standings-table td {
  white-space: nowrap;
}

/* Admin Management Section */
.admin-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-lines);
}

.admin-item:last-child {
  border-bottom: none;
}

.admin-username {
  flex: 1;
}

.admin-role {
  color: var(--color-text-muted);
}

.admin-add-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.admin-add-row input {
  flex: 1;
  margin-bottom: 0;
}