/*
 * Bilagent form. Loaded after qiform_v2.css, which provides the base look
 * (steps, inputs, radios, buttons, loading overlay) through the shared .qiform
 * classes — this file only adds what that stylesheet does not have. Markup:
 * templates/bilagent.php. A copy of css/dokumenttjek.css without the VIN and
 * document parts.
 */

.bilagent {
	--bilagent-primary: #334d6a; /* same as $primary-color in qiform_v2.scss */
	--bilagent-alert: #ff4136; /* same as $alert-color in qiform_v2.scss */
	--bilagent-surface: rgba(255, 255, 255, 0.5);
	--bilagent-radius: 8px;
}

/* The author rules below set display on elements that JS toggles with the
   hidden attribute, which would otherwise lose to them. */
.bilagent [hidden] {
	display: none;
}

/* The open step shows its content from the first paint. Once JS runs it takes
   over (it sets an inline display on the open step and adds --js): this rule
   must not outlive that, or a step that loses --active would vanish at once
   instead of sliding up with jQuery's slideUp. */
.bilagent:not(.bilagent--js) .qiform__step--active > .qiform__content {
	display: block;
}

/* Consent and terms. qiform_v2.css makes the label inline-block, and an
   inline-block that does not fit beside the checkbox is moved whole onto the
   next line instead of wrapping its text — fine for the short terms label, but
   the consent text is long. As a flex row the checkbox stays on the first line
   and the text wraps next to it. */
.bilagent .qiform__input--terms.qiform--active {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 0 8px;
}

.bilagent .qiform__input--terms input[type="checkbox"] {
	flex-shrink: 0;
	margin: 4px 0 0;
}

.bilagent .qiform__input--terms label:not(.error) {
	display: block;
	flex: 1;
}

/* The validation message is added inside this row too: on a line of its own
   under the text, not squeezed in beside it. */
.bilagent .qiform__input--terms label.error {
	flex: 0 0 100%;
	padding-left: 21px; /* checkbox width + gap, so it lines up under the text */
}

/* Validation: qiform_v2.css colours the label and a few named inputs; this
   covers the rest of the fields in this form. */
.bilagent .qiform__input.error input:not([type="checkbox"]):not([type="file"]),
.bilagent .qiform__input.error textarea {
	border-color: var(--bilagent-alert);
}

.bilagent label.error {
	display: block;
	margin-top: 5px;
	font-size: 0.9em;
	color: var(--bilagent-alert);
}

.bilagent__error {
	margin-top: 10px;
	margin-bottom: 10px;
	padding: 10px 15px;
	border: 1px solid var(--bilagent-alert);
	border-radius: var(--bilagent-radius);
	background: rgba(255, 65, 54, 0.1);
	color: var(--bilagent-alert);
}

/* Betaling footer: "Start forfra" on the left, the pay button on the right.
   The reset is a discreet link, deliberately not a button, as it throws data
   away. On a phone the pay button comes first. */
.bilagent__actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 15px;
	margin-top: 20px; /* air between the price block above and the footer row */
}

.bilagent__actions .qiform__input {
	width: auto;
	margin: 0;
}

.bilagent__reset {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.9em;
	color: var(--bilagent-primary);
	text-decoration: underline;
	cursor: pointer;
}

.bilagent__reset:hover {
	text-decoration: none;
	color: var(--bilagent-alert);
}

.bilagent__reset-icon {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

@media screen and (max-width: 700px) {
	.bilagent__actions {
		flex-direction: column-reverse;
		align-items: stretch;
		text-align: center;
	}

	.bilagent__reset {
		justify-content: center;
	}
}

/* FDM box below the form, outside .bilagent, always shown (as on the main
   form). --in is the plain "logged in" line without the box. */
.bilagent__fdm {
	margin-top: 15px;
	padding: 20px;
	border: 1px solid #dedede;
	border-radius: 20px; /* matches the FDM box on the main form */
	background: #eee;
	text-align: center;
}

/* The login link is a .button; the main form gives it these inline, and the
   theme's .button styling does not provide them. */
.bilagent__fdm .button {
	display: inline-block;
	margin-top: 15px;
}

.bilagent__fdm--in {
	padding: 0;
	border: 0;
	background: none;
	text-align: right;
}

.bilagent__fdm-logo {
	display: inline-block;
	width: 100px;
	margin-bottom: 15px;
}
