/* --- Mobile-First Styles --- */
/*
 .container {
  width: 100%;
  max-width: 500px;
  padding: 0 2px;
  margin: 0 auto;
}
*/

.container {
 width: 100%;
 max-width: 1024px;
 padding: 0;
 margin: 0;
}

body {
  font-family: system-ui, Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background-color: #ffffff;
  color: #222;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
}

h1 {
  margin-bottom: 20px;
  font-size: 1.6rem;
  color: #2e7d32;
  text-align: center;
}

h2 {
  font-size: 1.2rem;
  margin-bottom: 12px;
  color: #2e7d32;
}

.section {
  background: #f9f9f9;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* Inputs & Selects */
input, select, textarea {
  padding: 10px;
  margin-top: 6px;
  margin-bottom: 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
}

textarea {
  resize: none;
}

.platz-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px; /* war 18px */
  align-items: center;
}

.platz-radio-group div {
  display: flex;
  align-items: center;
  gap: 1px;
}

.platz-radio-group label {
  margin-left: 2px; /* reduziert Abstand zum Radio-Button */
  font-size: 1rem;  /* optional: Schriftgröße angleichen */
  vertical-align: middle; /* bessere Ausrichtung */
}

/* Buttons */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start; /* Buttons linksbündig */
}

.button-row {
  display: flex;
  align-items: center;
  gap: 0.2em;
  flex-wrap: wrap; /* optional für kleine Displays */
}

button {
  padding: 10px 12px; /* gleiche Höhe wie Inputs */
  font-size: 1rem;     /* gleiche Schriftgröße */
  border: 1px solid #ccc; /* wie Inputs */
  border-radius: 8px;
  background-color: #f0f0f0;
  color: #222;
  cursor: pointer;
  transition: background 0.2s ease;
  width: fit-content;
  white-space: nowrap;
}

button.selected {
  background-color: #2e7d32;
  color: #fff;
  border: 1px solid #2e7d32;
}

button.medium {
  background-color: #c4f0c5;
  color: #2e7d32;
  border: 1px solid #2e7d32;
}

button.active:hover, button.medium:hover, button.selected:hover {
  background-color: #256228;
  color: #fff;
}

button.disabled {
  background-color: #eee;
  color: #ccc;
  border: 1px solid #ccc;
  cursor: not-allowed;
}

button.active {
  background-color: #a5d6a7;
  color: #2e7d32;
  font-weight: bold;
  border: 1px solid #2e7d32;
}

button.header {
  background-color: #293133;
  color: #fff;
  border: 1px solid #293133;
}

/* Tables */
/*
table {
  width: 100%;
  border-collapse: collapse;
}

td, th {
  padding: 6px;
  vertical-align: top;
  word-break: break-word;
}
*/
table {
  width: auto;
  border-collapse: collapse;
  table-layout: auto;
}

th, td {
  padding: 2px 4px; /* möglichst knapp */
  white-space: nowrap;
  text-align: left;
}

th, td {
  width: 1%; /* zwingt die Zelle, sich am Inhalt zu orientieren */
}

.header {
  text-align: center;
  vertical-align: middle; /* optional: centers vertically within the row */
}

.slots-table {
  table-layout: auto; /* erlaubt dynamisches Wachstum */
  border-collapse: collapse;
}

.slots-table th,
.slots-table td {
  width: 3em;              /* Startbreite */
  max-width: none;         /* keine künstliche Begrenzung */
  white-space: nowrap;     /* verhindert Umbruch, zwingt ggf. Wachstum */
  overflow: visible;       /* Inhalt darf sichtbar bleiben */
  padding: 4px 6px;
  text-align: left;
}

[id^="section-"] table input,
[id^="section-"] table select,
[id^="section-"] table textarea,
[id^="section-"] table label {
  margin-top: 2px;
  margin-bottom: 2px;
}

.wrap-text {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 300px; /* Optional: Begrenzung der Breite */
}

/* Spezifische Regeln nur für die Reservierungs-Tabelle */
.reservierungen-tabelle {
  width: 100%;
  table-layout: fixed;      /* wir verwenden colgroup, also fixed */
  border-collapse: collapse;
  box-sizing: border-box;
}

/* Cols: 1, 2 und 4 fix, 3 flexibel */
.reservierungen-tabelle col:nth-child(1),
.reservierungen-tabelle col:nth-child(2),
.reservierungen-tabelle col:nth-child(4) {
  width: 40px;
  max-width: 40px;
}

.reservierungen-tabelle col:nth-child(3) {
  width: auto;
}

.reservierungen-tabelle col:nth-child(1),
.reservierungen-tabelle col:nth-child(2),
.reservierungen-tabelle col:nth-child(4) {
  width: 40px;
  max-width: 40px;
}

.reservierungen-tabelle col:nth-child(3) {
  width: auto;
}

/* Zellen: standardmäßig umbrechen dürfen (außer Icon-Spalten) */
.reservierungen-tabelle td,
.reservierungen-tabelle th {
  white-space: normal;          /* erlaubt Umbruch */
  overflow-wrap: anywhere;      /* bricht lange Wörter/Strings */
  word-break: break-word;
  padding: 4px;
  box-sizing: border-box;
}

/* Erste / letzte Spalte: zentriert, keine Umbrüche (Icons/Buttons) */
.reservierungen-tabelle td:first-child,
.reservierungen-tabelle td:last-child {
  white-space: nowrap;
  text-align: center;
  padding: 4px;
  vertical-align: middle;
}

/* Buttons/Links dürfen keine Mindestbreite erzwingen */
.reservierungen-tabelle button,
.reservierungen-tabelle a {
  min-width: 0;
  padding: 0;
  margin: 0;
  line-height: 1;
  display: inline-block;
  border: none;
  background: none;
}

/* Als letzter Ausweg (nur falls andere Regeln noch greifen): */
.reservierungen-tabelle td { width: auto !important; }
/* Kleine Helfer */
small {
  color: #555;
}

#status-message {
  margin-top: 30px;
  font-weight: bold;
  text-align: center;
  color: #2e7d32;
}

/* --- Popup --- */
#popup-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  background: white;
  padding: 1em;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
}

#popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  display: none;
}

#modal-details {
  max-width: 100%;
  overflow-wrap: break-word;
}

.modal-table td {
  white-space: pre-wrap;     /* erlaubt Umbrüche bei Leerzeichen und \n */
  word-break: break-word;    /* bricht lange Wörter */
  overflow-wrap: break-word; /* zusätzliche Sicherheit */
  max-width: 100%;
}

/* --- Responsive Tuning --- */
@media (min-width: 300px) {
  .button-group {
    flex-direction: column;
    flex-wrap: wrap;
  }
  button {
    flex: none; /* verhindert Streckung */^
  }
}

@media (max-width: 300px) {
  table:not(.no-break),
  table:not(.no-break) tr,
  table:not(.no-break) th,
  table:not(.no-break) td {
    display: block;
    width: 100%;
  }

  table:not(.no-break) tr {
    margin-bottom: 16px;
  }

  table:not(.no-break) th label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
  }

  table:not(.no-break) td input,
  table:not(.no-break) td select,
  table:not(.no-break) td textarea {
    width: 100%;
  }
}

/* --- Fix: Zeilenumbruch in SpielerInnen-Zelle --- */
.modal-table {
  table-layout: fixed;
  width: 100%;
}

.modal-table td.wrap-text {
  white-space: normal !important;      /* erlaubt Umbruch bei Leerzeichen */
  word-break: break-word !important;   /* bricht lange Wörter */
  overflow-wrap: anywhere !important;  /* bricht notfalls mitten im Wort */
  max-width: 100% !important;          /* nutzt gesamte Spaltenbreite */
}
