/*
 * Digital School Online — v2 card price/hours strip.
 *
 * Scoped to the real markup rendered by the MasterStudy/STM course loop on
 * digital-school.online (ul.stm-courses > li.product > .product__inner >
 * a.woocommerce-loop-product__link > { title, .price, .course-duration }) —
 * the same structure as test.academy, confirmed via live DOM, not vanilla
 * WooCommerce ul.products markup.
 *
 * unid-customizations/unid-ms/ms-elementor/category-product-template.php
 * already forces conflicting !important rules on .product__inner .price /
 * .price del / .price del bdi / .price ins / .price ins bdi / .course-duration
 * / .woocommerce-loop-product__title::after — every rule here that touches
 * those properties needs an equal-or-stronger !important to actually win.
 *
 * Sizing note: the desktop card is ~277px (product__inner min-width set by
 * the shared file), close to test.academy's measured ~280px — reused as a
 * starting point but re-measured against DS's own staging screenshot before
 * shipping (see unid-course-card/README.md: don't trust mockup px sizes).
 */

:root {
	--unid-cc-ds-accent: #04859f;
	--unid-cc-ds-accent-dark: #036b81;
	--unid-cc-ds-ink: #2b3a55;
	--unid-cc-ds-muted: #6d7078;
	--unid-cc-ds-separator: #d9dde1;
	--unid-cc-ds-price-bg-top: #f5fafb;
	--unid-cc-ds-price-bg-bottom: #eef6f8;
	--unid-cc-ds-price-border: #dcedf0;
}

.stm-courses li.product .product__inner {
	display: flex;
	flex-direction: column;
}

.stm-courses li.product .product__inner .woocommerce-loop-product__link {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
}

/*
 * The shared file hardcodes `.product__inner img { width: 280px !important }`,
 * a fixed px value that only matches the card's actual rendered width by
 * coincidence at some viewport widths — at others (e.g. the 1-card-per-row
 * mobile layout, where product__inner stretches to the full column width)
 * it leaves a visible blank strip beside the image. Override to fill
 * whatever width the card actually has; height/object-fit stay as the
 * shared file set them.
 */
.stm-courses li.product .product__inner img {
	width: 100% !important;
}

/*
 * The shared file already draws a plain gray divider under the title; our
 * price panel adds its own separator (with an accent segment) right above
 * itself, so hide the title's to avoid doubling up — matches TA.
 */
.stm-courses li.product .woocommerce-loop-product__title::after {
	display: none !important;
}

.stm-courses li.product .price {
	position: relative;
	display: grid !important;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-rows: auto auto;
	column-gap: 16px;
	row-gap: 6px;
	align-items: center;
	box-sizing: border-box;
	width: 100%;
	float: none !important;
	margin: auto 0 0 !important;
	padding: 14px 20px 16px !important;
	background: linear-gradient(180deg, var(--unid-cc-ds-price-bg-top) 0%, var(--unid-cc-ds-price-bg-bottom) 100%);
	border-top: 1px solid var(--unid-cc-ds-price-border);
	font-style: normal;
}

.stm-courses li.product .price::before {
	content: "";
	position: absolute;
	right: 20px;
	left: 20px;
	top: -14px;
	height: 1px;
	background: var(--unid-cc-ds-separator);
}

.stm-courses li.product .price::after {
	content: "";
	position: absolute;
	top: -15px;
	left: 50%;
	width: 57px;
	height: 2px;
	transform: translateX(-50%);
	background: var(--unid-cc-ds-accent);
	border-radius: 1px;
}

.stm-courses li.product .price del {
	grid-column: 1;
	grid-row: 1;
	justify-self: start;
	align-self: end;
	margin: 0 !important;
	color: var(--unid-cc-ds-muted);
	font-size: 15px !important;
	font-weight: 500;
	line-height: 1.15;
	text-decoration-thickness: 1.5px;
}

.stm-courses li.product .price del .amount,
.stm-courses li.product .price del bdi {
	color: inherit !important;
	font-size: inherit !important;
	font-weight: inherit !important;
}

.stm-courses li.product .price ins {
	grid-column: 1;
	grid-row: 2;
	justify-self: start;
	align-self: start;
	margin: 0 !important;
	color: var(--unid-cc-ds-accent);
	font-size: clamp(22px, 2.5vw, 28px) !important;
	font-weight: 800;
	line-height: .95 !important;
	letter-spacing: -0.025em;
	text-decoration: none;
}

.stm-courses li.product .price ins .amount,
.stm-courses li.product .price ins bdi {
	color: inherit !important;
	font-size: inherit !important;
	font-weight: inherit !important;
}

.stm-courses li.product .price .unid-cc-ds-discount-badge {
	grid-column: 2;
	grid-row: 1;
	justify-self: end;
	align-self: center;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 30px;
	padding: 6px 11px;
	background: rgba(255, 255, 255, .72);
	border: 1.5px solid var(--unid-cc-ds-accent);
	border-radius: 7px;
	color: var(--unid-cc-ds-accent-dark);
	font-size: 12px;
	font-weight: 750;
	line-height: 1;
	white-space: nowrap;
}

.stm-courses li.product:hover .unid-cc-ds-discount-badge {
	background: #fff;
	border-color: var(--unid-cc-ds-accent-dark);
	color: var(--unid-cc-ds-accent-dark);
}

.stm-courses li.product .price .unid-cc-ds-course-hours {
	grid-column: 2;
	grid-row: 2;
	justify-self: end;
	align-self: center;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding-right: 4px;
	color: var(--unid-cc-ds-ink);
	font-size: 16px;
	font-weight: normal;
	line-height: 1;
	white-space: nowrap;
}

.stm-courses li.product .price .unid-cc-ds-course-hours__clock {
	position: relative;
	display: inline-block;
	flex: 0 0 auto;
	width: 14px;
	height: 14px;
	border: 1.5px solid var(--unid-cc-ds-ink);
	border-radius: 50%;
}

.stm-courses li.product .price .unid-cc-ds-course-hours__clock::before,
.stm-courses li.product .price .unid-cc-ds-course-hours__clock::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 1.5px;
	background: var(--unid-cc-ds-ink);
	border-radius: 1px;
	transform-origin: 50% 100%;
}
.stm-courses li.product .price .unid-cc-ds-course-hours__clock::before {
	height: 4px;
	transform: translate(-50%, -100%);
}
.stm-courses li.product .price .unid-cc-ds-course-hours__clock::after {
	height: 3.5px;
	transform: translate(-50%, -100%) rotate(125deg);
}

.stm-courses li.product .course-duration {
	display: none !important;
}

/* Course grid — Bootstrap's .col-xs-6 (50% width, no media guard) puts two
 * cards per row below 768px; the card's own min-width makes them overlap.
 * Force one card per row until .col-sm-4 takes over at 768px. */
@media (max-width: 767px) {
	.course-col.col-xs-6 {
		width: 100% !important;
	}
}

@media (max-width: 1024px) {
	/*
	 * .product__inner keeps a hardcoded min-width:277px !important (shared
	 * theme file) even though the bootstrap col-md-4 track is narrower than
	 * that around this viewport width, so adjacent cards visually overlap
	 * by ~30px — pre-existing, not introduced here. Our right-aligned badge
	 * and hours text land exactly in that overlap zone, so give them extra
	 * right clearance and shrink them a bit to stay clear of it.
	 */
	.stm-courses li.product .price {
		column-gap: 10px;
		padding-right: 44px !important;
		padding-left: 16px !important;
	}
	.stm-courses li.product .price::before {
		right: 16px;
		left: 16px;
	}
	.stm-courses li.product .price ins {
		font-size: clamp(18px, 2vw, 24px) !important;
	}
	.stm-courses li.product .price .unid-cc-ds-discount-badge {
		padding-right: 8px;
		padding-left: 8px;
		font-size: 11px;
	}
	.stm-courses li.product .price .unid-cc-ds-course-hours {
		font-size: 13px;
		gap: 4px;
	}
	.stm-courses li.product .price .unid-cc-ds-course-hours__clock {
		width: 12px;
		height: 12px;
	}
}

@media (max-width: 600px) {
	.stm-courses li.product .price {
		grid-template-columns: minmax(0, 1fr) auto;
		column-gap: 12px;
		row-gap: 8px;
		padding: 20px 18px 21px !important;
	}
	.stm-courses li.product .price::before {
		right: 18px;
		left: 18px;
		top: -19px;
	}
	.stm-courses li.product .price::after {
		top: -20px;
		width: 70px;
	}
	.stm-courses li.product .price ins,
	.stm-courses li.product .price ins .amount,
	.stm-courses li.product .price ins bdi {
		font-size: clamp(30px, 9vw, 38px) !important;
	}
	.stm-courses li.product .price del {
		font-size: 15px !important;
	}
	.stm-courses li.product .price .unid-cc-ds-course-hours {
		gap: 7px;
		font-size: 14px;
	}
	.stm-courses li.product .price .unid-cc-ds-course-hours__clock {
		width: 19px;
		height: 19px;
	}
	.stm-courses li.product .price .unid-cc-ds-discount-badge {
		min-height: 39px;
		padding: 8px 11px;
		border-radius: 8px;
		font-size: 13px;
	}
}
