/**
 * Accommodation (cottage) product page: availability calendar.
 *
 * Changeover days are shown as split cells, so guests can see at a glance
 * which days they can arrive or leave on, without hovering over the plugin's
 * small info icons:
 *
 * - .fully_booked_end_days    a stay ends that morning: booked top-left,
 *                             available bottom-right (check-in only).
 * - .fully_booked_start_days  a stay starts that afternoon: available
 *                             top-left, booked bottom-right (check-out only).
 *
 * Colours match the plugins' own available (green) and booked (red) colours.
 * Loaded on accommodation products only (inc/woocommerce-accommodation.php).
 */

:root {
	--yb-cal-available: #1f874b;
	--yb-cal-booked: #c0392b;
}

/* Booked days at full strength (Bookings fades them to 75%), so they match
   the booked half of the changeover days and the key. */
#wc-bookings-booking-form .wc-bookings-date-picker .ui-datepicker td.fully_booked:not(.not_bookable_by_rules) {
	opacity: 1;
}

#wc-bookings-booking-form .wc-bookings-date-picker .ui-datepicker td.fully_booked:not(.not_bookable_by_rules) span.ui-state-default {
	background-color: var(--yb-cal-booked) !important;
}

/* Split changeover cells
   ---------------------------------------------------------------------- */

#wc-bookings-booking-form .wc-bookings-date-picker .ui-datepicker td.fully_booked_end_days:not(.fully_booked):not(.bookable-range):not(.ui-datepicker-current-day):not(.selection-start-date):not(.selection-end-date) a,
#wc-bookings-booking-form .wc-bookings-date-picker .ui-datepicker td.fully_booked_end_days:not(.fully_booked):not(.bookable-range):not(.ui-datepicker-current-day):not(.selection-start-date):not(.selection-end-date) span.ui-state-default {
	background-color: var(--yb-cal-available) !important;
	background-image: linear-gradient(to bottom right, var(--yb-cal-booked) 0 50%, var(--yb-cal-available) 50% 100%) !important;
	color: #fff !important;
	text-decoration: none !important;
}

#wc-bookings-booking-form .wc-bookings-date-picker .ui-datepicker td.fully_booked_start_days:not(.fully_booked):not(.bookable-range):not(.ui-datepicker-current-day):not(.selection-start-date):not(.selection-end-date) a,
#wc-bookings-booking-form .wc-bookings-date-picker .ui-datepicker td.fully_booked_start_days:not(.fully_booked):not(.bookable-range):not(.ui-datepicker-current-day):not(.selection-start-date):not(.selection-end-date) span.ui-state-default {
	background-color: var(--yb-cal-available) !important;
	background-image: linear-gradient(to bottom right, var(--yb-cal-available) 0 50%, var(--yb-cal-booked) 50% 100%) !important;
	color: #fff !important;
	text-decoration: none !important;
}

/* Keep the day number readable on both halves. */
#wc-bookings-booking-form .wc-bookings-date-picker .ui-datepicker td.fully_booked_end_days a,
#wc-bookings-booking-form .wc-bookings-date-picker .ui-datepicker td.fully_booked_end_days span.ui-state-default,
#wc-bookings-booking-form .wc-bookings-date-picker .ui-datepicker td.fully_booked_start_days a,
#wc-bookings-booking-form .wc-bookings-date-picker .ui-datepicker td.fully_booked_start_days span.ui-state-default {
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45) !important;
}

/* The split replaces the plugin's hover-only info icon. Its screen reader
   text ("Available for check-in only.") is separate and stays. */
#wc-bookings-booking-form .wc-bookings-date-picker .partial-availability-info-wrapper {
	display: none !important;
}

/* Calendar key
   ---------------------------------------------------------------------- */

.yb-calendar-key {
	line-height: 1.3;
}

/* Hidden until the script has placed it under the calendar. */
.yb-calendar-key:not(.is-placed) {
	display: none;
}

.yb-calendar-key__swatch {
	display: inline-block;
	flex: 0 0 auto;
	width: 1.25rem;
	height: 1.25rem;
	border: 1px solid rgba(0, 0, 0, 0.1);
}

.yb-calendar-key__swatch--available {
	background: var(--yb-cal-available);
}

.yb-calendar-key__swatch--booked {
	background: var(--yb-cal-booked);
}

.yb-calendar-key__swatch--check-in {
	background: linear-gradient(to bottom right, var(--yb-cal-booked) 0 50%, var(--yb-cal-available) 50% 100%);
}

.yb-calendar-key__swatch--check-out {
	background: linear-gradient(to bottom right, var(--yb-cal-available) 0 50%, var(--yb-cal-booked) 50% 100%);
}
