@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ============================================
   KNRB Regatta Checker – Design System
   ============================================ */

:root {
  --font-main: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a1f35;
  --bg-card-hover: #212845;
  --bg-input: #0d1225;

  --text-primary: #f0f2f7;
  --text-secondary: #9ca3b8;
  --text-muted: #6b7280;

  --accent: #003da5;
  --accent-light: #1e5fd0;
  --accent-glow: rgba(0, 61, 165, 0.25);

  --green: #10b981;
  --green-bg: rgba(16, 185, 129, 0.12);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.12);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.12);

  --border: #1e2642;
  --border-light: #2a3358;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);

  --transition: 0.2s ease;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  padding: 48px 0 32px;
  text-align: center;
}

.logo {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #4f8cff 0%, #003da5 50%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 8px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
  animation: fadeInUp 0.4s ease;
}

.card:hover {
  border-color: var(--border-light);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px 0;
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.step-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.card-body {
  padding: 20px 24px 24px;
}

/* Inputs */
.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input-row {
  display: flex;
  gap: 10px;
}

input[type="url"],
input[type="text"] {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder {
  color: var(--text-muted);
}

select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3b8' d='M6 8.825L.35 3.175l.7-.7L6 7.425l4.95-4.95.7.7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  transition: border-color var(--transition);
}

select:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.hint {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-light);
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  color: white;
  width: 100%;
  padding: 14px;
  font-size: 0.95rem;
}

.btn-accent:hover:not(:disabled) {
  box-shadow: 0 0 30px rgba(109, 40, 217, 0.3);
  transform: translateY(-1px);
}

/* Checkbox */
.options-row {
  margin-bottom: 20px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Loading */
.loading-body {
  text-align: center;
  padding: 48px 24px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--accent-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

.loading-text {
  font-weight: 600;
  font-size: 1rem;
}

.loading-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

/* Results Header */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
  animation: fadeInUp 0.4s ease;
}

.results-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.results-stats {
  display: flex;
  gap: 10px;
}

.stat {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.stat-total {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.stat-legal {
  background: var(--green-bg);
  color: var(--green);
}

.stat-illegal {
  background: var(--red-bg);
  color: var(--red);
}

/* Results Grid */
.results-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Crew Card */
.crew-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  animation: fadeInUp 0.4s ease;
  animation-fill-mode: backwards;
}

.crew-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow);
}

.crew-card.status-illegal {
  border-left: 3px solid var(--red);
}

.crew-card.status-legal {
  border-left: 3px solid var(--green);
}

.crew-card.status-skipped {
  border-left: 3px solid var(--text-muted);
}

.crew-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
}

.crew-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.crew-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.crew-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-badge {
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-legal {
  background: var(--green-bg);
  color: var(--green);
}

.badge-illegal {
  background: var(--red-bg);
  color: var(--red);
}

.badge-skipped {
  background: var(--amber-bg);
  color: var(--amber);
}

.crew-details {
  display: none;
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
}

.crew-card.expanded .crew-details {
  display: block;
}

.expand-icon {
  color: var(--text-muted);
  transition: transform var(--transition);
  font-size: 0.8rem;
}

.crew-card.expanded .expand-icon {
  transform: rotate(180deg);
}

/* Violations */
.violations {
  margin-bottom: 16px;
}

.violation {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  background: var(--red-bg);
  border-radius: var(--radius-xs);
  margin-bottom: 6px;
  font-size: 0.84rem;
  color: var(--red);
  line-height: 1.5;
}

.violation-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

/* Rower Table */
.rower-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.rower-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.rower-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

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

.rower-table .rower-name {
  color: var(--text-primary);
  font-weight: 500;
}

.points-cell {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.rower-violation-text {
  color: var(--red);
  font-size: 0.78rem;
}

.points-summary {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-xs);
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.points-summary strong {
  color: var(--text-primary);
}

/* Footer */
.footer {
  text-align: center;
  padding: 40px 0 32px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.disclaimer {
  margin-top: 6px;
  color: var(--amber);
  font-size: 0.76rem;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 640px) {
  .header { padding: 32px 0 24px; }
  .logo { font-size: 1.5rem; }
  .input-row { flex-direction: column; }
  .results-header { flex-direction: column; align-items: flex-start; }
  .crew-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .rower-table { font-size: 0.78rem; }
  .rower-table th, .rower-table td { padding: 8px 6px; }
}
