/* ==========================================================================
   Single course page: layout, purchase card (sidebar) and mobile bottom bar.
   Markup: course/single/course-sidebar.php, templates/course/topc6.php
   Design: "Teachers Training Price Card" (desktop card, tablets, mobile sticky bar)
   CSS only. No JavaScript is used for sticky or the bottom bar.
   ========================================================================== */

.single-course {
	--tts-primary: #45329D;
	--tts-primary-hover: #352680;
	--tts-tint: #EFEEF9;
	--tts-text: #0F172A;
	--tts-text-2: #475569;
	--tts-muted: #64748B;
	--tts-border: #E2E8F0;
	--tts-urgency: #BE123C;
	--tts-focus: rgba(69, 50, 157, 0.35);
}

/* The theme wrapper uses overflow:hidden, which turns it into a scroll container and
   stops position:sticky from working. overflow:clip clips the same way without that. */
.single-course .pusher {
	overflow: clip;
}

/* --------------------------------------------------------------------------
   Layout grid. DOM order = mobile order: hero, card, tabs, content.
   -------------------------------------------------------------------------- */
.tts-course-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
}

/* Full-width hero band behind the title without changing the markup width.
   z-index overrides the parent theme's "#title { z-index: 99 }" so the card sits on top. */
.single-course section#title.tts-course-hero {
	position: relative;
	z-index: 1;
	background: var(--tts-tint);
	box-shadow: 0 0 0 100vmax var(--tts-tint);
	clip-path: inset(0 -100vmax);
}

.single-course section#title.tts-course-hero .course_header {
	background: transparent !important;
	padding-top: 28px !important;
	padding-bottom: 28px !important;
}

.single-course .tts-course-hero #item-header {
	margin-top: 0 !important;
}

.tts-course-content__inner {
	min-width: 0;
}

/* --------------------------------------------------------------------------
   Purchase card
   -------------------------------------------------------------------------- */
.tts-course-aside {
	position: relative;
	z-index: 2;
	min-width: 0;
	font-family: inherit;
	color: var(--tts-text);
}

/* overflow:clip, not hidden: hidden would make the card a scroll container and the
   mobile bar's view-timeline would then track the card instead of the page. */
.tts-card {
	background: #FFFFFF;
	overflow: hidden;
	overflow: clip;
}

.tts-card__media img {
	display: block;
	width: 100%;
	height: 170px;
	object-fit: cover;
	border-radius: 12px;
}

.tts-card__media a {
	display: block;
}

.tts-card__body {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 14px 0 0;
}

.tts-card__pricing {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.tts-card__price-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 10px;
}

/* WooCommerce price HTML: <del>was</del> <ins>now</ins> or a single amount. */
.tts-card__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 10px;
	margin: 0;
	line-height: 1;
}

.tts-card__price,
.tts-card__price ins,
.tts-card__price .amount {
	font-size: 36px;
	font-weight: 800;
	letter-spacing: -0.03em;
	color: var(--tts-text);
	text-decoration: none;
	background: none;
}

.tts-card__price ins {
	order: -1;
}

.tts-card__price del,
.tts-card__price del .amount {
	font-size: 15px;
	font-weight: 400;
	letter-spacing: 0;
	color: var(--tts-muted);
	opacity: 1;
}

.tts-card__price .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.tts-card__save,
.tts-mbar__save {
	display: inline-block;
	padding: 3px 8px;
	border-radius: 999px;
	background: var(--tts-tint);
	color: var(--tts-primary);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.4;
	white-space: nowrap;
}

.tts-card__timer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
}

.tts-card__timer-label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--tts-urgency);
	font-size: 15px;
	font-weight: 600;
}

.tts-card__timer-img {
	display: block;
	width: 160px;
	max-width: 100%;
	height: auto;
}

.tts-card__facts {
	margin: 0;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--tts-text-2);
}

.tts-card__facts strong {
	color: var(--tts-text);
	font-weight: 700;
}

.tts-card__actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Buttons (links styled as buttons; real <a href> so they work without JS) */
.tts-course-aside .tts-btn,
.tts-mbar .tts-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 0 16px;
	border-radius: 12px;
	font-family: inherit;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease, transform .1s ease;
}

.tts-course-aside .tts-btn--primary,
.tts-mbar .tts-btn--primary {
	min-height: 52px;
	border: 0;
	background: var(--tts-primary);
	color: #FFFFFF;
	font-size: 16px;
	box-shadow: 0 8px 18px -10px rgba(69, 50, 157, 0.7);
}

.tts-course-aside .tts-btn--primary:hover,
.tts-course-aside .tts-btn--primary:focus,
.tts-mbar .tts-btn--primary:hover,
.tts-mbar .tts-btn--primary:focus {
	background: var(--tts-primary-hover);
	color: #FFFFFF;
}

.tts-course-aside .tts-btn--secondary,
.tts-mbar .tts-btn--secondary {
	min-height: 48px;
	border: 1.5px solid var(--tts-primary);
	background: #FFFFFF;
	color: var(--tts-primary);
	font-size: 15px;
}

.tts-course-aside .tts-btn--secondary:hover,
.tts-course-aside .tts-btn--secondary:focus,
.tts-mbar .tts-btn--secondary:hover,
.tts-mbar .tts-btn--secondary:focus {
	background: var(--tts-tint);
	color: var(--tts-primary);
}

.tts-course-aside .tts-btn:active,
.tts-mbar .tts-btn:active {
	transform: translateY(1px);
}

.tts-course-aside .tts-btn:focus-visible,
.tts-mbar .tts-btn:focus-visible,
.tts-card__footer--link:focus-visible {
	outline: 3px solid var(--tts-focus);
	outline-offset: 2px;
}

.tts-btn svg {
	flex: none;
}

/* Enrolled / member / free states keep the course module's own button, in brand colours. */
.tts-card__course-button .course_button,
.tts-card__course-button .button,
.tts-card__course-button button,
.tts-card__course-button > a {
	display: block;
	box-sizing: border-box;
	width: 100%;
	min-height: 52px;
	margin: 0;
	padding: 15px 16px !important;
	border: 0 !important;
	border-radius: 12px !important;
	background: var(--tts-primary) !important;
	color: #FFFFFF !important;
	font-family: inherit !important;
	font-size: 16px !important;
	font-weight: 700 !important;
	line-height: 1.4;
	text-align: center;
	text-decoration: none;
}

.tts-card__course-button .course_button:hover,
.tts-card__course-button .button:hover,
.tts-card__course-button button:hover,
.tts-card__course-button > a:hover {
	background: var(--tts-primary-hover) !important;
	color: #FFFFFF !important;
}

.tts-card__guarantee {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 6px;
	margin: -4px 0 0;
	font-size: 12.5px;
	color: var(--tts-text-2);
}

.tts-card__guarantee svg,
.tts-card__footer svg {
	flex: none;
	color: var(--tts-primary);
}

.tts-card__footer {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 7px;
	margin: 0;
	padding-top: 14px;
	border-top: 1px solid var(--tts-border);
	font-size: 13px;
	line-height: 1.4;
	color: var(--tts-text-2);
	text-align: center;
	text-decoration: none;
}

.tts-card__footer--link,
.tts-card__footer--link:hover,
.tts-card__footer--link:focus {
	color: var(--tts-text-2);
	text-decoration: none;
}

.tts-card__footer--link strong {
	color: var(--tts-primary);
	font-weight: 700;
}

.tts-card__footer--link:hover strong {
	text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Mobile / tablet sticky bottom bar (hidden on desktop)
   -------------------------------------------------------------------------- */
.tts-mbar {
	display: none;
}

@media (max-width: 1023px) {
	.tts-mbar {
		display: block;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 9990;
		box-sizing: border-box;
		padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
		background: #FFFFFF;
		border-top: 1px solid var(--tts-border);
		box-shadow: 0 -8px 24px -12px rgba(15, 23, 42, 0.25);
		color: var(--tts-text);
	}

	.tts-mbar__inner {
		display: flex;
		align-items: center;
		gap: 12px;
		max-width: 720px;
		margin: 0 auto;
	}

	.tts-mbar__price {
		flex: 1;
		min-width: 0;
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		gap: 3px;
	}

	.tts-mbar__amount,
	.tts-mbar__amount .amount {
		font-size: 22px;
		font-weight: 800;
		letter-spacing: -0.02em;
		line-height: 1;
		color: var(--tts-text);
	}

	.tts-mbar .tts-btn--icon {
		flex: 0 0 50px;
		width: 50px;
		min-height: 50px;
		height: 50px;
		padding: 0;
	}

	.tts-mbar .tts-mbar__enrol {
		flex: 0 0 160px;
		width: 160px;
		min-height: 50px;
		font-size: 15.5px;
	}

	/* Keep the page footer and floating widgets clear of the bar. */
	body.single-course:has(.tts-mbar) {
		padding-bottom: calc(76px + env(safe-area-inset-bottom));
	}

	body.single-course:has(.tts-mbar) .xoo-wsc-basket {
		bottom: calc(86px + env(safe-area-inset-bottom)) !important;
	}
}

@media (min-width: 768px) and (max-width: 1023px) {
	.tts-mbar .tts-mbar__enrol {
		flex-basis: 200px;
		width: 200px;
	}
}

/* Progressive enhancement (Chrome/Edge 116+, Safari 26+): reveal the bar only once the
   card's own "Enrol now" button has scrolled off the top. Other browsers simply show it. */
@supports (timeline-scope: --tts-enrol) and (animation-timeline: view()) {
	@media (max-width: 1023px) {
		body.single-course:has(.tts-mbar) {
			timeline-scope: --tts-enrol;
		}

		.single-course #tts-enrol {
			view-timeline: --tts-enrol block;
		}

		.tts-mbar {
			animation: tts-mbar-in linear both;
			animation-timeline: --tts-enrol;
			animation-range: exit 0% exit 100%;
		}
	}
}

@keyframes tts-mbar-in {
	from {
		transform: translateY(110%);
		visibility: hidden;
	}

	to {
		transform: translateY(0);
		visibility: visible;
	}
}

/* --------------------------------------------------------------------------
   Tablet portrait 768-1023: wide two-column card overlapping the hero
   -------------------------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 1023px) {
	.single-course section#title.tts-course-hero .course_header {
		padding-bottom: 88px !important;
	}

	.tts-course-aside {
		width: 100%;
		max-width: 720px;
		margin: -64px auto 32px;
	}

	.tts-card {
		display: grid;
		grid-template-columns: 280px minmax(0, 1fr);
		border: 1px solid var(--tts-border);
		border-radius: 16px;
		box-shadow: 0 16px 40px -18px rgba(15, 23, 42, 0.3);
	}

	.tts-card__media,
	.tts-card__media a {
		height: 100%;
	}

	.tts-card__media img {
		height: 100%;
		min-height: 220px;
		border-radius: 0;
	}

	.tts-card__body {
		padding: 22px 24px;
	}

	.tts-card__price,
	.tts-card__price ins,
	.tts-card__price .amount {
		font-size: 38px;
	}

	.tts-card__actions {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
		gap: 10px;
	}

	.tts-course-aside .tts-card__actions .tts-btn {
		min-height: 50px;
	}
}

/* --------------------------------------------------------------------------
   Desktop / tablet landscape >= 1024: sidebar column, sticky card
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
	.tts-course-layout {
		grid-template-columns: minmax(0, 1fr) 330px;
		grid-template-rows: auto auto 1fr;
		grid-template-areas:
			"hero    aside"
			"nav     aside"
			"content aside";
		column-gap: 32px;
	}

	.single-course section#title.tts-course-hero {
		grid-area: hero;
	}

	.tts-course-aside {
		grid-area: aside;
		padding-bottom: 40px;
	}

	.tts-course-nav {
		grid-area: nav;
	}

	.tts-course-content {
		grid-area: content;
		min-width: 0;
	}

	.tts-card {
		margin-top: 28px;
		border: 1px solid var(--tts-border);
		border-radius: 16px;
		box-shadow: 0 12px 32px -18px rgba(15, 23, 42, 0.25);
	}

	.tts-card__media img {
		height: 160px;
		border-radius: 0;
	}

	.tts-card__body {
		padding: 18px;
	}

	.tts-card__price,
	.tts-card__price ins,
	.tts-card__price .amount {
		font-size: 34px;
	}
}

/* Sticky only when the viewport is tall enough to show the whole card. */
@media (min-width: 1024px) and (min-height: 680px) {
	.tts-card {
		position: sticky;
		top: 16px;
	}

	.admin-bar .tts-card {
		top: 48px;
	}
}

@media (min-width: 1280px) {
	.tts-course-layout {
		grid-template-columns: minmax(0, 1fr) 360px;
		column-gap: 40px;
	}

	.tts-card {
		margin-top: 36px;
	}

	.tts-card__media img {
		height: 230px;
	}

	.tts-card__body {
		gap: 16px;
		padding: 20px;
	}

	.tts-card__price,
	.tts-card__price ins,
	.tts-card__price .amount {
		font-size: 38px;
	}

	.tts-card__timer-img {
		width: 180px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tts-course-aside .tts-btn,
	.tts-mbar .tts-btn {
		transition: none;
	}
}
