/* =========================================================
   Grundlayout & Typo
   ========================================================= */
:root {
  --c-primary: #007BFF;
  --c-primary-hover: #0056b3;
  --c-accent: #004080;
  --c-accent-hover: #0066cc;
  --c-success: #198754;
  --c-warning: #e0a800;
  --c-dark: #2c3e50;
  --c-text: #1a1a1a;
  --c-muted: #666;
  --box-bg: #fff;
}

html, body {
  height: 100%;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-image: url('/static/images/HGB.JPG');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  text-align: center;
  color: var(--c-text);
}

h1 {
  color: #07c307;
  text-shadow: 2px 2px 5px rgba(0,0,0,0.8);
  font-size: 2.5em;
  margin-top: 40px;
}

a {
  color: var(--c-text);
  text-decoration: none;
  transition: color .2s ease, background-color .2s ease;
}
a:hover {
  color: #fff;
  background-color: var(--c-dark);
  padding: 2px 6px;
  border-radius: 5px;
}

/* =========================================================
   Navigation
   ========================================================= */
nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
nav ul li {
  display: inline;
  margin: 0 10px;
}
nav ul li a {
  text-decoration: none;
  color: #fff;
  font-size: 1.7em;
  font-weight: bold;
  padding: 6px 12px;
  transition: color .3s ease;
}
nav ul li a:hover {
  color: #ffd700;
  text-decoration: underline;
}

/* =========================================================
   Layout: Wrapper, Spalten
   ========================================================= */
.matchplay-wrapper {
  display: grid;
  grid-template-columns: 300px 1fr;
  align-items: start;
  gap: 40px;
  padding: 40px;
  box-sizing: border-box;
}

.left-column {
  position: sticky;
  top: 40px;
  align-self: start;
}

.right-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* =========================================================
   Komponenten: Aktive Herausforderungen
   ========================================================= */
.active-challenges {
  flex-shrink: 0;
  background-color: rgba(255,255,255,0.9);
  padding: 15px;
  border: 1px solid #ccc;
  border-radius: 8px;
  min-width: 250px;
  max-width: 300px;
  font-size: .8em;
  text-align: left;
}
.active-challenges h3 {
  margin: 0 0 10px 0;
  color: #333;
}
.active-challenges ul {
  padding-left: 15px;
  margin: 0;
}
.active-challenges li { margin-bottom: 10px; }

/* =========================================================
   Flash / Hinweise
   ========================================================= */
.flashes li,
.ban-message {
  color: #f5f5f5;
  font-weight: bold;
  background-color: rgba(0,0,0,0.4);
  padding: 5px 8px;
  border-radius: 5px;
  display: inline-block;
  margin-bottom: 5px;
}

/* =========================================================
   Allgemeine Boxen/Container
   ========================================================= */
#content-wrapper,
.results-wrapper,
.small-centered-box,
.form-wrapper,
#login-box {
  background-color: rgba(255,255,255,0.9);
  box-shadow: 0 0 12px rgba(0,0,0,0.2);
  border-radius: 10px;
}

#content-wrapper {
  max-width: 800px; margin: 0 auto; padding: 20px; text-align: left;
}
.results-wrapper {
  max-width: 800px; width: 80%; margin: 20px auto; padding: 20px; text-align: center;
}
.small-centered-box {
  max-width: 600px; margin: 2rem auto; padding: 2rem;
}
.form-wrapper {
  max-width: 450px; margin: 10px auto; padding: 30px 40px; text-align: center;
}
#login-box {
  width: 300px; margin: 30px auto; padding: 20px; border: 1px solid #ccc;
}

.section-title { text-align: center; margin-bottom: 20px; }

/* Ergebnisse-Tabelle */
.results-table {
  width: auto; margin: 0 auto; font-size: .9rem; border-collapse: collapse;
}
.results-table th, .results-table td {
  border: 1px solid #ccc; padding: 6px 12px;
}
.results-table th { background-color: #f5f5f5; }

/* Form Controls */
.form-field,
.vacation-wrapper input,
.vacation-wrapper select {
  width: 100%; padding: 10px; margin: 10px 0;
  border-radius: 6px; border: 1px solid #ccc; box-sizing: border-box;
}
.checkbox-field {
  display: flex; align-items: center; justify-content: start; margin: 15px 0;
}
.checkbox-field input[type="checkbox"] { margin-right: 8px; transform: scale(1.2); }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-block;
  padding: 10px 15px;
  font-size: 1em;
  box-sizing: border-box;
  background-color: var(--c-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  margin-top: 10px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn:hover {
  display: inline-block;
  padding: 10px 15px;
  font-size: 1em;
  box-sizing: border-box;
  color: #fff;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  margin-top: 10px;
  cursor: pointer;
  transition: background-color 0.2s ease;  
  background-color: var(--c-accent-hover);
}

.extend-button {
  background-color: #066606;
  color: #fff;
  border: none;
  padding: 4px 8px;
  font-size: .8em;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 5px;
}
.extend-button:hover { background-color: var(--c-warning); }

/* =========================================================
   Spieler/Matchplay-Baum
   ========================================================= */
#matchplay-baum {
  display: flex; flex-direction: column; align-items: center; gap: 30px;
}
.row {
  display: flex; justify-content: center; flex-wrap: nowrap; gap: 20px;
}

.player {
  background-color: var(--box-bg);
  border: 2px solid #444;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  width: 105px;
  height: 84px;
  padding: 6px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; overflow: hidden;
  font-weight: bold; font-size: .8em; transition: all .3s ease;
}
.player.empty {
  width: 105px; height: 84px; border: 2px dashed #ccc; border-radius: 12px; background: transparent;
}

.player.protected { background-color: #e6f7ff; border-color: #3399ff; }
.player.manually-protected { background-color: #fdf2e9; border-color: #e67e22; }
.player.challenger {
  background-color: #d1e7dd !important;
  border: 3px solid #0f5132;
  box-shadow: 0 0 10px rgba(0,100,0,0.4);
}

.protected-note  {
  font-size: 0.75em;         /* noch kleiner als vorher */
  color: var(--c-muted);
  margin-top: 4px;
  display: inline-block;     /* statt block – damit's in einer Zeile bleibt */
  text-align: center;
  white-space: nowrap;       /* Zeilenumbruch verhindern */
  font-weight: 500;
}


.vacation-note  {
  font-size: 0.75em;         /* noch kleiner als vorher */
  color: var(--c-muted);
  margin-top: 4px;
  display: inline-block;     /* statt block – damit's in einer Zeile bleibt */
  text-align: center;
  white-space: nowrap;       /* Zeilenumbruch verhindern */
  font-weight: 500;
}


/* Standard-Buttons in .player (z. B. „Schutz aktivieren“), aber NICHT die Positions-Form */
.player > form:not(.pos-form) button {
  background-color: var(--c-primary);
  color: #fff;
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .75em;
}
.player > form:not(.pos-form) button:hover { background-color: var(--c-primary-hover); }

/* =========================================================
   Admin: Kompakte Positionssteuerung (Dropdown + Verschieben)
   ========================================================= */
.player form.pos-form {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.player form.pos-form .pos-label {
  font-size: 11px;
  opacity: .8;
}
.player form.pos-form .pos-select {
  font-size: 11px !important;
  height: 22px !important;
  line-height: 20px !important;
  padding: 0 4px !important;
  min-width: 54px !important;
  -webkit-appearance: menulist;
          appearance: menulist;
}
.player form.pos-form .btn-small {
  font-size: 11px !important;
  height: 22px !important;
  line-height: 20px !important;
  padding: 0 6px !important;
  border-radius: 4px !important;
  border: none;
  background: var(--c-primary);
  color: #fff;
  cursor: pointer;
}
.player form.pos-form .btn-small:hover { background: var(--c-primary-hover); }

/* =========================================================
   Vacation Box
   ========================================================= */
.vacation-wrapper {
  background: rgba(255,255,255,0.9);
  padding: 30px 40px;
  max-width: 420px;
  margin: 100px auto;
  border-radius: 15px;
  box-shadow: 0 0 15px rgba(0,0,0,0.25);
  text-align: center;
}
.vacation-wrapper h2 { margin-bottom: 20px; font-weight: bold; }

/* =========================================================
   Header Titel
   ========================================================= */
.header-title-wrapper {
  text-align: center;
  background: rgba(0,0,0,0.4);
  padding: 10px 30px;
  border-radius: 15px;
  margin: 20px auto;
  display: inline-block;
  box-shadow: 0 0 12px rgba(0,0,0,0.4);
  justify-content: center;
}
.header-title {
  color: #35de79;
  font-size: 2.8em;
  text-shadow: 2px 2px 6px black;
  margin: 0;
  line-height: 1.3;
}

/* =========================================================
   Modals
   ========================================================= */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  inset: 0;
  width: 100%; height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
}
.modal-content {
  background-color: #fff;
  margin: 15% auto;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  text-align: center;
}
.modal .btn {
  margin: 10px 5px;
  padding: 8px 12px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
.modal .confirm { background-color: var(--c-success); color: #fff; }
.modal .cancel  { background-color: #ccc; color: #000; }

/* =========================================================
   Status-Farben/Fehler
   ========================================================= */
.success { color: green; text-align: center; margin-bottom: 15px; }
.error   { color: red;   text-align: center; margin-bottom: 15px; }
.form-error { color: red; font-size: .9em; margin-top: 4px; margin-bottom: 10px; }
.protected { cursor: help; color: gray; }

/* Ultra-kompakte Admin-Positionssteuerung (überstimmt alles andere) */
.player form.pos-form {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.player form.pos-form .pos-label {
  font-size: 10px !important;
  opacity: .8;
  line-height: 1 !important;
}

/* Dropdown wirklich klein (auch auf iOS/Safari & mit evtl. Bootstrap) */
.player form.pos-form .pos-select {
  font-size: 10px !important;
  height: 20px !important;
  line-height: 18px !important;
  padding: 0 4px !important;
  min-width: 48px !important;
  width: auto !important;
  -webkit-appearance: menulist !important;
          appearance: menulist !important;
}

/* Mini-Button „Verschieben“ */
.player form.pos-form .btn-small {
  font-size: 10px !important;
  height: 20px !important;
  line-height: 18px !important;
  padding: 0 6px !important;
  border-radius: 4px !important;
  border: none !important;
  background: var(--c-primary) !important;
  color: #fff !important;
  cursor: pointer !important;
}
.player form.pos-form .btn-small:hover {
  background: var(--c-primary-hover) !important;
}

/* Falls irgendwo .btn miterwischt wurde (z.B. durch copy/paste) – neutralisieren: */
.player form.pos-form .btn {
  all: unset !important;
  display: inline-block !important;
  background: var(--c-primary) !important;
  color: #fff !important;
  padding: 0 6px !important;
  height: 20px !important;
  line-height: 18px !important;
  border-radius: 4px !important;
  cursor: pointer !important;
}

