/* ============================================================
   Base reset & variables
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --color-bg:        #f5f6fa;
  --color-surface:   #ffffff;
  --color-border:    #d1d5db;
  --color-primary:   #2563eb;
  --color-danger:    #dc2626;
  --color-warning-bg:#fef9c3;
  --color-warning-border: #f59e0b;
  --color-text:      #111827;
  --color-muted:     #6b7280;
  --radius:          6px;
  --shadow:          0 1px 3px rgba(0,0,0,.12);
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 15px;
  background: var(--color-bg);
  color: var(--color-text);
}

/* ============================================================
   Nav
   ============================================================ */
nav {
  background: var(--color-text);
  padding: 10px 20px;
  display: flex;
  gap: 20px;
  align-items: center;
}

nav a {
  color: #e5e7eb;
  text-decoration: none;
  font-size: 14px;
}

nav a:hover { color: #fff; text-decoration: underline; }
nav a.danger-link { color: #fca5a5; margin-left: auto; }

/* ============================================================
   Main / Alerts
   ============================================================ */
main { padding: 24px 20px; max-width: 1400px; margin: 0 auto; }

.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-error   { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-warning { background: var(--color-warning-bg); border: 1px solid var(--color-warning-border); color: #92400e; }
.alert-success { background: #dcfce7; border: 1px solid #86efac; color: #166534; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-block;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary   { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #e5e7eb; color: var(--color-text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger    { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 13px; }

/* ============================================================
   Upload page
   ============================================================ */
.upload-page { max-width: 480px; margin: 60px auto; }
.upload-page h1 { font-size: 26px; margin-bottom: 6px; }
.subtitle { color: var(--color-muted); margin-bottom: 28px; }

.upload-form {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label { font-weight: 600; font-size: 14px; }

.form-group input[type="file"],
.form-group input[type="number"] {
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  background: #f9fafb;
}

.form-group input[type="number"] { width: 120px; }
.hint { font-size: 12px; color: var(--color-muted); }

/* ============================================================
   Groups page
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h1 { margin: 0; font-size: 22px; }

.mat-section { margin-bottom: 32px; }

.mat-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 6px;
  margin-bottom: 14px;
}

.unassigned-heading { border-color: var(--color-warning-border); color: #92400e; }

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.group-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.group-warning {
  border-color: var(--color-warning-border);
  background: var(--color-warning-bg);
}

.group-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.group-label { font-weight: 700; font-size: 15px; }

.badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background: #e5e7eb;
  color: var(--color-muted);
}

.badge-warning { background: #fde68a; color: #92400e; }

/* ============================================================
   Wrestler table
   ============================================================ */
.wrestler-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.wrestler-table th {
  text-align: left;
  padding: 5px 6px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
}

.wrestler-table td {
  padding: 5px 6px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.wrestler-table tr:last-child td { border-bottom: none; }

.action-cell {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form { display: flex; gap: 4px; align-items: center; margin: 0; }

.move-select {
  padding: 3px 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 12px;
  background: #fff;
}

.empty-mat { color: var(--color-muted); font-style: italic; }

.unassigned-section { margin-top: 40px; }

/* ============================================================
   Pairings
   ============================================================ */
.round-block {
  margin-top: 12px;
}

.round-heading {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.vs-col {
  text-align: center;
  color: var(--color-muted);
  font-style: italic;
  width: 30px;
  white-space: nowrap;
}

.group-col {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  padding-right: 8px;
}

.muted {
  font-size: 11px;
  color: var(--color-muted);
}

/* ============================================================
   Print
   ============================================================ */
@media print {
  .no-print { display: none !important; }
  body { background: white; }
  .group-card { box-shadow: none; border: 1px solid #999; }
  .mat-heading { border-color: #000; }
}
