﻿/* CALENDAR STYLES
   Consolidated from admin.css and calendar.css.
   Keep calendar/rate-band/closure styling here rather than in admin.css. */

/* CALENDAR */
/* Container that holds multiple facilities */
.cal-facility {
	display: inline-block;
	vertical-align: top;
	width: 260px; /* adjust */
	margin-right: 12px;
	border: 1px solid #ddd;
	border-radius: 6px;
	overflow: hidden;
	background: #fff;
}

.cal-facility-header {
	padding: 10px 12px;
	font-weight: 600;
	background: #2f2f2f;
	color: #fff;
}

.cal-facility-body {
	position: relative;
	height: 720px; /* 12 hours x 60px/hr = 720 */
}

/* 15-min grid: 12 hours => 48 slots; each slot 15px gives 720px total */
.cal-grid {
	position: absolute;
	inset: 0;
	display: grid;
	grid-template-rows: repeat(48, 1fr);
}

.cal-slot {
	border-bottom: 1px solid #f0f0f0;
	background: #fff;
	transition: 0.25s;
	pointer-events: auto;
}

	.cal-slot:hover {
		background: #f8f8f8;
		cursor: pointer;
	}

	/* Optional: make hour lines darker */
	.cal-slot:nth-child(4n) {
		border-bottom: 1px solid #dcdcdc;
	}

.cal-items {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
}

/* =========================
   Calendar Day View Layout
   ========================= */

/* Wrapper: time column + facility columns */
.cal-wrapper {
	display: flex;
	flex-direction: row; /* ← important */
	align-items: flex-start;
	gap: 12px;
	width: 100%;
}

/* Container holding all facility columns (can scroll horizontally if needed) */
.cal-facilities {
	display: flex;
	gap: 12px;
	overflow-x: auto;
	padding-bottom: 6px; /* gives room for scrollbar */
}

/* =========================
   Time Ruler (left column)
   ========================= */

.cal-time {
	width: 50px;
	flex: 0 0 50px;
	color: #666;
	user-select: none;
}

.cal-time-header {
	height: 44px; /* MUST match facility header height */
}

.cal-time-body {
	position: relative;
	height: 840px; /* MUST match facility body height */
	border-right: 1px solid #e0e0e0;
}

/* One label per hour */
.cal-time-label {
	height: 30px; /* 1 hour = 60px in this scale */
	font-size: 0.9em;
	line-height: 1.0em;
	padding-top: 0px;
	margin: 0;
	box-sizing: border-box;
	position: relative;
	transform: translateY(-5px);
}

	/* Small tick line into the grid */
	.cal-time-label::after {
		content: "";
		position: absolute;
		right: -1px;
		top: 0;
		width: 10px;
		border-top: 1px solid #bbb;
		transform: translateY(5px);
	}


/* =========================
   Facility Columns
   ========================= */

.cal-facility {
	width: 260px; /* adjust as needed */
	flex: 0 0 260px;
	border: 1px solid #ddd;
	border-radius: 6px;
	overflow: hidden;
	background: #fff;
	box-sizing: border-box;
}

.cal-facility-header {
	height: 44px; /* MUST match .cal-time-header */
	padding: 10px 12px;
	box-sizing: border-box;
	font-weight: 600;
	background: #2f2f2f;
	color: #fff;
	display: flex;
	align-items: center;
}

.cal-facility-body {
	position: relative;
	height: 840px; /* MUST match .cal-time-body */
	background: #fff;
}


/* =========================
   15-min Grid Background
   ========================= */

.cal-grid {
	position: absolute;
	inset: 0;
	display: grid;
	grid-template-rows: repeat(56, 1fr); /* 14 hours * 4 = 56 slots */
	z-index: 1;
}

/* Each 15-min slot line */
.cal-slot {
	border-bottom: 1px solid #f0f0f0;
	box-sizing: border-box;
}

	/* Every hour (every 4 slots) draw darker line */
	.cal-slot:nth-child(4n) {
		border-bottom: 1px solid #dcdcdc;
	}

	/* Optional: hover highlight for selecting a start time */
	.cal-slot:hover {
		background: rgba(0,0,0,0.03);
	}


/* =========================
   Items Overlay Layer
   ========================= */

.cal-items {
	position: absolute;
	inset: 0;
	z-index: 2;
	/* Leave as none until items exist; when you add draggable blocks,
     set pointer-events: auto on the blocks themselves */
}


/* =========================
   Future: Booking/Session Block Styling
   ========================= */

/* Example event block (you'll add these inside .cal-items later) */
.cal-item {
	position: absolute;
	left: 6px;
	right: auto;
	width: calc(100% - 12px);
	border-radius: 6px;
	padding: 6px 8px;
	box-sizing: border-box;
	background: rgba(0,0,0,0.08);
	border: 2px solid rgba(0,0,0,0.15);
	font-size: 1.0em;
	font-family: Jost;
	line-height: 1.2;
	pointer-events: auto; /* important for drag/drop later */
	cursor: move;
	transition: filter 0.25s ease;
	overflow: hidden;
}

.cal-activity-label {
	position: absolute;
	bottom: 0px;
	right: 0px;
	white-space: nowrap;
	max-width: 60%;
	overflow: hidden;
	text-overflow: ellipsis;
	padding: 3px 10px;
	border-radius: 5px;
	pointer-events: none; /* important: don't interfere with dragging */
	opacity: 0.9;
	background: #222;
	color: #fff;
}

.cal-item:hover {
	filter: brightness(0.75);
}

.cal-item .cal-item-title {
	font-weight: 600;
	margin-bottom: 0px;
	margin-top: -2px;
	max-width: calc(100% - 26px);
	line-height: 1.3em;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	max-height: 2.6em;
}

.cal-item .cal-item-meta {
	font-size: 0.9em;
	opacity: 0.8;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.4em;
	color: #222;
}

/* Optional: show a subtle resize handle for later */
.cal-item .cal-item-resize {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 6px;
	cursor: ns-resize;
	opacity: 0.4;
}

.cal-item.dragging {
	opacity: 0.85;
	box-shadow: 0 6px 14px rgba(0,0,0,0.18);
}

.cal-item.cal-conflict {
	outline: solid 1px #ff0000;
	background: rgba(255, 0, 0, 0.25) !important;
}

.cal-drop-hover {
	background: rgba(0,0,0,0.03);
}

/* Original item while its clone is being dragged */
.cal-item.cal-drag-origin {
	opacity: 0.35;
	filter: grayscale(60%);
}

.cal-item-resize {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 8px;
	cursor: ns-resize;
	opacity: 0.35;
}

	/* A little grip line */
	.cal-item-resize::before {
		content: "";
		position: absolute;
		left: 40%;
		right: 40%;
		top: 3px;
		border-top: 2px solid rgba(0,0,0,0.35);
		border-radius: 2px;
	}

.cal-lock {
	position: absolute;
	bottom: 5px;
	right: 6px;
	width: 16px;
	height: 16px;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	z-index: 5;
}

	.cal-lock img {
		width: 16px;
		height: 16px;
		display: block;
		transition: 0.25s;
	}

	.cal-lock.unlocked img {
		opacity: 0.5; /* faded */
		filter: grayscale(90%);
	}

	.cal-lock.locked img {
		opacity: 1; /* full colour */
		filter: none;
	}

	/* Optional: hover affordance */
	.cal-lock:hover img {
		opacity: 1;
		filter: none;
	}

.cal-conflict {
	background-color: rgba(255, 0, 0, 0.15);
}


/* =========================
   Activity Colour Key
   ========================= */

.activity-key {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 20px;
	margin: 0px 0 24px 0;
	font-size: 0.95em;
}

.activity-key-item {
	display: flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
}

.activity-key-swatch {
	width: 18px;
	height: 18px;
	border-radius: 4px;
	border: 2px solid rgba(0,0,0,0.25);
	box-sizing: border-box;
}

.activity-key-label {
	color: #333;
}

/* RATE BAND AND CALENDAR EXTENSIONS */
﻿.rateband-page {
	padding: 20px;
}

.rateband-top {
	display: flex;
	gap: 12px;
	align-items: end;
	margin-bottom: 20px;
	flex-wrap: wrap;
}

	.rateband-top .box {
		margin: 0;
		min-width: 180px;
	}

	.rateband-top .field-label {
		display: block;
		margin-bottom: 6px;
		font-weight: 600;
	}

.rateband-layout {
	display: grid;
	grid-template-columns: 1fr 320px;
	gap: 20px;
}

.rateband-editor {
	background: #f8f8f8;
	border: 1px solid #ddd;
	height: 520px;
	padding: 16px;
}

	.rateband-editor h2 {
		margin-top: 0;
	}

	.rateband-editor .box {
		margin-bottom: 12px;
	}

	.rateband-editor .field-label {
		display: block;
		margin-bottom: 6px;
		font-weight: 600;
	}

	.rateband-editor .buttons {
		margin-top: 18px;
	}

		.rateband-editor .buttons .button {
			margin-right: 8px;
		}

	.rateband-editor .hint {
		font-size: 12px;
		color: #666;
		margin-top: 8px;
	}

.rateband-message {
	margin-bottom: 12px;
	margin-top: 20px;
	padding: 10px 12px;
	background: #fff3cd;
	border: 1px solid #e0c36c;
	color: #6b5800;
	opacity: 1;
	transition: opacity 0.6s ease;
	display: inline-block;
}

	.rateband-message.fadeout {
		opacity: 0;
	}

.rb-cal-wrapper {
	display: grid;
	grid-template-columns: 90px repeat(7, 1fr);
	border: 0px solid #d8d8d8;
	background: #fff;
}

.rb-corner,
.rb-day-header {
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	border-right: 1px solid #888;
	background: #333;
	color: #fff;
	border-top-right-radius: 8px;
	border-top-left-radius: 8px;
	margin-left: 10px;
}

	.rb-day-header:first-of-type {
		margin-left: 0;
	}

.rb-corner {
	visibility: hidden;
}

.rb-time-col {
	position: relative;
	border-right: 1px solid #d8d8d8;
	padding-top: 13px;
}

.rb-time-label {
	position: absolute;
	left: 0;
	right: 0;
	height: 30px;
	padding-right: 10px;
	text-align: right;
	font-size: 0.9em;
	color: #555;
	transform: translateY(-10px);
}

	/* the little horizontal tick */
	.rb-time-label::after {
		content: "";
		position: absolute;
		right: 0; /* sits on the border */
		top: 50%;
		width: 5px;
		height: 1px;
		transform: translateY(-5px);
		background: #999; /* tweak colour if needed */
	}

.rb-day-col {
	position: relative;
	border-right: 1px solid #e2e2e2;
	border-left: 1px solid #e2e2e2;
	min-height: 780px;
	background: repeating-linear-gradient( to bottom, #ffffff 0px, #ffffff 29px, #ececec 30px );
	margin-left: 10px;
}

	.rb-day-col:first-of-type {
		margin-left: 0;
	}

.rb-slot {
	position: absolute;
	left: 0;
	right: 0;
	height: 30px;
	cursor: pointer;
}

	.rb-slot:hover {
		background: rgba(0, 123, 255, 0.08);
	}

.rb-band {
	position: absolute;
	left: 6px;
	right: 6px;
	border: 1px solid #999;
	overflow: hidden;
	cursor: pointer;
	box-sizing: border-box;
	user-select: none;
}

	.rb-band.peak {
		background: #DDE5FF;
		border-color: #8c8c8c;
	}

	.rb-band:hover {
		box-shadow: 0 1px 4px rgba(0,0,0,0.15);
	}

	.rb-band.offpeak {
		background: #DFFFD3;
		border-color: #67D33D;
	}

	.rb-band.selected {
		box-shadow: 0 0 0 2px #2f6fed inset;
	}

	.rb-band.offpeak.selected {
		box-shadow: 0 0 0 2px #67D33D inset;
	}

.rb-band-body {
	padding: 8px 10px 20px 10px;
	font-size: 14px;
	line-height: 1.3;
	cursor: move;
}

.rb-band-title {
	font-weight: 600;
	margin-bottom: 4px;
}

.rb-band-meta {
	font-size: 0.9em;
	color: #333;
	margin-top: 2px;
}

.rb-band-actions {
	position: absolute;
	top: 6px;
	right: 6px;
	display: flex;
	gap: 4px;
}

.rb-band-toggle {
	background: #f8f8f8;
	border: 1px solid #aaa;
	font-size: 0.9em;
	font-family: Jost;
	padding: 4px 8px 5px 8px;
	border-radius: 5px;
	cursor: pointer;
	transition: 0.25s;
}

	.rb-band-toggle:hover {
		background: #444;
		color: #fff;
		border-color: #444;
		cursor: pointer;
	}

.rb-band-resize {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 10px;
	cursor: ns-resize;
	background: rgba(0,0,0,0.08);
}

	.rb-band-resize:hover {
		background: rgba(0,0,0,0.16);
	}

.textinput.small {
	width: 110px;
}

.input.small {
	width: 130px;
}

.cal-facility-body {
	position: relative;
}

.cal-grid {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1;
}

.cal-ratebands {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	pointer-events: none;
}

.cal-rateband {
	position: absolute;
	left: 0;
	right: 0;
	border-left: 4px solid transparent;
}

	.cal-rateband.peak {
		background: rgba(221, 229, 255, 0.2);
		border-left-color: rgba(221, 229, 255, 0.8);
	}

	.cal-rateband.offpeak {
		background: rgba(223, 255, 211, 0.2);
		border-left-color: rgba(223, 255, 211, 1);
	}

.cal-item-rateband-warning {
	border-color: #ffa500 !important;
	border-style: dashed !important;
}

.cal-items {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 3;
}

.cal-closures {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	pointer-events: none;
}

.cal-closure {
	position: absolute;
	left: 2px;
	right: 2px;
	background: rgba(80,80,80,0.18);
	border: 1px dashed #666;
	box-sizing: border-box;
	overflow: hidden;
	font-size: 11px;
	padding: 2px 4px;
	border-radius: 4px;
	color: #222;
}

.cal-closure-title {
	font-weight: 600;
	font-size: 1.2em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cal-closure-meta {
	font-size: 10px;
	opacity: 0.8;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Calendar closures rendered as draggable calendar items */
.cal-item.cal-closure-item {
	background: rgba(80, 80, 80, 0.18) !important;
	border: 2px solid #555 !important;
	border-radius: 5px;
	box-sizing: border-box;
	cursor: move;
}

	.cal-item.cal-closure-item:hover {
		box-shadow: 0 1px 5px rgba(0,0,0,0.18);
	}

	.cal-item.cal-closure-item .cal-item-title {
		color: #222;
		font-weight: 700;
	}

	.cal-item.cal-closure-item .cal-item-meta {
		color: #333;
	}

.activity-key-swatch.closure {
	background: rgba(80, 80, 80, 0.25);
	border: 2px solid #555;
}

.cal-item.cal-closure-item .cal-item-type-label {
	background: #666 !important;
	color: #fff;
}


/* Bottom-right type label used by bookings and closures */
.cal-item-type-label {
	position: absolute;
	right: 26px;
	bottom: 3px;
	max-width: calc(100% - 46px);
	padding: 2px 8px 3px 8px;
	border-radius: 5px;
	background: rgba(255,255,255,0.85);
	color: #fff;
	font-size: 0.85em;
	font-weight: 400;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	pointer-events: none;
}

.cal-item[data-locked="1"] {
	cursor: default !important;
}

.cal-item.cal-closure-item[data-locked="1"] {
	cursor: default !important;
}

.cal-item.cal-closure-item .cal-lock {
	z-index: 5;
}

@media (max-width: 960px) {
	.cal-facility {
		width: 220px;
		flex: 0 0 220px;
	}

	.cal-time {
		width: 60px;
		flex: 0 0 60px;
	}
}


/* Today's bookings with an outstanding balance */
.cal-item.cal-item-payment-warning {
	background: rgba(220, 0, 0, 0.18) !important;
	border-color: #d00000 !important;
	outline: 1px solid rgba(208, 0, 0, 0.9);
	outline-offset: -1px;
}

	/* Preserve the dashed rate-band warning while using red for unpaid status. */
	.cal-item.cal-item-payment-warning.cal-item-rateband-warning {
		border-style: dashed !important;
	}


/* Key shown only when today's calendar contains at least one unpaid booking */
.activity-key-swatch.unpaid-booking {
	background: rgba(220, 0, 0, 0.18);
	border: 2px solid #d00000;
}
