/* Railbird Contest - Public Pages Styles */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --bg-color: #f8fafc;
  --surface-color: #ffffff;
  --text-color: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

header {
  text-align: center;
  padding: 2rem 0;
  background: var(--surface-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

header h1 {
  color: var(--primary-color);
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.125rem;
}

/* Loading */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.spinner {
  display: inline-block;
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Cards */
.card {
  background: var(--surface-color);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.card h2 {
  margin-bottom: 1rem;
  color: var(--text-color);
}

.card p {
  margin-bottom: 1rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
}

.required::after {
  content: " *";
  color: var(--danger-color);
}

input[type="text"],
input[type="tel"],
input[type="email"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

input:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.btn-success {
  background: var(--success-color);
  color: white;
  width: 100%;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

/* Messages */
.error-message {
  padding: 1rem;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 4px;
  color: var(--danger-color);
  margin-bottom: 1rem;
}

.success-message {
  padding: 1rem;
  background: #d1fae5;
  border: 1px solid #a7f3d0;
  border-radius: 4px;
  color: var(--success-color);
  margin-bottom: 1rem;
}

.info-message {
  padding: 1rem;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.warning-message {
  padding: 1rem;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 4px;
  color: #92400e;
  margin-bottom: 1rem;
}

/* Grid for bets */
.picks-grid {
  overflow-x: auto;
  margin: 1.5rem 0;
}

.picks-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-color);
}

.picks-table th,
.picks-table td {
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  text-align: left;
}

.picks-table th {
  background: var(--bg-color);
  font-weight: 600;
  font-size: 0.875rem;
  position: sticky;
  top: 0;
}

.picks-table td {
  font-size: 0.875rem;
}

.picks-table input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.875rem;
}

.picks-table input:disabled {
  background: var(--bg-color);
  cursor: not-allowed;
}

/* Info Box */
.info-box {
  background: var(--bg-color);
  padding: 1.5rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
}

.info-box h3 {
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.info-box p {
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.info-box strong {
  color: var(--text-color);
}

/* Access Code */
.access-code {
  background: var(--primary-color);
  color: white;
  padding: 1rem;
  border-radius: 4px;
  text-align: center;
  margin: 1.5rem 0;
}

.access-code .code {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  font-family: monospace;
}

/* Standings */
.standings-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-color);
}

.standings-table th,
.standings-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.standings-table th {
  background: var(--bg-color);
  font-weight: 600;
  text-align: left;
  position: sticky;
  top: 0;
}

.standings-table tbody tr:hover {
  background: var(--bg-color);
}

.standings-table .rank {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary-color);
  width: 60px;
  text-align: center;
}

.standings-table .rank.first {
  color: #fbbf24;
}

.standings-table .rank.second {
  color: #94a3b8;
}

.standings-table .rank.third {
  color: #cd7f32;
}

.winnings {
  font-weight: 600;
  color: var(--success-color);
  text-align: right;
}

.summary-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 1rem;
  color: var(--text-color);
}

.table-scroll {
  overflow-x: auto;
}

.race-header.complete {
  color: #065f46;
}

.race-header.pending {
  color: var(--text-muted);
}

.race-pick {
  display: inline-block;
  min-width: 2.5rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  text-align: center;
}

.race-pick.winner {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.race-pick.place {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}

.race-pick.miss {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.race-pick.pending,
.race-pick.no-pick {
  background: #f8fafc;
  color: var(--text-muted);
  border: 1px dashed #cbd5e1;
}

/* Last updated */
.last-updated {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 1rem;
}

/* Print Styles */
@media print {
  body {
    background: white;
  }
  
  .btn {
    display: none !important;
  }
  
  .card {
    box-shadow: none;
    page-break-inside: avoid;
  }
}

/* Responsive */
@media (max-width: 768px) {
  header h1 {
    font-size: 1.5rem;
  }
  
  .card {
    padding: 1.5rem;
  }
  
  .picks-table th,
  .picks-table td {
    padding: 0.5rem;
    font-size: 0.75rem;
  }
  
  .standings-table th,
  .standings-table td {
    padding: 0.75rem;
    font-size: 0.875rem;
  }
}
