/* =========================================================================
   EDS Calendar - frontend styles
   Design tokens mirror the Eichendorffschule SCSS palette so the calendar
   blends seamlessly with the site (primary #2f80b2, sky #c8ebf9, radius 4px).
   Override any --eds-* variable from the site to re-theme.
   ========================================================================= */
.eds-cal {
    --eds-primary: #2f80b2;
    --eds-dark: #256a94;
    --eds-light: #8edcf8;
    --eds-sky: #c8ebf9;
    --eds-surface: #f7fafb;
    --eds-ink: #212529;
    --eds-muted: #6c7a86;
    --eds-border: rgba(0, 51, 102, .18);
    --eds-radius: 4px;
    --eds-speed: .3s;

    --eds-cat-ferien: #2f9e6f;
    --eds-cat-feiertag: #c0392b;
    --eds-cat-konferenz: var(--eds-primary);
    --eds-cat-pruefung: #8e44ad;
    --eds-cat-default: var(--eds-primary);

    color: var(--eds-ink);
    font-size: 1rem;
    line-height: 1.4;
}

.eds-cal *,
.eds-cal *::before,
.eds-cal *::after {
    box-sizing: border-box;
}

/* ---------- Toolbar (large view) --------------------------------------- */
.eds-cal__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
}

.eds-cal__title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--eds-primary);
    text-align: center;
    flex: 1 1 auto;
}

.eds-cal__nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 auto;
    border: 1px solid var(--eds-border);
    border-radius: var(--eds-radius);
    background: var(--eds-surface);
    color: var(--eds-primary);
    font-size: 1.5rem;
    line-height: 1;
    text-decoration: none;
    transition: background var(--eds-speed), color var(--eds-speed), border-color var(--eds-speed);
}

.eds-cal__nav:hover,
.eds-cal__nav:focus-visible {
    background: var(--eds-primary);
    border-color: var(--eds-primary);
    color: var(--eds-surface);
}

/* ---------- Grid ------------------------------------------------------- */
.eds-cal__grid {
    border: 1px solid var(--eds-border);
    border-radius: var(--eds-radius);
    overflow: hidden;
    background: var(--eds-surface);
}

.eds-cal__weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

/* One CSS grid per week. Fixed 7 equal columns (minmax(0,1fr) stops a long
   word from widening a column). Rows: 1 = day numbers, 2..(1+lanes) = multi-day
   bar lanes, last = single-day events. */
.eds-cal__week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: min-content;
    position: relative;
}

.eds-cal__weekday {
    padding: .5rem .25rem;
    text-align: center;
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--eds-surface);
    background: var(--eds-primary);
}

/* Column background: borders + weekend/today/outside shading, spans the whole
   week height so bars and events overlay on top of it. */
.eds-cal__daybg {
    min-height: 6.5rem;
    border-left: 1px solid var(--eds-border);
    z-index: 0;
}

.eds-cal__daybg.is-firstcol {
    border-left: 0;
}

.eds-cal__week + .eds-cal__week .eds-cal__daybg {
    border-top: 1px solid var(--eds-border);
}

.eds-cal__daybg.is-weekend {
    background: rgba(200, 235, 249, .35);
}

.eds-cal__daybg.is-outside {
    background: rgba(0, 0, 0, .02);
}

/* Content layers above the backgrounds. min-width:0 keeps columns from being
   stretched by long unbreakable content. */
.eds-cal__daynum-wrap,
.eds-cal__bar,
.eds-cal__daycol {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.eds-cal__daynum-wrap {
    padding: .25rem .3rem 0;
    text-align: right;
}

.eds-cal__daynum {
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.6rem;
}

.eds-cal__daynum-wrap.is-outside .eds-cal__daynum {
    opacity: .5;
}

.eds-cal__daynum.is-today {
    display: inline-block;
    min-width: 1.6rem;
    text-align: center;
    border-radius: 999px;
    background: var(--eds-primary);
    color: var(--eds-surface);
}

/* Continuous multi-day bars. */
.eds-cal__bar {
    align-self: start;
    margin: 1px 2px;
    padding: .1rem .45rem;
    border-radius: var(--eds-radius);
    border-left: 3px solid var(--eds-cat-default);
    background: rgba(47, 128, 178, .16);
    font-size: .76rem;
    line-height: 1.35;
    color: var(--eds-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eds-cal__bar.is-continue-left {
    margin-left: 0;
    border-left: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.eds-cal__bar.is-continue-right {
    margin-right: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.eds-cal__bar-arrow {
    font-weight: 700;
    margin-right: .15rem;
}

.eds-cal__daycol {
    padding: 0 .3rem .3rem;
}

/* ---------- Events in cells -------------------------------------------- */
.eds-cal__events {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.eds-cal__event {
    display: flex;
    align-items: flex-start;
    gap: .25rem;
    padding: .12rem .35rem;
    border-radius: var(--eds-radius);
    border-left: 3px solid var(--eds-cat-default);
    background: rgba(47, 128, 178, .1);
    font-size: .78rem;
    line-height: 1.25;
    overflow: hidden;
    min-width: 0;
}

.eds-cal__event-time {
    font-weight: 600;
    color: var(--eds-dark);
    flex: 0 0 auto;
}

.eds-cal__event-title {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.eds-cal__more {
    list-style: none;
    font-size: .72rem;
    color: var(--eds-muted);
    padding-left: .35rem;
}

/* ---------- Category colours ------------------------------------------- */
.eds-cal__event--ferien { border-left-color: var(--eds-cat-ferien); background: rgba(47, 158, 111, .12); }
.eds-cal__event--feiertag { border-left-color: var(--eds-cat-feiertag); background: rgba(192, 57, 43, .1); }
.eds-cal__event--konferenz { border-left-color: var(--eds-cat-konferenz); background: rgba(47, 128, 178, .12); }
.eds-cal__event--abschlusspruefungen { border-left-color: var(--eds-cat-pruefung); background: rgba(142, 68, 173, .1); }

/* Multi-day bar category colours. */
.eds-cal__bar--ferien { border-left-color: var(--eds-cat-ferien); background: rgba(47, 158, 111, .18); }
.eds-cal__bar--feiertag { border-left-color: var(--eds-cat-feiertag); background: rgba(192, 57, 43, .16); }
.eds-cal__bar--konferenz { border-left-color: var(--eds-cat-konferenz); background: rgba(47, 128, 178, .18); }
.eds-cal__bar--abschlusspruefungen { border-left-color: var(--eds-cat-pruefung); background: rgba(142, 68, 173, .16); }

/* ===================== SMALL VIEW ====================================== */
.eds-cal--small {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    font-size: .95rem;
}

.eds-cal__mini {
    position: relative;
    transition: opacity var(--eds-speed);
}

.eds-cal--small.is-loading {
    opacity: .45;
    pointer-events: none;
    transition: opacity var(--eds-speed);
}

.eds-cal__mini-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .4rem;
    margin-bottom: .4rem;
}

.eds-cal__mini-title {
    font-weight: 600;
    color: var(--eds-primary);
    text-align: center;
    flex: 1 1 auto;
}

.eds-cal__mini-nav {
    flex: 0 0 auto;
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--eds-border);
    border-radius: var(--eds-radius);
    background: var(--eds-surface);
    color: var(--eds-primary);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: background var(--eds-speed), color var(--eds-speed), border-color var(--eds-speed);
}

.eds-cal__mini-nav:hover,
.eds-cal__mini-nav:focus-visible {
    background: var(--eds-primary);
    border-color: var(--eds-primary);
    color: var(--eds-surface);
}

.eds-cal__grid--mini .eds-cal__weekday {
    padding: .25rem 0;
    font-size: .68rem;
}

.eds-cal__grid--mini .eds-cal__week + .eds-cal__week .eds-cal__minicell {
    border-top: 1px solid var(--eds-border);
}

.eds-cal__minicell {
    position: relative;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--eds-border);
    font-size: .8rem;
}

.eds-cal__minicell:first-child { border-left: 0; }
.eds-cal__minicell.is-weekend { background: rgba(200, 235, 249, .35); }
.eds-cal__minicell.is-outside { color: var(--eds-muted); opacity: .55; }

.eds-cal__minicell.is-today .eds-cal__minicell-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    background: var(--eds-primary);
    color: var(--eds-surface);
}

.eds-cal__minicell-dot {
    position: absolute;
    bottom: .28rem;
    left: 50%;
    transform: translateX(-50%);
    width: .3rem;
    height: .3rem;
    border-radius: 999px;
    background: var(--eds-primary);
}

.eds-cal__minicell.is-today .eds-cal__minicell-dot { background: var(--eds-light); }

/* ---------- Upcoming list --------------------------------------------- */
.eds-cal__upcoming-title {
    margin: 0 0 .5rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--eds-primary);
}

.eds-cal__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.eds-cal__list-item {
    display: flex;
    gap: .75rem;
    padding: .55rem .25rem;
    border-top: 1px solid var(--eds-border);
    border-left: 3px solid var(--eds-cat-default);
    padding-left: .6rem;
}

.eds-cal__list-item:first-child { border-top: 0; }
.eds-cal__list-item--ferien { border-left-color: var(--eds-cat-ferien); }
.eds-cal__list-item--feiertag { border-left-color: var(--eds-cat-feiertag); }
.eds-cal__list-item--konferenz { border-left-color: var(--eds-cat-konferenz); }
.eds-cal__list-item--abschlusspruefungen { border-left-color: var(--eds-cat-pruefung); }

.eds-cal__list-date {
    flex: 0 0 2.75rem;
    text-align: center;
    line-height: 1.1;
}

.eds-cal__list-weekday {
    display: block;
    font-size: .7rem;
    text-transform: uppercase;
    color: var(--eds-muted);
}

.eds-cal__list-day {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--eds-dark);
}

.eds-cal__list-body { display: flex; flex-direction: column; }
.eds-cal__list-title { font-weight: 600; }
.eds-cal__list-meta { font-size: .82rem; color: var(--eds-muted); }
.eds-cal__list-loc { color: var(--eds-muted); }

.eds-cal__empty {
    color: var(--eds-muted);
    font-style: italic;
    margin: 0;
}

/* ---------- Card variant (Small plugin inside a Bootstrap card) -------- */
.card-group-element .eds-cal__upcoming-title {
    font-weight: 300;
    color: #000;
}

.card-group-element .eds-cal__list-item {
    align-items: center;
    border-left: 0;
    padding-left: .25rem;
}

.card-group-element .eds-cal__list-item::before {
    content: "";
    flex: 0 0 auto;
    width: .55rem;
    height: .55rem;
    border-radius: 999px;
    background: var(--eds-cat-default);
}

.card-group-element .eds-cal__list-item--ferien::before { background: var(--eds-cat-ferien); }
.card-group-element .eds-cal__list-item--feiertag::before { background: var(--eds-cat-feiertag); }
.card-group-element .eds-cal__list-item--konferenz::before { background: var(--eds-cat-konferenz); }
.card-group-element .eds-cal__list-item--abschlusspruefungen::before { background: var(--eds-cat-pruefung); }

/* ---------- Responsive: stack the large grid on small screens ---------- */
@media (max-width: 640px) {
    .eds-cal__daybg {
        min-height: 4.75rem;
    }
    .eds-cal__title {
        font-size: 1.2rem;
    }
}
