/* Kalenderansicht Busplan */

/* Kopfzeile mit Monatsnavigation */
.bus-kal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .75rem;
}

.bus-kal-title {
    text-align: center;
    line-height: 1.25;
}

.bus-kal-title h5 {
    margin: 0;
    font-weight: 600;
}

/* Legende */
.bus-kal-legende {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-bottom: .75rem;
    font-size: .85rem;
    color: #6c757d;
}

.bus-dot {
    display: inline-block;
    width: .7rem;
    height: .7rem;
    border-radius: 3px;
    margin-right: .3rem;
    vertical-align: -1px;
}

.bus-dot-spiel { background: #0cd602; }
.bus-dot-res   { background: #45d7f7; }
.bus-dot-frei  { background: #fff; border: 1px solid #ced4da; }

/* Monatsraster */
.bus-kal-grid {
    display: grid;
    /* minmax(0,1fr) verhindert, dass Zellinhalte die Spalten aufblähen */
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    background: #dee2e6;
    border: 1px solid #dee2e6;
    border-radius: .5rem;
    padding: 4px;
    overflow: hidden;
}

.bus-kal-wt {
    background: #f8f9fa;
    text-align: center;
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    color: #6c757d;
    padding: .4rem 0;
}

.bus-kal-tag {
    background: #fff;
    min-height: 92px;
    padding: .3rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
    position: relative;
    /* verhindert, dass lange Teamnamen die Spalte aufweiten */
    min-width: 0;
    overflow: hidden;
}

.bus-kal-tag[role="button"] {
    cursor: pointer;
    transition: box-shadow .12s, transform .12s;
}

.bus-kal-tag[role="button"]:hover,
.bus-kal-tag[role="button"]:focus-visible {
    box-shadow: inset 0 0 0 2px #0d6efd;
    outline: none;
    z-index: 1;
}

.bus-kal-tag.is-active {
    box-shadow: inset 0 0 0 2px #0d6efd;
}

/* Tage aus dem Vor-/Folgemonat */
.bus-kal-fremd {
    background: #f8f9fa;
    opacity: .55;
}

.bus-kal-we { background: #fcfcfd; }
.bus-kal-we.bus-kal-fremd { background: #f4f5f6; }

.bus-kal-heute .bus-kal-nr {
    background: #dc3545;
    color: #fff;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bus-kal-nr {
    font-size: .85rem;
    font-weight: 600;
    color: #212529;
}

.bus-kal-frei {
    font-size: .72rem;
    color: #adb5bd;
    font-style: italic;
    margin-top: auto;
}

/* Chips innerhalb einer Tageszelle */
.bus-kal-chips {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    min-width: 0;
}

.bus-chip {
    font-size: .68rem;
    line-height: 1.25;
    padding: .1rem .3rem;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 3px solid transparent;
    min-width: 0;
}

.bus-chip b {
    font-weight: 700;
    margin-right: .2rem;
}

.bus-chip-spiel {
    background: #0cd602;
    color: black;
}

.bus-chip-reservierung {
    background: #45d7f7;
    color: black;
}

/* Buszuordnung am linken Rand: KSV rot, TSV blau.
   Steht nach den Typ-Regeln, damit die Busfarbe gewinnt. */
.bus-chip-bus1 { border-left-color: #dc3545; }
.bus-chip-bus2 { border-left-color: #0d6efd; }

/* Detail-Panel unter dem Kalender */
.bus-kal-detail {
    margin-top: 1rem;
    border: 1px solid #dee2e6;
    border-radius: .5rem;
    background: #fff;
    padding: 1rem;
}

.bus-kal-detail h6 {
    margin: 0 0 .75rem;
    font-weight: 600;
}

/* Je Bus eine Tabelle mit fest ausgerichteten Spalten */
.bus-detail-tabelle {
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
    border-radius: .4rem;
    overflow: hidden;
}

.bus-detail-tabelle-kopf {
    font-weight: 700;
    padding: .4rem .6rem;
    background: #f8f9fa;
    border-left: 4px solid transparent;
}

/* Buszuordnung wie im Kalender: KSV rot, TSV blau */
.bus-detail-tabelle-bus1 .bus-detail-tabelle-kopf { border-left-color: #dc3545; }
.bus-detail-tabelle-bus2 .bus-detail-tabelle-kopf { border-left-color: #0d6efd; }

.bus-detail-liste {
    width: 100%;
    border-collapse: collapse;
    /* feste Spaltenbreiten – sonst richtet sich die Tabelle nach dem Inhalt */
    table-layout: fixed;
}

.bus-detail-liste th {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: #6c757d;
    padding: .4rem .6rem;
    border-bottom: 1px solid #e9ecef;
    text-align: left;
}

.bus-detail-liste td {
    padding: .55rem .6rem;
    border-bottom: 1px solid #f1f3f5;
    vertical-align: top;
}

.bus-detail-liste tr:last-child td { border-bottom: none; }

.bus-sp-zeit {
    width: 7.5rem;
    font-variant-numeric: tabular-nums;
    color: #495057;
    white-space: nowrap;
}

/* Badge über dem Teamnamen – bleibt bei langen Namen bündig */
.bus-sp-was { width: 11rem; }

.bus-sp-was .badge { display: inline-block; }

.bus-sp-was .bus-team {
    display: block;
    margin-top: .2rem;
    overflow-wrap: anywhere;
}

.bus-sp-info {
    font-size: .85rem;
    color: #6c757d;
}

.bus-sp-info .bus-info-label { color: #868e96; }

.bus-sp-aktion {
    width: 7.5rem;
    text-align: right;
    white-space: nowrap;
}

/* Bearbeitungsformular ersetzt eine Zeile und nutzt die volle Breite */
.bus-detail-formularzeile > td { padding: 0; }
.bus-detail-formularzeile .bus-form { margin: .5rem; }

.bus-detail-leer {
    margin: 0 0 .5rem;
    color: #6c757d;
    font-size: .9rem;
}

/* Reservierungsverwaltung im Tagesdetail */
.bus-detail-neu {
    padding-top: .75rem;
    border-top: 1px solid #f1f3f5;
}

.bus-detail-eintrag + .bus-detail-neu { margin-top: .25rem; }

.bus-form {
    margin-top: .75rem;
    padding: .85rem;
    border: 1px solid #cfe2ff;
    border-radius: .5rem;
    background: #f8fbff;
}

.bus-form-titel {
    font-weight: 600;
    margin-bottom: .6rem;
}

.bus-form-hinweis {
    font-size: .85rem;
    color: #6c757d;
    margin-bottom: .6rem;
}

.bus-form-zeile {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-bottom: .6rem;
}

.bus-form-feld {
    flex: 1 1 8rem;
    min-width: 7.5rem;
}

.bus-form-feld-breit { flex: 2 1 14rem; }

.bus-form-feld .form-label {
    font-size: .8rem;
    margin-bottom: .2rem;
    color: #495057;
}

.bus-form-radios {
    display: flex;
    gap: .9rem;
    font-size: .85rem;
    padding-top: .25rem;
}

.bus-form-radios label {
    display: flex;
    align-items: center;
    gap: .3rem;
    cursor: pointer;
}

.bus-form-aktionen {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

/* Aufklappbare Busprobleme */
.bus-probleme {
    border: 1px solid #ffe69c;
    border-radius: .5rem;
    background: #fff9e6;
    padding: .75rem 1rem;
}

.bus-probleme > summary {
    display: flex;
    align-items: center;
    gap: .6rem;
    cursor: pointer;
    font-size: 1.15rem;
    font-weight: 500;
    list-style: none;
    user-select: none;
}

/* Eigenes Dreieck statt Browser-Marker */
.bus-probleme > summary::-webkit-details-marker { display: none; }

.bus-probleme > summary::before {
    content: '';
    border: .35rem solid transparent;
    border-left-color: #997404;
    transition: transform .15s;
    flex-shrink: 0;
    margin-left: .15rem;
}

.bus-probleme[open] > summary::before {
    transform: rotate(90deg) translateX(-.1rem);
}

.bus-probleme > summary:hover { color: #664d03; }

.bus-probleme > summary:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 3px;
    border-radius: .25rem;
}

/* Mobil: schmalere Zellen, Chips nur als Farbbalken */
@media (max-width: 768px) {
    /* Container-Padding reduzieren, damit die 7 Spalten in die Breite passen */
    body > .container {
        padding-left: .5rem;
        padding-right: .5rem;
    }

    .bus-kal-grid { gap: 2px; padding: 2px; }
    .bus-kal-tag { min-height: 62px; padding: .2rem; }
    .bus-kal-wt { font-size: .7rem; padding: .25rem 0; }
    .bus-kal-nr { font-size: .75rem; }
    .bus-chip {
        font-size: 0;
        padding: 0;
        height: 5px;
        border-radius: 2px;
        border-left: none;
    }
    .bus-chip b { font-size: 0; }
    .bus-chip-spiel { background: #198754; }
    .bus-chip-reservierung { background: #0dcaf0; }
    .bus-kal-frei { display: none; }

    /* Bus bleibt am Balkenanfang erkennbar (KSV rot, TSV blau) */
    .bus-chip-bus1,
    .bus-chip-bus2 {
        border-left-style: solid;
        border-left-width: 8px;
    }

    /* Formularfelder untereinander statt gequetscht nebeneinander */
    .bus-form-feld,
    .bus-form-feld-breit { flex: 1 1 100%; }
    .bus-form-aktionen .ms-auto { margin-left: 0 !important; }

    /* Vier Spalten sind zu schmal – Zeilen werden zu Blöcken */
    .bus-detail-liste,
    .bus-detail-liste tbody,
    .bus-detail-liste tr,
    .bus-detail-liste td {
        display: block;
        width: auto;
    }

    .bus-detail-liste thead { display: none; }

    .bus-detail-liste tr {
        padding: .5rem .6rem;
        border-bottom: 1px solid #f1f3f5;
    }

    .bus-detail-liste tr:last-child { border-bottom: none; }

    .bus-detail-liste td {
        padding: .1rem 0;
        border-bottom: none;
    }

    .bus-sp-zeit { font-weight: 600; }
    .bus-sp-aktion { text-align: left; padding-top: .4rem !important; }

    .bus-detail-formularzeile { padding: 0; }
    .bus-detail-formularzeile .bus-form { margin: .5rem 0; }
}
