/*
 * Dokumenttjek form. Loaded after qiform_v2.css, which provides the base look
 * (steps, inputs, buttons, regdate badge, file names, loading overlay) through
 * the shared .qiform classes — this file only adds what that stylesheet does
 * not have. Markup: templates/dokumenttjek.php.
 */

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

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

/* The open step shows its content from the first paint; JS takes over with
   slideUp/slideDown from there (those set an inline display that wins). */
.dokumenttjek .qiform__step--active > .qiform__content {
	display: block;
}

/* Fields */

.dokumenttjek__vin-field {
	position: relative;
}

.dokumenttjek__vin-counter {
	position: absolute;
	top: 50%;
	right: 10px;
	transform: translateY(-50%);
	font-size: 0.8em;
	color: var(--dokumenttjek-primary);
	opacity: 0.7;
	pointer-events: none;
}

.dokumenttjek__vin-counter--complete {
	color: #065f46; /* green: the same as the main form's regno-badge text */
	opacity: 1;
}

.dokumenttjek__vin-counter--invalid {
	color: var(--dokumenttjek-alert);
	font-weight: bold;
	opacity: 1;
}

/* A stored document's box (qiform_v2.css) is clickable here: it removes the
   document so another can be picked. The cross says so; the main form has the
   same cross commented out because nothing there removes a file. */
.dokumenttjek .qiform__file-name {
	cursor: pointer;
}

.dokumenttjek .qiform__file-name:after {
	content: "✖";
	flex-grow: 1;
	text-align: right;
}

/* 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. */
.dokumenttjek .qiform__input--terms.qiform--active {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 0 8px;
}

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

.dokumenttjek .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. */
.dokumenttjek .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. */
.dokumenttjek .qiform__input.error input:not([type="checkbox"]):not([type="file"]),
.dokumenttjek .qiform__input.error textarea {
	border-color: var(--dokumenttjek-alert);
}

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

.dokumenttjek__error {
	margin-top: 10px;
	margin-bottom: 10px;
	padding: 10px 15px;
	border: 1px solid var(--dokumenttjek-alert);
	border-radius: var(--dokumenttjek-radius);
	background: rgba(255, 65, 54, 0.1);
	color: var(--dokumenttjek-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. */
.dokumenttjek__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 */
}

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

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

.dokumenttjek__reset:hover {
	text-decoration: none;
	color: var(--dokumenttjek-alert);
}

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

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

	.dokumenttjek__reset {
		justify-content: center;
	}
}

/* FDM box below the form, outside .dokumenttjek, always shown (as on the main
   form). --in is the plain "logged in" line without the box. */
.dokumenttjek__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. */
.dokumenttjek__fdm .button {
	display: inline-block;
	margin-top: 15px;
}

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

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