/*
 * components.css — Shared UI components (Phase 1: buttons, forms, player list;
 * Phase 3: dashboard cards, back-to-home control, placeholder text;
 * Phase 4: setup screen — availability/pin rows, radio groups, summary, issues).
 */

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #e0e0e0;
  color: #212121;
  font: inherit;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.btn:hover {
  filter: brightness(0.93);
}

.btn-primary {
  background: #1b5e20;
  color: #ffffff;
}

.btn-secondary {
  background: #eeeeee;
  color: #212121;
}

.btn-edit {
  background: #eeeeee;
  color: #1a237e;
}

.btn-danger {
  background: #b71c1c;
  color: #ffffff;
}

.view-title {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.toolbar {
  margin-bottom: 1rem;
}

.card {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.player-form {
  margin-bottom: 1rem;
}

.form-heading {
  font-size: 1.15rem;
  margin-bottom: 0.9rem;
}

.form-field {
  margin-bottom: 0.9rem;
}

.form-field label,
.field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

input[type='text'],
input[type='number'] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #bdbdbd;
  border-radius: 6px;
  font: inherit;
  background: #ffffff;
}

input[type='text']:focus,
input[type='number']:focus {
  outline: 2px solid #1b5e20;
  outline-offset: 1px;
}

.form-field input[type='text'] {
  max-width: 24rem;
}

.positions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.6rem;
}

.position-option {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.5rem;
  background: #fafafa;
}

.position-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 600;
}

.position-ratings {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.rating-field {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: default;
}

.rating-field input[type='number'] {
  width: 5.5em;
  padding: 0.3rem 0.4rem;
}

.form-error {
  background: #ffebee;
  color: #b71c1c;
  border: 1px solid #ef9a9a;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  margin: 0.75rem 0;
  font-size: 0.95rem;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.player-list {
  list-style: none;
  display: grid;
  gap: 0.5rem;
  padding: 0;
}

.player-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  background: #ffffff;
}

.player-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.player-name {
  font-weight: 700;
}

.player-positions {
  color: #616161;
  font-size: 0.9rem;
}

.player-actions {
  display: flex;
  gap: 0.4rem;
  margin-inline-start: auto;
}

.empty-state {
  color: #757575;
  padding: 0.75rem;
  text-align: center;
}

.dashboard-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 1rem;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}

.dashboard-card:hover {
  filter: brightness(0.96);
}

.btn-back {
  background: #eeeeee;
  color: #1b5e20;
}

.placeholder-text {
  color: #616161;
  font-size: 1rem;
}

.available-count {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.field-hint {
  color: #757575;
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.setup-players {
  list-style: none;
  display: grid;
  gap: 0.4rem;
  padding: 0;
}

.setup-player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  background: #ffffff;
}

.setup-player-row.unavailable {
  background: #f5f5f5;
  border-color: #eeeeee;
}

.row-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  min-width: 0;
}

.row-name {
  font-weight: 600;
}

.row-positions {
  color: #616161;
  font-size: 0.85rem;
}

.row-pin {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-size: 0.9rem;
  margin-inline-start: auto;
}

.row-pin.muted,
.setup-player-row.unavailable .row-main {
  color: #9e9e9e;
}

.row-pin input:disabled {
  cursor: not-allowed;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-weight: 600;
}

.summary-list {
  list-style: none;
  display: grid;
  gap: 0.35rem;
  padding: 0;
}

.summary-label {
  font-weight: 600;
  margin-inline-end: 0.4rem;
}

.issues-list {
  list-style: none;
  background: #ffebee;
  color: #b71c1c;
  border: 1px solid #ef9a9a;
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  margin-top: 0.75rem;
  display: grid;
  gap: 0.25rem;
}

.btn-continue {
  width: 100%;
  max-width: 22rem;
  padding: 0.75rem 1rem;
  font-size: 1.05rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: none;
}

.result-error {
  background: #ffebee;
  color: #b71c1c;
  border: 1px solid #ef9a9a;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.btn-edit-setup {
  margin-top: 0.5rem;
}

.bench-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0;
}

.bench-chip {
  background: #eeeeee;
  border: 1px solid #e0e0e0;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.9rem;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bench-empty {
  color: #757575;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.edit-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.edit-feedback {
  background: #fff8e1;
  color: #e65100;
  border: 1px solid #ffcc80;
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
}

.bench-chip.editable {
  cursor: pointer;
}

.bench-chip.selected {
  outline: 2px solid #1565c0;
  outline-offset: 1px;
}

.score-note {
  color: #8d6e63;
  font-size: 0.9rem;
}

.match-badge {
  display: inline-block;
  background: #1b5e20;
  color: #ffffff;
  border-radius: 999px;
  padding: 0.15rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.match-meta {
  align-items: center;
}

.match-conflict {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.hidden {
  display: none !important;
}

.suggestions-panel {
  margin-top: 1rem;
}

.suggestion-card {
  border-color: #c8e6c9;
}

.suggestion-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.suggestion-improvement {
  background: #1b5e20;
  color: #ffffff;
  border-radius: 999px;
  padding: 0.15rem 0.75rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.suggestion-kind {
  color: #616161;
  font-size: 0.9rem;
  font-weight: 600;
}

.suggestion-scores {
  margin: 0 0 0.5rem;
  color: #424242;
}

.suggestion-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0 0 0.5rem;
}

.suggestion-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.sub-chip {
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.9rem;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-chip.out {
  background: #ffebee;
  color: #b71c1c;
  border: 1px solid #ef9a9a;
}

.sub-chip.in {
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #a5d6a7;
}

.suggestion-none {
  color: #9e9e9e;
  font-size: 0.9rem;
}

.suggestion-repositioning-block {
  margin-top: 0.4rem;
}

.suggestion-repositioning {
  list-style: none;
  display: grid;
  gap: 0.25rem;
  padding: 0;
  margin: 0.35rem 0 0;
}

.reposition-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  background: #fff8e1;
  border: 1px solid #ffcc80;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.9rem;
}

.reposition-name {
  font-weight: 600;
}

.reposition-move {
  color: #e65100;
}

.suggestion-notice {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 0.9rem;
  color: #616161;
}

.substitution-count {
  font-weight: 700;
  color: #1b5e20;
}

.exited-card {
  border-color: #ffcdd2;
}

.exited-chip {
  background: #ffebee;
  color: #b71c1c;
  border: 1px solid #ef9a9a;
  text-decoration: line-through;
}

.manual-toolbar {
  border-color: #c5cae9;
}

.manual-hint {
  color: #303f9f;
  margin-bottom: 0.6rem;
}

.manual-preview {
  background: #e8eaf6;
  border: 1px solid #c5cae9;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
}

.manual-preview p {
  margin: 0 0 0.25rem;
}

.manual-preview p:last-child {
  margin-bottom: 0;
}

.manual-preview-slot {
  color: #1a237e;
}

.confirm-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed #bdbdbd;
}

.confirm-text {
  font-weight: 600;
  color: #1b5e20;
}

.btn-apply-suggestion,
.btn-confirm-apply {
  margin-top: 0.4rem;
}

/* Phase 11: player lock during an active match */

.player-lock-banner {
  background: #fff3e0;
  color: #bf360c;
  border: 1px solid #ffb74d;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.6;
  max-width: 100%;
}

/* Phase 11: end-match inline confirmation */

.end-match-card {
  border-color: #ffcdd2;
}

.end-match-question {
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.end-match-card .result-error {
  margin-bottom: 0;
  margin-top: 0.75rem;
}

/* Phase 12: backup/restore */

.backup-notice {
  margin-top: 0.75rem;
}

.backup-lock-note {
  background: #fff3e0;
  color: #bf360c;
  border: 1px solid #ffb74d;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.9rem;
  font-weight: 600;
  line-height: 1.6;
}

.backup-file-input {
  max-width: 100%;
}

.backup-summary {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  margin: 0.6rem 0;
}

.backup-summary-line {
  margin: 0 0 0.25rem;
}

.backup-summary-line:last-child {
  margin-bottom: 0;
}

.confirm-text.confirm-destructive {
  color: #b71c1c;
}

@media (max-width: 480px) {
  .player-actions {
    width: 100%;
  }

  .player-actions .btn {
    flex: 1;
  }
}
