/*
 * Shared shell for every Kvaser_Form — one popup/inline look every migrated
 * form reuses, instead of a bespoke modal per form (the CanKing #cankingmodel
 * pattern this replaces had its own ~150 lines of modal CSS on top of its
 * own JS, all specific to that one form).
 */
.kvaser-form {
	margin-bottom: 16px;
}
.kvaser-form-row {
	margin-bottom: 16px;
}
.kvaser-form-row label {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
}
.kvaser-form-row input[type="text"],
.kvaser-form-row input[type="email"],
.kvaser-form-row input[type="tel"],
.kvaser-form-row input[type="url"],
.kvaser-form-row textarea,
.kvaser-form-row select {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #d6d6d6;
	border-radius: 4px;
}
.kvaser-form-row textarea {
	resize: vertical;
	font: inherit;
	/* rows="4" (Kvaser_Form::render_field()) sets the initial height, but
	   resize: vertical alone would let a visitor drag it shorter than that —
	   min-height keeps 4 rows the floor, not just the starting point.
	   Matches rows="4" exactly at this row's line-height/padding/border
	   (border-box): 4 * 24px line-height + 20px padding + 2px border. */
	min-height: 118px;
}
.kvaser-form-row--checkbox label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-weight: 400;
}
.kvaser-form-row--hidden {
	display: none;
}
.kvaser-form-field-error {
	display: block;
	color: #e4002b;
	font-size: 13px;
	margin-top: 4px;
}
.kvaser-form-field-error:empty {
	display: none;
}
.kvaser-form-notice {
	margin-bottom: 16px;
	padding: 10px 14px;
	border-radius: 4px;
}
.kvaser-form-notice.is-error {
	background: #fff2f2;
	color: #d63638;
	border: 1px solid #d63638;
}
.kvaser-form-notice.is-success {
	background: #f0fbf0;
	color: #1e7e1e;
	border: 1px solid #1e7e1e;
}
.kvaser-form-submit.is-loading {
	opacity: 0.6;
	pointer-events: none;
}
.kvaser-form-submit {
	margin-top: 20px;
}

.kvaser-form-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(20, 20, 20, 0.6);
	align-items: flex-start;
	justify-content: center;
	padding: 20px;
	overflow: auto;
}
.kvaser-form-modal.show {
	display: flex;
}
.kvaser-form-modal-content {
	position: relative;
	background: #fff;
	max-width: 520px;
	width: 100%;
	padding: 40px 32px;
	border-radius: 6px;
}
/* The shop's "Ask for quote" popup (Kvaser_Shop_Functions::render_quote_modal()):
   centred, near the top of the window rather than against its edge. A tall
   form on a short window still scrolls inside the overlay. */
#kvaser-form-modal-site-contact {
	padding-top: max(20px, 8vh);
	padding-bottom: 40px;
}
.kvaser-form-modal-close {
	position: absolute;
	top: 12px;
	right: 16px;
	background: none;
	border: none;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

/*
 * "Intro" row (Kvaser_Form::render_intro()) — icon + text side by side,
 * reproducing the original CanKing modal's #cankingmodel .thumbnail-box
 * (class-kvaser-download.php's popup_model()) under namespaced class names
 * so this doesn't collide with that file's own still-live inline CSS on the
 * CanKing listing page, which hasn't migrated to this system yet.
 */
.kvaser-form-canking-intro {
	display: flex;
	align-items: flex-start;
	gap: 20px;
	margin-top: 20px;
	margin-bottom: 20px;
	padding: 15px;
	border: 1px solid #e5e5e5;
	border-radius: 10px;
	background: #fafafa;
}
.kvaser-form-canking-intro-icon {
	width: 100px;
	min-width: 100px;
	height: 100px;
}
.kvaser-form-canking-intro-text h3 {
	margin: 0;
}
.kvaser-form-canking-intro-text p {
	margin: 5px 0 0;
	font-size: 14px;
	color: #6c717f;
}
@media screen and (max-width: 768px) {
	.kvaser-form-canking-intro {
		flex-direction: column;
		align-items: center;
		text-align: center;
	}
}

/*
 * Split layout (Kvaser_Forms_Registry::render_inline() when the form, or the
 * render() caller, supplies an aside image): form on the left at exactly half
 * the available width, image filling the other half and stretching to the
 * form's height. First used by the site-contact form on /contact-us/.
 */
.kvaser-form-split {
	display: flex;
	align-items: stretch;
	gap: 40px;
}
.kvaser-form-split > .kvaser-form {
	flex: 0 0 50%;
	max-width: 50%;
	/* The gap takes its share out of the image column, not the form's half. */
	box-sizing: border-box;
	margin-bottom: 0;
}
.kvaser-form-split-image {
	flex: 1 1 0;
	min-width: 0;
	margin: 0;
	display: flex;
}
.kvaser-form-split-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 10px;
}
@media screen and (max-width: 767px) {
	.kvaser-form-split {
		flex-direction: column;
		gap: 24px;
	}
	.kvaser-form-split > .kvaser-form {
		flex-basis: auto;
		max-width: none;
	}
	.kvaser-form-split-image img {
		height: auto;
		max-height: 320px;
	}
}

/* Anchor target for links like the shop's "Ask for quote"
   (#kvaser-form-site-contact): keep the form clear of the sticky header. */
form.kvaser-form[id] {
	scroll-margin-top: 140px;
}
