/* ==========================================================
   COMPONENT: Tables
   Wiederverwendbare Tabellen, aktuell Termine / Veranstaltungen
   ========================================================== */

.termin-tabelle {
  width: 100%;
  max-width: var(--content-width);
  margin: 2rem auto;
  border-collapse: collapse;
  font-size: var(--font-normal);
  background: #fff;
  border-radius: var(--radius-large);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.termin-tabelle td,
.termin-tabelle th {
  vertical-align: top;
  padding: clamp(0.65rem, 1.2vw, 1rem) clamp(0.75rem, 1.5vw, 1.2rem);
  border-bottom: 1px solid #ddd;
}

.termin-tabelle tr:nth-child(even) {
  background: #f9f9f9;
}

.termin-tabelle tbody tr:hover {
  background-color: #fffbe6;
  transition: background-color 0.2s ease;
}

.termin-tabelle thead tr:hover {
  background: inherit;
}

.termin-vergangen {
  background-color: #ffeaea;
  color: #800000;
}

.termin-naechster {
  background-color: #fff4d6;
  color: #8a4500;
  font-weight: 700;
}

.termin-zukunft {
  background-color: #eaffea;
  color: #006600;
}

.termin-vergangen td {
  background-color: #ffeaea;
  color: #800000;
}

.termin-naechster td {
  background-color: #fff4d6;
  color: #444;
  font-weight: 700;
}

.termin-zukunft td {
  background-color: #eaffea;
  color: #006600;
}

.termin-legende {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.termin-legende a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0.3rem 0.7rem;
  margin: 0;
  border-radius: var(--radius-small);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  will-change: transform;
}

.legende-vergangen {
  background: #ffeaea;
  color: #800000;
}

.legende-naechster {
  background: #fff4d6;
  color: #8a4500;
}

.legende-zukunft {
  background: #eaffea;
  color: #006600;
}

.termin-legende a:hover {
  opacity: 0.8;
  transform: scale(1.06);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.termin-legende a:active {
  transform: scale(1.03);
}

@media (max-width: 600px) {
  .termin-tabelle {
    max-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 0.92rem;
  }

  .termin-tabelle tr {
    margin-bottom: 0.5rem;
    border: 1px solid #ccc;
    border-radius: var(--radius-medium);
    overflow: hidden;
  }

  .termin-tabelle td,
  .termin-tabelle th {
    padding: 0.5rem 0.6rem;
    border-bottom: 2px solid #ddd;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .termin-tabelle td:first-child {
    width: 7.4rem;
    white-space: nowrap;
  }

  .termin-tabelle td:last-child {
    width: auto;
  }

  .termin-legende a {
    flex: 1 1 145px;
    max-width: 240px;
  }
}

@media (max-width: 380px) {
  .termin-tabelle {
    font-size: 0.86rem;
  }

  .termin-tabelle td,
  .termin-tabelle th {
    padding: 0.45rem 0.5rem;
  }

  .termin-tabelle td:first-child {
    width: 6.8rem;
  }
}
