#termine-container {
  border: 1px solid #c9c9c9;
  background-color: #fcfcfc;
  padding: 3px;
}

/* Zeilen wie Tabelle auf Desktop */
.termine-row {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid #ddd;
  padding: 8px 0;
  text-align: left; /* linksbündig */
  align-items: flex-start; /* Inhalte oben ausrichten */
}

.termine-row:last-child {
  border-bottom: none;
}

/* Spalten */
.termine-col {
  flex: 1;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* oben */
}

  .termine-col h3 {
    font-size: 20px;
    line-height: 1.6;
    font-weight: bold;
    padding: 0;
    margin: 0;
  }

/* Überschriften bleiben mittig oder optional oben */
.termine-header {
  display: none; /* nur Desktop */
  font-weight: bold;
  border-bottom: 2px solid #000;
  padding-bottom: 5px;
  margin-bottom: 10px;
}

.events {
  margin: 20px;
}

/* Beschreibung kursiv und etwas kleiner */
.termine-description {
  font-style: italic;
  font-size: 0.9em;
}

/* Desktop Header sichtbar ab md */
@media (min-width: 768px) {
  .termine-header {
    display: flex;
    align-items: flex-start; /* Header-Items auch oben */
  }

}

/* Mobil: Karten untereinander */
@media (max-width: 767px) {
 #termine-container {
		border: none;
		background-color: #fff;
		padding: 0;
  }

	.termine-row:last-child {
	  border-bottom: 1px solid #ddd;
	}

  .termine-row {
    flex-direction: column;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    align-items: flex-start; /* oben */
  }
  .termine-col {
    padding: 4px 0;
    flex: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
  }
  
  .events {
    margin: 0;
  }
}

@media (max-width: 399px) {
  .termine-col h3 {
    font-size: 20px;
    font-weight: bold;
    padding: 0;
    margin: 0;
  }
}

.event {
  margin-bottom: 20px;
  font-family: sans-serif;
}

.tags {
  display: flex;
  flex-wrap: wrap; /* erlaubt Zeilenumbruch wenn nötig */
  gap: 6px;        /* Abstand zwischen Tags */
  margin-top: 6px;
}

/* Pillen: alle im selben Stil (Verlauf von hell nach dunkel, weiße Schrift, weicher Schatten in der eigenen Farbe) */
.tag {
  --tag-light: #9ca3af;
  --tag-dark: #4b5563;
  --tag-shadow: rgba(75, 85, 99, 0.35);

  display: inline-flex;      /* wichtig! */
  align-items: center;
  justify-content: center;

  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;

  border: none;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--tag-light), var(--tag-dark));
  box-shadow: 0 2px 6px var(--tag-shadow);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);

  white-space: nowrap;       /* verhindert Zeilenumbruch im Tag */
  width: fit-content;        /* nur so breit wie Inhalt */

  transition: all 0.2s ease;
}

/* Kategorien: Leistungssport lila, Breitensport grün */
.tag.leistungssport {
  --tag-light: #a855f7;
  --tag-dark: #6b21a8;
  --tag-shadow: rgba(126, 34, 206, 0.4);
}

.tag.breitensport {
  --tag-light: #22c55e;
  --tag-dark: #166534;
  --tag-shadow: rgba(34, 197, 94, 0.4);
}

/* Art: Wettbewerb blau, Lehrgang türkis, Testlaufen gold */
.tag.art-wettbewerb {
  --tag-light: #3b82f6;
  --tag-dark: #1e40af;
  --tag-shadow: rgba(37, 99, 235, 0.4);
}

.tag.art-lehrgang {
  --tag-light: #14b8a6;
  --tag-dark: #0f766e;
  --tag-shadow: rgba(13, 148, 136, 0.4);
}

.tag.art-testlaufen {
  --tag-light: #eab308;
  --tag-dark: #a16207;
  --tag-shadow: rgba(202, 138, 4, 0.4);
}

/* Status: abgesagt orange, vorläufig grau */
.tag.abgesagt {
  --tag-light: #fb923c;
  --tag-dark: #c2410c;
  --tag-shadow: rgba(234, 88, 12, 0.4);
}

.tag.vorlaeufig {
  --tag-light: #94a3b8;
  --tag-dark: #475569;
  --tag-shadow: rgba(71, 85, 105, 0.4);
}

/* Priorität als 5 px breiter Streifen links an der Zeile: hoch rot, mittel blau, gering grün.
   Als Schatten nach innen, damit sich die Breite der Spalten nicht ändert. */
/* Gedeckte Töne, damit der Streifen nicht vom Inhalt ablenkt */
.termine-row.termine-prio-hoch { --prio: #e89a9a; }
.termine-row.termine-prio-mittel { --prio: #9db8e6; }
.termine-row.termine-prio-gering { --prio: #9fd0ae; }

.termine-row.termine-prio-hoch,
.termine-row.termine-prio-mittel,
.termine-row.termine-prio-gering {
  box-shadow: inset 10px 0 0 var(--prio);
}

/* Handy: Streifen zusätzlich zum Schatten der Karte */
@media (max-width: 767px) {
  .termine-row.termine-prio-hoch,
  .termine-row.termine-prio-mittel,
  .termine-row.termine-prio-gering {
    box-shadow: inset 10px 0 0 var(--prio), 0 2px 5px rgba(0, 0, 0, 0.05);
  }
}

/* Abstand zwischen Streifen und Inhalt (mindestens 6 px); für alle Zeilen gleich, damit der Inhalt untereinander steht */
.termine-row { padding-left: 6px; }
@media (max-width: 767px) {
  .termine-row { padding-left: 16px; }
}

/* „Wichtig!“: nur Termine mit hoher Priorität, rot (mittel und gering bekommen keine Pille) */
.tag.prioritaet-hoch {
  --tag-light: #ef4444;
  --tag-dark: #991b1b;
  --tag-shadow: rgba(220, 38, 38, 0.4);
}

/* Erste Zeile: drei exakt gleich breite Spalten (Titel, Datum und Uhrzeit, Status-Pillen); Titel, Datum und Uhrzeit
   linksbündig, die Status-Pille ganz rechts.
   Feste Breite von je einem Drittel (box-sizing: border-box über Bootstrap), damit die Spalten in allen Zeilen
   untereinander stehen, egal wie lang der Inhalt ist. */
.termine-titel,
.termine-wann,
.termine-status {
  flex: 0 0 33.3333%;
  max-width: 33.3333%;
  min-width: 0;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

.termine-wann {
  flex-direction: row !important;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: baseline;
  column-gap: 16px;
  padding-top: 4px;
  text-align: left;
}

.termine-status {
  align-items: flex-end;
  padding-top: 4px;
}

.termine-status .tags {
  margin-top: 0;
  justify-content: flex-end;
}

/* Ort in einer eigenen Zeile */
.termine-ort {
  flex: 0 0 100%;
  margin-top: 4px;
}

/* Danach Beschreibung und Pillen („Wichtig!“, Kategorien) über die ganze Breite */
.termine-details {
  flex: 0 0 100%;
  margin-top: 6px;
}

/* Handy: oben Titel und rechts die Status-Pille, darunter Datum und Uhrzeit, Ort, Beschreibung */
@media (max-width: 767px) {
  .termine-row {
    flex-direction: row;
  }

  .termine-row .termine-col {
    flex: 0 0 100%;
    margin-top: 0;
  }

  .termine-row .termine-col {
    max-width: 100%;
  }

  /* Titel und Status-Pille in einer Zeile, die Pille ganz rechts */
  .termine-row .termine-titel {
    flex: 1 1 0;
    min-width: 0;
  }

  .termine-row .termine-status {
    flex: 0 0 auto;
    width: auto;
    padding-left: 8px;
    order: 2;
  }

  /* Datum und Uhrzeit unter Titel und Status, untereinander und linksbündig */
  .termine-row .termine-titel { order: 1; }
  .termine-row .termine-wann {
    order: 3;
    flex-direction: column !important;
    align-items: flex-start;
    text-align: left;
    padding-top: 0;
  }
  .termine-row .termine-ort { order: 4; }
  .termine-row .termine-details { order: 5; }

  .termine-datum {
    padding-bottom: 4px;
  }
}

/* Abgesagter Termin: hellroter Hintergrund, Titel durchgestrichen */
.termine-row.termine-abgesagt {
  background-color: #fdecec;
}

.termine-abgesagt h3 {
  text-decoration: line-through;
}

/* „Weitere Infos“ unter der Beschreibung */
.termine-link {
  font-style: normal;
}

.location {
  display: inline-flex;       /* Icon + Text nebeneinander */
  align-items: center;
  gap: 6px;

  white-space: nowrap;        /* verhindert Zeilenumbruch */
}

.location i {
  display: inline-block;      /* Wichtig! verhindert 100%-Breite */
  flex: 0 0 auto;             /* wächst nicht, bleibt nur so breit wie Inhalt */
  font-size: 0.9rem;          /* optional anpassen */
  color: #9ca3af;
}

.location .icon {
  color: #9ca3af; /* grau statt knallig */
}

.locations {
  line-height: 1.6;
  display: flex;
  flex-wrap: nowrap; /* Symbol bleibt vor dem Ort, lange Adressen brechen im Text um */
  gap: 6px;
  align-items: flex-start;
}
.locations i {
  flex: 0 0 auto;
  margin-top: 5px;
}

/* Ladeanzeige, bis der Kalender geladen ist */
.termine-laden {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 10px;
  color: #6b7280;
}

.termine-spinner {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 3px solid #e5e7eb;
  border-top-color: #dc3545; /* Linkfarbe der Website */
  border-radius: 50%;
  animation: termine-drehen 0.8s linear infinite;
}

@keyframes termine-drehen {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .termine-spinner {
    animation-duration: 2.4s;
  }
}
