/* ============================================================
   Kalender: Scroll-Wrapper
   ============================================================ */
.cal-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 auto;
}

/* ============================================================
   Kalender: Basis-Tabelle
   ============================================================ */
table.tablenote,
table.tablenote * {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 0.82rem;
}

.tablenote {
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--color-border, #ddd);
    border-radius: 12px;
    overflow: hidden;
    margin: 1.25rem auto 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    background: #fff;
    table-layout: fixed;
    min-width: 900px;
}

table.tablenote td {
    border: 1px solid var(--color-border, #e5e7eb);
    padding: 5px 4px;
    text-align: center;
    position: relative;
}

table.tablenote .tableblk { border-width: 0; border-style: none; margin: 0; }
table.tablenote .tableblk th,
table.tablenote .tableblk td { border-width: 0; padding: 2px 0; text-align: left; vertical-align: top; }

/* ============================================================
   Kalender: Tages-Zellen
   ============================================================ */
table.tablenote .today {
    background-color: var(--color-accent, #3498db);
    color: #fff;
    font-weight: 700;
    border-radius: 0;
}

table.tablenote .event {
    background-color: #dbeafe;
    color: var(--color-cta-dark, #0d47a1);
    font-weight: 700;
    cursor: pointer;
}

table.tablenote .weekday {
    background-color: #fff;
}

table.tablenote .weekend {
    background-color: var(--color-bg-light, #f0f4f8);
    color: var(--color-text-muted, #666);
}

table.tablenote .holiday {
    background-color: #fee2e2;
    color: var(--color-danger, #c0392b);
    font-weight: 600;
}

/* ============================================================
   Kalender: Header & Struktur
   ============================================================ */
.cal-header {
    font-weight: 700;
    border: none;
    background-color: var(--color-primary, #1a5276);
    color: #fff;
    padding: 8px 6px;
    font-size: 0.85rem;
}

table.tablenote td.cal-month {
    text-align: left;
    border-style: none;
    font-weight: 600;
    color: var(--color-primary, #1a5276);
    padding: 10px 8px 4px;
    font-size: 0.9rem;
}

.cal-day-past {
    color: var(--color-text-light, #aaa);
    border-color: var(--color-border, #e5e7eb);
}

.cal-day-future {
    border-color: var(--color-border, #e5e7eb);
}

.cal-day-top {
    border-color: var(--color-border, #e5e7eb);
    border-bottom-style: none;
}

.cal-day-bottom {
    border-color: var(--color-border, #e5e7eb);
    border-top-style: none;
    font-size: 0.72rem;
    color: var(--color-text-muted, #666);
}

/* ============================================================
   Kalender: Legende & Hinweise
   ============================================================ */
.cal-spacer {
    border-style: none;
}

.cal-legend-label {
    text-align: left;
    border-style: none;
    padding: 4px 8px;
}

/* ============================================================
   Kalender: Event-Cards (Detailansicht)
   ============================================================ */
.cal-card {
    background: #fff;
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: 8px;
    margin: 6px 0;
    overflow: hidden;
}

.cal-card-header {
    background: var(--color-primary, #1a5276);
    color: #fff;
    padding: 9px 14px;
    font-weight: 700;
    font-size: 0.85rem;
}

.cal-card-content {
    padding: 4px 14px;
}

.cal-card-row {
    display: flex;
    align-items: baseline;
    padding: 7px 0;
    border-bottom: 1px dotted var(--color-border, #e0e0e0);
    gap: 10px;
}

.cal-card-row:last-child {
    border-bottom: none;
}

.cal-card-label {
    font-weight: 600;
    color: #555;
    min-width: 100px;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.cal-card-value {
    font-size: 0.85rem;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.cal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    position: relative;
    top: -1px;
}

.cal-dot-open {
    background: #27ae60;
}

.cal-dot-closed {
    background: #e74c3c;
}

/* ============================================================
   Kalender: Popup (Event-Details bei Hover)
   ============================================================ */
.popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid var(--color-border, #ddd);
    border-radius: 8px;
    padding: 10px 14px;
    z-index: 100;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    font-size: 0.82rem;
    color: var(--color-text, #000);
}

/* ============================================================
   Kalender: Responsive
   ============================================================ */
@media (max-width: 768px) {
    .tablenote {
        font-size: 0.7rem;
        border-radius: 8px;
    }
    table.tablenote td {
        padding: 3px 2px;
    }
    .cal-header,
    .cal-card-header {
        font-size: 0.75rem;
        padding: 5px 4px;
    }
    .cal-card-content {
        padding: 2px 10px;
    }
    .cal-card-label {
        min-width: 85px;
        font-size: 0.78rem;
    }
    .cal-card-value {
        font-size: 0.78rem;
    }
    .popup {
        font-size: 0.75rem;
        left: 0;
        transform: none;
    }
}

/* Titel "Anstehende Termine" – nur auf Mobile-Portrait sichtbar */
.cal-events-title {
    display: none;
}

/* ============================================================
   Kalender: Mobile Portrait – nur Terminliste anzeigen
   ============================================================ */
@media (max-width: 768px) and (orientation: portrait) {
    .cal-scroll-wrap {
        overflow-x: visible;
    }
    .cal-grid,
    .cal-legend {
        display: none;
    }
    .tablenote {
        border: none;
        box-shadow: none;
        background: transparent;
        margin-top: 0.5rem;
        min-width: 0;
        table-layout: auto;
        width: 100%;
    }
    table.tablenote td {
        border: none;
        padding: 0;
    }
    .cal-header {
        border-radius: 10px;
        font-size: 0.8rem;
        padding: 10px 12px;
        margin-bottom: 0.5rem;
    }
    .cal-events-title {
        display: table-cell;
        text-align: left;
        font-weight: 700;
        color: var(--color-primary, #1a5276);
        padding: 12px 4px 8px;
        border-style: none;
        font-size: 1rem;
    }
    .cal-card {
        margin: 8px 0;
        border-radius: 12px;
    }
    .cal-card-header {
        font-size: 0.82rem;
        padding: 10px 14px;
        border-radius: 12px 12px 0 0;
    }
    .cal-card-content {
        padding: 6px 14px;
    }
    .cal-card-row {
        padding: 8px 0;
    }
    .cal-card-label {
        min-width: 90px;
        font-size: 0.82rem;
    }
    .cal-card-value {
        font-size: 0.82rem;
    }
}
