/* CCAC Classes — base/structural styles. Pill labels & colors are injected
   dynamically from the settings page (see render.php). Everything front-end is
   prefixed "cls-" rather than "ccac-" so the theme's CCACicons icon-font rule
   (which targets [class^="ccac-"]) never touches these elements.

   Redesign: the filter is now a sticky left sidebar beside the class cards.
   On small screens it becomes a slide-out drawer opened from a "filter
   classes" bar. Filter groups collapse/expand from their headers; options are
   full-width buttons (normal weight when unselected, bold when selected). */

/* ===== Two-column layout ================================================= */
.cls-layout {
	display: flex;
	align-items: flex-start;
	gap: 24px;
	width: 100%;        /* fill the container instead of shrinking to content */
	max-width: 1280px;
	margin: 0 auto;
	position: relative;
}

.cls-main {
	flex: 1 1 0;        /* always grow to fill the space beside the sidebar, even
	                       when only a message or one thin card is showing */
	min-width: 0;       /* lets the card flex row shrink instead of overflowing */
}

/* ===== Sidebar =========================================================== */
.cls-filter {
	flex: 0 0 272px;
	width: 272px;
	position: -webkit-sticky;
	position: sticky;
	top: 40px;                        /* visual buffer above the box when stuck */
	align-self: flex-start;
	max-height: calc(100vh - 60px);
	overflow: hidden;                 /* rounded corners clip the inner scrollbar */
	background: #fff;
	border: 1px solid #e2eef2;
	border-radius: 18px;
	box-shadow: 0 2px 10px rgba(2, 66, 109, .05);
}
/* The inner element scrolls; a stable gutter is always reserved so content
   never shifts/squeezes when the scrollbar appears. */
.cls-filter-inner {
	max-height: calc(100vh - 60px);
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-gutter: stable;
	padding: 18px 8px 18px 16px;
	box-sizing: border-box;
}

/* Slim scrollbar inside the sidebar (kept inside the rounded box) */
.cls-filter-inner { scrollbar-width: thin; scrollbar-color: #cfe3e9 transparent; }
.cls-filter-inner::-webkit-scrollbar { width: 8px; }
.cls-filter-inner::-webkit-scrollbar-thumb { background: #cfe3e9; border-radius: 8px; }
.cls-filter-inner::-webkit-scrollbar-track { background: transparent; }

.cls-sidebar-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0 0 14px;
}
.cls-filter-title {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: #4aa6bd;
	font-weight: 400;
	font-size: 18px;
	margin: 0;
	white-space: nowrap;
	text-transform: uppercase;
	letter-spacing: .5px;
}
.cls-filter-title-icon {
	width: 18px; height: 18px;
	flex: 0 0 18px;
	background-color: #4aa6bd;
	-webkit-mask: no-repeat center / contain;
	mask: no-repeat center / contain;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 4h18v2.5L14 14v6l-4 2v-8L3 6.5z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 4h18v2.5L14 14v6l-4 2v-8L3 6.5z'/%3E%3C/svg%3E");
}
.cls-drawer-close {
	display: none;            /* only shown in the mobile drawer */
	border: none; background: none;
	font-size: 26px; line-height: 1;
	color: #02426d; cursor: pointer;
	padding: 0 4px;
}

/* ===== Sort + Search (full-width rounded rows) =========================== */
.cls-control { margin: 0 0 10px; }

#cls-search,
#cls-sort {
	width: 100%;
	box-sizing: border-box;
	border: 2px solid #00A8BF;
	border-radius: 999px;
	padding: 0 18px;
	height: 42px;
	font-size: 14px;
	color: #02426d;
	background: #fff;
}
#cls-sort { cursor: pointer; appearance: none; -webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2300A8BF' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 18px center;
	padding-right: 38px;
}
#cls-search::placeholder { color: #9bb4c2; }

/* ===== Fair-share toggle ================================================= */
.cls-fairshare-pill { display: block; position: relative; margin: 0 0 8px; }

/* Small italic "What is Fair Share Pricing?" link, matching the toggle green.
   The bottom margin also creates the gap before the first filter group. */
.cls-fairshare-info {
	display: block;
	margin: 5px;
	text-align: center;
	color: #7A9B06;
	font-size: 10px;
	font-style: italic;
	text-decoration: underline;
	line-height: 1.3;
}
.cls-fairshare-info:hover,
.cls-fairshare-info:focus { color: #7A9B06; filter: opacity(0.75); }

/* ===== Collapsible filter groups ======================================== */
.cls-groups { border-top: 1px solid #e7eef1; }

.cls-group { border-bottom: 1px solid #e7eef1; }

.cls-group-title {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 13px 2px;
	margin: 0;
	color: #02426d;
	letter-spacing: .6px;
	text-transform: uppercase;
	font-size: 12px;
	font-weight: 700;
	text-align: left;
}
.cls-group-title:hover { color: #4aa6bd; }

.cls-group-label { flex: 1 1 auto; }

/* small "(n)" badge when a group has active selections */
.cls-group-count {
	flex: 0 0 auto;
	background: #ce0060; color: #fff;
	font-size: 11px; font-weight: 700;
	min-width: 18px; height: 18px; line-height: 18px;
	border-radius: 999px; text-align: center;
	padding: 0 5px;
}

/* caret (chevron) — points down when collapsed, up when open */
.cls-group-caret {
	flex: 0 0 auto;
	width: 9px; height: 9px;
	border-right: 2px solid #4aa6bd;
	border-bottom: 2px solid #4aa6bd;
	transform: rotate(45deg);
	transition: transform .2s ease;
	margin-right: 4px;
}
.cls-group-title[aria-expanded="true"] .cls-group-caret {
	transform: rotate(-135deg);
}

.cls-group-body { padding: 2px 0 12px; }

.cls-pill-list {
	display: flex;
	flex-direction: column;
	gap: 7px;
}
.cls-pill {
	display: block;
	position: relative;
	margin: 0;
}

/* ===== Filter buttons (full-width, outline → fill, normal → bold) ======== */
.cls-filter input[type="checkbox"] {
	width: 100%; height: 38px; position: relative; margin: 0;
	appearance: none; -webkit-appearance: none; cursor: pointer; transition: ease .25s;
}
.cls-filter input[type="checkbox"]:hover { filter: brightness(108%); }
.cls-filter input[type="checkbox"]::before {
	content: ""; position: absolute; inset: 0;
	display: flex; align-items: center; justify-content: center;
	box-sizing: border-box; padding: 0 14px;
	border: 2px solid #ce0060; border-radius: 999px; color: #ce0060;
	text-align: center; font-weight: 400; font-size: 13px; line-height: 1.15;
}
/* selected = filled AND bold */
.cls-filter input[type="checkbox"]:checked::before {
	color: #fff; background-color: #ce0060; font-weight: 700;
}

/* Fair share / free toggle (green, full-width like a group button) */
.cls-filter input[type="checkbox"]#fairshare { height: 42px; }
.cls-filter input[type="checkbox"]#fairshare::before {
	content: "fair share or free only";
	border-color: #7A9B06; color: #7A9B06;
	font-size: 14px; font-weight: 400;
}
.cls-filter input[type="checkbox"]#fairshare:checked::before {
	background-color: #7A9B06; color: #fff; font-weight: 700;
}

/* ===== Bottom action row (calendar + reset, split half/half) ============= */
.cls-bottom-actions {
	display: flex;
	gap: 10px;
	margin-top: 16px;
}
.cls-calendar-btn,
#clear-filters {
	flex: 1 1 0;
	min-width: 0;
	height: 42px;
	border-radius: 999px;
	font-weight: 700;
	font-size: 13px;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	white-space: nowrap;
	box-sizing: border-box;
	transition: ease .25s;
}
.cls-calendar-btn {
	background: #02426d; color: #fff !important;
	text-decoration: none;
	border: 2px solid #02426d;
}
.cls-calendar-btn:hover { filter: brightness(120%); }
.cls-calendar-btn--empty { visibility: hidden; }

#clear-filters {
	background-color: #FF6A1B; color: #fff;
	border: 2px solid #FF6A1B;
	cursor: pointer;
}
#clear-filters:hover:enabled { filter: brightness(110%); }
#clear-filters:disabled {
	background-color: #fff; border-color: #dcdcdc; color: #cfcfcf; cursor: default;
}

/* ===== Mobile pull-out tab (fixed, bottom-left) + drawer overlay ======== */
/* Hidden on desktop; shown only when the layout collapses to a drawer. */
.cls-filter-tab {
	display: none;
	position: fixed;
	left: 0;
	bottom: 24px;
	z-index: 10000;
	align-items: center;
	gap: 8px;
	height: 46px;
	padding: 0 16px 0 14px;
	border: none;
	border-radius: 0 24px 24px 0;       /* rounded on the right, flush left */
	background: #00A8BF;
	color: #fff;
	font-weight: 700;
	font-size: 15px;
	text-transform: uppercase;
	letter-spacing: .5px;
	cursor: pointer;
	box-shadow: 0 3px 12px rgba(2, 66, 109, .3);
	/* --cls-tab-x slides the tab out with the drawer (CSS, animated).
	   --cls-tab-y is set by JS to keep the tab inside the classes section
	   so it scrolls away instead of floating over the rest of the page. */
	transform: translate(var(--cls-tab-x, 0px), var(--cls-tab-y, 0px));
	transition: transform .28s ease;
}
/* While the tab is being pinned to the section edge, don't animate the
   vertical follow — it must track the scroll frame-for-frame. */
.cls-filter-tab.is-parking { transition: none; }
.cls-filter-open-icon {
	width: 16px; height: 12px; position: relative; display: inline-block;
}
.cls-filter-open-icon::before,
.cls-filter-open-icon::after {
	content: ""; position: absolute; left: 0; right: 0;
	border-top: 2px solid #fff;
}
.cls-filter-open-icon::before { top: 1px; }
.cls-filter-open-icon::after  { bottom: 1px; right: 4px; }

.cls-drawer-overlay {
	position: fixed; inset: 0;
	background: rgba(2, 66, 109, .45);
	z-index: 9998;
	opacity: 0; transition: opacity .25s ease;
}

/* ===== Results bar / empty states ======================================= */
.cls-results-bar { text-align: center; color: #707070; margin: 0 0 16px; font-weight: 600; font-size: 14px; }
.cls-no-results { text-align: center; color: #872837; font-weight: 600; margin: 20px 0; }
.cls-empty { text-align: center; color: #707070; }

/* ===== Card grid ========================================================= */
.cls-class-grid {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
}
.cls-class-grid .class-block { display: flex; }

/* ===== Cards: switch to 2-across ~250px earlier than the theme would ===== */
/* Avada normally drops the 1/3 columns to 50% around 1024px; extend that up
   to ~1274px so three-across never feels cramped next to the sidebar. Bounded
   above 640px so the theme's single-column phone layout is untouched. */
@media (min-width: 641px) and (max-width: 1274px) {
	.cls-class-grid .class-block {
		--awb-width-large: 50%;
		width: 50% !important;
		max-width: 50% !important;
		flex-basis: 50% !important;
	}
}

/* ===== Responsive: collapse to a slide-out drawer ======================= */
@media (max-width: 900px) {
	.cls-layout { display: block; }
	.cls-filter-tab { display: inline-flex; }

	.cls-filter {
		position: fixed;
		top: 0; left: 0; bottom: 0;
		height: 100%;
		max-height: none;
		width: 320px;
		max-width: 86vw;
		border-radius: 0 18px 18px 0;
		z-index: 9999;
		transform: translateX(-100%);
		transition: transform .28s ease;
		box-shadow: 0 0 30px rgba(0, 0, 0, .25);
	}
	.cls-filter-inner { max-height: none; height: 100%; }
	.cls-drawer-close { display: block; }

	/* open state (class toggled on .cls-layout by JS) */
	.cls-layout.drawer-open .cls-filter { transform: translateX(0); }
	.cls-layout.drawer-open .cls-drawer-overlay { opacity: 1; }

	/* the pull-tab slides out to ride the drawer's right edge */
	body.cls-drawer-lock .cls-filter-tab {
		--cls-tab-x: min(320px, 86vw);
		--cls-tab-y: 0px;
	}
	body.cls-drawer-lock { overflow: hidden; }
}

@media (max-width: 480px) {
	.cls-bottom-actions { flex-wrap: wrap; }
}

/* ===== Register button (bottom CTA) ===================================== */
/* The card CTA originally relied on Avada's .button_at_the_bottom handling
   plus the inline --button_margin-* variables to sit centered at the bottom
   with a 30px margin all around. A theme update stopped honoring those
   variables, which dropped the button into the bottom-left corner with no
   margin. Reassert the intended layout here so it no longer depends on the
   theme's internal button CSS. */
.class-block .fusion-button.button_at_the_bottom {
	display: block;
	box-sizing: border-box;
	width: calc(100% - 60px) !important;
	margin: 0 30px 30px !important;   /* left/right center it, bottom = breathing room */
	text-align: center;
}

/* ===== Cancelled classes ================================================= */
/* The card stays in the grid (still filterable) but reads as inactive: muted,
   not clickable, with a banner and a grayed-out register button. */
.class-block.class-cancelled {
	--awb-transform-hover: scaleX(1) scaleY(1) !important;   /* kill hover zoom */
}
.class-block.class-cancelled,
.class-block.class-cancelled * { cursor: default; }

/* Grayscale every image on the card: the main photo and the small
   "Fair Share Pricing eligible" icon. */
.class-block.class-cancelled img { filter: grayscale(1); }

/* Belt-and-suspenders: the inert anchor never behaves like a link */
.class-block.class-cancelled .fusion-column-anchor { pointer-events: none; cursor: default; }

/* Mute the normally-colored text (title blue, Fair Share/Free green) down to
   the same gray as the rest of the card copy. These override the inline colors
   set in the markup, so !important is required. */
.class-block.class-cancelled .fusion-text [style*="color: #02426d"],
.class-block.class-cancelled .fusion-text [style*="color: #7a9b06"] { color: #707070 !important; }

/* Banner at the top of the card body */
.cls-cancel-banner {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 10px;
	margin: 0 0 14px;
	padding: 10px 14px;
	border-radius: 10px;
	background: #fbe6ea;
	border: 1px solid #e3b7c0;
}
.cls-cancel-tag {
	text-transform: uppercase;
	letter-spacing: .5px;
	font-weight: 700;
	font-size: 13px;
	color: #b00020;
}
.cls-cancel-reason {
	font-size: 13px;
	color: #872837;
	line-height: 1.3;
}

/* Grayed-out, non-clickable register button (rendered as a <span>) */
.cls-btn-cancelled {
	background: #e6e6e6 !important;
	border: 2px solid #d8d8d8 !important;
	color: #9a9a9a !important;
	cursor: not-allowed !important;
	pointer-events: none;
	box-shadow: none !important;
	text-align: center;
}
.cls-btn-cancelled .fusion-button-text { color: #9a9a9a !important; }
.cls-btn-cancelled:hover { filter: none !important; }
