/* ================================================================
   STRABAREGGIA ISCRIZIONI — Stili semplici e accessibili
   ================================================================ */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #666666;
  --border: #d0d7de;
  --accent: #c44d34;
  --accent-dark: #a33b26;
  --success: #2e7d32;
  --warning: #ed6c02;
  --error: #d32f2f;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

.container-wide {
  max-width: none;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 6px;
}

.page-logo {
  display: block;
  height: 48px;
  width: auto;
  margin: 0 0 10px;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 10px;
}

/* Layout compatto a due colonne per il form iscrizione */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 16px;
}

.form-grid .btn-group {
  grid-column: 1 / -1;
}

@media (max-width: 599px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Layout con intestazione in colonna a sinistra (pagina iscrizione) */
.form-layout {
  max-width: 940px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}

.form-layout .form-sidebar {
  position: sticky;
  top: 16px;
}

.form-layout .form-sidebar .page-logo {
  height: 56px;
  margin-bottom: 12px;
}

.form-layout .form-sidebar h1 {
  font-size: 1.3rem;
}

.form-layout .form-sidebar .subtitle {
  margin-bottom: 16px;
}

.form-operator {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.form-operator .operator {
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 700px) {
  .form-layout {
    grid-template-columns: 1fr;
  }
  .form-layout .form-sidebar {
    position: static;
  }
  .form-operator {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

label .required { color: var(--error); }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="date"],
select {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

input.error,
select.error {
  border-color: var(--error);
  background: #fff5f5;
}

/* Radio group stile "segmented" */
.radio-group {
  display: flex;
  gap: 8px;
}

.radio-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 10px 12px;
  font-weight: 600;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.radio-option input {
  margin: 0;
  accent-color: var(--accent);
}

.radio-option:has(input:checked) {
  border-color: var(--accent);
  background: #f0f7ff;
}

.radio-group.error .radio-option {
  border-color: var(--error);
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.error-msg {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 4px;
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.btn:active { transform: scale(0.99); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
  background: #e9ecef;
  color: var(--text);
}

.btn-secondary:hover { background: #dde2e6; }

.btn-danger {
  background: var(--error);
  color: #fff;
}

.btn-danger:hover { background: #b71c1c; }

.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-group .btn { flex: 1; }

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.top-bar .operator {
  font-size: 0.9rem;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #e9ecef;
  color: var(--text);
}

.badge-5km { background: #fff3cd; color: #856404; }
.badge-10km { background: #d1ecf1; color: #0c5460; }

.alert {
  padding: 14px;
  border-radius: var(--radius);
  margin-bottom: 18px;
}

.alert-success { background: #e8f5e9; color: #1b5e20; }
.alert-warning { background: #fff3cd; color: #856404; }
.alert-error { background: #ffebee; color: #b71c1c; }

.confirm-box {
  background: #fff8e1;
  border: 1px solid #ffcc80;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
}

.confirm-box h2 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.confirm-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #ffe0b2;
}

.confirm-row:last-child { border-bottom: none; }

.confirm-label { color: var(--muted); }
.confirm-value { font-weight: 600; }

/* Admin table */
.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: #f8f9fa;
  font-weight: 600;
}

tr:hover { background: #f8f9fa; }

.actions {
  display: flex;
  gap: 8px;
}

.actions button {
  padding: 6px 12px;
  font-size: 0.85rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.btn-edit { background: #e3f2fd; color: #1565c0; }
.btn-delete { background: #ffebee; color: #c62828; }

/* ID tecnico: attenuato per non prevalere sul pettorale */
.col-seq { width: 1%; white-space: nowrap; }

.seq-id {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

/* Danger zone (nuova stagione) */
.danger-zone {
  margin-top: 20px;
  border: 1px solid #ffcdd2;
  background: #fff5f5;
}

.danger-zone h2 {
  margin-top: 0;
  font-size: 1.1rem;
  color: #b71c1c;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.filters input,
.filters select {
  flex: 1;
  min-width: 160px;
  font-size: 0.95rem;
  padding: 10px;
}

.stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

.modal h2 {
  margin-top: 0;
  font-size: 1.25rem;
}

.hidden { display: none !important; }

.link-admin {
  display: block;
  text-align: center;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.85rem;
}

.link-admin a { color: var(--muted); }

@media (min-width: 600px) {
  .container { padding: 32px; }
  .card { padding: 32px; }
}
