/* SportSpendFestathlon – helles Design (Blau/Grün-Palette) */
:root {
  --bg: #f0f4f8;
  --bg-card: #ffffff;
  --fg: #1a2533;
  --fg-muted: #5a6a7e;
  --primary: #1565c0;
  --primary-dark: #0d47a1;
  --primary-light: #e3f0ff;
  --accent: #00897b;
  --accent-light: #e0f2f1;
  --border: #d0dce8;
  --border-strong: #b0c4d8;
  --radius: 10px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.08);
  --shadow: 0 4px 16px rgba(0,0,0,0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--fg);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.topbar {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #1976d2 100%);
  color: #fff;
  padding: 1.75rem 1.5rem 1.25rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(21,101,192,0.25);
}

.topbar h1 {
  margin: 0 0 0.3rem;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: rgba(255,255,255,0.82);
  font-size: 0.95rem;
}

/* ── Navigation ── */
.nav {
  margin-top: 1.1rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-link {
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  color: #fff;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  transition: background 0.18s ease, transform 0.12s ease;
  white-space: nowrap;
  /* Tap-Target Mindestgröße */
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.nav-link:hover {
  background: rgba(255,255,255,0.26);
  transform: translateY(-1px);
}

.nav-link:active {
  transform: translateY(0);
}

.nav-link.active {
  background: #fff;
  color: var(--primary-dark);
}

/* ── Main content ── */
.content {
  flex: 1;
  padding: 1.75rem 1.5rem 2.5rem;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

/* ── Card / Panel ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card p {
  margin: 0 0 1rem;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

/* ── Uploader (legacy class kept for compatibility) ── */
.uploader {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* ── File input ── */
.file-label {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.18s ease;
}

.file-label:hover {
  background: #cfe1fc;
}

.file-label input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

/* ── Controls ── */
.controls {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.controls input[type="search"] {
  flex: 1 1 240px;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--fg);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.18s;
  min-height: 44px;
}

.controls input[type="search"]:focus {
  border-color: var(--primary);
}

.controls button,
.btn {
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.25rem;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease;
  min-height: 44px;
  white-space: nowrap;
}

.controls button:hover,
.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

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

.btn-accent:hover {
  background: #00695c;
}

/* ── Hint text ── */
.hint {
  margin: 0.85rem 0 0;
  font-size: 0.88rem;
  color: var(--fg-muted);
}

/* ── Status badges ── */
.status-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
  color: var(--fg-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-success {
  background: var(--accent-light);
  color: #00695c;
}

.badge-error {
  background: #fdecea;
  color: #c62828;
}

.badge-info {
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* ── Alert boxes ── */
.alert {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  border-left: 4px solid;
}

.alert-error {
  background: #fdecea;
  border-color: #e53935;
  color: #b71c1c;
}

.alert-warn {
  background: #fff8e1;
  border-color: #f9a825;
  color: #5d4037;
}

.alert-info {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* ── Table ── */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.empty {
  margin: 0;
  padding: 3.5rem 1rem;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}

thead {
  background: var(--primary-light);
}

th,
td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.88rem;
}

th {
  font-weight: 700;
  color: var(--primary-dark);
  cursor: pointer;
  position: relative;
  user-select: none;
  white-space: nowrap;
}

th:hover {
  background: #d6e8fb;
}

th::after {
  content: "";
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--primary);
  opacity: 0.35;
}

th.sorted-asc::after {
  transform: translateY(-50%) rotate(180deg);
  opacity: 0.85;
}

th.sorted-desc::after {
  opacity: 0.85;
}

tbody tr:nth-child(even) {
  background: #f7fafd;
}

tbody tr:hover {
  background: var(--primary-light);
}

/* ── Loader spinner ── */
.loader {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem;
  justify-content: center;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── RaceResult widget container ── */
.rr-widget {
  min-height: 200px;
}

/* ── WhatsApp Floating Button ── */
.wa-float {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
}

.wa-float-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #25d366;
  box-shadow: 0 4px 16px rgba(37,211,102,0.45);
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.wa-float-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(37,211,102,0.55);
}

.wa-float-btn svg {
  width: 32px;
  height: 32px;
  fill: #fff;
}

.wa-float-label {
  background: #25d366;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.wa-float:hover .wa-float-label {
  opacity: 1;
  transform: translateX(0);
}

@media (max-width: 480px) {
  .wa-float { bottom: 1rem; right: 1rem; }
  .wa-float-btn { width: 52px; height: 52px; }
  .wa-float-btn svg { width: 28px; height: 28px; }
}

/* ── Footer ── */
.footer {
  padding: 1rem 1.5rem;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  background: #fff;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .topbar {
    padding: 1.25rem 1rem 1rem;
  }

  .topbar h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.88rem;
  }

  .nav {
    gap: 0.4rem;
    margin-top: 0.85rem;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 0.45rem 0.75rem;
    min-height: 38px;
  }

  .content {
    padding: 1rem 0.85rem 2rem;
  }

  .card {
    padding: 1.1rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .controls input[type="search"] {
    flex: none;
    width: 100%;
  }

  .controls button {
    width: 100%;
    justify-content: center;
  }

  table {
    font-size: 0.82rem;
    min-width: 400px;
  }

  th, td {
    padding: 0.55rem 0.65rem;
  }
}

@media (max-width: 480px) {
  .topbar h1 {
    font-size: 1.25rem;
  }

  .nav-link {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
  }

  .card {
    padding: 0.9rem;
    border-radius: 8px;
  }

  .badge {
    font-size: 0.75rem;
  }

  table {
    font-size: 0.78rem;
    min-width: 320px;
  }

  th, td {
    padding: 0.45rem 0.5rem;
  }
}
