/**
 * Certificate paywall — modal, download buttons and the certificates list.
 *
 * The fee table is deliberately full size and high contrast: mandatory fees belong in plain sight,
 * not in small print.
 */

/*
 * Design tokens read from the Elementor kit first, with the kit's current values as fallbacks. If
 * the client restyles the site, the paywall follows instead of drifting out of step.
 *
 * Kit "Level Up": Primary #0B2541, Secondary #FA8B1F, headings Bebas Neue, body Schibsted Grotesk,
 * buttons 12px radius.
 */
:root {
	--cle-accent: var(--e-global-color-primary, #0B2541);
	--cle-highlight: var(--e-global-color-secondary, #FA8B1F);
	--cle-muted: var(--e-global-color-text, #6B7280);
	--cle-ink: #08080C;
	--cle-line: #EDEDED;
	--cle-accent-ink: #ffffff;
	--cle-surface: #ffffff;
	--cle-radius: 12px;

	--cle-font-display: var(--e-global-typography-primary-font-family, "Bebas Neue"), Impact, "Arial Narrow", sans-serif;
	--cle-font-body: var(--e-global-typography-text-font-family, "Schibsted Grotesk"), system-ui, -apple-system, "Segoe UI", sans-serif;
	--cle-font-button: var(--e-global-typography-accent-font-family, "Schibsted Grotesk"), system-ui, sans-serif;
}

/* ---------------------------------------------------------------- Modal */

.cle-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
}

.cle-modal[hidden] {
	display: none;
}

.cle-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.cle-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 30rem;
	max-height: 88vh;
	background: var(--cle-surface);
	border-radius: var(--cle-radius);
	box-shadow: 0 1.5rem 3rem rgba(11, 37, 65, 0.35);

	/*
	 * The dialog states its own typography rather than inheriting: the theme sizes headings for
	 * full-width hero use, which swallows a 30rem dialog. It uses the site's fonts at sizes that fit
	 * — and no element in here is a heading tag, so those rules cannot reach in. See paywall.js.
	 */
	font-family: var(--cle-font-body);
	font-size: 16px;
	font-weight: 400;
	line-height: 1.55;
	letter-spacing: normal;
	text-transform: none;
	color: var(--cle-ink);
}

.cle-modal *,
.cle-modal *::before,
.cle-modal *::after {
	box-sizing: border-box;
}

.cle-modal__body {
	overflow-y: auto;
	padding: 1.5rem 1.5rem 0;
}

.cle-modal .cle-modal__close {
	all: unset;
	position: absolute;
	top: 0.4rem;
	right: 0.6rem;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	font-size: 1.5rem;
	line-height: 1;
	color: var(--cle-muted);
	cursor: pointer;
}

.cle-modal .cle-modal__close:hover,
.cle-modal .cle-modal__close:focus-visible {
	background: rgba(0, 0, 0, 0.06);
	color: var(--cle-ink);
}

/* The site's display face, at a size that suits a dialog rather than a hero band. */
.cle-modal__title {
	margin: 0 2rem 0.2rem 0;
	font-family: var(--cle-font-display);
	font-size: 2rem;
	font-weight: 400;
	line-height: 1.05;
	letter-spacing: 0.01em;
	color: var(--cle-ink);
}

.cle-modal__course {
	margin: 0 0 1.1rem;
	font-size: 0.95rem;
	color: var(--cle-muted);
}

.cle-modal__intro {
	margin: 1.1rem 0 0.5rem;
	font-size: 0.95rem;
}

/* Keeps the primary action visible instead of scrolling off the end of a long dialog. */
.cle-modal__actions {
	position: sticky;
	bottom: 0;
	margin-top: 1.25rem;
	padding: 0.85rem 0 1.5rem;
	background: var(--cle-surface);
	box-shadow: 0 -0.75rem 0.75rem -0.5rem rgba(255, 255, 255, 0.9);
}

body.cle-modal-open {
	overflow: hidden;
}

/* ------------------------------------------------------------- Controls */

.cle-check {
	display: flex;
	gap: 0.65rem;
	align-items: flex-start;
	padding: 0.85rem 0.9rem;
	border: 1px solid var(--cle-line);
	border-radius: 0.35rem;
	font-size: 0.95rem;
	line-height: 1.45;
	cursor: pointer;
}

.cle-modal .cle-check input {
	width: 1.05rem;
	height: 1.05rem;
	margin: 0.2rem 0 0;
	flex: 0 0 auto;
	accent-color: var(--cle-accent);
}

.cle-field {
	margin: 0.85rem 0 0;
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

.cle-modal .cle-field label {
	margin: 0;
	font-size: 0.88rem;
	font-weight: 600;
	line-height: 1.35;
	text-transform: none;
	letter-spacing: normal;
	color: var(--cle-ink);
}

.cle-modal .cle-field input {
	width: 100%;
	height: auto;
	margin: 0;
	padding: 0.6rem 0.7rem;
	border: 1px solid var(--cle-line);
	border-radius: var(--cle-radius);
	background: var(--cle-surface);
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.4;
	color: var(--cle-ink);
	box-shadow: none;
}

.cle-modal .cle-field input:focus {
	border-color: var(--cle-accent);
	outline: 2px solid rgba(11, 74, 111, 0.25);
	outline-offset: 0;
}

.cle-field__help {
	font-size: 0.8rem;
	color: var(--cle-muted);
}

.cle-error {
	margin: 0 0 1rem;
	padding: 0.6rem 0.75rem;
	border-left: 3px solid #b32d2e;
	background: #fcf0f0;
	font-size: 0.9rem;
	color: #7a1f20;
}

.cle-modal .cle-button {
	display: inline-block;
	margin: 0;
	padding: 0.85rem 1.25rem;
	border: 0;
	border-radius: var(--cle-radius);
	font-family: var(--cle-font-button);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

/*
 * !important is a last resort, and this is one: the Elementor kit paints every button with its own
 * accent colour at a specificity this cannot outrank. The paywall has to look like part of the
 * certificate flow, not like the site's generic call-to-action, so these four declarations win.
 */
.cle-modal .cle-button--primary {
	width: 100%;
	background: var(--cle-accent) !important;
	background-image: none !important;
	color: var(--cle-accent-ink) !important;
	border: 0 !important;
}

.cle-modal .cle-button--primary:hover {
	background: var(--cle-highlight) !important;
}

.cle-modal .cle-button[disabled] {
	opacity: 0.6;
	cursor: default;
}

/* ------------------------------------------------------------- Preview */

.cle-preview {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding: 1.1rem 1rem;
	border: 2px solid var(--cle-accent);
	border-radius: var(--cle-radius);
	text-align: center;
}

.cle-preview__name {
	font-family: var(--cle-font-display);
	font-size: 1.7rem;
	font-weight: 400;
	line-height: 1.1;
	letter-spacing: 0.01em;
	color: var(--cle-accent);
}

.cle-preview__course {
	font-size: 0.95rem;
	color: var(--cle-muted);
}

.cle-preview__credits {
	font-size: 0.95rem;
	font-weight: 600;
}

/* ---------------------------------------------------------------- Fees */

.cle-fees__title {
	margin: 1.4rem 0 0.4rem;
	font-family: var(--cle-font-display);
	font-size: 1.25rem;
	font-weight: 400;
	line-height: 1.15;
	color: var(--cle-ink);
}

.cle-modal .cle-fees {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	font-size: 0.98rem;
}

.cle-modal .cle-fees th,
.cle-modal .cle-fees td {
	padding: 0.45rem 0;
	border: 0;
	border-bottom: 1px solid var(--cle-line);
	background: none;
	font-family: inherit;
	font-size: inherit;
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: normal;
	text-transform: none;
	text-align: left;
	color: var(--cle-ink);
}

.cle-modal .cle-fees td {
	text-align: right;
	white-space: nowrap;
}

.cle-modal .cle-fees__total th,
.cle-modal .cle-fees__total td {
	padding-top: 0.7rem;
	border-bottom: 0;
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--cle-accent);
}

.cle-fees__note {
	margin: 0.75rem 0 0;
	font-size: 0.85rem;
	color: var(--cle-muted);
}

/* ------------------------------------------------- Downloads and lists */

/*
 * Same story as the modal button: the Elementor kit colours every link and button with its own
 * accent, so the download call to action states its colours outright.
 */
.cle-cert-button,
a.cle-cert-button {
	display: inline-block;
	padding: 0.7rem 1.2rem;
	border: 0 !important;
	border-radius: var(--cle-radius);
	background: var(--cle-accent) !important;
	background-image: none !important;
	color: var(--cle-accent-ink) !important;
	font-family: var(--cle-font-button);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none !important;
	transition: background-color 0.15s ease;
}

.cle-cert-button:hover,
a.cle-cert-button:hover {
	background: var(--cle-highlight) !important;
	color: var(--cle-accent-ink) !important;
}

.cle-cert-button--large {
	padding: 0.85rem 1.5rem;
	font-size: 1.05rem;
}

.cle-cert-thankyou {
	margin: 1.5rem 0;
	padding: 1.4rem;
	border: 2px solid var(--cle-accent);
	border-radius: var(--cle-radius);
	font-family: var(--cle-font-body);
	color: var(--cle-ink);
}

.cle-cert-thankyou__title {
	margin: 0 0 0.9rem;
	font-family: var(--cle-font-display);
	font-size: 1.9rem;
	font-weight: 400;
	line-height: 1.05;
	letter-spacing: 0.01em;
	text-transform: none;
	color: var(--cle-accent);
}

.cle-cert-thankyou__row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1rem;
	align-items: center;
	justify-content: space-between;
	padding: 0.6rem 0;
	border-top: 1px solid var(--cle-line);
}

/* A single certificate needs no divider — it is not a list yet. */
.cle-cert-thankyou__row:first-of-type {
	border-top: 0;
	padding-top: 0;
}

.cle-cert-thankyou__text {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	min-width: 0;
}

.cle-cert-thankyou__course {
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.3;
}

.cle-cert-thankyou__credits {
	font-size: 0.88rem;
	color: var(--cle-muted);
}

.cle-cert-thankyou__note {
	margin: 0.9rem 0 0;
	padding-top: 0.75rem;
	border-top: 1px solid var(--cle-line);
	font-size: 0.85rem;
	color: var(--cle-muted);
}

@media (max-width: 480px) {
	.cle-cert-thankyou__row {
		align-items: flex-start;
	}

	.cle-cert-thankyou .cle-cert-button {
		width: 100%;
		text-align: center;
	}
}

.cle-cert-list {
	list-style: none;
	margin: 0;
	padding: 0;
	font-family: var(--cle-font-body);
	color: var(--cle-ink);
}

.cle-cert-item {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
	justify-content: space-between;
	padding: 0.9rem 0;
	border-bottom: 1px solid var(--cle-line);
}

.cle-cert-item__text {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.cle-cert-item__title {
	font-weight: 600;
}

.cle-cert-item__meta {
	font-size: 0.85rem;
	color: var(--cle-muted);
}

.cle-cert-empty {
	color: var(--cle-muted);
}
