/* Match Display */
.match-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.625rem;
  margin: 1.25rem 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: 3.125rem;
}

.match-number {
  flex-shrink: 0;
  width: 3.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-bg-secondary);
  font-weight: bold;
  font-size: 0.875rem;
  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.125rem 0.625rem;
  font-size: 1rem;
  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.3125rem;
  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.1875rem;
  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: 1.875rem;
}

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

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

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

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

.match-actions {
  flex-shrink: 0;
  width: 3.125rem;
  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: 0.875rem;
}

/* Player Management Cards */
/* Players List */
.players-list {
  list-style: none;
  margin: 1.25rem 0;
  padding: 0;
}

.player-item {
  margin: 0;
  padding: 0.625rem;
  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.3125rem;
}

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

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

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

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

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

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

.player-status {
  font-size: 0.6875rem;
  padding: 0.125rem 0.3125rem;
  border-radius: 3px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.03125rem;
  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: 0.6875rem;
  padding: 0.1875rem 0.5rem;
  height: auto;
  line-height: 1.2;
}

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

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

  .player-actions .button {
    font-size: 0.75rem;
    padding: 0.3125rem 0.625rem;
  }

  .player-actions {
    flex-shrink: 1;
    text-align: right;
  }
}

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

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

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

.unmatched-player-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem;
}

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

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

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

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

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

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

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

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

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

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

.seeding-actions {
    margin-top: 1.25rem;
    text-align: center;
    display: flex;
    gap: 0.625rem;
    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: 0.625rem;
  justify-content: flex-start;
}

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

/* Modal Form Elements */
.modal .modal-actions {
  margin-top: 0.625rem;
  display: flex;
  gap: 0.625rem;
  justify-content: center;
}

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

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

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

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

/* Admin Management Section */
.admin-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.46875rem 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.3125rem;
  margin-top: 0.625rem;
}

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

/* Pods */
.pod-switcher {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.625rem;
  margin: 0 0 0.9375rem 0;
}

.pod-switcher__label {
  margin: 0;
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  letter-spacing: 0.1rem;
  text-transform: uppercase;
}

.pod-switcher__select {
  width: auto;
  max-width: 16rem;
  margin: 0;
}

.pod-group-heading {
  margin: 1.25rem 0 0 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1rem;
}

.pod-group-heading + .match-grid {
  margin-top: 0.625rem;
}

.seeding-confirmation--pods {
  max-width: none;
}

.pod-assignment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 1rem;
}

.pod-assignment-title {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.pod-assignment-list {
  min-height: 64px;
}

.pod-assignment-list .drag-drop-item {
  touch-action: auto;
}

.pod-assignment-list .drag-handle {
  touch-action: none;
}

.pod-assignment-list .seeding-item {
  padding: 6px 8px;
}

.pod-assignment-list .seed-number {
  min-width: 28px;
  padding: 4px 6px;
  margin-right: 8px;
}

.pod-assignment-list .player-info {
  min-width: 0;
}

.pod-assignment-list .player-info > div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pod-assignment-list .drag-drop-actions {
  margin-left: 6px;
  flex-shrink: 0;
}

.pod-assignment-list .pod-select {
  margin-bottom: 0;
  width: 6.5rem;
  height: auto;
  padding: 0.25rem 0.375rem;
  font-size: 0.75rem;
}

.pod-name-row {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
}

.pod-name-row .pod-name-input {
  flex: 1;
}

.pod-name-row .button {
  margin-bottom: 1.5rem;
}

.player-pod-form {
  display: inline-block;
}

.player-pod-form select {
  max-width: 8rem;
  margin-bottom: 0;
  height: auto;
  padding: 0.3125rem 0.625rem;
  font-size: 0.75rem;
}
