/* South Form. Sites restyle it through the --sf-* variables.
   Field selectors go through .sf-body so they beat a theme's bare input rules. */

.sf {
	--sf-accent: #d41313;
	--sf-accent-hover: #a5161b;
	--sf-accent-soft: rgba(212, 19, 19, 0.08);
	--sf-text: #082137;
	--sf-muted: #454545;
	--sf-border: #d8d8d8;
	--sf-field-bg: #f7f7f7;
	--sf-card-bg: #fff;
	--sf-success: #2a5b5a;
	--sf-backdrop: rgba(8, 33, 55, 0.65);
	--sf-font: Lato, sans-serif;
	--sf-radius: 8px;
	--sf-card-radius: 16px;

	box-sizing: border-box;
	font-family: var(--sf-font);
	color: var(--sf-text);
}

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

.sf [hidden] {
	display: none !important;
}

.sf p,
.sf label,
.sf button,
.sf input {
	font-family: var(--sf-font);
}

@keyframes sf-slide-up {
	from { opacity: 0; transform: translateY(40px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes sf-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes sf-scale-in {
	from { opacity: 0; transform: scale(0.6); }
	to { opacity: 1; transform: scale(1); }
}

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

/* Modal */

.sf-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 2147483647;
	align-items: flex-end;
	justify-content: center;
}

.sf-modal.sf-open {
	display: flex;
}

.sf-backdrop {
	position: absolute;
	inset: 0;
	background: var(--sf-backdrop);
	animation: sf-fade-in 0.2s ease forwards;
}

.sf-card {
	position: relative;
	z-index: 10;
	width: 100%;
	max-width: 520px;
	max-height: 95vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--sf-card-bg);
	border-radius: var(--sf-card-radius) var(--sf-card-radius) 0 0;
	animation: sf-slide-up 0.35s ease-out;
}

@media (min-width: 600px) {
	.sf-modal {
		align-items: center;
	}

	.sf-card {
		border-radius: var(--sf-card-radius);
	}
}

.sf .sf-close {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 20;
	padding: 0;
	line-height: 1;
	color: var(--sf-muted);
	background: none;
	border: none;
	cursor: pointer;
	transition: color 0.15s;
}

.sf .sf-close:hover {
	color: var(--sf-text);
}

/* Inline */

.sf-static .sf-card {
	max-width: 100%;
	max-height: none;
	overflow: visible;
	border-radius: var(--sf-card-radius);
	box-shadow: 0 4px 24px rgba(8, 33, 55, 0.15);
	animation: none;
}

.sf-static .sf-body {
	overflow: visible;
}

.sf-static .sf-dropdown-menu {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 2;
	width: 100%;
}

.south-form-inline {
	max-width: 552px;
	margin: 0 auto 40px;
	padding: 0 16px;
}

/* Progress */

.sf-dots {
	display: flex;
	flex-shrink: 0;
	justify-content: center;
	gap: 8px;
	padding: 24px 0 8px;
}

.sf-dot {
	display: block;
	width: 10px;
	height: 10px;
	border: 2px solid #b1b1b1;
	border-radius: 50%;
	background: transparent;
	transition: background 0.2s, border-color 0.2s;
}

.sf-dot-active {
	background: var(--sf-accent);
	border-color: var(--sf-accent);
}

/* Body */

.sf-body {
	flex: 1;
	overflow-y: auto;
	padding: 8px 32px 32px;
	margin: 0;
}

.sf-one-step .sf-body {
	padding-top: 32px;
}

.sf .sf-title {
	margin: 0 0 4px;
	font-family: var(--sf-font);
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.3;
	text-align: center;
	color: var(--sf-text);
}

.sf .sf-subtitle {
	margin: 0 0 24px;
	font-family: var(--sf-font);
	font-size: 0.875rem;
	text-align: center;
	color: var(--sf-muted);
}

.sf .sf-title + .sf-field,
.sf .sf-title + .sf-row {
	margin-top: 24px;
}

.sf .sf-subtitle-wide {
	max-width: 375px;
	margin: 9px auto 0;
	line-height: 1.625;
}

.sf-step {
	animation: sf-fade-in 0.2s ease forwards;
}

.sf-success {
	padding: 24px 0;
	text-align: center;
}

.sf-success-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	margin: 0 auto 20px;
	border-radius: 50%;
	color: #fff;
	background: var(--sf-success);
	animation: sf-scale-in 0.3s ease forwards;
}

.sf-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Fields */

.sf-field {
	margin-bottom: 12px;
}

.sf-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-bottom: 12px;
}

.sf-row .sf-field {
	margin-bottom: 0;
}

.sf .sf-label {
	display: block;
	margin-bottom: 6px;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--sf-text);
}

.sf-required {
	color: var(--sf-accent);
}

.sf .sf-error {
	margin: 3px 0 0;
	font-size: 0.75rem;
	color: var(--sf-accent);
}

.sf .sf-hint {
	margin: 6px 0 0;
	font-size: 0.75rem;
	color: var(--sf-muted);
}

.sf .sf-body .sf-input,
.sf .sf-body .sf-dropdown-search,
.sf .sf-body .sf-dropdown-trigger {
	width: 100%;
	height: 48px;
	margin: 0;
	padding: 0 16px;
	font-family: var(--sf-font);
	font-size: 1rem;
	color: var(--sf-text);
	background: var(--sf-field-bg);
	border: 1px solid var(--sf-border);
	border-radius: var(--sf-radius);
	box-shadow: none;
	outline: none;
	transition: border-color 0.15s;
}

.sf .sf-body .sf-input::placeholder,
.sf .sf-body .sf-dropdown-search::placeholder {
	color: var(--sf-muted);
	opacity: 1;
}

.sf .sf-body .sf-input:focus,
.sf .sf-body .sf-dropdown-search:focus,
.sf .sf-body .sf-dropdown-trigger:focus,
.sf .sf-body .sf-dropdown-trigger[aria-expanded="true"],
.sf .sf-body .sf-invalid {
	border-color: var(--sf-accent);
}

/* Dropdowns */

.sf-dropdown {
	position: relative;
}

.sf-dropdown-disabled {
	opacity: 0.5;
}

.sf .sf-body .sf-dropdown-trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	text-align: left;
	cursor: pointer;
}

.sf-dropdown-value {
	overflow: hidden;
	color: var(--sf-muted);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sf-dropdown-value-selected {
	color: var(--sf-text);
}

.sf-chevron {
	flex-shrink: 0;
	margin-left: 8px;
	color: var(--sf-muted);
	pointer-events: none;
	transition: transform 0.2s;
}

.sf .sf-body .sf-dropdown-search {
	padding-right: 30px;
	text-overflow: ellipsis;
}

.sf-dropdown-search ~ .sf-chevron {
	position: absolute;
	top: 16px;
	right: 12px;
	margin-left: 0;
}

.sf-dropdown-trigger[aria-expanded="true"] .sf-chevron,
.sf-dropdown-open .sf-chevron {
	transform: rotate(180deg);
}

.sf-dropdown-menu {
	max-height: 240px;
	margin-top: 4px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid var(--sf-border);
	border-radius: var(--sf-radius);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.sf-dropdown-menu-programs {
	max-height: 256px;
}

.sf .sf-option,
.sf .sf-program,
.sf .sf-group {
	display: block;
	width: 100%;
	margin: 0;
	padding: 10px 16px;
	font-family: var(--sf-font);
	font-size: 0.875rem;
	line-height: 1.4;
	text-align: left;
	color: var(--sf-text);
	background: none;
	border: none;
	border-radius: 0;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.sf .sf-program {
	padding: 8px 16px 8px 32px;
}

.sf .sf-program-extra {
	padding-left: 16px;
}

.sf .sf-option:hover,
.sf .sf-option:focus,
.sf .sf-program:hover,
.sf .sf-program:focus {
	color: #fff;
	background: var(--sf-accent);
	outline: none;
}

.sf .sf-selected {
	font-weight: 600;
	background: var(--sf-accent-soft);
}

.sf .sf-group {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	font-weight: 700;
	background: rgba(237, 237, 237, 0.4);
}

.sf-group svg {
	flex-shrink: 0;
}

.sf-group span {
	margin-left: 4px;
	font-size: 0.75rem;
	font-weight: 400;
	color: var(--sf-muted);
}

.sf .sf-dropdown-empty {
	margin: 0;
	padding: 12px 16px;
	font-size: 0.875rem;
	color: #9e9e9e;
}

/* Terms and consent */

.sf-checkbox {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-bottom: 12px;
	cursor: pointer;
}

.sf .sf-body .sf-checkbox input {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	margin: 2px 0 0;
	padding: 0;
	background: none;
	border: none;
	accent-color: var(--sf-accent);
	cursor: pointer;
}

.sf-checkbox-label {
	font-size: 0.75rem;
	line-height: 1.4;
	color: var(--sf-muted);
}

.sf .sf-consent {
	margin: 8px 0 20px;
	font-size: 0.625rem;
	line-height: 1.4;
	color: var(--sf-muted);
}

.sf-checkbox-label a,
.sf-consent a,
.sf-success a {
	color: var(--sf-accent);
	text-decoration: underline;
}

.sf .sf-submit-error {
	margin-top: 12px;
	font-size: 0.875rem;
	text-align: center;
}

/* Buttons */

.sf .sf-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	height: 48px;
	margin: 24px 0 0;
	padding: 0 16px;
	font-family: var(--sf-font);
	font-size: 1rem;
	font-weight: 700;
	color: #fff;
	background: var(--sf-accent);
	border: none;
	border-radius: var(--sf-radius);
	cursor: pointer;
	transition: background 0.2s, transform 0.15s;
}

.sf .sf-btn:hover {
	background: var(--sf-accent-hover);
	transform: scale(1.02);
}

.sf .sf-btn:active {
	transform: scale(1);
}

.sf .sf-btn:disabled {
	opacity: 0.7;
	cursor: not-allowed;
	transform: none;
}

.sf .sf-btn-inline {
	width: auto;
	margin-right: auto;
	margin-left: auto;
	padding: 0 40px;
}

.sf .sf-btn-ghost {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	margin-top: 12px;
	padding: 0;
	font-family: var(--sf-font);
	font-size: 0.875rem;
	line-height: 1.4;
	color: var(--sf-muted);
	background: transparent;
	border: none;
	cursor: pointer;
}

.sf .sf-btn-ghost:hover {
	color: var(--sf-text);
}

.sf-spinner {
	display: none;
}

.sf-loading .sf-btn-text {
	display: none;
}

.sf-loading .sf-spinner {
	display: block;
	animation: sf-spin 0.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
	.sf *,
	.sf-backdrop,
	.sf-card {
		animation: none !important;
		transition: none !important;
	}
}
