/* Minimal Styling für TBS Events Kalender-Widget */

.tbs-events-widget {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #1f2937;
  /* Volle Breite im Contao-Spaltenbereich nutzen (Modul-Container kann sonst schmaler sein) */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.tbs-events-widget-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.tbs-events-month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.tbs-month-nav-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  text-decoration: none;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  color: #111827;
}

.tbs-month-nav-btn.disabled {
  opacity: 0.4;
}

.tbs-month-label {
  font-weight: 700;
}

.tbs-events-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  color: #4b5563;
  font-size: 0.9rem;
}

.tbs-events-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/*
 * Hex-Anordnung: 7-Spalten-Raster – schmalerer Kalender (3 Spalten),
 * oben/unten nur noch eine freie Spalte zwischen TL und TR (Spalte 4).
 * TL/BL: 2–3, TR/BR: 5–6, L: 1–2, R: 6–7, Kalender: 3–5.
 */
.tbs-events-layout-hex {
  display: grid;
  /* Mitte (Kalender-Spalten 3–5) stärker gewichten, damit die Wochentabelle nicht gequetscht wird */
  grid-template-columns:
    minmax(0, 0.9fr)
    minmax(0, 0.9fr)
    minmax(0, 1.15fr)
    minmax(0, 1.15fr)
    minmax(0, 1.15fr)
    minmax(0, 0.9fr)
    minmax(0, 0.9fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  column-gap: 10px;
  row-gap: 12px;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.tbs-teaser-hex-ring {
  display: contents;
}

.tbs-teaser-slot {
  min-width: 0;
  display: flex;
  justify-content: center;
  width: 100%;
}

.tbs-teaser-slot-top-left {
  grid-column: 2 / 4;
  grid-row: 1;
}

.tbs-teaser-slot-top-right {
  grid-column: 5 / 7;
  grid-row: 1;
}

.tbs-teaser-slot-left {
  grid-column: 1 / 3;
  grid-row: 2;
}

.tbs-teaser-slot-right {
  grid-column: 6 / 8;
  grid-row: 2;
}

.tbs-teaser-slot-bottom-left {
  grid-column: 2 / 4;
  grid-row: 3;
}

.tbs-teaser-slot-bottom-right {
  grid-column: 5 / 7;
  grid-row: 3;
}

.tbs-teaser-slot-top-left,
.tbs-teaser-slot-top-right {
  align-self: end;
  padding-bottom: 2px;
}

.tbs-teaser-slot-bottom-left,
.tbs-teaser-slot-bottom-right {
  align-self: start;
  padding-top: 2px;
}

.tbs-teaser-slot-left,
.tbs-teaser-slot-right {
  align-self: center;
}

/* Leere Slots: Platz im Raster, unsichtbar (Desktop) */
.tbs-teaser-slot--empty {
  visibility: hidden;
  pointer-events: none;
}

.tbs-calendar-wrapper {
  grid-column: 3 / 6;
  grid-row: 2;
  align-self: center;
  width: 100%;
  min-width: 0;
  border-radius: 16px;
  /* Fallback nur wenn Inhalt wirklich übersteht (Tabelle selbst hat keine Mindestbreite mehr) */
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.07);
}

/* Punkt-Navigation nur mobil (Desktop: kein Grid-Platz) */
.tbs-teaser-slider-dots {
  display: none;
}

.tbs-calendar {
  /* Feste Spaltenbreiten: lange Ferien-Texte weiten die Tabelle nicht mehr */
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-collapse: collapse;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  overflow: visible;
}

.tbs-calendar th,
.tbs-calendar td {
  border: 1px solid rgba(0,0,0,0.06);
  padding: 6px;
  vertical-align: top;
}

.tbs-col-kw {
  width: 46px;
  min-width: 46px;
  max-width: 46px;
  text-align: center;
  font-weight: 700;
  background: #f9fafb;
}

/* Mo–So gleich breit (Rest nach KW); min-width:0 verhindert Aufweiten durch Inhalt */
.tbs-calendar thead th:not(.tbs-col-kw),
.tbs-calendar tbody td:not(:first-child) {
  width: calc((100% - 46px) / 7);
  min-width: 0;
}

.tbs-day {
  min-height: 58px;
  height: auto;
  position: relative;
  overflow: visible;
}

.tbs-day-outside {
  background: #fafafa;
}

.tbs-day-outside .tbs-day-number,
.tbs-day-outside .tbs-day-offday-badges,
.tbs-day-outside .tbs-day-events {
  opacity: 0.55;
}

.tbs-day-today {
  outline: 2px solid rgba(241, 142, 0, 0.45);
  outline-offset: -2px;
}

.tbs-day-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  position: relative;
  overflow: visible;
}

.tbs-day-number {
  font-weight: 700;
}

.tbs-day-offday-badges {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 3px;
  max-width: 100%;
  min-width: 0;
}

.tbs-offday-badge {
  display: block;
  box-sizing: border-box;
  max-width: 100%;
  font-size: 0.65rem;
  line-height: 1.25;
  padding: 2px 5px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.1);
  background: rgba(0,0,0,0.02);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  text-align: center;
}

.tbs-day-events {
  display: flex;
  gap: 4px;
  align-items: center;
}

.tbs-day-tooltip {
  display: none;
  position: fixed;
  z-index: 9000;
  left: 0;
  top: 0;
  width: max-content;
  min-width: 240px;
  max-width: min(340px, calc(100vw - 24px));
  background: rgba(17, 24, 39, 0.98);
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 14px 36px rgba(0,0,0,0.35);
  white-space: normal;
  pointer-events: auto;
  opacity: 1 !important;
}

.tbs-day-tooltip.is-visible {
  display: block;
}

.tbs-day-tooltip-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 8px;
  opacity: 0.95;
}

.tbs-day-tooltip-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.tbs-day-tooltip-link {
  color: #fff;
  text-decoration: none;
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

.tbs-day-tooltip-link:hover {
  background: rgba(255,255,255,0.16);
}

.tbs-day-state-holiday {
  background: #fef9c3;
}

.tbs-day-state-closed {
  background: #fee2e2;
}

.tbs-day.tbs-has-mode-bg {
  background: var(--tbs-mode-day-bg, transparent);
}

.tbs-day-outside.tbs-has-mode-bg {
  background: color-mix(in srgb, var(--tbs-mode-day-bg, #f3f4f6) 55%, #fafafa);
}

.tbs-day-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
}

.tbs-day-mode-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.9;
}

.tbs-day-mode-icon-img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: block;
}

.tbs-day-mode-icon-fa {
  font-size: 0.78rem;
  line-height: 1;
  color: #374151;
}

.tbs-day-mode-deco {
  display: none; /* später: Event-Layer */
}

.tbs-mode-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: center;
  margin-top: 10px;
  padding: 0 4px 2px;
  font-size: 0.82rem;
  color: #4b5563;
}

.tbs-mode-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tbs-mode-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.12);
  display: inline-block;
}

.tbs-event-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2e3254;
  display: inline-block;
}

.tbs-event-dot-featured {
  background: #f18e00;
}

.tbs-event-more {
  font-size: 0.75rem;
  color: #4b5563;
}

/* Teaser (sehr minimal, damit es nicht "kaputt" aussieht) */
.tbs-teasers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.tbs-teaser-card {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  overflow: visible;
  width: 100%;
  max-width: 240px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.09);
}

.tbs-teaser-card-has-series {
  position: relative;
}

.tbs-teaser-series-dates-popover {
  display: none;
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 52px;
  z-index: 6;
  background: rgba(17, 24, 39, 0.94);
  color: #f9fafb;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.78rem;
  max-height: 130px;
  overflow-y: auto;
  pointer-events: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.tbs-teaser-series-dates-title {
  font-weight: 650;
  margin-bottom: 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.9;
}

.tbs-teaser-series-dates-list {
  margin: 0;
  padding-left: 1.1rem;
}

.tbs-teaser-series-dates-list li {
  margin: 0.1rem 0;
}

.tbs-teaser-card-has-series:hover .tbs-teaser-series-dates-popover {
  display: block;
}

.tbs-teaser-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.tbs-teaser-image-wrapper {
  position: relative;
  background: #f3f4f6;
  height: 96px;
  overflow: hidden;
}

.tbs-teaser-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tbs-teaser-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 0.8rem;
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

.tbs-teaser-date-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(17,24,39,0.75);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.tbs-teaser-featured-badge {
  position: absolute;
  right: 10px;
  top: 10px;
  background: #f18e00;
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
}

.tbs-teaser-text {
  padding: 10px;
  min-height: 62px;
}

.tbs-teaser-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.tbs-teaser-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tbs-teaser-target {
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.1);
  background: rgba(0,0,0,0.02);
  color: #374151;
}

@media (max-width: 960px) {
  .tbs-events-layout-hex {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    overflow-x: hidden;
  }

  .tbs-calendar-wrapper {
    order: -1;
    width: 100%;
    max-width: 100%;
    grid-column: unset;
    grid-row: unset;
    overflow-x: hidden;
    /* ~75 %: ganze Woche (Mo–So) ohne horizontales Scrollen; zoom skaliert Layout + Darstellung */
    zoom: 0.75;
  }

  /* Firefox & Umgebungen ohne zoom: gleiche Wirkung per transform */
  @supports not (zoom: 1) {
    .tbs-calendar-wrapper {
      zoom: unset;
    }

    .tbs-calendar {
      transform: scale(0.75);
      transform-origin: top center;
      width: calc(100% / 0.75);
      max-width: none;
    }
  }

  .tbs-teaser-slot--empty {
    display: none !important;
  }

  .tbs-teaser-slot {
    visibility: visible;
    grid-column: unset !important;
    grid-row: unset !important;
    padding: 0 !important;
  }

  /* Nur befüllte Teaser horizontal wischen */
  .tbs-teaser-hex-ring {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 16px;
    gap: 12px;
    padding: 4px 8px 6px;
    margin: 0 -4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .tbs-teaser-hex-ring::-webkit-scrollbar {
    height: 6px;
  }

  .tbs-teaser-hex-ring .tbs-teaser-slot:not(.tbs-teaser-slot--empty) {
    flex: 0 0 min(88vw, 300px);
    max-width: 300px;
    scroll-snap-align: center;
    align-self: stretch;
  }

  .tbs-teaser-slider-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 8px;
    order: 1;
  }

  .tbs-teaser-slider-dots[hidden] {
    display: none !important;
  }

  .tbs-teaser-slider-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    border: none;
    padding: 0;
    background: rgba(15, 23, 42, 0.22);
    cursor: pointer;
    flex-shrink: 0;
  }

  .tbs-teaser-slider-dot.active {
    background: #f18e00;
    transform: scale(1.15);
  }

  .tbs-day-tooltip.is-visible {
    display: none !important; /* Mobile: kein Hover */
  }
}

/* Lightbox für interne Event-Details */
.tbs-lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.62);
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.tbs-lightbox-overlay.is-open {
  display: flex;
}

.tbs-lightbox-dialog {
  position: relative;
  width: min(960px, 100%);
  height: auto;
  max-height: min(92vh, 920px);
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}

.tbs-lightbox-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.85);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.tbs-lightbox-frame {
  width: 100%;
  height: 200px;
  min-height: 160px;
  max-height: min(92vh, 920px);
  border: 0;
  display: block;
  background: transparent;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

body.tbs-lightbox-open {
  overflow: hidden;
}

