/* Solar Set Configurator – frontend
 * Scoped + defensive: themes often style every <button>, so tile rules are
 * given extra specificity and reset appearance explicitly.
 */

.gp-solar-app {
	--gp-accent: #61ce70;
	--gp-accent-ink: #2f8f3d;
	--gp-accent-soft: rgba(97, 206, 112, 0.12);
	--gp-border: #e3e8e8;
	--gp-bg: #ffffff;
	--gp-bg-soft: #f5f7f7;
	--gp-heading: #0a3033;
	--gp-text: #313131;
	--gp-text-soft: #5f6f70;
	--gp-radius: 10px;
	box-sizing: border-box;
	margin: 20px 0 24px;
	padding: 22px;
	background: var(--gp-bg);
	border: 1px solid var(--gp-border);
	border-radius: var(--gp-radius);
	font-family: inherit;
	color: var(--gp-text);
}

.gp-solar-app *,
.gp-solar-app *::before,
.gp-solar-app *::after {
	box-sizing: border-box;
}

.gp-solar-app [hidden] {
	display: none !important;
}

.gp-solar-roof-hint {
	margin: 0 0 16px;
	padding: 10px 12px;
	border: 1px dashed var(--gp-border);
	border-radius: var(--gp-radius);
	font-size: 13px;
	font-weight: 600;
	color: var(--gp-text-soft);
	background: var(--gp-bg-soft);
}

.gp-solar-field {
	margin-bottom: 20px;
}

.gp-solar-field:last-of-type {
	margin-bottom: 0;
}

.gp-solar-label {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
	font-weight: 700;
	font-size: 15px;
	line-height: 1.3;
	margin-bottom: 8px;
	color: var(--gp-heading);
}

.gp-solar-app .gp-req {
	color: #ef4444;
}

.gp-solar-app .gp-info {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 17px;
	height: 17px;
	border-radius: 50%;
	background: var(--gp-accent);
	color: #fff;
	font-size: 11px;
	font-weight: 800;
	font-style: normal;
	cursor: help;
}

.gp-solar-app .gp-solar-roof-select {
	width: 100%;
	max-width: 100%;
	padding: 12px 14px;
	border: 1.5px solid var(--gp-border);
	border-radius: var(--gp-radius);
	font-size: 15px;
	line-height: 1.3;
	background: var(--gp-bg-soft);
	color: var(--gp-text);
	font-weight: 500;
	cursor: pointer;
	height: auto;
}

.gp-solar-app .gp-solar-roof-select:focus {
	outline: none;
	border-color: var(--gp-accent);
	background: var(--gp-bg);
	box-shadow: 0 0 0 3px var(--gp-accent-soft);
}

.gp-solar-roof-desc {
	margin: 8px 0 0;
	font-size: 13px;
	color: var(--gp-text-soft);
}

.gp-solar-roof-desc:empty {
	display: none;
}

.gp-solar-price-pill {
	font-weight: 700;
	color: var(--gp-heading);
	font-size: 14px;
}

.gp-solar-tiles {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
	gap: 10px;
	margin-top: 10px;
}

/* Tiles are <div role="radio">, not <button>, so theme .cart button rules
 * cannot reach them. Extra specificity + resets kept as belt-and-braces. */
.gp-solar-app .gp-solar-tiles .gp-solar-tile {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	width: 100%;
	margin: 0;
	padding: 10px 6px 8px;
	border: 2px solid var(--gp-border);
	border-radius: 10px;
	background: var(--gp-bg);
	background-image: none;
	box-shadow: none;
	cursor: pointer;
	font-family: inherit;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.25;
	letter-spacing: normal;
	text-transform: none;
	text-align: center;
	color: var(--gp-text);
	min-height: 118px;
	height: auto;
	transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.gp-solar-app .gp-solar-tiles .gp-solar-tile:hover {
	border-color: var(--gp-accent);
	background: var(--gp-bg);
	transform: translateY(-2px);
	color: var(--gp-text);
}

.gp-solar-app .gp-solar-tiles .gp-solar-tile:focus-visible {
	outline: 2px solid var(--gp-accent);
	outline-offset: 2px;
}

.gp-solar-app .gp-solar-tiles .gp-solar-tile.is-selected {
	border-color: var(--gp-accent);
	background: var(--gp-accent-soft);
	box-shadow: 0 0 0 1px var(--gp-accent), 0 4px 14px rgba(97, 206, 112, 0.25);
}

.gp-solar-tile-visual {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 58px;
	pointer-events: none;
}

.gp-solar-tile-visual svg,
.gp-solar-tile-visual img {
	max-width: 100%;
	max-height: 56px;
	width: auto;
	height: auto;
	object-fit: contain;
}

.gp-solar-tile-name {
	display: block;
	width: 100%;
	font-size: 11.5px;
	font-weight: 600;
	line-height: 1.25;
	white-space: normal;
	word-break: normal;
	overflow-wrap: anywhere;
	color: inherit;
}

.gp-solar-tile-price {
	display: block;
	font-size: 11px;
	font-weight: 700;
	color: var(--gp-heading);
}

.gp-solar-dimensions {
	margin: 10px 0 0;
	font-size: 13px;
	font-weight: 500;
	color: var(--gp-text-soft);
}

.gp-solar-dimensions:empty {
	display: none;
}

.gp-solar-empty {
	grid-column: 1 / -1;
	font-size: 13px;
	color: var(--gp-text-soft);
}

.gp-solar-addons {
	background: var(--gp-bg-soft);
	border: 1px solid var(--gp-border);
	border-radius: var(--gp-radius);
	padding: 14px 16px;
}

.gp-solar-addons-head {
	font-size: 13.5px;
	font-weight: 700;
	margin-bottom: 8px;
	color: var(--gp-heading);
}

.gp-solar-app label.gp-solar-addon {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--gp-bg);
	border: 1px solid var(--gp-border);
	border-radius: 8px;
	padding: 9px 12px;
	margin-bottom: 6px;
	cursor: pointer;
	font-size: 13px;
	font-weight: 400;
	color: var(--gp-text);
}

.gp-solar-app label.gp-solar-addon:has(input:checked) {
	border-color: var(--gp-accent);
	background: var(--gp-accent-soft);
}

.gp-solar-app label.gp-solar-addon:last-child {
	margin-bottom: 0;
}

.gp-solar-addon input {
	margin: 0;
	accent-color: var(--gp-accent);
	flex: none;
}

.gp-solar-addon-name {
	flex: 1;
	font-weight: 500;
}

.gp-solar-addon-price {
	font-weight: 700;
	color: var(--gp-heading);
	white-space: nowrap;
}

.gp-solar-error {
	margin: 12px 0 0;
	padding: 10px 12px;
	border-radius: 6px;
	background: #fef2f2;
	color: #b91c1c;
	font-size: 13px;
	font-weight: 600;
}

/* Opt-in dark styling (set body.gp-solar-dark or add .is-dark to the app). */
body.gp-solar-dark .gp-solar-app,
.gp-solar-app.is-dark {
	--gp-accent-soft: rgba(45, 212, 191, 0.14);
	--gp-border: #334155;
	--gp-bg: #0f172a;
	--gp-bg-soft: #1e293b;
	--gp-text: #e2e8f0;
	--gp-text-soft: #94a3b8;
}

body.gp-solar-dark .gp-solar-app .gp-solar-error,
.gp-solar-app.is-dark .gp-solar-error {
	background: rgba(185, 28, 28, 0.15);
	color: #fca5a5;
}

/* --------------------------------------------------------------------------
 * Native WooCommerce variation selector ("Uw soort dak") — restyled to match
 * the configurator. This stylesheet only loads on pages where the configurator
 * renders, so these rules are effectively scoped to solar-set products.
 * ------------------------------------------------------------------------ */

.woocommerce div.product form.cart .variations {
	--gp-accent: #61ce70;
	--gp-border: #e3e8e8;
	--gp-heading: #0a3033;
	--gp-radius: 10px;
	width: 100%;
	margin: 0;
	border: 0;
	background: transparent;
	border-collapse: separate;
	table-layout: fixed;
	text-align: left;
}

/* ------------------------------------------------------------------------
 * One unified panel: variation selector + price + opstelling + extra's +
 * qty + "Bestellen" all live inside form.cart, so we card the form itself
 * and strip the inner borders.
 * ---------------------------------------------------------------------- */
.woocommerce div.product form.cart:has(.gp-solar-app) {
	border: 1px solid #e3e8e8;
	border-radius: 12px;
	padding: 20px;
	background: #fff;
	margin-top: 18px;
}

.woocommerce div.product form.cart:has(.gp-solar-app) .variations tr {
	padding: 0 0 14px;
}

.woocommerce div.product form.cart:has(.gp-solar-app) .variations tr + tr {
	padding-top: 14px;
}

.woocommerce div.product form.cart:has(.gp-solar-app) .single_variation_wrap {
	margin: 0;
}

.woocommerce div.product form.cart:has(.gp-solar-app) .gp-solar-app {
	border: 0;
	border-top: 1px solid #e3e8e8;
	border-radius: 0;
	margin: 14px 0 20px;
	padding: 16px 0 0;
}

/* Breathing room above the quantity + add-to-cart row. */
.woocommerce div.product form.cart:has(.gp-solar-app) .quantity,
.woocommerce div.product form.cart:has(.gp-solar-app) .e-atc-qty-button-holder,
.woocommerce div.product form.cart:has(.gp-solar-app) .single_add_to_cart_button {
	margin-top: 6px;
}

.woocommerce div.product form.cart:has(.gp-solar-app) .woocommerce-variation-price {
	margin: 10px 0 0;
}

/* Fallback for browsers without :has() — keep them as tidy separate cards. */
@supports not (selector(:has(*))) {
	.woocommerce div.product form.cart .variations {
		margin: 0 0 8px;
		border: 1px solid var(--gp-border);
		border-radius: var(--gp-radius);
		background: #fff;
	}
	.woocommerce div.product form.cart .variations tr {
		padding: 14px 18px;
	}
	.woocommerce div.product form.cart .single_variation_wrap .gp-solar-app {
		margin-top: 6px;
	}
}

.woocommerce div.product form.cart .variations tbody,
.woocommerce div.product form.cart .variations tr {
	display: block;
}

.woocommerce div.product form.cart .variations td,
.woocommerce div.product form.cart .variations th {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
}

.woocommerce div.product form.cart .variations tr {
	padding: 14px 18px;
}

.woocommerce div.product form.cart .variations tr + tr {
	border-top: 1px solid var(--gp-border);
}

.woocommerce div.product form.cart .variations .label,
.woocommerce div.product form.cart .variations .label label {
	display: block;
	margin: 0 0 8px;
	padding: 0;
	font-weight: 700;
	font-size: 15px;
	line-height: 1.3;
	text-align: left;
	color: var(--gp-heading);
	text-transform: none;
}

.woocommerce div.product form.cart .variations td.value {
	position: relative;
	font-size: 0; /* collapse whitespace text nodes between the select and reset link */
	line-height: 0;
}

.woocommerce div.product form.cart .variations td.value > * {
	font-size: 15px;
	line-height: 1.3;
}

/* WooCommerce toggles the reset link with an inline visibility style. */
.woocommerce div.product form.cart .variations .reset_variations[style*="hidden"] {
	display: none !important;
}

.woocommerce div.product form.cart .variations select {
	width: 100%;
	max-width: 100%;
	min-height: 46px;
	margin: 0;
	padding: 12px 40px 12px 14px;
	border: 1.5px solid var(--gp-border);
	border-radius: var(--gp-radius);
	background-color: #f5f7f7;
	font-size: 15px;
	line-height: 1.3;
	font-weight: 500;
	color: #313131;
	cursor: pointer;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%230a3033' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
}

.woocommerce div.product form.cart .variations select:focus {
	outline: none;
	border-color: var(--gp-accent);
	background-color: #fff;
	box-shadow: 0 0 0 3px rgba(97, 206, 112, 0.18);
}

.woocommerce div.product form.cart .variations .reset_variations {
	display: inline-block;
	margin-top: 8px;
	font-size: 12.5px;
	font-weight: 600;
	color: #5f6f70;
	text-decoration: underline;
}

.woocommerce div.product form.cart .variations .reset_variations:hover {
	color: #0a3033;
}

/* The price/stock block that appears once a variation is picked. */
.woocommerce div.product form.cart .single_variation_wrap .woocommerce-variation.single_variation:empty {
	display: none;
}

.woocommerce div.product form.cart .single_variation_wrap .woocommerce-variation-price {
	margin: 4px 0 10px;
	font-weight: 700;
	color: #0a3033;
}

.woocommerce div.product form.cart .single_variation_wrap .woocommerce-variation-availability p {
	margin: 0 0 10px;
	font-size: 13px;
	color: #5f6f70;
}
