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

/* -------------------------------------
 *  Global / Variables
 * ------------------------------------- */
:root {
  --bg-dark: #121212;
  --card-light: rgba(255, 255, 255, 0.95);
  /* Sehr hoher Kontrast (95% deckend) */
  --card-dark: rgba(20, 20, 20, 0.95);

  --text-light: #000000;
  --text-dark: #ffffff;

  --accent-dark: #818cf8;
  --border-light: #000;
  --border-dark: #fff;

  /* Status Colors für maximale Lesbarkeit */
  --color-green: #059669;
  /* Dunkles Grün für Beamer */
  --color-orange: #d97706;
  /* Starkes Orange */
  --color-red: #dc2626;
  /* Starkes Rot */
  --color-blue: #2563eb;

  --body-bg: #f1f5f9;
  --panel-bg: rgba(255, 255, 255, 0.95);
  --section-bg: transparent;
  --section-shadow: none;
  --section-border: none;
  --text-primary: #000;
  --text-secondary: #444;
  --text-muted: #666;
  --admin-controls-bg: rgba(0, 0, 0, 0.05);
  --btn-note-hover: rgba(0, 0, 0, 0.05);
  --select-bg: white;
  --select-border: #000;
  --segment-group-bg: #e2e8f0;
  --segment-label-color: #334155;
  --segment-btn-text: #64748b;
  --segment-btn-active-bg: white;
  --segment-btn-active-text: #0f172a;
  --timer-bg: #eee;
  --timer-text: #333;
}

body {
  font-family: 'Inter', sans-serif;
  background:
    linear-gradient(rgba(245, 245, 245, 0.2), rgba(245, 245, 245, 0.2)),
    url('/bg.png') center/cover no-repeat fixed;
  margin: 0 auto;
  padding: 20px;
  color: var(--text-primary);
  /* 
    Viewport-basiertes Skalieren:
    Wächst mit der Breite des Bildschirms mit (ideal für Beamer).
    Minimum 14px, Maximum 26px.
  */
  font-size: clamp(14px, 1.3vw, 26px);
  max-width: 1920px;
  /* 16:9 Maximum bei Full HD */
}

/* -------------------------------------
 *  Admin Specific Layout Overrides
 * ------------------------------------- */
#admin-body {
  font-size: 16px !important;
  max-width: none;
}

body.dark-mode {
  --body-bg: var(--bg-dark);
  --panel-bg: var(--card-dark);
  --section-bg: var(--card-dark);
  --section-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
  --section-border: 2px solid rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: #aaaaaa;
  --text-muted: #888888;
  --admin-controls-bg: rgba(255, 255, 255, 0.05);
  --btn-note-hover: rgba(255, 255, 255, 0.1);
  --select-bg: #333;
  --select-border: #666;
  --segment-group-bg: #333;
  --segment-label-color: #ddd;
  --segment-btn-text: #888;
  --segment-btn-active-bg: #444;
  --segment-btn-active-text: white;
  --timer-bg: #333;
  --timer-text: #ddd;
  background: linear-gradient(rgba(18, 18, 18, 0.85), rgba(18, 18, 18, 0.85)), url('/bg.png') center/cover no-repeat fixed !important;
  color: var(--text-dark);
}


#app-body {
  transition: opacity 0.3s ease;
}

/* -------------------------------------
 *  Progress Bar (Neu!)
 * ------------------------------------- */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 8px;
  background: var(--color-blue);
  width: 0%;
  z-index: 9999;
  transition: width linear;
}

.dark-mode #progress-bar {
  background: var(--accent-dark);
}

/* -------------------------------------
 *  Common Components
 * ------------------------------------- */
.section {
  background: var(--card-light);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border: 2px solid rgba(0, 0, 0, 0.1);
}

.section h1 {
  margin-top: 0;
  margin-bottom: 20px;
  border-bottom: 3px solid #000;
  font-size: 1.8em;
  font-weight: 800;
  padding-bottom: 10px;
}

/* 2-Spalten-Layout für Breite Bildschirme (Warteschlange daneben) */
.dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 1200px) {
  .dashboard-layout.has-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    align-items: start;
  }
}

.section-title {
  color: var(--text-light);
  margin-top: 0;
  padding-bottom: 12px;
  border-bottom: 3px solid #000;
  font-size: 1.5em;
  font-weight: 800;
}

.footer {
  margin: 20px auto;
  color: #000;
  font-size: 1.1em;
  font-weight: 600;
  background-color: var(--card-light);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  padding: 12px 20px;
  width: fit-content;
  border: 2px solid #000;
}

/* Dark Mode Overrides (Common) */
.dark-mode .section {
  background: var(--card-dark);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.dark-mode .section h1,
.dark-mode .section-title {
  border-bottom-color: var(--border-dark);
  color: var(--text-dark);
}

.dark-mode .footer {
  background: var(--card-dark);
  border-color: var(--border-dark);
  color: var(--text-dark);
}/* -------------------------------------
 *  Matches Page (index.ejs)
 * ------------------------------------- */
.header {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  color: white;
  text-align: center;
  padding: 10px;
  margin-bottom: 24px;
  border-radius: 12px;
  border: 2px solid #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.header h1 {
  font-size: 3em;
  font-weight: 800;
  margin: 10px 0;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 20px;
  margin-top: 20px;
}

.match-card {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  border-left: 12px solid;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border-right: 2px solid rgba(0, 0, 0, 0.1);
  border-top: 2px solid rgba(0, 0, 0, 0.1);
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.match-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

.started {
  border-left-color: var(--color-green);
}

.assigned {
  border-left-color: var(--color-orange);
}

.station {
  font-weight: 800;
  color: var(--text-light);
  margin-bottom: 20px;
  font-size: 1.8em;
  border-bottom: 2px solid #ddd;
  padding-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  white-space: nowrap;
  gap: 10px;
}

/* Badges für sehr gute Lesbarkeit */
.badge,
.status {
  font-size: 0.55em;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 6px 14px;
  border-radius: 20px;
  color: white;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
}

.status-started {
  background: var(--color-green);
}

.status-assigned {
  background: var(--color-orange);
}

.players {
  font-size: 1.4em;
  font-weight: 800;
  margin: 8px 0;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vs {
  color: #555;
  margin: 5px 0;
  font-style: italic;
  font-weight: 600;
  font-size: 1.2em;
}

.vs2 {
  color: #555;
  margin: 0 10px;
  font-style: italic;
  font-size: 0.8em;
  display: inline-block;
}

.live-timer {
  text-align: right;
  font-size: 1em;
  color: #333;
  font-weight: 600;
  margin-top: 15px;
  background: #eee;
  padding: 4px 10px;
  border-radius: 6px;
  float: right;
  transition: all 0.3s ease;
}

.timer-urgent {
  background: var(--color-red);
  color: white;
  animation: pulse-bg 2s infinite;
}

@keyframes pulse-bg {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.8;
  }

  100% {
    opacity: 1;
  }
}

.pending-matches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 15px;
  margin-top: 20px;
}

.pending-card {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  border-left: 6px solid var(--color-blue);
  border-right: 2px solid rgba(0, 0, 0, 0.1);
  border-top: 2px solid rgba(0, 0, 0, 0.1);
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  font-size: 1.05em;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.pending-card>div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Matches Dark Mode */




.dark-mode .live-timer {
  background: #333;
  color: #ddd;
}





.dark-mode .timestamp {
  background: #333;
  color: #fff;
}

/* -------------------------------------
 *  Participants Page (participants.ejs)
 * ------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}

.participant-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-left: 10px solid #2c3e50;
  border-right: 2px solid rgba(0, 0, 0, 0.1);
  border-top: 2px solid rgba(0, 0, 0, 0.1);
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.participant-card.complete {
  border-left-color: var(--color-green);
}

.participant-card.missing {
  border-left-color: var(--color-red);
}

.participant-name {
  font-size: 1.25em;
  font-weight: 800;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.participant-status {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Participants Dark Mode */
.dark-mode .participant-card {
  background: #1a1a1a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  border-right-color: #333;
  border-top-color: #333;
  border-bottom-color: #333;
}

.dark-mode .participant-name {
  color: #fff;
}

/* -------------------------------------
 *  Admin Page (admin.ejs)
 * ------------------------------------- */
.panel {
  max-width: 900px;
  margin: 0 auto;
  background: var(--card-light);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border: 2px solid rgba(0, 0, 0, 0.1);
}

/* Touch-Friendly Admin Layout */
.admin-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.admin-header-row h1 {
  margin: 0 0 4px 0;
  font-size: 2.5em;
}

.stats {
  color: #666;
}

.btn-refetch {
  background: var(--color-blue);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: transform 0.1s;
}

.btn-refetch:active {
  transform: scale(0.95);
}

.admin-controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.03);
  padding: 16px 24px;
  border-radius: 12px;
  gap: 16px;
}

.segment-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.text-input {
  font-family: inherit;
  font-size: 1.1em;
  padding: 10px 14px;
  border: 2px solid #cbd5e1;
  background: #fff;
  color: #333;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
  height: 48px; /* match buttons which are 48px typically: 12px pad * 2 + ~20px font + 4px border */
  box-sizing: border-box;
}

.text-input:focus {
  border-color: var(--color-blue);
}

.segment-label {
  font-weight: 800;
  color: #333;
}

.segment-group {
  display: flex;
  background: #e2e8f0;
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
}

.segment-btn {
  cursor: pointer;
}

.segment-btn input {
  display: none;
}

.segment-btn span {
  display: block;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 800;
  color: var(--segment-btn-text);
  transition: all 0.2s;
}

.segment-btn input:checked+span {
  background: var(--segment-btn-active-bg);
  color: var(--segment-btn-active-text, #111);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark-mode .segment-btn input:checked+span {
  background: #444;
  color: #fff;
}

/* Touch-Friendly Admin Grid */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.admin-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid #ddd;
}

.ac-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.ac-title {
  font-size: 1.3em;
  font-weight: 800;
}

.ac-toggles {
  display: flex;
  gap: 12px;
}

.touch-toggle {
  flex: 1;
  cursor: pointer;
}

.touch-toggle input {
  display: none;
}

.touch-toggle .toggle-btn {
  display: block;
  text-align: center;
  padding: 14px 10px;
  border-radius: 8px;
  background: #eee;
  color: #666;
  font-weight: 800;
  font-size: 1.1em;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.touch-toggle input[name^="checkin"]:checked+.toggle-btn {
  background: var(--color-green);
  color: white;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.touch-toggle input[name^="paid"]:checked+.toggle-btn {
  background: var(--color-blue);
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

label {
  white-space: nowrap;
  font-weight: 600;
  cursor: pointer;
}

input[type="checkbox"] {
  transform: scale(1.5);
  margin-right: 10px;
  cursor: pointer;
}

.team-note {
  font-size: 0.85em;
  color: #666;
  margin-top: 4px;
  font-style: italic;
}

.btn-edit-note {
  background: transparent;
  border: none;
  box-shadow: none;
  cursor: pointer;
  padding: 6px;
  font-size: 1.2em;
  border-radius: 4px;
}

.btn-edit-note:hover {
  background: rgba(0, 0, 0, 0.05);
  box-shadow: none;
}

.mode-row {
  margin: 0 0 20px;
  font-size: 1.2em;
  font-weight: 800;
}

.mode-row select {
  padding: 10px 14px;
  border-radius: 8px;
  border: 2px solid var(--select-border);
  background: var(--select-bg);
  font-size: 1em;
  font-weight: 600;
  font-family: inherit;
  margin-left: 10px;
  cursor: pointer;
}

.autosave {
  margin-top: 16px;
  font-size: 1.1em;
  color: #444;
  font-weight: 600;
}

button {
  padding: 12px 20px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--color-blue);
  color: white;
  cursor: pointer;
  font-size: 1.1em;
  font-weight: 800;
  transition: all 0.2s;
}

.dark-mode .stats {
  color: #aaa;
}











button:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.message {
  margin-top: 20px;
  padding: 16px;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.1);
  border-left: 6px solid var(--color-blue);
  font-weight: 600;
}

.refetched {
  color: #666;
  margin-top: 12px;
  font-weight: 600;
}

.link {
  margin-top: 24px;
  font-size: 1.2em;
  font-weight: 800;
}

.link a {
  color: var(--color-blue);
  text-decoration: none;
}

.link a:hover {
  text-decoration: underline;
}

/* Admin Dark Mode Support */
.dark-mode .panel {
  background: var(--card-dark);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.dark-mode .admin-card {
  background: #1a1a1a;
  border-color: #333;
}

.dark-mode .admin-header-row h1,
.dark-mode .segment-label,
.dark-mode .ac-title {
  color: #fff;
}

.dark-mode .refetched,
.dark-mode .autosave,
.dark-mode .team-note {
  color: #aaa;
}

.dark-mode .admin-controls-bar {
  background: rgba(255, 255, 255, 0.05);
}

.dark-mode .touch-toggle .toggle-btn {
  background: #333;
  color: #aaa;
}

.dark-mode .link a {
  color: var(--accent-dark);
}

/* -------------------------------------
 *  Theme Toggle Button
 * ------------------------------------- */
.theme-toggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #000;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  font-size: 1.8em;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s ease;
}

.dark-mode .theme-toggle {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.2);
}

body:hover .theme-toggle,
.theme-toggle:focus {
  opacity: 1;
}

/* -------------------------------------
 *  Modern UI Elements (Laws of UX)
 * ------------------------------------- */
.toast-modern {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(12px);
  color: #fff;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.pulse-dot {
  width: 12px;
  height: 12px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }

  70% {
    box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

@keyframes slideUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 20px);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.pulse-dot-white {
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.8);
  animation: pulse-white 2s infinite;
  display: inline-block;
  margin-right: 8px;
}

@keyframes pulse-white {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.8);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

:root[data-theme="dark"] .text-input,
.dark-mode .text-input {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
}