/* Occupancy table for the public booking calendar. */

.occupancy-calendar {
    margin-top: 20px;
}

.occupancy-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.occupancy-nav-side {
    display: flex;
    gap: 6px;
}

.occupancy-nav h4 {
    margin: 0;
}

.occupancy-range {
    font-weight: 600;
}

.occupancy-months {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(820px, 1fr));
    gap: 20px;
}

.occupancy-month {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
}

.occupancy-month-head {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.occupancy-month h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.occupancy-hint {
    font-size: 0.8rem;
    color: #007bff;
    font-weight: 700;
    text-align: left;
}

.occupancy-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.occupancy-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.8rem;
}

table.occupancy-table th,
table.occupancy-table td {
    border: 1px solid #e6e6e6;
    text-align: center;
    padding: 2px 0;
    min-width: 22px;
}

table.occupancy-table th.day-head {
    font-weight: 500;
    color: #555;
    background: #f7f7f7;
}

table.occupancy-table th.day-head.weekend {
    background: #efe9dc;
}

table.occupancy-table th.flat-label,
table.occupancy-table td.flat-label {
    text-align: left;
    padding-left: 6px;
    padding-right: 6px;
    min-width: 100px;
    background: #fafafa;
    font-weight: 400;
    white-space: nowrap;
}

/* Keep the flat label visible while a month scrolls horizontally. */
table.occupancy-table th.flat-label,
table.occupancy-table td.flat-label {
    position: sticky;
    left: 0;
    z-index: 2;
}

td.occ {
    cursor: pointer;
    color: #222;
}

td.occ.free {
    background: #a7d1a7;
}

td.occ.free.weekend {
    background: #94c894;
}

td.occ.occupied {
    background: #d77070;
    color: #fff;
}

/* Arrival: only the upper (top-right) triangle is booked. */
td.occ.arrival {
    background: linear-gradient(45deg, #a7d1a7 0 50%, #d77070 50% 100%);
    color: #222;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.85);
}

/* Departure: only the lower (bottom-left) triangle is booked. */
td.occ.departure {
    background: linear-gradient(45deg, #d77070 0 50%, #a7d1a7 50% 100%);
    color: #222;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.85);
}

td.occ.changeover {
    background: linear-gradient(45deg, #d77070 0 50%, #b85c5c 50% 100%);
    color: #fff;
}

td.occ.selected {
    outline: 2px solid #005000;
    outline-offset: -2px;
}

td.occ.is-today {
    font-weight: 700;
    text-decoration: underline;
}

td.occ.is-past {
    opacity: 0.55;
}

.occupancy-legend {
    margin-top: 20px;
}

.occupancy-legend .legend-item {
    display: inline-flex;
    align-items: center;
    margin-right: 20px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.occupancy-legend .legend-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-right: 6px;
    display: inline-block;
}

.occupancy-legend .legend-swatch.s-free {
    background: #a7d1a7;
}

.occupancy-legend .legend-swatch.s-occupied {
    background: #d77070;
}

.occupancy-legend .legend-swatch.s-arrival {
    background: linear-gradient(45deg, #a7d1a7 0 50%, #d77070 50% 100%);
}

.occupancy-legend .legend-swatch.s-departure {
    background: linear-gradient(45deg, #d77070 0 50%, #a7d1a7 50% 100%);
}

.occupancy-legend .legend-swatch.s-changeover {
    background: linear-gradient(45deg, #d77070 0 50%, #b85c5c 50% 100%);
}

/* Emphasise the flat whose page is being viewed. */
tr.occ-current th.flat-label,
tr.occ-current td.occ {
    font-weight: 700;
}

tr.occ-current th.flat-label {
    background: #e6f0e6;
}
