/* ────────────────────────────────────────────────────────────────────────────
   Gemeindebus Buchung — Kalender CSS
   ──────────────────────────────────────────────────────────────────────────── */

/* ── Container ── */
.gb-calendar-wrap {
    position: relative;
    max-width: 580px;
    margin: 0 auto 1.5em;
    font-family: inherit;
}

.gb-cal-inner {
    position: relative;
}

/* Lade-Overlay */
.gb-cal-inner.gb-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 4px;
}

/* ── Navigation ── */
.gb-cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75em;
    margin-bottom: .5em;
}

.gb-cal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 12px;
    background: #fff;
    border: 1.5px solid #c3c4c7;
    border-radius: 6px;
    font-size: 1.2em;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    color: #3c434a;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.gb-cal-btn:hover {
    background: #f0f6fc;
    border-color: #2271b1;
    color: #2271b1;
    box-shadow: 0 1px 5px rgba(34,113,177,.15);
}
.gb-cal-btn:active {
    background: #dce8f5;
    box-shadow: none;
}
.gb-cal-btn:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.gb-cal-heading {
    font-size: 1.1em;
}

/* ── Wochentage ── */
.gb-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 2px;
}

.gb-cal-weekday {
    text-align: center;
    font-size: .72em;
    font-weight: 600;
    color: #666;
    padding: 2px 0;
}

/* ── Tages-Grid ── */
.gb-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.gb-day-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9em;
    cursor: default;
    user-select: none;
    transition: filter .1s;
    position: relative;
    /* Platz für Zeitbalken am unteren Rand reservieren */
    padding-bottom: 22px;
}

.gb-day-cell.gb-day--empty { background: transparent; }
.gb-day-cell.gb-day--free  { background: #eef6ee; }
.gb-day-cell.gb-day--partial { background: #fef3cd; }
.gb-day-cell.gb-day--busy  { background: #fce8e8; }

.gb-day-cell.gb-day--past  { opacity: .45; }
.gb-day-cell.gb-day--today { outline: 2px solid #2271b1; outline-offset: -2px; font-weight: 700; }

/* Tage mit Buchungsdetails sind klickbar */
.gb-day-cell[data-bookings] {
    cursor: pointer;
}
.gb-day-cell[data-bookings]:hover { filter: brightness(.92); }
.gb-day-cell[data-bookings]:focus { outline: 2px solid #2271b1; outline-offset: -2px; }

.gb-day-number {
    pointer-events: none;
}

/* ── Zeitbalken ── */
.gb-time-bars {
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    pointer-events: none;
}

.gb-time-label {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: inherit;
    opacity: .75;
    line-height: 1.2;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.2px;
}

.gb-time-bar {
    height: 8px;
    background: rgba(0,0,0,.1);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

.gb-time-seg {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 2px;
}

.gb-day--partial .gb-time-seg { background: #b07a00; }
.gb-day--busy    .gb-time-seg { background: #b03030; }

@media (max-width: 420px) {
    .gb-time-label { font-size: 7px; letter-spacing: -.3px; }
    .gb-day-cell   { padding-bottom: 20px; }
    .gb-time-bar   { height: 5px; }
}
@media (max-width: 340px) {
    .gb-time-label { flex-direction: column; gap: 0; align-items: center; }
    .gb-time-label span { line-height: 1.15; }
    .gb-day-cell   { padding-bottom: 28px; }
}

/* ── Legende ── */
.gb-cal-legend {
    display: flex;
    gap: 1em;
    margin-top: .5em;
    flex-wrap: wrap;
    font-size: .78em;
}

.gb-legend-item {
    display: flex;
    align-items: center;
    gap: .35em;
}

.gb-legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
}
.gb-legend-dot.gb-day--free    { background: #eef6ee; border: 1px solid #c3e6c3; }
.gb-legend-dot.gb-day--partial { background: #fef3cd; border: 1px solid #f0c040; }
.gb-legend-dot.gb-day--busy    { background: #fce8e8; border: 1px solid #f0a0a0; }

/* ── Modal ── */
#gb-cal-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.gb-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.5);
    cursor: pointer;
}

.gb-modal-content {
    position: relative;
    background: #fff;
    border-radius: 6px;
    padding: 24px;
    max-width: 480px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
}

.gb-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    font-size: 1.6em;
    cursor: pointer;
    color: #666;
    line-height: 1;
}
.gb-modal-close:hover { color: #000; }

.gb-modal-title {
    margin: 0 0 1em;
    font-size: 1.05em;
}

.gb-modal-booking {
    border-top: 1px solid #eee;
    padding: 10px 0;
    font-size: .9em;
}
.gb-modal-booking:first-child { border-top: none; }
.gb-modal-booking strong { display: block; margin-bottom: 3px; }
.gb-modal-booking small { color: #666; }

/* ── Drucken ── */
@media print {
    .gb-cal-btn { display: none !important; }
    .gb-cal-legend { display: none !important; }
}
