/* ─── Reset & base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
	--green: #5cb85c;
	--darker-green: #4a8740;
	--off-black: #1c1e1f;
}

body {
	font-family: 'Work Sans', sans-serif;
	background: #f5f6f8;
	color: #333;
	overflow: hidden;
	height: 100vh;
}

/* ─── Full-screen layout ────────────────────────────────── */
.pt-ccal {
	display: flex;
	flex-direction: column;
	height: 100vh;
}

.pt-ccal-header {
	flex-shrink: 0;
	background: #fff;
	border-bottom: 1px solid #e5e5e5;
	padding: 0 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.pt-view-tabs {
	display: flex;
	gap: 4px;
}

.pt-view-tab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 18px;
	font-size: 14px;
	font-weight: 600;
	font-family: 'Work Sans', sans-serif;
	color: #666;
	text-decoration: none;
	border: none;
	background: none;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	cursor: pointer;
	transition: color 0.15s, border-color 0.15s;
}

.pt-view-tab:hover {
	color: #333;
}

.pt-view-tab--active {
	color: var(--green);
	border-bottom-color: var(--green);
	cursor: default;
}

.pt-view-tab i {
	font-size: 13px;
}

/* Mobile-only action button in the header (Filters).
   Hidden on desktop — revealed inside the mobile media query below. */
.pt-ccal-mobile-actions {
	display: none;
}

/* Drawer header shown at the top of the sidebar on mobile.
   Hidden on desktop. */
.pt-ccal-drawer-header {
	display: none;
}

/* Backdrop behind an open drawer. Hidden on desktop. */
.pt-ccal-overlay {
	display: none;
}

/* Mobile-only notice above the calendar. */
.pt-ccal-mobile-notice {
	display: none;
}

/* Lock body scroll when a drawer is open on mobile. */
html.pt-ccal-no-scroll,
html.pt-ccal-no-scroll body {
	overflow: hidden;
}

.pt-ccal-body {
	display: flex;
	flex: 1;
	overflow: hidden;
}

/* ─── Sidebar ───────────────────────────────────────────── */
.pt-ccal-sidebar {
	width: 240px;
	flex-shrink: 0;
	background: #fff;
	border-right: 1px solid #e5e5e5;
	overflow-y: auto;
	padding: 16px 14px;
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.pt-ccal-filter-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.pt-ccal-filter-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 4px;
}

.pt-ccal-filter-header span {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: #888;
	cursor: pointer;
	user-select: none;
}

.pt-ccal-collapse-icon {
	font-size: 9px;
	margin-right: 2px;
	transition: transform 0.15s;
}

.pt-ccal-collapsed {
	display: none !important;
}

.pt-ccal-toggle-all {
	font-size: 11px;
	color: var(--green);
	background: none;
	border: none;
	cursor: pointer;
	font-weight: 600;
	font-family: 'Work Sans', sans-serif;
}

.pt-ccal-toggle-all:hover {
	color: var(--darker-green);
}

/* ─── Checkbox filters ──────────────────────────────────── */
.pt-ccal-checkboxes {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.pt-ccal-checkbox {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: #444;
	cursor: pointer;
	padding: 3px 0;
	user-select: none;
}

.pt-ccal-checkbox input[type="checkbox"] {
	width: 14px;
	height: 14px;
	accent-color: var(--green);
	cursor: pointer;
	flex-shrink: 0;
}

.pt-ccal-checkbox-name {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pt-ccal-checkbox-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	flex-shrink: 0;
}

.pt-ccal-only {
	margin-left: auto;
	font-size: 11px;
	color: var(--green);
	font-weight: 500;
	opacity: 0;
	transition: opacity 0.1s;
	cursor: pointer;
	flex-shrink: 0;
}

.pt-ccal-checkbox:hover .pt-ccal-only {
	opacity: 1;
}

/* ─── Filter group items ────────────────────────────────── */
.pt-ccal-filter-item {
	margin-bottom: 2px;
}

/* ─── Toggle switches ───────────────────────────────────── */
.pt-ccal-filter-group hr {
	border: none;
	border-top: 1px solid #eee;
	margin: 4px 0;
}

.pt-ccal-toggle-row {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 4px 0;
	cursor: pointer;
	user-select: none;
}

.pt-ccal-toggle-row input[type="checkbox"] {
	width: 14px;
	height: 14px;
	accent-color: var(--green);
	cursor: pointer;
	flex-shrink: 0;
}

.pt-ccal-toggle-label {
	font-size: 12px;
	color: #555;
}

/* ─── Color legend ──────────────────────────────────────── */
.pt-ccal-legend {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 8px 0 4px;
	border-top: 1px solid #eee;
}

.pt-ccal-legend-title {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #888;
	margin-bottom: 2px;
}

.pt-ccal-legend-item {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	color: #555;
}

.pt-ccal-legend-swatch {
	width: 12px;
	height: 12px;
	border-radius: 3px;
	flex-shrink: 0;
}

/* ─── Main calendar area ────────────────────────────────── */
.pt-ccal-main {
	flex: 1;
	overflow: hidden;
	position: relative;
	padding: 12px 16px;
}

#ccal-calendar {
	height: 100%;
}

/* ─── FullCalendar overrides ────────────────────────────── */
#ccal-calendar .fc {
	font-family: 'Work Sans', sans-serif;
	height: 100%;
}

#ccal-calendar .fc-toolbar-title {
	font-size: 18px;
	font-weight: 600;
	color: var(--off-black);
}

#ccal-calendar .fc-button-primary {
	background: var(--green);
	border-color: var(--green);
	font-family: 'Work Sans', sans-serif;
	font-size: 12px;
	border-radius: 5px;
	padding: 5px 12px;
}

#ccal-calendar .fc-button-primary:hover {
	background: var(--darker-green);
	border-color: var(--darker-green);
}

#ccal-calendar .fc-button-primary:disabled {
	background: #ccc;
	border-color: #ccc;
}

#ccal-calendar .fc-button-primary:focus {
	box-shadow: 0 0 0 2px rgba(92, 184, 92, 0.3);
}

#ccal-calendar .fc-button-primary:not(:disabled).fc-button-active {
	background: var(--darker-green);
	border-color: var(--darker-green);
}

#ccal-calendar .fc-today-button {
	text-transform: capitalize;
}

/* Space out prev/next/today buttons */
#ccal-calendar .fc-toolbar .fc-button-group {
	gap: 6px;
}

#ccal-calendar .fc-toolbar .fc-button-group .fc-button {
	margin-left: 0;
}

#ccal-calendar .fc-timegrid-now-indicator-line {
	border-color: #e74c3c;
}

#ccal-calendar .fc-timegrid-now-indicator-arrow {
	border-top-color: #e74c3c;
}

#ccal-calendar .fc-day-today {
	background: rgba(92, 184, 92, 0.04) !important;
}

#ccal-calendar .fc-col-header-cell-cushion {
	font-size: 12px;
	font-weight: 600;
	color: #555;
}

#ccal-calendar .fc-timegrid-slot-label-cushion {
	font-size: 11px;
	color: #888;
}

#ccal-calendar .fc-event {
	cursor: pointer;
	border-radius: 4px;
	border: none;
	font-size: 11px;
}

#ccal-calendar .fc-timegrid-event .fc-event-main {
	padding: 2px 4px;
}

/* List view overrides */
#ccal-calendar .fc-list-event td {
	padding: 6px 10px;
}

#ccal-calendar .fc-list-day-cushion {
	font-size: 13px;
	font-weight: 600;
	background: #f5f6f8;
}

#ccal-calendar .fc-list-event:hover td {
	background: rgba(92, 184, 92, 0.06);
}

/* ─── Event content ─────────────────────────────────────── */
.pt-ccal-event {
	line-height: 1.25;
	overflow: hidden;
}

.pt-ccal-event__actnum {
	display: inline-block;
	font-size: 8px;
	font-weight: 700;
	font-family: monospace, 'Work Sans', sans-serif;
	background: rgba(0, 0, 0, 0.08);
	color: #666;
	padding: 0 4px;
	border-radius: 3px;
	line-height: 1.5;
	letter-spacing: 0.3px;
	margin-bottom: 1px;
	white-space: nowrap;
}

.pt-ccal-event__top-row {
	display: flex;
	align-items: center;
	gap: 3px;
	margin-bottom: 1px;
}

.pt-ccal-event__session {
	display: inline-block;
	font-size: 8px;
	font-weight: 600;
	font-family: monospace, 'Work Sans', sans-serif;
	background: rgba(0, 0, 0, 0.06);
	color: #888;
	padding: 0 3px;
	border-radius: 3px;
	line-height: 1.5;
	white-space: nowrap;
}

.pt-ccal-event__session--first {
	background: #fff3e0;
	color: #e65100;
	font-weight: 700;
}

.pt-ccal-event__first-badge {
	display: inline-block;
	font-size: 7px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	background: #e65100;
	color: #fff;
	padding: 0 4px;
	border-radius: 3px;
	line-height: 1.6;
	white-space: nowrap;
}

.pt-ccal-event--first {
	box-shadow: inset 0 0 0 1px rgba(230, 81, 0, 0.3);
}

.pt-ccal-list-event--first {
	border-left: 3px solid #e65100;
}

.pt-ccal-modal__first-badge {
	display: inline-block;
	font-size: 11px;
	font-weight: 600;
	background: #fff3e0;
	color: #e65100;
	padding: 1px 8px;
	border-radius: 4px;
	margin-left: 6px;
}

.pt-ccal-event__name {
	font-weight: 600;
	font-size: 11px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.pt-ccal-event__meta {
	font-size: 9px;
	opacity: 0.85;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.3;
}

.pt-ccal-event__enrollment {
	font-size: 9px;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 4px;
	margin-top: 1px;
}

.pt-ccal-event__enrollment-bar {
	flex: 1;
	height: 4px;
	background: rgba(0, 0, 0, 0.1);
	border-radius: 2px;
	overflow: hidden;
	max-width: 40px;
}

.pt-ccal-event__enrollment-fill {
	height: 100%;
	border-radius: 2px;
	transition: width 0.2s;
}

.pt-ccal-event__full-badge {
	font-size: 8px;
	font-weight: 700;
	letter-spacing: 0.5px;
	color: #fff;
	background: #d9534f;
	padding: 0 4px;
	border-radius: 2px;
	line-height: 1.4;
}

/* Enrollment color states */
.pt-ccal-enrollment--available .pt-ccal-event__enrollment-fill { background: #5cb85c; }
.pt-ccal-enrollment--nearly-full .pt-ccal-event__enrollment-fill { background: #e8a735; }
.pt-ccal-enrollment--full .pt-ccal-event__enrollment-fill { background: #d9534f; }

/* ─── List view event content ───────────────────────────── */
.pt-ccal-list-event {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
}

.pt-ccal-list-event .pt-ccal-event__actnum {
	font-size: 10px;
	padding: 1px 6px;
	background: rgba(0, 0, 0, 0.06);
	color: #555;
	flex-shrink: 0;
	align-self: center;
}

.pt-ccal-list-event .pt-ccal-event__session {
	font-size: 10px;
	padding: 1px 5px;
	flex-shrink: 0;
	align-self: center;
}

.pt-ccal-list-event .pt-ccal-event__first-badge {
	font-size: 9px;
	padding: 1px 5px;
	flex-shrink: 0;
	align-self: center;
}

.pt-ccal-list-event__level {
	font-size: 10px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 3px;
	white-space: nowrap;
	flex-shrink: 0;
}

.pt-ccal-list-event__info {
	flex: 1;
	min-width: 0;
}

.pt-ccal-list-event__name {
	font-weight: 600;
	font-size: 13px;
	color: #333;
}

.pt-ccal-list-event__detail {
	font-size: 11px;
	color: #777;
	margin-top: 1px;
}

.pt-ccal-list-event__enrollment {
	flex-shrink: 0;
	font-size: 12px;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 6px;
}

.pt-ccal-list-enrollment-bar {
	width: 50px;
	height: 6px;
	background: #eee;
	border-radius: 3px;
	overflow: hidden;
}

.pt-ccal-list-enrollment-fill {
	height: 100%;
	border-radius: 3px;
}

/* ─── Slot detail modal ─────────────────────────────────── */
.pt-ccal-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: 9999;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.pt-ccal-modal--open {
	display: flex;
}

.pt-ccal-modal__backdrop {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(0, 0, 0, 0.5);
	animation: pt-ccal-fadeIn 0.15s ease-out;
}

.pt-ccal-modal__card {
	position: relative;
	width: min(460px, 100%);
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
	padding: 24px 24px 20px;
	animation: pt-ccal-modalPop 0.18s ease-out;
}

.pt-ccal-modal__close {
	position: absolute;
	top: 10px;
	right: 14px;
	background: none;
	border: none;
	font-size: 24px;
	line-height: 1;
	color: #aaa;
	cursor: pointer;
	padding: 4px 6px;
}

.pt-ccal-modal__close:hover {
	color: #333;
}

.pt-ccal-modal__title {
	font-size: 18px;
	font-weight: 700;
	color: var(--off-black);
	margin-bottom: 14px;
	padding-right: 28px;
}

.pt-ccal-modal__row {
	font-size: 14px;
	color: #444;
	margin-bottom: 8px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.pt-ccal-modal__row i {
	width: 14px;
	text-align: center;
	color: #999;
	font-size: 13px;
}

.pt-ccal-modal__enrollment-bar {
	margin-top: 12px;
	margin-bottom: 4px;
}

.pt-ccal-modal__enrollment-track {
	height: 8px;
	background: #eee;
	border-radius: 4px;
	overflow: hidden;
}

.pt-ccal-modal__enrollment-fill {
	height: 100%;
	border-radius: 4px;
	transition: width 0.3s;
}

.pt-ccal-modal__enrollment-text {
	font-size: 13px;
	font-weight: 600;
	margin-top: 4px;
}

.pt-ccal-modal__actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 18px;
}

.pt-ccal-modal__view-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 16px;
	background: var(--green);
	color: #fff;
	border-radius: 8px;
	text-decoration: none;
	font-weight: 600;
	font-size: 14px;
	transition: background 0.15s;
}

.pt-ccal-modal__view-btn:hover {
	background: var(--darker-green);
	color: #fff;
}

@keyframes pt-ccal-fadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes pt-ccal-modalPop {
	from { opacity: 0; transform: translateY(8px) scale(0.96); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Hover tooltip ─────────────────────────────────────── */
.pt-ccal-tooltip {
	display: none;
	position: fixed;
	z-index: 999999;
	background: var(--off-black);
	color: #eee;
	border-radius: 8px;
	padding: 10px 14px;
	font-size: 12px;
	line-height: 1.5;
	max-width: 280px;
	box-shadow: 0 4px 16px rgba(0,0,0,0.3);
	pointer-events: none;
}

.pt-ccal-tt-name {
	font-weight: 700;
	font-size: 13px;
	color: #fff;
	margin-bottom: 4px;
}

.pt-ccal-tt-row {
	color: #ccc;
	margin-bottom: 1px;
}

.pt-ccal-tt-row i {
	width: 14px;
	text-align: center;
	margin-right: 4px;
	font-size: 10px;
	color: #999;
}

.pt-ccal-tt-enrollment {
	margin-top: 4px;
	padding-top: 4px;
	border-top: 1px solid rgba(255,255,255,0.15);
	display: flex;
	align-items: center;
	gap: 6px;
}

.pt-ccal-tt-enrollment-bar {
	width: 50px;
	height: 5px;
	background: rgba(255,255,255,0.15);
	border-radius: 3px;
	overflow: hidden;
}

.pt-ccal-tt-enrollment-fill {
	height: 100%;
	border-radius: 3px;
}

.pt-ccal-tt-badge {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.5px;
	padding: 1px 6px;
	border-radius: 3px;
}

.pt-ccal-tt-badge--available {
	color: #5cb85c;
}

.pt-ccal-tt-badge--full {
	color: #e74c3c;
}

/* ─── Loading ───────────────────────────────────────────── */
.pt-ccal-loading {
	display: none;
	position: absolute;
	inset: 0;
	background: rgba(245, 246, 248, 0.85);
	align-items: center;
	justify-content: center;
	gap: 12px;
	color: #888;
	font-size: 14px;
	z-index: 10;
}

.pt-ccal-spinner {
	width: 22px;
	height: 22px;
	border: 3px solid #ddd;
	border-top-color: var(--green);
	border-radius: 50%;
	animation: pt-ccal-spin 0.7s linear infinite;
}

@keyframes pt-ccal-spin {
	to { transform: rotate(360deg); }
}

/* ─── Mobile: drawer pattern ────────────────────────────── */
@media (max-width: 900px) {
	body {
		overflow-y: auto;
		overflow-x: hidden;
		height: auto;
		min-height: 100vh;
	}

	.pt-ccal {
		height: auto;
		min-height: 100vh;
	}

	.pt-ccal-header {
		padding: 0 12px;
		flex-wrap: wrap;
		gap: 6px;
		position: sticky;
		top: 0;
		z-index: 60;
	}

	.pt-view-tab {
		padding: 10px 14px;
		font-size: 13px;
	}

	.pt-ccal-mobile-actions {
		display: flex;
		gap: 8px;
	}

	.pt-ccal-mobile-btn {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		padding: 8px 14px;
		font-size: 13px;
		font-weight: 600;
		font-family: 'Work Sans', sans-serif;
		color: #fff;
		background: var(--green);
		border: none;
		border-radius: 20px;
		cursor: pointer;
		line-height: 1;
	}

	.pt-ccal-mobile-btn:active {
		background: var(--darker-green);
	}

	.pt-ccal-mobile-btn i {
		font-size: 12px;
	}

	/* Body becomes column */
	.pt-ccal-body {
		flex-direction: column;
		overflow: visible;
	}

	/* Sidebar becomes slide-in drawer */
	.pt-ccal-sidebar {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		width: min(320px, 88vw);
		max-width: 88vw;
		z-index: 101;
		background: #fff;
		box-shadow: -4px 0 16px rgba(0, 0, 0, 0.12);
		transform: translateX(100%);
		transition: transform 0.25s ease;
		border-right: none;
		border-left: none;
		overflow-y: auto;
	}

	.pt-ccal-sidebar--open {
		transform: translateX(0);
	}

	.pt-ccal-drawer-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 14px 16px;
		border-bottom: 1px solid #eee;
		position: sticky;
		top: 0;
		background: #fff;
		z-index: 1;
	}

	.pt-ccal-drawer-title {
		font-size: 15px;
		font-weight: 700;
		color: #222;
	}

	.pt-ccal-drawer-close {
		background: none;
		border: none;
		font-size: 24px;
		line-height: 1;
		color: #888;
		cursor: pointer;
		padding: 0 4px;
	}

	.pt-ccal-drawer-close:hover {
		color: #333;
	}

	/* Backdrop */
	.pt-ccal-overlay {
		display: none;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.4);
		z-index: 100;
	}

	.pt-ccal-overlay--visible {
		display: block;
	}

	.pt-ccal-main {
		flex: 1;
		min-height: calc(100vh - 110px);
		overflow: auto;
		-webkit-overflow-scrolling: touch;
	}

	.pt-ccal-mobile-notice {
		display: flex;
		align-items: center;
		gap: 8px;
		margin: 0 0 10px;
		padding: 10px 12px;
		background: #fff8e1;
		border: 1px solid #f5e2a8;
		border-radius: 6px;
		color: #7a5a00;
		font-size: 12px;
		line-height: 1.4;
	}

	.pt-ccal-mobile-notice i {
		color: #b88800;
		font-size: 14px;
		flex-shrink: 0;
	}

	#ccal-calendar {
		min-width: 600px;
		min-height: calc(100vh - 140px);
	}

	#ccal-calendar .fc-toolbar {
		flex-wrap: wrap;
		gap: 6px;
	}

	#ccal-calendar .fc-toolbar-title {
		font-size: 15px;
	}

	.pt-ccal-only {
		opacity: 1;
	}
}
