/* =============================================================
   Schleifchenturnier – TC74 Groß-Rohrheim
   Inspiriert von Monte Carlo Tennis Masters: hell, elegant, clean
   ============================================================= */

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

/* ---- CSS Custom Properties ---- */
:root {
  --tc74-red: #d4111e;
  --tc74-red-dark: #b30e18;
  --tc74-red-light: #e8333f;
  --accent: #2ea3f2;
  --accent-dark: #1a8ad4;
  --ball-yellow: #e8d44d;
  --white: #ffffff;
  --off-white: #fafbfc;
  --cream: #f8f7f4;
  --gray-50: #f9f9f9;
  --gray-100: #f2f2f2;
  --gray-200: #e5e5e5;
  --gray-300: #d0d0d0;
  --gray-400: #aaaaaa;
  --gray-500: #888888;
  --gray-600: #666666;
  --gray-700: #444444;
  --gray-800: #2c3338;
  --gray-900: #1a1a1a;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --transition: 0.25s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Open Sans', 'Segoe UI', system-ui, sans-serif;
  background: var(--off-white);
  color: var(--gray-900);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-top-accent {
  height: 3px;
  background: var(--tc74-red);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  height: 48px;
  width: auto;
}

.header-text h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--gray-900);
  line-height: 1.2;
}

.header-text h1 .highlight {
  color: var(--tc74-red);
}

.header-text .subtitle {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.round-badge {
  padding: 7px 18px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--tc74-red);
  background: rgba(212, 17, 30, 0.06);
  border: 1px solid rgba(212, 17, 30, 0.15);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---- Navigation ---- */
.nav-link {
  color: var(--gray-600);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.75rem;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.nav-link:hover {
  color: var(--tc74-red);
  background: rgba(212, 17, 30, 0.04);
}

/* ============================================
   LAYOUT
   ============================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  transition: var(--transition);
  border: 1px solid var(--gray-100);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--gray-400);
  margin-bottom: 18px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ============================================
   COURT CARDS (Platz-Anzeige)
   ============================================ */
.courts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.court-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  border: 1px solid var(--gray-200);
}

.court-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--gray-300);
  transform: translateY(-2px);
}

.court-header {
  background: var(--gray-900);
  color: var(--white);
  padding: 10px 20px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.court-header .court-number {
  display: flex;
  align-items: center;
  gap: 8px;
}

.court-header .court-number::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tc74-red);
}

.court-header .match-type {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.5;
}

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

.court-matchup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.court-team {
  text-align: center;
  flex: 1;
}

.court-team .player-name {
  display: block;
  font-weight: 700;
  padding: 3px 0;
  font-size: 0.95rem;
  color: var(--gray-900);
}

.court-vs {
  font-weight: 800;
  color: var(--gray-400);
  font-size: 0.65rem;
  padding: 4px 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  flex-shrink: 0;
}

.court-score {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-100);
}

.court-score .score-display {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--gray-900);
}

.court-score .score-pending {
  color: var(--gray-300);
  font-size: 0.8rem;
  font-weight: 400;
}

.score-winner { color: var(--tc74-red) !important; font-weight: 800; }
.score-loser { color: var(--gray-300) !important; }

/* ============================================
   STANDINGS TABLE
   ============================================ */
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.standings-table thead {
  border-bottom: 2px solid var(--gray-900);
}

.standings-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 800;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray-500);
}

.standings-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
}

.standings-table tbody tr {
  transition: var(--transition);
}

.standings-table tbody tr:hover {
  background: var(--gray-50);
}

.standings-table .rank {
  font-weight: 800;
  width: 40px;
  text-align: center;
  font-size: 1rem;
  color: var(--gray-900);
}

.standings-table .rank-1 { color: var(--tc74-red); }
.standings-table .rank-2 { color: var(--gray-700); }
.standings-table .rank-3 { color: var(--gray-500); }

.standings-table .player-name-cell {
  font-weight: 700;
  color: var(--gray-900);
}

.standings-table .ribbon-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 800;
  color: var(--tc74-red);
}

.standings-table .stat {
  text-align: center;
  color: var(--gray-600);
  font-weight: 600;
  font-size: 0.85rem;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: inherit;
}

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

.btn-primary {
  background: var(--tc74-red);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--tc74-red-dark);
  box-shadow: 0 4px 12px rgba(212, 17, 30, 0.25);
}

.btn-secondary {
  background: var(--white);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}
.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-gold {
  background: var(--gray-900);
  color: var(--white);
}
.btn-gold:hover {
  background: var(--gray-800);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-danger {
  background: var(--white);
  color: var(--tc74-red);
  border: 1px solid var(--tc74-red);
}
.btn-danger:hover {
  background: var(--tc74-red);
  color: var(--white);
}

.btn-sm {
  padding: 7px 16px;
  font-size: 0.7rem;
}

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-weight: 700;
  font-size: 0.7rem;
  color: var(--gray-500);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-input {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: var(--transition);
  font-family: inherit;
  background: var(--white);
}

.form-input:focus {
  outline: none;
  border-color: var(--gray-900);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

/* ============================================
   PLAYER LIST (Admin)
   ============================================ */
.player-list { list-style: none; }

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  transition: var(--transition);
}

.player-item:last-child { border-bottom: none; }

.player-item .player-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.9rem;
}

.player-item .player-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tc74-red);
  flex-shrink: 0;
}

.player-item .player-status.inactive {
  background: var(--gray-300);
}

.player-item .player-actions {
  display: flex;
  gap: 6px;
}

/* ============================================
   SITTING OUT
   ============================================ */
.sitting-out-section {
  margin-top: 12px;
  padding: 14px 18px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}

.sitting-out-section strong {
  color: var(--gray-900);
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px);
  transition: var(--transition);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal h2 {
  color: var(--gray-900);
  margin-bottom: 4px;
  font-size: 1.2rem;
}

.modal p {
  color: var(--gray-500);
  margin-bottom: 20px;
  font-size: 0.85rem;
}

/* ---- Score Input ---- */
.score-input-group {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
}

.score-input {
  width: 64px;
  height: 56px;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 800;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-family: inherit;
}

.score-input:focus {
  outline: none;
  border-color: var(--tc74-red);
  box-shadow: 0 0 0 2px rgba(212, 17, 30, 0.08);
}

.score-separator {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gray-300);
}


/* ============================================
   STATUS BAR
   ============================================ */
.status-bar {
  background: var(--cream);
  padding: 10px 24px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-bar.active-round {
  background: rgba(212, 17, 30, 0.03);
  color: var(--tc74-red);
  border-bottom-color: rgba(212, 17, 30, 0.08);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--gray-900);
  color: var(--white);
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.8rem;
  font-weight: 600;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  max-width: 360px;
}

.toast.success { border-left: 3px solid var(--tc74-red); }
.toast.error { border-left: 3px solid #ff4444; }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.7;
}

.section-title {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--gray-400);
  margin-bottom: 18px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

/* ---- History (Runden-Historie) ---- */
.history-matches {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-match {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.history-court {
  font-weight: 800;
  color: var(--gray-400);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 24px;
}

.history-team {
  flex: 1;
  font-weight: 600;
  color: var(--gray-600);
}

.history-team.history-winner {
  color: var(--gray-900);
  font-weight: 700;
}

.history-score {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--gray-900);
  min-width: 44px;
  text-align: center;
}

.history-type {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@media (max-width: 480px) {
  .history-match {
    font-size: 0.75rem;
    gap: 8px;
    padding: 6px 8px;
  }
}

/* ---- Ribbon (Schleifchen) ---- */
.ribbon {
  display: inline-block;
  width: 12px;
  height: 12px;
  position: relative;
}

.ribbon::before,
.ribbon::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 9px;
  background: var(--tc74-red);
  border-radius: 0 0 2px 2px;
  top: 3px;
}

.ribbon::before { left: 0; transform: rotate(-15deg); }
.ribbon::after { right: 0; transform: rotate(15deg); }

/* ---- Admin Grid ---- */
.admin-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .header-inner { padding: 12px 16px; }
  .header-text h1 { font-size: 1.2rem; }
  .header-logo { height: 38px; }

  .courts-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }

  .container { padding: 20px 16px; }
  .card { padding: 20px; }

  .standings-table { font-size: 0.8rem; }
  .standings-table th,
  .standings-table td { padding: 10px 12px; }

  .court-matchup { flex-direction: column; gap: 6px; }
  .draw-title { font-size: 1.4rem; }
}

@media (max-width: 480px) {
  .header-text h1 { font-size: 1rem; }
  .header-logo { height: 32px; }
  .header-actions { gap: 6px; }
  .court-score .score-display { font-size: 1.6rem; }
  .round-badge { padding: 5px 10px; font-size: 0.7rem; }
  .subtitle { display: none; }
}
