/* ==========================================================================
   MB-Pori - product enquiry form (WPForms "Tuotekysely-fin") on product pages
   Loaded from functions.php only when is_product().

   Panel   = BG Light (#242425, kit colour 0a70b42)
   Fields  = black, white text, light grey placeholders
   Accent  = gold (focus, radio, button)

   Selector prefix uses :is(.wpforms-container, #mb-x#mb-y) so every rule has
   two-ID specificity and beats the WPForms widget styles that Elementor
   prints per widget.
   ========================================================================== */

body.single-product :is(.wpforms-container, #mb-x#mb-y) {
	--mbf-panel: #242425;
	--mbf-field: #0f0f0f;
	--mbf-text: #f5f5f5;
	--mbf-label: #f5f5f5;
	--mbf-hint: #b4bcc8;
	--mbf-placeholder: #9aa3b0;
	--mbf-border: #5c636b;
	--mbf-gold: #d7b741;
	--mbf-red: #ff6b6b;

	/* WPForms "modern" reads these too */
	--wpforms-field-background-color: var(--mbf-field);
	--wpforms-field-text-color: var(--mbf-text);
	--wpforms-field-border-color: var(--mbf-border);
	--wpforms-label-color: var(--mbf-label);
	--wpforms-label-sublabel-color: var(--mbf-hint);
	--wpforms-label-error-color: var(--mbf-red);
	--wpforms-button-background-color: var(--mbf-gold);
	--wpforms-button-text-color: #0f0f0f;

	box-sizing: border-box;
	margin: 0;
	padding: clamp(1rem, 3vw, 1.75rem);
	background: var(--mbf-panel);
	border: 1px solid rgba(160, 173, 194, 0.22);
	border-radius: 10px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
	color: var(--mbf-text);
	font-family: "Inter", sans-serif;
}

/* Spacing between fields */
body.single-product :is(.wpforms-container, #mb-x#mb-y) .wpforms-field {
	padding: 0 0 1.1rem;
	margin: 0;
}
body.single-product :is(.wpforms-container, #mb-x#mb-y) .wpforms-field-container { margin: 0; }

/* Labels */
body.single-product :is(.wpforms-container, #mb-x#mb-y) .wpforms-field-label {
	margin: 0 0 0.4rem;
	font-family: "Inter", sans-serif;
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.35;
	color: var(--mbf-label);
}
body.single-product :is(.wpforms-container, #mb-x#mb-y) .wpforms-required-label { color: var(--mbf-gold); }
body.single-product :is(.wpforms-container, #mb-x#mb-y) :is(.wpforms-field-description, .wpforms-field-sublabel) {
	margin-top: 0.35rem;
	font-size: 0.8rem;
	line-height: 1.4;
	color: var(--mbf-hint);
}

/* Text fields, textarea, select: full width, black */
body.single-product :is(.wpforms-container, #mb-x#mb-y) :is(input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="url"], select, textarea) {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	min-height: 2.9rem;
	margin: 0;
	padding: 0.65rem 0.9rem;
	background: var(--mbf-field);
	border: 1px solid var(--mbf-border);
	border-radius: 8px;
	box-shadow: none;
	color: var(--mbf-text);
	font-family: "Inter", sans-serif;
	font-size: 1rem; /* 16px: stops iOS from zooming in on focus */
	line-height: 1.4;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
body.single-product :is(.wpforms-container, #mb-x#mb-y) textarea {
	min-height: 8rem;
	resize: vertical;
}
body.single-product :is(.wpforms-container, #mb-x#mb-y) :is(input, select, textarea):hover { border-color: #808891; }
body.single-product :is(.wpforms-container, #mb-x#mb-y) :is(input, select, textarea):focus {
	outline: none;
	border-color: var(--mbf-gold);
	box-shadow: 0 0 0 3px rgba(215, 183, 65, 0.22);
}
body.single-product :is(.wpforms-container, #mb-x#mb-y) :is(input, textarea)::placeholder {
	color: var(--mbf-placeholder);
	opacity: 1;
}

/* Radio / checkbox choices */
body.single-product :is(.wpforms-container, #mb-x#mb-y) ul:is(.wpforms-field-radio-choices, .wpforms-field-checkbox-choices),
body.single-product :is(.wpforms-container, #mb-x#mb-y) .wpforms-field :is(ul, ul li) {
	margin: 0;
	padding: 0;
	list-style: none;
}
body.single-product :is(.wpforms-container, #mb-x#mb-y) .wpforms-field:is(.wpforms-field-radio, .wpforms-field-checkbox) li {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin: 0 0 0.45rem;
}
body.single-product :is(.wpforms-container, #mb-x#mb-y) :is(input[type="radio"], input[type="checkbox"]) {
	flex: none;
	width: 1.15rem;
	height: 1.15rem;
	margin: 0;
	accent-color: var(--mbf-gold);
}
/* WPForms modern draws its own circle with ::before/::after -> keep it in theme colours */
body.single-product :is(.wpforms-container, #mb-x#mb-y) input[type="radio"]::before { background: var(--mbf-field); border-color: var(--mbf-border); }
body.single-product :is(.wpforms-container, #mb-x#mb-y) input[type="radio"]:checked::before { border-color: var(--mbf-gold); box-shadow: 0 0 0 1px var(--mbf-gold); }
body.single-product :is(.wpforms-container, #mb-x#mb-y) input[type="radio"]:checked::after { background: var(--mbf-gold); border-color: var(--mbf-gold); }
body.single-product :is(.wpforms-container, #mb-x#mb-y) .wpforms-field:is(.wpforms-field-radio, .wpforms-field-checkbox) li label {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 400;
	line-height: 1.35;
	color: var(--mbf-text);
	cursor: pointer;
}

/* Layout field: columns side by side on a wide form, wrapped under each other
   on a narrow one (the same form sits in a ~280px sidebar, where words broke
   mid-word). flex-wrap instead of a container query: the sidebar column is
   sized by its content, and container-type would collapse it to zero width. */
body.single-product :is(.wpforms-container, #mb-x#mb-y) .wpforms-field-layout-columns {
	/* WPForms' small-screen CSS sets column direction; then flex-basis would become a height */
	flex-direction: row;
	flex-wrap: wrap;
	align-items: flex-start;
	column-gap: 1.5rem;
	row-gap: 0;
	margin: 0;
}
body.single-product :is(.wpforms-container, #mb-x#mb-y) .wpforms-layout-column {
	flex: 1 1 13rem;
	width: auto !important;
	min-width: 0;
	margin: 0;
	padding: 0 !important;
}

/* Errors */
body.single-product :is(.wpforms-container, #mb-x#mb-y) :is(input, select, textarea).wpforms-error { border-color: var(--mbf-red); }
body.single-product :is(.wpforms-container, #mb-x#mb-y) :is(label.wpforms-error, em.wpforms-error) {
	margin-top: 0.35rem;
	font-size: 0.8rem;
	font-weight: 500;
	color: var(--mbf-red);
}

/* Submit */
body.single-product :is(.wpforms-container, #mb-x#mb-y) .wpforms-submit-container {
	margin: 0.5rem 0 0;
	padding: 0;
}
body.single-product :is(.wpforms-container, #mb-x#mb-y) button[type="submit"] {
	min-height: 3rem;
	padding: 0.7rem 1.6rem;
	background: var(--mbf-gold);
	border: 0;
	border-radius: 6px;
	box-shadow: 0 4px 14px rgba(215, 183, 65, 0.2);
	color: #0f0f0f;
	font-family: "Armata", sans-serif;
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
body.single-product :is(.wpforms-container, #mb-x#mb-y) button[type="submit"]:hover {
	background: #e6c654;
	box-shadow: 0 6px 18px rgba(215, 183, 65, 0.3);
	transform: translateY(-1px);
}
body.single-product :is(.wpforms-container, #mb-x#mb-y) button[type="submit"]:focus-visible {
	outline: 2px solid var(--mbf-text);
	outline-offset: 3px;
}
@media (max-width: 767px) {
	body.single-product :is(.wpforms-container, #mb-x#mb-y) button[type="submit"] { width: 100%; }
}

/* ==========================================================================
   Product template (4201111748880): "Tuotetiedot" row
   2bb090a8 = grid, 5d41bed9 = "Tuotekuvaus container", 2e3359a = "PC Hinta right side"
   Laptop and larger (>= 1025px): 65% / 35% of the width left after the gap.
   Tablet and phone (<= 1024px): right side hidden (its forms are also in the
   accordions under the description), description gets the full width.
   ========================================================================== */
@media (min-width: 1025px) {
	body.single-product :is(.elementor-element-2bb090a8, #mb-x#mb-y) { grid-template-columns: minmax(0, 65fr) minmax(0, 35fr); }
	body.single-product :is(.elementor-element-5d41bed9, #mb-x#mb-y) { grid-column: 1; width: auto; max-width: none; min-width: 0; }
	body.single-product :is(.elementor-element-2e3359a, #mb-x#mb-y) { grid-column: 2; width: auto; max-width: none; min-width: 0; }
}
@media (max-width: 1024px) {
	body.single-product :is(.elementor-element-2e3359a, #mb-x#mb-y) { display: none; }
	body.single-product :is(.elementor-element-2bb090a8, #mb-x#mb-y) { grid-template-columns: minmax(0, 1fr); }
}

/* Sent confirmation */
body.single-product .wpforms-confirmation-container-full {
	background: var(--mbf-panel, #242425);
	border: 1px solid rgba(160, 173, 194, 0.22);
	border-left: 3px solid #d7b741;
	border-radius: 10px;
	color: #f5f5f5;
}
