/**
 * Ubuntu Express Entry CRS Forms - frontend styles.
 * Every colour is a CSS variable so Elementor controls can override it.
 */

.uecf-app {
	--uecf-accent: #c8102e;
	--uecf-accent-contrast: #ffffff;
	--uecf-surface: #ededed;
	--uecf-surface-alt: #ffffff;
	--uecf-text: #1b1b1b;
	--uecf-muted: #5f5f5f;
	--uecf-border: #cfcfcf;
	--uecf-radius: 6px;
	--uecf-error: #b3261e;

	/* Tabs have their own colours so they can sit on a dark section
	   background without affecting the form text inside the panel. */
	--uecf-tab-color: var(--uecf-text);
	--uecf-tab-active-color: var(--uecf-accent);
	--uecf-tab-active-bg: var(--uecf-surface-alt);

	color: var(--uecf-text);
	box-sizing: border-box;
	max-width: 100%;
}

.uecf-app *,
.uecf-app *::before,
.uecf-app *::after {
	box-sizing: inherit;
}

.uecf-app__title {
	margin: 0 0 16px;
	font-size: 1.5em;
}

/* ---------------------------------------------------------------- Tabs -- */

.uecf-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
	border-bottom: 1px solid var(--uecf-border);
}

.uecf-tab {
	appearance: none;
	background: transparent;
	border: 1px solid transparent;
	border-bottom: none;
	border-radius: var(--uecf-radius) var(--uecf-radius) 0 0;
	padding: 12px 20px;
	font-size: 1em;
	font-weight: 700;
	color: var(--uecf-tab-color);
	cursor: pointer;
	transition: color .15s ease, background-color .15s ease;
}

.uecf-tab:hover {
	color: var(--uecf-tab-active-color);
}

.uecf-tab.is-active {
	color: var(--uecf-tab-active-color);
	background: var(--uecf-tab-active-bg);
	border-color: var(--uecf-border);
}

.uecf-tab:focus-visible {
	outline: 2px solid var(--uecf-accent);
	outline-offset: 2px;
}

/* -------------------------------------------------------------- Panels -- */

.uecf-panel {
	background: var(--uecf-surface);
	padding: 22px;
	border-radius: 0 0 var(--uecf-radius) var(--uecf-radius);
}

.uecf-panel[hidden] {
	display: none;
}

.uecf-form__heading {
	margin: 0 0 18px;
	font-size: 1.25em;
	font-weight: 700;
}

/* ------------------------------------------------------------ Sections -- */

.uecf-section {
	border: none;
	border-top: 1px dotted var(--uecf-border);
	margin: 0 0 4px;
	padding: 14px 0 6px;
}

.uecf-section__legend {
	padding: 0;
	margin-bottom: 10px;
	font-size: 1em;
	font-weight: 600;
	color: var(--uecf-muted);
}

/* -------------------------------------------------------------- Fields -- */

.uecf-field {
	margin-bottom: 16px;
}

.uecf-label {
	display: block;
	margin-bottom: 6px;
	font-size: .95em;
	line-height: 1.4;
}

.uecf-required {
	color: var(--uecf-accent);
	margin-left: 2px;
}

.uecf-help {
	margin: 0 0 6px;
	font-size: .85em;
	color: var(--uecf-muted);
	line-height: 1.4;
}

.uecf-input {
	width: 100%;
	max-width: 440px;
	padding: 9px 11px;
	font-size: 1em;
	font-family: inherit;
	color: var(--uecf-text);
	background: var(--uecf-surface-alt);
	border: 1px solid var(--uecf-border);
	border-radius: 4px;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.uecf-input:focus {
	outline: none;
	border-color: var(--uecf-accent);
	box-shadow: 0 0 0 3px rgba(200, 16, 46, .15);
}

.uecf-select {
	appearance: none;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23555' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 11px;
	padding-right: 34px;
}

.uecf-radiogroup {
	border: none;
	margin: 0;
	padding: 0;
}

/* Options render as selectable cards so the chosen one is unmistakable. */
.uecf-option {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-bottom: 6px;
	padding: 10px 13px;
	font-size: .95em;
	line-height: 1.45;
	cursor: pointer;
	background: var(--uecf-surface-alt);
	border: 1px solid var(--uecf-border);
	border-radius: 6px;
	transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
}

.uecf-option:hover {
	border-color: var(--uecf-accent);
}

.uecf-option input {
	margin-top: 2px;
	width: 18px;
	height: 18px;
	accent-color: var(--uecf-accent);
	flex-shrink: 0;
	cursor: pointer;
}

/* Works in every browser: the label text of the chosen option. */
.uecf-option input:checked + span {
	font-weight: 700;
	color: var(--uecf-accent);
}

/* Highlights the whole card. Needs :has(); the rule above is the fallback. */
.uecf-option:has(input:checked) {
	border-color: var(--uecf-accent);
	box-shadow: inset 0 0 0 2px var(--uecf-accent);
}

/* Keyboard focus must stay visible on top of the card styling. */
.uecf-option input:focus-visible {
	outline: 2px solid var(--uecf-text);
	outline-offset: 2px;
}

/* Selected value in a dropdown. */
.uecf-select.has-value {
	border-color: var(--uecf-accent);
	font-weight: 600;
}

.uecf-field--readonly .uecf-input {
	max-width: 180px;
	background: #f7f7f7;
	color: var(--uecf-muted);
	cursor: default;
}

/* Honeypot: visually hidden but not display:none, so bots still fill it. */
.uecf-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* -------------------------------------------------------------- Errors -- */

.uecf-error {
	margin: 5px 0 0;
	font-size: .85em;
	color: var(--uecf-error);
}

.uecf-field.has-error .uecf-input {
	border-color: var(--uecf-error);
}

.uecf-errors {
	margin: 14px 0;
	padding: 11px 14px;
	border-left: 3px solid var(--uecf-error);
	background: rgba(179, 38, 30, .07);
	color: var(--uecf-error);
	font-size: .92em;
	border-radius: 3px;
}

/* --------------------------------------------------------- Live totals -- */

.uecf-final {
	margin-top: 14px;
	padding: 16px 18px;
	background: var(--uecf-surface-alt);
	border: 1px solid var(--uecf-border);
	border-radius: var(--uecf-radius);
}

.uecf-final__label {
	font-size: .8em;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--uecf-muted);
}

.uecf-final__score {
	font-size: 2.6em;
	font-weight: 800;
	line-height: 1.15;
	color: var(--uecf-accent);
	transition: opacity .12s ease;
}

/* Dim slightly while a recalculation is in flight. */
.uecf-final__score.is-updating {
	opacity: .45;
}

/* Short pulse when the number actually changes. */
.uecf-final__score.is-bumped {
	animation: uecf-bump .32s ease;
}

@keyframes uecf-bump {
	0%   { transform: scale(1); }
	40%  { transform: scale(1.14); }
	100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
	.uecf-final__score.is-bumped { animation: none; }
}

.uecf-final__hint {
	margin: 4px 0 0;
	font-size: .82em;
	color: var(--uecf-muted);
}

/* ------------------------------------------------------------- Actions -- */

.uecf-actions {
	margin-top: 16px;
}

.uecf-submit {
	position: relative;
	appearance: none;
	border: none;
	border-radius: 4px;
	background: var(--uecf-accent);
	color: var(--uecf-accent-contrast);
	font-size: 1em;
	font-weight: 600;
	font-family: inherit;
	padding: 12px 30px;
	cursor: pointer;
	transition: opacity .15s ease, transform .05s ease;
}

.uecf-submit:hover {
	opacity: .9;
}

.uecf-submit:active {
	transform: translateY(1px);
}

.uecf-submit:focus-visible {
	outline: 2px solid var(--uecf-text);
	outline-offset: 2px;
}

.uecf-submit[disabled] {
	opacity: .6;
	cursor: not-allowed;
}

.uecf-submit__spinner {
	display: none;
	width: 14px;
	height: 14px;
	margin-left: 9px;
	vertical-align: -2px;
	border: 2px solid rgba(255, 255, 255, .4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: uecf-spin .7s linear infinite;
}

.uecf-form.is-busy .uecf-submit__spinner {
	display: inline-block;
}

@keyframes uecf-spin {
	to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
	.uecf-submit__spinner { animation-duration: 2s; }
	.uecf-app * { transition: none !important; }
}

.uecf-actions__hint {
	margin: 7px 0 0;
	font-size: .84em;
	color: var(--uecf-muted);
}

/* -------------------------------------------------------------- Result -- */

.uecf-result {
	margin-top: 18px;
	padding: 20px;
	background: var(--uecf-surface-alt);
	border: 1px solid var(--uecf-border);
	border-radius: var(--uecf-radius);
}

.uecf-result[hidden] {
	display: none;
}

.uecf-result__score {
	display: flex;
	align-items: baseline;
	gap: 7px;
}

.uecf-result__number {
	font-size: 2.8em;
	font-weight: 700;
	line-height: 1;
	color: var(--uecf-accent);
}

.uecf-result__max {
	font-size: 1em;
	color: var(--uecf-muted);
}

.uecf-result__message {
	margin: 10px 0 16px;
	line-height: 1.5;
}

.uecf-result__table {
	width: 100%;
	max-width: 420px;
	border-collapse: collapse;
	font-size: .93em;
}

.uecf-result__table th,
.uecf-result__table td {
	padding: 8px 0;
	border-bottom: 1px solid var(--uecf-border);
	text-align: left;
	font-weight: 400;
}

.uecf-result__table td {
	text-align: right;
	font-weight: 700;
	width: 70px;
}

.uecf-result__disclaimer {
	margin: 14px 0 0;
	font-size: .8em;
	color: var(--uecf-muted);
	line-height: 1.5;
}

/* --------------------------------------------------------------- Small -- */

@media (max-width: 600px) {
	.uecf-panel { padding: 16px; }
	.uecf-tab   { padding: 10px 13px; font-size: .92em; }
	.uecf-input { max-width: 100%; }
}

/* ------------------------------------------------- Conditional fields -- */

/* Fields revealed by an earlier answer. Hidden via the [hidden] attribute
   by JS; this rule guarantees it applies even against display:flex rules. */
.uecf-field[hidden] {
	display: none !important;
}

/* Subtle emphasis so a newly revealed question is noticeable. */
.uecf-field--conditional:not([hidden]) {
	border-left: 2px solid var(--uecf-accent);
	padding-left: 12px;
}
