/* ARX Course Catalogue - shared base styles.
   Reuses the same CSS-variable language as ARX Dashboard Widgets
   (--arx-accent / --arx-text / --arx-muted / --arx-border / --arx-card-bg)
   for visual consistency across the two plugins, without a hard runtime
   dependency between them. Elementor's own Style-tab controls override
   these per-instance. */

.arx-filter-bar,
.arx-course-grid {
	--arx-accent: #559fc5;
	--arx-text: #1f2937;
	--arx-muted: #6b7280;
	--arx-border: #e5e7eb;
	--arx-card-bg: #ffffff;
	font-family: inherit;
	color: var( --arx-text );
}

/* Themes/builders routinely ship global `input, select { width: 100%; }`
   resets for form consistency; without our own explicit box-sizing and
   sizing rules on every form control below, those inherited rules win
   simply because we never declared a competing value. Scoping a border-box
   reset here means padding/border never blow past a control's own width,
   regardless of what the active theme does elsewhere on the page. */
.arx-filter-bar,
.arx-filter-bar *,
.arx-course-grid,
.arx-course-grid * {
	box-sizing: border-box;
}

/* Matches the course card's own container treatment (border, radius, shadow
   values below are identical to .arx-course-card) so the filter bar reads
   as the same "card" surface as the rest of the dashboard/catalogue. */
.arx-filter-bar {
	background: var( --arx-card-bg );
	border: 1px solid var( --arx-border );
	border-radius: 4px;
	padding: 24px;
	box-shadow: 0 1px 2px rgba( 16, 24, 40, 0.06 ), 0 1px 3px rgba( 16, 24, 40, 0.1 );
}

.arx-catalogue-widget.arx-empty-state {
	grid-column: 1 / -1;
	padding: 40px 24px;
	text-align: center;
	color: var( --arx-muted );
	background: var( --arx-card-bg );
	border: 1px dashed var( --arx-border );
	border-radius: 4px;
}

/* Filter bar - deliberately `flex-wrap: nowrap` above the breakpoint below
   (rather than letting flex-wrap organically break fields onto their own
   rows at in-between widths, which looks like broken/unstyled stacking).
   Each field gets an explicit width/flex-basis so nothing depends on a
   theme's default form-control width. */

/* Several selectors below are written as `.arx-filter-bar .arx-filter-bar__x`
   rather than a bare `.arx-filter-bar__x`. That's not stylistic - themes
   routinely ship a `input[type=search]{...}` / `[type=button]{...}` reset
   (Hello Elementor's does), and those compound selectors are equal to or
   *more* specific than a single class, so a bare class can silently lose
   the cascade to the theme regardless of load order. The extra ancestor
   segment adds a specificity level so our rule always wins without
   resorting to !important. */
.arx-filter-bar__row {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 12px;
}

.arx-filter-bar__field {
	position: relative;
}

.arx-filter-bar__field--search {
	flex: 1 1 auto;
	min-width: 0;
}

.arx-filter-bar__search-icon {
	position: absolute;
	top: 50%;
	left: 14px;
	width: 16px;
	height: 16px;
	transform: translateY( -50% );
	color: var( --arx-muted );
	pointer-events: none;
}

.arx-filter-bar .arx-filter-bar__search {
	width: 100%;
	padding: 11px 14px 11px 38px;
	border: 1px solid var( --arx-border );
	border-radius: 4px;
	font-size: 14px;
	color: var( --arx-text );
	background: var( --arx-card-bg );
}

.arx-filter-bar__select {
	flex: 0 0 auto;
	width: auto;
	max-width: 220px;
	padding: 11px 34px 11px 14px;
	border: 1px solid var( --arx-border );
	border-radius: 4px;
	font-size: 14px;
	color: var( --arx-text );
	background-color: var( --arx-card-bg );
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5 7.5 5 5 5-5' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E" );
	background-repeat: no-repeat;
	background-position: right 12px center;
	/* This SVG has no explicit width/height, only a viewBox, so without a
	   background-size browsers fall back to the CSS default replaced-element
	   size (usually 300x150) instead of the viewBox's 20x20 - the chevron
	   renders huge and bleeds across the option text. Pin it down. */
	background-size: 14px 14px;
}

.arx-filter-bar__search:focus,
.arx-filter-bar__select:focus {
	outline: none;
	border-color: var( --arx-accent );
	box-shadow: 0 0 0 3px color-mix( in srgb, var( --arx-accent ) 15%, transparent );
}

.arx-filter-bar__row-actions {
	display: flex;
	align-items: center;
	gap: 20px;
	flex: 0 0 auto;
	margin-left: auto;
}

.arx-filter-bar .arx-filter-bar__clear {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: 0 0 auto;
	padding: 10px 4px;
	background: none;
	border: none;
	color: var( --arx-muted );
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

.arx-filter-bar .arx-filter-bar__clear:hover {
	background: none;
	color: var( --arx-text );
}

.arx-filter-bar__clear svg {
	display: block;
	width: 12px;
	height: 12px;
	flex-shrink: 0;
}

/* Hidden-checkbox toggle switch: the real <input> stays in the DOM and
   keyboard/screen-reader accessible (clipped, not display:none), and the
   visible track/knob are a sibling <span> driven purely by :checked - no
   dependency on styling the checkbox's own (theme-collision-prone) box. */
.arx-filter-bar__bookmarked-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	color: var( --arx-muted );
	white-space: nowrap;
	user-select: none;
}

.arx-filter-bar__bookmarked-toggle input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
	padding: 0;
}

.arx-filter-bar__toggle-track {
	position: relative;
	flex-shrink: 0;
	width: 34px;
	height: 20px;
	background: var( --arx-border );
	border-radius: 3px;
	transition: background-color 0.15s ease;
}

.arx-filter-bar__toggle-track::before {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba( 16, 24, 40, 0.25 );
	transition: transform 0.15s ease;
}

.arx-filter-bar__bookmarked-toggle input:checked + .arx-filter-bar__toggle-track {
	background: var( --arx-accent );
}

.arx-filter-bar__bookmarked-toggle input:checked + .arx-filter-bar__toggle-track::before {
	transform: translateX( 14px );
}

.arx-filter-bar__bookmarked-toggle input:focus-visible + .arx-filter-bar__toggle-track {
	outline: 2px solid var( --arx-accent );
	outline-offset: 2px;
}

.arx-filter-bar__popular {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-top: 16px;
}

.arx-filter-bar__popular-label {
	font-size: 13px;
	font-weight: 600;
	color: var( --arx-muted );
}

.arx-filter-bar .arx-tag-pill {
	padding: 6px 14px;
	border: 1px solid var( --arx-border );
	border-radius: 3px;
	background: var( --arx-card-bg );
	color: var( --arx-text );
	font-size: 13px;
	cursor: pointer;
}

/* The theme's `[type=button]:hover{background-color:#c36;color:#fff}` reset
   has nothing of ours to compete with unless we declare our own :hover
   rule - a rule that only changes border-color (as this one used to) still
   leaves background-color/color to the theme's equal-specificity hover
   rule, which wins on source order. So hover states below always
   re-declare background + color explicitly, not just the property we
   actually want to change. */
.arx-filter-bar .arx-tag-pill:hover {
	background: var( --arx-card-bg );
	border-color: var( --arx-accent );
	color: var( --arx-text );
}

.arx-filter-bar .arx-tag-pill.is-active {
	background: var( --arx-accent );
	border-color: var( --arx-accent );
	color: #fff;
}

.arx-filter-bar .arx-tag-pill.is-active:hover {
	background: var( --arx-accent );
	border-color: var( --arx-accent );
	color: #fff;
}

.arx-filter-bar .arx-filter-bar__view-all-tags:hover {
	background: none;
	color: #2a77a8;
}

.arx-filter-bar .arx-filter-bar__view-all-tags {
	background: none;
	border: none;
	color: #2a77a8;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	padding: 0;
}

.arx-filter-bar__sort {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 16px;
}

.arx-filter-bar__sort-label {
	font-size: 13px;
	color: var( --arx-muted );
}

/* Course grid header */
.arx-course-grid__count {
	font-size: 22px;
	font-weight: 800;
	margin-bottom: 16px;
}

.arx-course-grid.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

.arx-course-grid__cards {
	display: grid;
	grid-template-columns: repeat( 4, 1fr );
	gap: 24px;
}

/* Course card */
.arx-course-card {
	display: flex;
	flex-direction: column;
	background: var( --arx-card-bg );
	border: 1px solid var( --arx-border );
	border-radius: 4px;
	overflow: hidden;
	box-shadow: 0 1px 2px rgba( 16, 24, 40, 0.06 ), 0 1px 3px rgba( 16, 24, 40, 0.1 );
}

.arx-course-card__media {
	position: relative;
	aspect-ratio: 16 / 10;
	background: #f3f4f6;
	overflow: hidden;
}

.arx-course-card__media-link {
	display: block;
	width: 100%;
	height: 100%;
}

.arx-course-card__media img,
.arx-course-card__media-placeholder {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Scoped under `.arx-course-card` (rather than a bare `.arx-course-card__bookmark`)
   for the same reason the filter bar's buttons are - the theme's global
   `[type=button]{color:#c36;...}` reset ties in specificity with a lone
   class selector, and the theme was winning that tie, which is why this
   button rendered in the theme's pink instead of any color we set here. */
.arx-course-card .arx-course-card__bookmark {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 34px;
	height: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba( 255, 255, 255, 0.92 );
	border: none;
	border-radius: 50%;
	/* Card thumbnails are often light (placeholder logos, product shots),
	   so a near-white circle needs its own shadow for definition rather
	   than relying on contrast against whatever image sits behind it. */
	box-shadow: 0 1px 3px rgba( 16, 24, 40, 0.15 );
	color: var( --arx-text );
	cursor: pointer;
}

/* See the note above .arx-filter-bar .arx-tag-pill:hover - same reasoning:
   without an explicit hover rule the theme's `[type=button]:hover` reset
   applies uncontested and turns this pink. */
.arx-course-card .arx-course-card__bookmark:hover,
.arx-course-card .arx-course-card__bookmark:focus-visible {
	background: rgba( 255, 255, 255, 0.92 );
	color: #2a77a8;
	outline: none;
}

.arx-course-card__bookmark svg {
	display: block;
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.arx-course-card .arx-course-card__bookmark.is-active {
	color: #2a77a8;
}

.arx-course-card .arx-course-card__bookmark.is-active:hover {
	background: rgba( 255, 255, 255, 0.92 );
	color: #2a77a8;
}

.arx-course-card__bookmark.is-active svg path {
	fill: currentColor;
}

.arx-course-card__badge {
	position: absolute;
	top: 12px;
	left: 12px;
	padding: 4px 10px;
	border-radius: 3px;
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.arx-course-card__badge--completed {
	background: #16a34a;
	color: #fff;
}

.arx-course-card__badge--locked {
	background: rgba( 31, 41, 55, 0.85 );
	color: #fff;
}

.arx-course-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 18px;
}

.arx-course-card__category {
	display: block;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #2a77a8;
	margin-bottom: 6px;
}

.arx-course-card__title {
	margin: 0 0 6px;
	font-size: 17px;
	line-height: 1.3;
}

.arx-course-card__title a {
	color: var( --arx-text );
	text-decoration: none;
}

.arx-course-card__title a:hover {
	text-decoration: underline;
}

.arx-course-card__excerpt {
	margin: 0 0 14px;
	font-size: 13px;
	line-height: 1.5;
	color: var( --arx-muted );
	flex: 1;
}

.arx-course-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 12px;
}

.arx-course-card__meta-item {
	font-size: 13px;
	color: var( --arx-muted );
	background: #f9fafb;
	border: 1px solid var( --arx-border );
	border-radius: 3px;
	padding: 3px 10px;
}

.arx-course-card__progress {
	display: flex;
	align-items: center;
	gap: 10px;
}

.arx-course-card__progress .arx-progress-bar {
	flex: 1;
	height: 6px;
	background: var( --arx-border );
	border-radius: 3px;
	overflow: hidden;
}

.arx-course-card__progress .arx-progress-bar__fill {
	height: 100%;
	background: var( --arx-accent );
	border-radius: 3px;
}

.arx-course-card__progress-percent {
	font-size: 13px;
	color: var( --arx-muted );
	flex-shrink: 0;
}

/* Footer / pagination */
.arx-course-grid__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 28px;
}

.arx-course-grid__result-text {
	font-size: 13px;
	color: var( --arx-muted );
}

.arx-pagination {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-left: auto;
}

/* Scoped under `.arx-pagination` for the same reason as `.arx-course-card
   .arx-course-card__bookmark` above - these are also `<button type="button">`
   and were losing to the theme's `[type=button]{color:#c36;...}` reset. */
.arx-pagination .arx-pagination__page,
.arx-pagination .arx-pagination__arrow {
	min-width: 32px;
	height: 32px;
	padding: 0 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var( --arx-border );
	border-radius: 4px;
	background: var( --arx-card-bg );
	color: var( --arx-text );
	font-size: 13px;
	cursor: pointer;
}

.arx-pagination .arx-pagination__page:hover,
.arx-pagination .arx-pagination__arrow:hover {
	background: var( --arx-card-bg );
	border-color: var( --arx-accent );
	color: var( --arx-text );
}

.arx-pagination .arx-pagination__page.is-current {
	background: var( --arx-accent );
	border-color: var( --arx-accent );
	color: #fff;
}

.arx-pagination .arx-pagination__page.is-current:hover {
	background: var( --arx-accent );
	border-color: var( --arx-accent );
	color: #fff;
}

.arx-pagination__arrow:disabled {
	opacity: 0.4;
	cursor: default;
}

.arx-pagination__ellipsis {
	color: var( --arx-muted );
	padding: 0 4px;
}

@media ( max-width: 767px ) {
	.arx-course-grid__cards {
		grid-template-columns: repeat( 2, 1fr ) !important;
	}

	/* Below this width a `nowrap` row can no longer fit search + two
	   selects + clear button, so switch to a deliberate single-column
	   stack instead of letting flex-wrap break it awkwardly mid-row. */
	.arx-filter-bar__row {
		flex-wrap: wrap;
	}

	.arx-filter-bar__field--search,
	.arx-filter-bar__select {
		flex: 1 1 100%;
		width: 100%;
		max-width: none;
	}

	.arx-filter-bar__row-actions {
		flex: 1 1 100%;
		width: 100%;
		margin-left: 0;
		justify-content: space-between;
	}
}

@media ( max-width: 480px ) {
	.arx-course-grid__cards {
		grid-template-columns: 1fr !important;
	}
}

/* v1.2: compact one-line filter bar, and thumbnails that always fill their frame.
   Written to be forgiving of browser zoom: the whole bar is a single slim row
   (search, category, tag, saved toggle, clear, sort) and only wraps on narrow screens. */
body .arx-filter-bar.arx-filter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
	padding: 10px 12px;
}

body .arx-filter-bar.arx-filter-bar .arx-filter-bar__row {
	flex: 1 1 560px;
	gap: 8px;
	min-width: 0;
}

body .arx-filter-bar.arx-filter-bar .arx-filter-bar__search,
body .arx-filter-bar.arx-filter-bar .arx-filter-bar__select {
	padding-top: 7px;
	padding-bottom: 7px;
	font-size: 13px;
	line-height: 1.3;
	height: 36px;
}

body .arx-filter-bar.arx-filter-bar .arx-filter-bar__search { padding-left: 34px; }
body .arx-filter-bar.arx-filter-bar .arx-filter-bar__search-icon { left: 11px; width: 14px; height: 14px; }
body .arx-filter-bar.arx-filter-bar .arx-filter-bar__row-actions { gap: 14px; }
body .arx-filter-bar.arx-filter-bar .arx-filter-bar__clear { padding: 6px 2px; font-size: 13px; }

/* Sort sits at the end of the same line instead of on a row of its own. */
body .arx-filter-bar.arx-filter-bar .arx-filter-bar__sort {
	flex: 0 0 auto;
	margin: 0;
	gap: 6px;
}

body .arx-filter-bar.arx-filter-bar .arx-filter-bar__sort-label { font-size: 13px; white-space: nowrap; }

body .arx-filter-bar.arx-filter-bar .arx-filter-bar__popular { flex: 1 1 100%; margin-top: 0; gap: 8px; }
body .arx-filter-bar.arx-filter-bar .arx-tag-pill { padding: 4px 11px; font-size: 13px; }

/* Thumbnails: fill the frame whatever the theme or an Elementor image-height setting does,
   so no grey strip can appear under the picture. */
.arx-course-card .arx-course-card__media { position: relative; height: auto; min-height: 0; line-height: 0; }
.arx-course-card .arx-course-card__media-link { position: absolute; inset: 0; width: 100%; height: 100%; }
.arx-course-card .arx-course-card__media img,
.arx-course-card .arx-course-card__media-placeholder {
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	max-width: none;
	object-fit: cover;
	margin: 0;
}

.arx-course-grid__count { font-size: 18px; margin-bottom: 12px; }
.arx-course-grid__cards { gap: 20px; }

@media ( max-width: 900px ) {
	body .arx-filter-bar.arx-filter-bar .arx-filter-bar__row { flex-basis: 100%; flex-wrap: wrap; }
	body .arx-filter-bar.arx-filter-bar .arx-filter-bar__field--search { flex: 1 1 100%; }
	body .arx-filter-bar.arx-filter-bar .arx-filter-bar__select { flex: 1 1 140px; max-width: none; }
}

/* Completed chapters: green wash and a stamp over the thumbnail, green bar and "Complete!". */
.arx-course-card__done {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba( 22, 163, 74, 0.52 );
	pointer-events: none;
}

.arx-course-card__done span {
	padding: 6px 18px 4px;
	border: 3px solid #ffffff;
	border-radius: 4px;
	color: #ffffff;
	font-family: "Fjalla One", sans-serif;
	font-size: clamp( 22px, 2.6vw, 34px );
	letter-spacing: 0.14em;
	line-height: 1.1;
	text-transform: uppercase;
	text-shadow: 0 1px 6px rgba( 0, 0, 0, 0.35 );
	background: rgba( 22, 120, 60, 0.35 );
	transform: rotate( -6deg );
}

.arx-course-card .arx-course-card__bookmark { z-index: 2; }

.arx-course-card.is-completed .arx-course-card__progress .arx-progress-bar__fill { background: #16a34a; }
.arx-course-card.is-completed .arx-course-card__progress-percent { color: #15803d; font-weight: 700; font-size: 13px; }

/* The Resources chapter: wider, dark and clearly different from the learning chapters. */
.arx-course-card.is-resource { background: #111111; border-color: #111111; }
.arx-course-card.is-resource .arx-course-card__title a,
.arx-course-card.is-resource .arx-course-card__title { color: #ffffff; }
.arx-course-card.is-resource .arx-course-card__excerpt { color: #c9d3db; }
.arx-course-card.is-resource .arx-course-card__meta-item { background: rgba( 255, 255, 255, 0.1 ); border-color: rgba( 255, 255, 255, 0.18 ); color: #e5e9ed; }
.arx-course-card.is-resource .arx-progress-bar { background: rgba( 255, 255, 255, 0.2 ); }
.arx-course-card.is-resource .arx-progress-bar__fill { background: #4b9bce; }
.arx-course-card.is-resource .arx-course-card__progress-percent { color: #c9d3db; }
.arx-course-card .arx-course-card__badge--resource { background: #4b9bce; color: #ffffff; letter-spacing: 0.08em; }
@media ( min-width: 900px ) {
	.arx-course-grid__cards > .arx-course-card.is-resource { grid-column: span 2; flex-direction: row; }
	.arx-course-card.is-resource .arx-course-card__media { flex: 0 0 46%; aspect-ratio: auto; min-height: 220px; }
	.arx-course-card.is-resource .arx-course-card__body { flex: 1; justify-content: center; }
}
