/* M8 Multievent Kalender – Flat Styling */
.m8-me { --gap: 14px; width: 100%; }
.m8-me * { box-sizing: border-box; }

.m8-me__error {
  padding: 10px 12px;
  border: 1px solid #d33;
  border-radius: 8px;
  background: #fff;
}

.m8-me-topbar{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin: 0 0 12px 0;
  width: 100%;
}

.m8-me-toprow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}

.m8-me-nav{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:flex-start;
  margin: 0;
}

.m8-me-filter{
  display:flex;
  align-items:center;
  gap:8px;
  flex: 0 0 auto;
  justify-content:flex-end;
  margin-left:auto;
}

.m8-me-filter__label{
  font-size: 12px;
  font-weight: 600;
  opacity: .75;
}

.m8-me-select{
  height: 34px;
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 12px;
}

.m8-me-legend{
  display:flex;
  gap:8px;
  align-items:center;
  justify-content:center;
  width:100%;
  flex-wrap:wrap;
}

.m8-me-chip{
  display:inline-flex;
  align-items:center;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1;
  user-select:none;
  cursor: pointer;
}

.m8-me-chip:focus{
  outline: 2px solid rgba(0,0,0,.25);
  outline-offset: 2px;
}

.m8-me-chip.is-active{
  border-color: rgba(0,0,0,.25);
  background: rgba(0,0,0,.03);
}

.m8-me-swatch{
  width: 10px;
  height: 10px;
  border-radius: 99px;
  margin-right: 8px;
}

.m8-me-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 34px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  border-radius: 10px;
  text-decoration:none;
  line-height:1;
  user-select:none;
}

.m8-me-btn:hover{ background: rgba(0,0,0,.03); }
.m8-me-btn--ghost{ opacity:.85; }

/* Reset-Button (Icon) */
.m8-me-reset{
  font-size: 16px;
  padding: 0 10px;
}

.m8-me-reset__ico{
  font-size: 16px;
  line-height: 1;
}

/* Reset Button (Icon) */
.m8-me-reset{
  font-size: 16px;
  padding: 0 10px;
}

.m8-me-reset__ico{
  display:inline-block;
  line-height: 1;
}

/* Layouts */
.m8-me-months{ display:flex; flex-wrap:wrap; gap: var(--gap); }
.m8-me--layout-vertical .m8-me-months{ flex-direction:column; }
.m8-me--layout-vertical .m8-me-months__item{ width:100%; }

.m8-me--layout-horizontal .m8-me-months__item{
  flex: 1 1 320px;
  min-width: 280px;
}

/* Desktop: bis 3 nebeneinander */
@media (min-width: 992px){
  /* 1 Monat: volle Breite */
  .m8-me[data-count="1"].m8-me--layout-horizontal .m8-me-months__item{
    flex: 0 0 100%;
  }

  /* 2 Monate: 50% / 50% */
  .m8-me[data-count="2"].m8-me--layout-horizontal .m8-me-months__item{
    flex: 0 0 calc(50% - (var(--gap) / 2));
  }

  /* 3+ Monate: bis 3 nebeneinander */
  .m8-me[data-count="3"].m8-me--layout-horizontal .m8-me-months__item,
  .m8-me[data-count="4"].m8-me--layout-horizontal .m8-me-months__item,
  .m8-me[data-count="5"].m8-me--layout-horizontal .m8-me-months__item,
  .m8-me[data-count="6"].m8-me--layout-horizontal .m8-me-months__item,
  .m8-me[data-count="7"].m8-me--layout-horizontal .m8-me-months__item,
  .m8-me[data-count="8"].m8-me--layout-horizontal .m8-me-months__item{
    flex: 0 0 calc(33.333% - (2 * var(--gap) / 3));
  }
}

.m8-me--layout-grid .m8-me-months{
  display:grid;
  grid-template-columns: repeat(var(--m8me-cols, 2), minmax(280px, 1fr));
  gap: var(--gap);
}
.m8-me--layout-grid .m8-me-months__item{ min-width: 0; }

/* Month card */
.m8-me-month{
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 14px;
  overflow:hidden;
  background:#fff;
}

.m8-me-month__head{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  font-weight: 600;
}

/* Table */
.m8-me-table{ width:100%; border-collapse: collapse; table-layout: fixed; }
.m8-me-table th{
  padding: 8px 6px;
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid rgba(0,0,0,.06);
  text-align:center;
}

.m8-me-td{
  vertical-align: top;
  border-top: 1px solid rgba(0,0,0,.06);
  padding: 6px;
  height: 96px;
  background:#fff;
}

.m8-me-td.is-weekend{ background: rgba(0,0,0,.02); }
.m8-me-td.is-today{ outline: 2px solid rgba(0,0,0,.25); outline-offset: -2px; border-radius: 10px; }
.m8-me-td.is-out{ opacity: .55; }
.m8-me--hide-other .m8-me-td.is-out{ visibility: hidden; }

/* Day cell */
.m8-me-day__num{
  font-size: 12px;
  font-weight: 600;
  opacity: .85;
  margin: 0 0 6px 0;
}

/* Slots alignment */
.m8-me-slots{
  display:flex;
  flex-direction: column;
  gap: 3px;
}

.m8-me-slot{
  min-height: 18px;
}

.m8-me-event{
  --m8-me-color:#999;
  --m8-me-text:#000;
  position: relative;
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 2px 6px 2px 8px;
  border-radius: 8px;
  border-left: 4px solid var(--m8-me-color);
  overflow:hidden;
  white-space:nowrap;
  text-overflow: ellipsis;
  font-size: 12px;
  line-height: 1.2;
  color: var(--m8-me-text);
  background: transparent;
}

/* Vollflächige Hintergrundfarbe, ohne Text/Schraffur zu beeinflussen */
.m8-me-event::before{
  content:"";
  position:absolute;
  inset:0;
  background: var(--m8-me-color);
  opacity: 1;
  z-index:0;
  pointer-events:none;
}

/* Inhalt immer über dem Hintergrund */
.m8-me-event > *{
  position: relative;
  z-index: 2;
}

.m8-me-event__title{
  font-weight: 600;
  overflow:hidden;
  text-overflow: ellipsis;
}


/* Option: Eventtitel in Kalendertagen ausblenden */
.m8-me--hide-titles .m8-me-event__title{
  opacity: 0 !important;
  pointer-events: none;
}

.m8-me--hide-titles .m8-me-event{
  /* Höhe behalten, auch wenn Titel (und ggf. Zeiten) ausgeblendet sind */
  min-height: calc(1.2em + 4px);
}

.m8-me-event__time{
  font-weight: 500;
  opacity: .8;
  flex: 0 0 auto;
}

.m8-me-event__more{
  margin-left:auto;
  font-weight: 700;
  opacity: .75;
}

/* Compact (Farbstreifen) */
.m8-me-slots.is-compact{
  gap: 4px;
}

.m8-me-stripe{
  --m8-me-color:#999;
  position: relative;
  display:block;
  height: 6px;
  border-radius: 99px;
  overflow:hidden;
  background: transparent;
}

/* Vollfläche (Farbe) als pseudo-element, damit wir Opacity unabhängig von Schraffur steuern können */
.m8-me-stripe::before{
  content:"";
  position:absolute;
  inset:0;
  background: var(--m8-me-color);
  opacity: .95;
  pointer-events:none;
}

.m8-me-stripe.is-empty{
  background: transparent;
  border: 1px solid rgba(0,0,0,.08);
  opacity: 1;
}
.m8-me-stripe.is-empty::before{
  display:none;
}


/* AJAX transition */
.m8-me-months.is-loading{
  opacity: .65;
  pointer-events:none;
}

.m8-me-months.is-swapping{
  transition: transform .18s ease, opacity .18s ease;
  opacity: .25;
}


/* Ausgebucht / nicht verfügbar
   - Hintergrund halbtransparent (nur Farbe)
   - Schraffur bleibt deutlich / opak
*/
.m8-me-event--blocked{
  border-left: 0;
}

.m8-me-event--blocked::before{
  opacity: .10; /* nur die Farbe etwas zurücknehmen */
}

.m8-me-event--blocked::after{
  content: "";
  position: absolute;
  inset: 0;
  /* Fallback: farbige Schraffur (wird über mix-blend-mode dunkler) */
  background-image: repeating-linear-gradient(
    135deg,
    var(--m8-me-color) 0 6px,
    rgba(0,0,0,0) 6px 12px
  );
  pointer-events: none;
  z-index: 1;
  opacity: .55;
  mix-blend-mode: multiply;
}

/* Wenn color-mix verfügbar ist, nutzen wir einen dunkleren Farbton für mehr Kontrast */
@supports (color: color-mix(in srgb, red 50%, black)){
  .m8-me-event--blocked::after{
    background-image: repeating-linear-gradient(
      135deg,
      color-mix(in srgb, var(--m8-me-color) 70%, #000) 0 6px,
      rgba(0,0,0,0) 6px 12px
    );
    opacity: 1;
    mix-blend-mode: normal;
  }
}

.m8-me-stripe.is-blocked::before{
  opacity: .45; /* Farbstreifen halbtransparent */
}

.m8-me-stripe.is-blocked::after{
  content: "";
  position: absolute;
  inset: 0;
  /* Fallback: farbige Schraffur (wird über mix-blend-mode dunkler) */
  background-image: repeating-linear-gradient(
    135deg,
    var(--m8-me-color) 0 5px,
    rgba(0,0,0,0) 5px 10px
  );
  pointer-events: none;
  opacity: .55;
  mix-blend-mode: multiply;
}

@supports (color: color-mix(in srgb, red 50%, black)){
  .m8-me-stripe.is-blocked::after{
    background-image: repeating-linear-gradient(
      135deg,
      color-mix(in srgb, var(--m8-me-color) 70%, #000) 0 5px,
      rgba(0,0,0,0) 5px 10px
    );
    opacity: 1;
    mix-blend-mode: normal;
  }
}


.m8-me-chip--blocked{
  cursor: default;
  opacity: .95;
}

.m8-me-swatch--blocked{
  position: relative;
  background: rgba(0,0,0,.08);
  border: 1px solid rgba(0,0,0,.18);
  overflow:hidden;
}
.m8-me-swatch--blocked::after{
  content:"";
  position:absolute;
  inset:0;
  background-image: repeating-linear-gradient(135deg, rgba(0,0,0,.65) 0 4px, rgba(0,0,0,0) 4px 8px);
  pointer-events:none;
  opacity: 1;
}




/* -------------------------------------------------------------------------
   Custom Tooltip (modal-like) – wird per JS aus data-m8-me-tip befüllt
   ------------------------------------------------------------------------- */
.m8-me-tooltip{
  position: fixed;
  z-index: 99999;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(16,20,26,.96);
  color: #fff;
  box-shadow: 0 18px 45px rgba(0,0,0,.35);
  opacity: 0;
  transform: translateY(6px) scale(.98);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none; /* Tooltip soll kein Hover "abfangen" */
  backdrop-filter: blur(6px);
}

.m8-me-tooltip::before{
  content:"";
  position:absolute;
  left: var(--m8-me-tip-arrow-left, 50%);
  top: -6px;
  width: 12px;
  height: 12px;
  background: rgba(16,20,26,.96);
  transform: translateX(-50%) rotate(45deg);
}

/* Wenn Tooltip oberhalb angezeigt wird, Pfeil unten anzeigen */
.m8-me-tooltip.is-above::before{
  top: auto;
  bottom: -6px;
}

.m8-me-tooltip.is-visible{
  opacity: 1;
  transform: translateY(0) scale(1);
}

.m8-me-tooltip__inner{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.m8-me-tooltip__line{
  font-size: 12px;
  line-height: 1.25;
  opacity: .95;
}

.m8-me-tooltip__line.is-first{
  font-weight: 700;
  opacity: 1;
}
