/*
 Theme Name: Klasse Child Theme
 Theme URI: https: //klassebv.nl/
 Author: Klasse Software & Development B.V. 
 Author URI: https: //klassebv.nl/
 Description: Wordpress child theme for all the Klasse Software & Development B.V. trademarks.
 Template: klasse-theme
 Version: 1.1.8
 License: GNU General Public License v2 or later
 License URI: http://www.gnu.org/licenses/gpl-2.0.html
 Version: 1.1.8 
 Requires at least: 5.0 
 Tested up to: 5.8.1 
 Requires PHP: 7.4 
 License: GNU General Public License v3 or later 
 License URI: http://www.gnu.org/licenses/gpl-3.0.html
 Text Domain: klasse-theme
 This theme is licensed under the GPL.
*/

/* VAT field validation status: spinner (validating) and green check (valid). */
#billing_vat_field .woocommerce-input-wrapper {
	position: relative;
}

#billing_vat_field.kls-vat-validating .woocommerce-input-wrapper input,
#billing_vat_field.kls-vat-valid .woocommerce-input-wrapper input {
	padding-right: 36px;
}

#billing_vat_field .woocommerce-input-wrapper::after {
	content: '';
	position: absolute;
	top: 50%;
	right: 12px;
	width: 16px;
	height: 16px;
	box-sizing: border-box;
	transform: translateY(-50%);
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.15s ease;
}

#billing_vat_field.kls-vat-validating .woocommerce-input-wrapper::after {
	opacity: 1;
	border: 2px solid #d4d4d4;
	border-top-color: #555;
	border-radius: 50%;
	animation: kls-vat-spin 0.8s linear infinite;
}

#billing_vat_field.kls-vat-valid .woocommerce-input-wrapper::after {
	opacity: 1;
	background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2328a745' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") no-repeat center / contain;
}

@keyframes kls-vat-spin {
	from { transform: translateY(-50%) rotate(0deg); }
	to   { transform: translateY(-50%) rotate(360deg); }
}
/* ------------------------------------------------------------------
 * P1 – design tokens, taken from the theme (buttons, sidebar, cards)
 * ------------------------------------------------------------------ */
:root {
	--kls-brand: #2d64ae;
	--kls-brand-dark: #265491;
	--kls-card-bg: #f7f7f7;
	--kls-card-radius: 16px;
	--kls-button-radius: 5px;
}

/* ------------------------------------------------------------------
 * P1 – messages at the field (VAT, checkout errors)
 * ------------------------------------------------------------------ */
.kls-field-message {
	margin: 6px 0 0;
	font-size: 0.875em;
	line-height: 1.4;
}

.kls-field-message--error {
	color: #b42318;
}

.kls-field-message--info {
	color: #475467;
}

/* ------------------------------------------------------------------
 * P1 – VAT info button and popup (task 19b)
 * ------------------------------------------------------------------ */
.kls-vat-info-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	margin: 0 0 0 4px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	vertical-align: middle;
	cursor: pointer;
}

.kls-vat-info-trigger:hover,
.kls-vat-info-trigger:focus-visible {
	background: rgba(0, 0, 0, 0.06);
	outline: none;
}

.kls-vat-info-trigger:focus-visible {
	box-shadow: 0 0 0 2px currentColor;
}

.kls-modal {
	width: min(560px, calc(100vw - 32px));
	max-height: calc(100vh - 48px);
	padding: 0;
	border: 0;
	border-radius: var(--kls-card-radius);
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
	color: #1d2939;
}

.kls-modal::backdrop {
	background: rgba(16, 24, 40, 0.5);
}

.kls-modal__inner {
	position: relative;
	padding: 24px 24px 16px;
	font-size: 15px;
	line-height: 1.5;
}

.kls-modal__inner h3 {
	margin: 0 0 8px;
	padding-right: 32px;
	font-size: 17px;
}

.kls-modal__inner h3 + p {
	margin-top: 0;
}

.kls-modal__inner p,
.kls-modal__inner ul {
	margin: 0 0 12px;
}

.kls-modal__inner ul {
	padding-left: 20px;
	list-style: disc;
}

.kls-vat-info__examples {
	font-family: monospace;
}

.kls-modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	font-size: 24px;
	line-height: 1;
	color: inherit;
	cursor: pointer;
}

.kls-modal__close:hover,
.kls-modal__close:focus-visible {
	background: rgba(0, 0, 0, 0.06);
}

html.kls-modal-open {
	overflow: hidden;
}

.kls-field-message--success {
	color: #067647;
}

/* P1 task 4 – nacalculatie explanation under the shipping amount */
.kls-shipping-note {
	display: block;
	margin-top: 4px;
	font-size: 0.85em;
	font-weight: normal;
	line-height: 1.4;
	white-space: normal;
}

/* ------------------------------------------------------------------
 * P1 task 7 – thank-you page per payment status
 * ------------------------------------------------------------------ */
.kls-thankyou {
	max-width: 1040px;
	margin: 0 auto;
	padding: 24px 0 40px;
	color: #1d2939;
}

.kls-thankyou__header {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 24px;
}

.kls-thankyou__icon {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: #e7f6ec;
	color: #067647;
	font-size: 20px;
}

.kls-thankyou--bank_open .kls-thankyou__icon,
.kls-thankyou--pending .kls-thankyou__icon {
	background: #fef3c7;
	color: #b54708;
}

.kls-thankyou--failed .kls-thankyou__icon {
	background: #fee4e2;
	color: #b42318;
}

.kls-thankyou--quote .kls-thankyou__icon {
	background: #e0eaff;
	color: var(--kls-brand);
}

.kls-thankyou__title {
	margin: 0 0 4px;
	font-size: clamp(22px, 3vw, 28px);
	line-height: 1.25;
}

.kls-thankyou__subtitle {
	margin: 0;
	color: #475467;
}

/* Stepper – step 3 active */
.kls-thankyou__steps {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 24px;
	padding: 0;
	list-style: none;
	font-size: 14px;
	color: var(--kls-brand);
}

.kls-thankyou__steps li {
	display: flex;
	flex: 1 1 0;
	align-items: center;
	gap: 8px;
	margin: 0;
}

.kls-thankyou__steps li:not(:last-child)::after {
	content: '';
	flex: 1 1 auto;
	height: 2px;
	margin-left: 8px;
	background: var(--kls-brand);
}

.kls-thankyou__step-dot {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border: 2px solid var(--kls-brand);
	border-radius: 50%;
	font-size: 13px;
	font-weight: 700;
}

.kls-thankyou__steps .is-done .kls-thankyou__step-dot {
	background: var(--kls-brand);
	color: #fff;
}

.kls-thankyou__steps .is-current {
	font-weight: 700;
}

/* Cards */
.kls-thankyou__grid {
	display: grid;
	grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
	gap: 20px;
	margin-bottom: 20px;
}

.kls-thankyou__card {
	padding: 24px;
	border: 0;
	border-radius: var(--kls-card-radius);
	background: var(--kls-card-bg);
}

.kls-thankyou__card h2 {
	margin: 0 0 16px;
	font-size: 19px;
}

.kls-thankyou__card h3 {
	margin: 20px 0 6px;
	font-size: 15px;
}

.kls-thankyou--bank_open .kls-thankyou__card--main {
	border-top: 4px solid #f5a524;
}

.kls-thankyou__highlight {
	margin: 0 0 16px;
	padding: 12px 14px;
	border-radius: 8px;
	background: #fffaeb;
	color: #7a2e0e;
}

.kls-thankyou__details {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 10px 24px;
	margin: 0 0 20px;
}

.kls-thankyou__details dt {
	color: #475467;
}

.kls-thankyou__details dd {
	margin: 0;
	font-weight: 600;
	overflow-wrap: anywhere;
}

.kls-thankyou__mono {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	letter-spacing: 0.02em;
}

.kls-thankyou__reference {
	color: var(--kls-brand);
}

.kls-thankyou__copy-status {
	margin-left: 10px;
	color: #067647;
	font-weight: 600;
}

.kls-thankyou__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 16px 0 0;
}

.kls-thankyou__gateway {
	margin-top: 12px;
	font-size: 14px;
}

/* Summary */
.kls-thankyou__summary {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	font-size: 14px;
}

.kls-thankyou__summary th,
.kls-thankyou__summary td {
	padding: 6px 0;
	border: 0;
	background: none;
	vertical-align: top;
	font-weight: normal;
	text-align: left;
}

.kls-thankyou__summary td {
	padding-left: 12px;
	text-align: right;
	white-space: nowrap;
}

.kls-thankyou__summary th {
	color: #475467;
}

.kls-thankyou__total--order_total th,
.kls-thankyou__total--order_total td {
	padding-top: 12px;
	border-top: 1px solid #e4e7ec;
	color: #1d2939;
	font-size: 17px;
	font-weight: 700;
}

.kls-thankyou__card--summary address {
	font-style: normal;
	font-size: 14px;
	line-height: 1.5;
}

/* What happens next */
.kls-thankyou__next h2 {
	margin-bottom: 10px;
	font-size: 17px;
}

.kls-thankyou__next ol {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 28px;
	margin: 0;
	padding-left: 20px;
	color: #475467;
}

.kls-thankyou__next li.is-done {
	color: #067647;
	font-weight: 600;
}

.kls-thankyou .cart-usp-bar {
	margin-top: 20px;
}

@media (max-width: 767px) {
	.kls-thankyou {
		padding-top: 12px;
	}

	.kls-thankyou__header {
		align-items: flex-start;
	}

	.kls-thankyou__grid {
		grid-template-columns: 1fr;
	}

	.kls-thankyou__card {
		padding: 18px;
	}

	.kls-thankyou__steps {
		font-size: 12px;
	}

	.kls-thankyou__steps li:not(:last-child)::after {
		display: none;
	}

	.kls-thankyou__next ol {
		flex-direction: column;
	}
}

/* P1 task 8 – track & trace card in My Account */
.kls-tracking {
	margin: 0 0 32px;
	padding: 20px 24px;
	border: 0;
	border-radius: var(--kls-card-radius);
	background: var(--kls-card-bg);
}

.kls-tracking h2 {
	margin: 0 0 12px;
	font-size: 19px;
}

.kls-tracking__table th {
	width: 40%;
	font-weight: normal;
	color: #475467;
}

.kls-tracking__table a {
	overflow-wrap: anywhere;
}

/* Thank-you: numbered "what happens next" steps with arrows, as in the design */
.kls-thankyou__next ol {
	counter-reset: kls-next;
	padding-left: 0;
	list-style: none;
}

.kls-thankyou__next li {
	counter-increment: kls-next;
}

.kls-thankyou__next li::before {
	content: counter(kls-next) ". ";
}

.kls-thankyou__next li:not(:last-child)::after {
	content: "\2192";
	margin-left: 28px;
	color: #98a2b3;
}

@media (max-width: 767px) {
	.kls-thankyou__next li:not(:last-child)::after {
		content: none;
	}
}

/* VAT popup: long texts scroll inside the dialog (mobile) */
.kls-modal {
	overflow-y: auto;
	overscroll-behavior: contain;
}

.kls-modal[open] {
	display: block;
}

/* Keep the close button reachable while scrolling a long popup */
.kls-modal .kls-modal__close {
	position: sticky;
	z-index: 1;
	top: 0;
	float: right;
	margin: -12px -12px 0 8px;
	background: #fff;
}

/* Nacalculatie: the theme hides the amount of €0 shipping (.free); show our explanation instead */
.shipping-total.free .totals:has(.kls-shipping-nacalc) {
	display: block !important;
}

.shipping-total .kls-shipping-nacalc {
	font-weight: 600;
}

/* WooCommerce inline checkout errors (task 5a) */
form.checkout .checkout-inline-error-message {
	margin: 6px 0 0;
	color: #b42318;
	font-size: 0.875em;
	line-height: 1.4;
}

form.checkout .woocommerce-invalid input.input-text,
form.checkout .woocommerce-invalid select,
#billing_vat_field.woocommerce-invalid input {
	border-color: #b42318 !important;
}

/* Track & trace card – lighter table, clear link and button */
.kls-tracking .kls-tracking__table {
	border: 1px solid #e4e7ec !important;
	border-collapse: collapse;
	background: #fff;
}

.kls-tracking .kls-tracking__table th,
.kls-tracking .kls-tracking__table td {
	padding: 10px 12px;
	border: 1px solid #e4e7ec !important;
}

.kls-tracking .kls-tracking__table a {
	color: var(--kls-brand);
	text-decoration: underline;
}

.kls-tracking .kls-tracking__button {
	display: inline-block;
	padding: 12px 20px;
	border-radius: var(--kls-button-radius);
	background: var(--kls-brand);
	color: #fff !important;
	font-weight: 600;
	text-decoration: none;
}

.kls-tracking .kls-tracking__button:hover,
.kls-tracking .kls-tracking__button:focus-visible {
	background: var(--kls-brand-dark);
}

/* The theme colours links with high specificity */
html body .kls-tracking .kls-tracking__table a {
	color: var(--kls-brand) !important;
	text-decoration: underline !important;
}

html body .kls-tracking a.kls-tracking__button {
	color: #fff !important;
}

/* My Account is a Divi layout: its text module colours all links with an ID selector + !important */
.et-db #et-boc .et-l .et_pb_text .kls-tracking .kls-tracking__table a {
	color: var(--kls-brand) !important;
	text-decoration: underline !important;
}

.et-db #et-boc .et-l .et_pb_text .kls-tracking a.kls-tracking__button {
	color: #fff !important;
	text-decoration: none !important;
}

/* Thank-you page: never wider than the screen (360 px phones, tablets) */
.kls-thankyou__grid > * {
	min-width: 0;
}

.kls-thankyou__details {
	grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
}

.kls-thankyou__summary td {
	white-space: normal;
	overflow-wrap: anywhere;
}

.kls-thankyou__summary .woocommerce-Price-amount {
	white-space: nowrap;
}

@media (max-width: 900px) {
	.kls-thankyou__grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 480px) {
	.kls-thankyou__copy {
		width: 100%;
		white-space: normal;
	}

	.kls-thankyou__copy-status {
		display: block;
		margin: 8px 0 0;
	}

	.kls-thankyou__card {
		padding: 18px 16px;
	}
}
