.alea-kurskalender {
    --alea-header: #7a7a7a;
    --alea-empty: #dbdbdb;
    --alea-border: #676767;
    --alea-cell-min-height: 160px;
    --alea-mobile-min-width: 900px;
    width: 100%;
}

.alea-calendar-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 0 28px;
    padding-bottom: 2px;
}

.alea-calendar-frame {
    min-width: var(--alea-mobile-min-width);
    border: 1px solid var(--alea-border);
    border-radius: 5px;
    overflow: hidden;
    background: var(--alea-empty);
}

.alea-calendar-table {
    width: 100%;
    border: 0;
    border-collapse: collapse;
    table-layout: fixed;
    margin: 0;
    background: var(--alea-empty);
}

.alea-calendar-table th,
.alea-calendar-table td {
    width: 14.285714%;
    border: 0;
}

.alea-calendar-table thead th {
    padding: 14px 8px;
    background: var(--alea-header);
    color: #fff;
    text-align: center;
    font: inherit;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.2;
    border-right: 1px solid var(--alea-border);
}

.alea-calendar-table thead th:last-child {
    border-right: 0;
}

.alea-calendar-table tbody td {
    height: var(--alea-cell-min-height);
    min-height: var(--alea-cell-min-height);
    padding: 0;
    vertical-align: stretch;
    background: var(--alea-empty);
    border-top: 1px solid var(--alea-border);
    border-right: 1px solid var(--alea-border);
}

.alea-calendar-table tbody td:last-child {
    border-right: 0;
}

.alea-calendar-day--empty {
    position: relative;
}

.alea-empty-date {
    min-height: var(--alea-cell-min-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    color: #545454;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.25;
}

.alea-calendar-events {
    height: var(--alea-cell-min-height);
    min-height: var(--alea-cell-min-height);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.alea-calendar-event {
    position: relative;
    min-height: 0;
    flex: 1 1 0;
    display: flex;
    overflow: hidden;
    background: var(--alea-event-bg, #8c8c8c);
    color: var(--alea-event-fg, #fff);
    transition:
        flex-grow 420ms cubic-bezier(0.22, 1, 0.36, 1),
        flex-basis 420ms cubic-bezier(0.22, 1, 0.36, 1),
        min-height 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.alea-calendar-event + .alea-calendar-event {
    border-top: 1px solid rgba(255, 255, 255, 0.7);
}

.alea-event-content {
    position: relative;
    isolation: isolate;
    width: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 18px 10px;
    overflow: hidden;
    color: inherit !important;
    text-decoration: none !important;
    text-align: center;
    line-height: 1.2;
    box-sizing: border-box;
    transition: padding 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.alea-event-content:hover,
.alea-event-content:focus {
    color: inherit !important;
    text-decoration: none !important;
}

.alea-event-content:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -4px;
}

.alea-event-cohort,
.alea-event-date,
.alea-event-title,
.alea-event-time {
    position: relative;
    z-index: 2;
}

.alea-event-cohort,
.alea-event-date,
.alea-event-time {
    display: block;
    font-size: 14px;
    font-weight: 400;
}

.alea-event-cohort {
    margin: 0 0 12px;
}

.alea-event-date {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.2;
    margin: 0 0 7px;
}

.alea-event-title {
    display: block;
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.22;
}

.alea-event-time {
    margin: 7px 0 0;
}

/* SVG-Wasserzeichen: Farbe und Deckkraft kommen aus den Plugin-Einstellungen. */
.alea-event-icon {
    position: absolute;
    z-index: 1;
    top: 8px;
    right: 5px;
    width: 74px;
    height: 74px;
    background-color: var(--alea-event-icon-color, #fff);
    opacity: var(--alea-event-icon-opacity, 0.22);
    -webkit-mask-image: var(--alea-event-icon-url);
    mask-image: var(--alea-event-icon-url);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    pointer-events: none;
    transition:
        width 360ms cubic-bezier(0.22, 1, 0.36, 1),
        height 360ms cubic-bezier(0.22, 1, 0.36, 1),
        top 360ms cubic-bezier(0.22, 1, 0.36, 1),
        right 360ms cubic-bezier(0.22, 1, 0.36, 1),
        opacity 260ms ease;
}

/* Mehrere Termine an einem Tag teilen sich immer nur die normale Tageshöhe. */
.alea-calendar-events--multi .alea-calendar-event {
    min-height: 0;
}

/* Kompakte Darstellung ohne Layout-Spruenge:
   Datum + Titel bleiben immer im normalen Dokumentfluss. Durchgang und Uhrzeit
   werden bei Doppelterminen absolut positioniert und nur eingeblendet. Dadurch
   veraendert sich beim Hover nicht gleichzeitig die komplette Typografie. */
.alea-calendar-events--multi .alea-event-content {
    gap: 0;
    padding: 7px 8px;
}

.alea-calendar-events--multi .alea-event-cohort,
.alea-calendar-events--multi .alea-event-time {
    position: absolute;
    left: 8px;
    right: 8px;
    display: block;
    margin: 0;
    font-size: 13px;
    line-height: 1.15;
    opacity: 0;
    pointer-events: none;
    transform: translateY(0);
    transition: opacity 220ms ease;
}

.alea-calendar-events--multi .alea-event-cohort {
    top: 14px;
}

.alea-calendar-events--multi .alea-event-time {
    bottom: 14px;
}

.alea-calendar-events--multi .alea-event-date {
    margin: 0 0 5px;
    font-size: 13px;
    line-height: 1.15;
}

.alea-calendar-events--multi .alea-event-title {
    margin: 0;
    font-size: 13px;
    line-height: 1.12;
}

.alea-calendar-events--multi .alea-event-icon {
    width: 50px;
    height: 50px;
    top: 5px;
    right: 5px;
}

/* Doppeltermine: Die Trennlinie wandert bewusst langsam zwischen oben und unten.
   Der aktive Bereich wird anhand der festen oberen/unteren Zellhaelfte per JS bestimmt.
   Dadurch kann die wandernde Trennlinie den Hover-Zustand nicht selbst umschalten. */
.alea-calendar-events--count-2 {
    display: grid;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    transition: grid-template-rows 1000ms cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: grid-template-rows;
}

.alea-calendar-events--count-2 .alea-calendar-event {
    min-height: 0;
    overflow: hidden;
    flex: none;
    transition: none;
}

.alea-calendar-events--count-2.alea-double--top-active {
    grid-template-rows: minmax(0, 2.15fr) minmax(0, 1fr);
}

.alea-calendar-events--count-2.alea-double--bottom-active {
    grid-template-rows: minmax(0, 1fr) minmax(0, 2.15fr);
}

/* Zusatzinformationen erscheinen sanft erst im gerade groesseren Eintrag.
   Datum und Kurstitel selbst bleiben dabei komplett stabil. */
.alea-calendar-events--count-2.alea-double--top-active > .alea-calendar-event:nth-child(1) .alea-event-cohort,
.alea-calendar-events--count-2.alea-double--top-active > .alea-calendar-event:nth-child(1) .alea-event-time,
.alea-calendar-events--count-2.alea-double--bottom-active > .alea-calendar-event:nth-child(2) .alea-event-cohort,
.alea-calendar-events--count-2.alea-double--bottom-active > .alea-calendar-event:nth-child(2) .alea-event-time {
    opacity: 1;
    transition: opacity 360ms ease 180ms;
}

@media (prefers-reduced-motion: reduce) {
    .alea-calendar-events--count-2 {
        transition-duration: 1ms;
    }

    .alea-calendar-events--count-2 .alea-event-cohort,
    .alea-calendar-events--count-2 .alea-event-time {
        transition-duration: 1ms;
        transition-delay: 0ms;
    }
}

/* Bei mehr als zwei Eintraegen bleibt die gleichmaessige, stabile Teilung.
   Fuer den derzeit benoetigten Doppeltermin ist die weiche Grid-Animation aktiv. */
.alea-calendar-events--multi:not(.alea-calendar-events--count-2) .alea-calendar-event {
    flex: 1 1 0;
}

.alea-kurskalender-empty {
    padding: 18px 20px;
    background: #f3f3f3;
    border: 1px solid #ddd;
    text-align: center;
}

@media (hover: none), (pointer: coarse) {
    /* Auf Touch-Geräten gibt es kein Hover: dort bleibt die saubere Teilung stabil. */
    .alea-calendar-events--multi:hover .alea-calendar-event {
        flex: 1 1 0;
    }
}

@media (max-width: 767px) {
    .alea-calendar-scroll {
        margin-bottom: 20px;
    }

    .alea-calendar-table thead th {
        padding: 10px 6px;
        font-size: 13px;
    }
}
