/**
 * Bookings - Oeffentlicher Belegungskalender
 * Farben/Muster nach TPO-Vorbild: gold=auf Anfrage, rot=belegt,
 * schraffiert=indirekt belegt, gruen(=frei) als Timeline-Hintergrund.
 */

/* Ressourcen-Farbpunkte (8er-Palette) */
.occ-res-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 2px;
    vertical-align: baseline;
}
.occ-color-0 { background: #002b7f; }
.occ-color-1 { background: #00c851; }
.occ-color-2 { background: #d80000; }
.occ-color-3 { background: #00bfff; }
.occ-color-4 { background: #9b30ff; }
.occ-color-5 { background: #ff6f00; }
.occ-color-6 { background: #ff1493; }
.occ-color-7 { background: #6c757d; }

/* Legende */
.occ-legend {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    vertical-align: text-bottom;
}
.occ-legend-free { background: #e7f5e9; border: 1px solid #bfe3c5; }
.occ-legend-booked { background: #dc3545; }
.occ-legend-indirect {
    background: repeating-linear-gradient(45deg, #f8d7da, #f8d7da 4px, #ffffff 4px, #ffffff 8px);
    border: 1px solid #f1aeb5;
}

/* Wochenansicht */
.occ-day.occ-today .card-header { background: #fff8e1; }
.occ-row { min-height: 34px; }
.occ-row + .occ-row { border-top: 1px solid #f0f0f0; }
.occ-row-label {
    flex: 0 0 180px;
    max-width: 180px;
    font-size: 0.85rem;
    padding-right: 8px;
}
.occ-timeline {
    position: relative;
    flex: 1 1 auto;
    height: 26px;
    background: #e7f5e9;
    border-radius: 4px;
    overflow: hidden;
}
.occ-block {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.72rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    border-radius: 3px;
}
.occ-block-booked { background: #dc3545; }
.occ-block-indirect {
    background: repeating-linear-gradient(45deg, #f8d7da, #f8d7da 5px, #fdeef0 5px, #fdeef0 10px);
    color: #842029;
    border: 1px solid #f1aeb5;
}
.occ-block-text { overflow: hidden; text-overflow: ellipsis; }

/* Monatsansicht */
.occ-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr)); /* sonst schieben lange Raumnamen die Spalten auseinander */
}
.occ-month-head {
    padding: 6px 8px;
    font-weight: 600;
    text-align: center;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}
.occ-month-cell {
    min-height: 96px;
    padding: 4px 6px;
    border-bottom: 1px solid #eef0f2;
    border-right: 1px solid #eef0f2;
    font-size: 0.78rem;
}
.occ-month-cell:nth-child(7n) { border-right: none; }
.occ-month-out { background: #fafafa; color: #adb5bd; }
.occ-month-cell.occ-today { background: #fff8e1; }
.occ-month-daynum { font-weight: 600; margin-bottom: 2px; }
.occ-month-entry {
    padding: 1px 4px;
    margin-bottom: 2px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.occ-month-entry-booked { background: #f8d7da; }
.occ-month-entry-indirect {
    background: repeating-linear-gradient(45deg, #f8d7da, #f8d7da 4px, #ffffff 4px, #ffffff 8px);
}
.occ-month-status { font-weight: 600; }
.occ-month-more { color: #6c757d; font-style: italic; }

/* Mobil: Raumspalte schmaler */
@media (max-width: 576px) {
    .occ-row-label { flex-basis: 110px; max-width: 110px; font-size: 0.75rem; }
    .occ-month-cell { min-height: 70px; }
}

/* Click-to-Book */
.occ-timeline-bookable { cursor: pointer; }
.occ-timeline-bookable:hover { background: #e8f5e9; }
/* Buchen-Knopf und Platzhalter gleich breit: Skala und alle Zeitleisten
   enden an derselben Stelle */
.occ-book-link,
.occ-book-spacer {
    flex: 0 0 44px; /* = Mindestgroesse der Klickflaeche (accessibility.css) */
    margin-left: 6px;
    text-align: center;
}
.occ-book-link {
    color: #198754;
    font-size: 1.05rem;
    line-height: 1;
    text-decoration: none;
}
.occ-book-link:hover { color: #146c43; }
.occ-month-cell[data-day] { cursor: pointer; }
.occ-month-cell[data-day]:hover { outline: 2px solid #0d6efd33; outline-offset: -2px; }

/* 30-Minuten-Raster in der Timeline (Fenster 6-22 Uhr = 16h: 1h = 6.25%) */
.occ-timeline {
    background-image:
        repeating-linear-gradient(to right, rgba(0,0,0,0.14) 0, rgba(0,0,0,0.14) 1px, transparent 1px, transparent 6.25%),
        repeating-linear-gradient(to right, rgba(0,0,0,0.06) 0, rgba(0,0,0,0.06) 1px, transparent 1px, transparent 3.125%);
}

/* Stundenskala ueber den Raum-Zeilen */
.occ-scale-row { margin-bottom: 2px; }
.occ-scale {
    position: relative;
    flex: 1 1 auto;
    height: 14px;
}
.occ-scale-mark {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: #5c636a; /* vorher #6c757d = 4,4:1 auf #f6f8fb */
    line-height: 14px;
}

/* Hover-Anzeige "ab HH:MM Uhr buchen" */
.occ-hover-tip {
    position: fixed;
    z-index: 1080;
    background: #212529;
    color: #fff;
    font-size: 0.75rem;
    padding: 3px 9px;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* Vergangene Tage: gedaempft, nicht buchbar (grau statt gruen) */
/* BITV 1.4.3: gedaempft ueber hellere Flaechen und dunkle Schrift, nicht
   ueber opacity - die nahm der weissen Schrift auf dem roten Block den
   Kontrast (2,4:1). Grau #646b72 erreicht 5,1:1 auf dem Kartenkopf. */
.occ-day-past .card-header strong { color: #646b72; }
.occ-timeline-past {
    background: #f1f3f5;
    background-image: none;
}
.occ-timeline-past .occ-block-booked:not(.occ-block-indirect) { background: #f1aeb5; color: #58151c; }
.occ-legend-past { background: #f1f3f5; }

/* Monatsansicht: vergangene Tage leer/grau, nicht anklickbar */
.occ-month-past {
    background: #f8f9fa;
    color: #646b72; /* vorher #ced4da = 1,5:1 */
    cursor: default;
}
.occ-month-past:hover { outline: none; }

/* BITV: Woche/Monat-Umschalter - das Kunden-Branding faerbte den
   aktiven Button so um, dass der Kontrast auf ~1.9:1 fiel. Explizite
   kontrastsichere Farben (weiss auf Dunkelblau ~10:1). */
#occViewWeek,
#occViewMonth {
    color: var(--pp-accent, #1e40af);
    border-color: var(--pp-accent, #1e40af);
    background-color: #ffffff;
}
#occViewWeek.active,
#occViewMonth.active {
    background-color: var(--pp-accent, #1e40af);
    border-color: var(--pp-accent, #1e40af);
    color: #ffffff;
}

/* Belegungskalender eines Bereichs: gegliedert nach Standort */
.occ-loc-filters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem 1.5rem;
}
.occ-loc-filter {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}
.occ-loc-filter legend {
    float: none;
    width: 100%;
    font-size: 1rem;
    margin: 0 0 0.25rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #dee2e6;
}
.occ-loc-head {
    margin: 10px 0 2px;
    padding: 2px 0 2px 2px;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 1px solid #dee2e6;
}
.occ-month-loc {
    display: flex;
    align-items: center;
    gap: 3px;
}
.occ-month-loc-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.occ-month-loc-count { flex: 0 0 auto; font-weight: 600; }

/* "Auf Anfrage" (Migration 147): vergeben, nach Absprache eventuell moeglich -
   Goldton wie bei TPO, dunkle Schrift (7:1) */
.occ-legend-onrequest { background: #daa520; }
.occ-block-onrequest:not(.occ-block-indirect) { background: #daa520; color: #212529; }
.occ-block-onrequest.occ-block-indirect {
    background: repeating-linear-gradient(45deg, #f5deb3, #f5deb3 5px, #fdf6e3 5px, #fdf6e3 10px);
    color: #4d3a03;
    border-color: #daa520;
}
.occ-month-entry-onrequest:not(.occ-month-entry-indirect) { background: #f5deb3; }
.occ-timeline-past .occ-block-onrequest:not(.occ-block-indirect) { background: #ecd28f; color: #4d3a03; }

/* "Reserviert" (Migration 149): vorgehalten, Anfragen weiter moeglich -
   Himmelblau wie bei TPO, dunkle Schrift */
.occ-legend-reserved { background: #87ceeb; }
.occ-block-reserved:not(.occ-block-indirect) { background: #87ceeb; color: #212529; }
.occ-block-reserved.occ-block-indirect {
    background: repeating-linear-gradient(45deg, #cdebf6, #cdebf6 5px, #f0f9fd 5px, #f0f9fd 10px);
    color: #0b3d52;
    border-color: #87ceeb;
}
.occ-month-entry-reserved:not(.occ-month-entry-indirect) { background: #cdebf6; }
.occ-timeline-past .occ-block-reserved:not(.occ-block-indirect) { background: #b9e0ef; color: #0b3d52; }

/* Viele Haeuser (seit 28.10.2026): nur Haus-Kaestchen, enger, mit Suche */
.occ-loc-search { max-width: 18rem; }
.occ-loc-filters-pick { gap: 0 1.5rem; max-height: 22rem; overflow-y: auto; }
.occ-loc-filters-pick .occ-loc-filter legend { border-bottom: 0; margin: 0; padding-bottom: 0; }
