/*
 * MeWeb Quotation – quote request page.
 *
 * The markup reuses WooCommerce's classic cart classes (shop_table cart, quantity template,
 * cart_totals, form-row) and Flatsome's grid/buttons, and the page gets the
 * body.woocommerce-cart class, so the theme's own cart styles apply. This file is only:
 *   1. a baseline that matches the Flatsome cart look (overridden by the theme's cart CSS
 *      wherever the theme defines it), and
 *   2. the quote-only parts (form layout, company autocomplete).
 *
 * Colours: Flatsome's secondary/primary unless set in WooCommerce → Settings → ใบเสนอราคา.
 */
.mwq,
.mwq-cart-cta,
.mwq-cart-button {
	--mwq-primary: var(--fs-color-secondary, #202a8f);
	--mwq-accent: var(--fs-color-primary, #e52322);
	--mwq-border: #dfe2ea;
	--mwq-muted: #6b7280;
	--mwq-radius: 7px;
}

.mwq {
	container-type: inline-size;
	container-name: mwq;
}

.mwq *,
.mwq *::before,
.mwq *::after {
	box-sizing: border-box;
}

/* Layout ------------------------------------------------------------------ */

/* Flatsome lays out .row/.col itself; other themes get the same 7/5 split here. */
body:not(.theme-flatsome) .mwq .mwq-layout {
	display: grid;
	grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
	gap: 30px;
	align-items: start;
	margin: 0;
}

body:not(.theme-flatsome) .mwq .mwq-layout > .col {
	width: auto;
	max-width: none;
	margin: 0;
	padding: 0;
}

@container mwq (max-width: 820px) {
	body:not(.theme-flatsome) .mwq .mwq-layout {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Flatsome stacks the columns below 850px; keep a gap between the two cards. */
@media (max-width: 849px) {
	.theme-flatsome .mwq .mwq-col-items {
		padding-bottom: 30px;
	}
}

/* Cards (same values as the site's cart cards) */
.mwq .mwq-card {
	container-type: inline-size;
	container-name: mwq-card;
	padding: 22px 25px 25px;
	border: 1px solid #f0f1f5;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 6px 25px rgba(0, 25, 75, 0.08);
}

@container mwq (max-width: 520px) {
	.mwq .mwq-card {
		padding: 15px;
		border-radius: 10px;
	}
}

/* Titles: heading + Flatsome's short divider bar */
.mwq .mwq-title {
	margin: 0;
	color: var(--mwq-primary);
	font-size: 1.25em;
	font-weight: 700;
	line-height: 1.3;
}

body:not(.theme-flatsome) .mwq .is-divider {
	display: block;
	width: 100%;
	max-width: 30px;
	height: 3px;
	margin: 0.8em 0 1.2em;
	background-color: var(--mwq-accent);
}

.theme-flatsome .mwq .is-divider {
	margin-bottom: 1.2em;
	background-color: var(--mwq-accent);
}

.mwq .text-center .is-divider,
.mwq .text-center.mwq-card .is-divider {
	margin-left: auto;
	margin-right: auto;
}

/* Items table ------------------------------------------------------------- */

/* In Flatsome the table is styled by the theme's cart CSS (same classes as the cart page);
   the rules below only give other themes the same look. */
body:not(.theme-flatsome) .mwq .mwq-table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: separate;
	border-spacing: 0;
}

body:not(.theme-flatsome) .mwq .mwq-table thead {
	background: var(--mwq-primary);
}

body:not(.theme-flatsome) .mwq .mwq-table thead th {
	padding: 13px 12px;
	border: 0;
	color: #fff;
	font-size: 0.85em;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	white-space: nowrap;
}

body:not(.theme-flatsome) .mwq .mwq-table thead th:first-child {
	border-radius: 8px 0 0 8px;
}

body:not(.theme-flatsome) .mwq .mwq-table thead th:last-child {
	border-radius: 0 8px 8px 0;
}

body:not(.theme-flatsome) .mwq .mwq-table td {
	padding: 15px 8px;
	border: 0;
	border-bottom: 1px solid #eee;
	vertical-align: middle;
}

body:not(.theme-flatsome) .mwq .mwq-table .product-remove {
	width: 40px;
	text-align: center;
}

body:not(.theme-flatsome) .mwq .mwq-table .product-thumbnail {
	width: 84px;
}

body:not(.theme-flatsome) .mwq .mwq-table .product-thumbnail img {
	display: block;
	width: 64px;
	max-width: none;
	height: 64px;
	margin: 0;
	border: 1px solid #eef0f5;
	border-radius: 8px;
	object-fit: cover;
}

body:not(.theme-flatsome) .mwq .mwq-table .product-name > a {
	color: var(--mwq-primary);
	font-weight: 600;
	text-decoration: none;
}

.mwq .mwq-item__desc,
.mwq .mwq-item__meta {
	display: block;
	margin-top: 4px;
	color: var(--mwq-muted);
	font-size: 0.85em;
	font-weight: 400;
	line-height: 1.45;
}

body:not(.theme-flatsome) .mwq .mwq-table .product-price .amount {
	color: var(--mwq-accent);
	font-weight: 700;
}

body:not(.theme-flatsome) .mwq .mwq-table .product-quantity {
	width: 1%;
	white-space: nowrap;
}

body:not(.theme-flatsome) .mwq .mwq-table .product-quantity .quantity {
	margin: 0;
}

body:not(.theme-flatsome) .mwq .mwq-table td.actions {
	padding: 20px 0 0;
	border-bottom: 0;
	text-align: left;
}

.mwq .cart-collaterals .cart_totals.mwq-card {
	float: none;
	width: auto;
}

/* Flatsome-only helper (price under the name on phones). */
body:not(.theme-flatsome) .mwq .show-for-small {
	display: none;
}

/* Non-Flatsome themes: × remove button and outline button like the site's cart. */
body:not(.theme-flatsome) .mwq a.remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border: 1px solid var(--mwq-accent);
	border-radius: 50%;
	background: #fff;
	color: var(--mwq-accent);
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
}

body:not(.theme-flatsome) .mwq a.remove:hover {
	background: var(--mwq-accent);
	color: #fff;
}

body:not(.theme-flatsome) .mwq .button-continue-shopping,
body:not(.theme-flatsome) .mwq .mwq-success__button,
body:not(.theme-flatsome) .mwq .wc-backward {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 42px;
	padding: 0 20px;
	border: 1px solid var(--mwq-accent);
	border-radius: var(--mwq-radius);
	background: #fff;
	color: var(--mwq-accent);
	font-weight: 600;
	text-decoration: none;
}

body:not(.theme-flatsome) .mwq .wc-backward {
	background: var(--mwq-accent);
	color: #fff;
}

/* Flatsome: rounded like the site's cart buttons. */
.theme-flatsome .mwq .button-continue-shopping,
.theme-flatsome .mwq .mwq-success__button {
	min-height: 42px;
	margin: 0;
	border-radius: var(--mwq-radius);
}

/* Request form ------------------------------------------------------------ */
.mwq .mwq-field {
	display: grid;
	grid-template-columns: 112px minmax(0, 1fr);
	gap: 4px 14px;
	align-items: start;
	width: 100%;
	margin: 0 0 14px;
	padding: 0;
}

.mwq .mwq-field > label {
	margin: 0;
	padding-top: 11px;
	color: #222;
	font-size: 0.9em;
	font-weight: 600;
	line-height: 1.35;
}

.mwq .mwq-field .required {
	color: var(--mwq-accent);
	border: 0;
	text-decoration: none;
}

.mwq .mwq-field .input-text {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	min-height: 44px;
	margin: 0;
	padding: 0 12px;
	border: 1px solid var(--mwq-border);
	border-radius: var(--mwq-radius);
	background: #fff;
	box-shadow: none;
	color: #333;
	font: inherit;
	font-size: 0.95em;
	line-height: 1.4;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mwq .mwq-field textarea.input-text {
	min-height: 90px;
	padding: 10px 12px;
	resize: vertical;
}

.mwq .mwq-field .input-text::placeholder {
	color: #9aa1b1;
	opacity: 1;
}

.mwq .mwq-field .input-text:focus {
	border-color: var(--mwq-primary);
	outline: none;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--mwq-primary) 15%, transparent);
}

.mwq .mwq-field.woocommerce-invalid .input-text {
	border-color: var(--mwq-accent);
}

.mwq .mwq-field__help,
.mwq .mwq-field__error {
	display: block;
	margin-top: 5px;
	color: var(--mwq-muted);
	font-size: 0.8em;
	line-height: 1.45;
}

.mwq .mwq-field__error {
	color: var(--mwq-accent);
	font-weight: 600;
}

/* Thin divider between the customer details and the contact person. */
.mwq #mwq_contact_name_field {
	margin-top: 18px;
	padding-top: 18px;
	border-top: 1px solid #eceef3;
}

/* Labels above the fields when the card is narrow. */
@container mwq-card (max-width: 340px) {
	.mwq .mwq-field {
		grid-template-columns: minmax(0, 1fr);
	}

	.mwq .mwq-field > label {
		padding-top: 0;
	}

	.mwq .mwq-hint {
		margin-left: 0;
	}
}

/* Company autocomplete */
.mwq .mwq-combobox {
	position: relative;
}

.mwq .mwq-suggest {
	position: absolute;
	z-index: 60;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	max-height: 280px;
	margin: 0;
	padding: 5px;
	overflow-y: auto;
	list-style: none;
	border: 1px solid var(--mwq-border);
	border-radius: var(--mwq-radius);
	background: #fff;
	box-shadow: 0 10px 28px rgba(0, 25, 75, 0.14);
}

.mwq .mwq-suggest[hidden] {
	display: none;
}

.mwq .mwq-suggest li {
	margin: 0;
	padding: 9px 12px;
	border-radius: 5px;
	font-size: 0.9em;
	line-height: 1.4;
	cursor: pointer;
}

.mwq .mwq-suggest li[aria-selected="true"],
.mwq .mwq-suggest li:hover {
	background: #eef1fa;
	color: var(--mwq-primary);
}

.mwq .mwq-suggest mark {
	padding: 0;
	background: none;
	color: var(--mwq-primary);
	font-weight: 700;
}

.mwq .mwq-suggest .mwq-suggest__empty,
.mwq .mwq-suggest .mwq-suggest__empty:hover {
	background: none;
	color: var(--mwq-muted);
	cursor: default;
}

.mwq .mwq-hint {
	margin: 0 0 14px 126px;
	color: var(--mwq-muted);
	font-size: 0.8em;
}

/* Submit: same look as the site's "ดำเนินการสั่งซื้อ" button. */
.mwq .mwq-submit-wrap {
	margin: 0;
	padding: 4px 0 0;
}

.mwq .mwq-submit.button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 48px;
	margin: 0;
	padding: 0 20px;
	border: 0;
	border-radius: var(--mwq-radius);
	background: var(--mwq-primary);
	box-shadow: 0 5px 15px color-mix(in srgb, var(--mwq-primary) 18%, transparent);
	color: #fff;
	font-size: 1em;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0.03em;
	transition: background-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.mwq .mwq-submit.button:hover,
.mwq .mwq-submit.button:focus-visible {
	background: var(--mwq-accent);
	box-shadow: 0 6px 18px color-mix(in srgb, var(--mwq-accent) 22%, transparent);
	color: #fff;
	transform: translateY(-1px);
}

.mwq .mwq-submit.button:focus-visible {
	outline: 2px solid var(--mwq-primary);
	outline-offset: 2px;
}

.mwq .mwq-submit.button[aria-busy="true"] {
	opacity: 0.75;
	cursor: progress;
	transform: none;
}

.mwq .mwq-form-error {
	margin: 10px 0 0;
	color: var(--mwq-accent);
	font-size: 0.875em;
	font-weight: 600;
	text-align: center;
}

.mwq .mwq-form-error[hidden] {
	display: none;
}

.mwq .mwq-privacy {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	margin: 14px 0 0;
	color: var(--mwq-muted);
	font-size: 0.8em;
}

.mwq .mwq-privacy svg {
	flex: none;
	color: var(--mwq-primary);
}

/* Honeypot: off-screen, never shown to people. */
.mwq .mwq-hp {
	position: absolute !important;
	left: -10000px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Empty + success --------------------------------------------------------- */
body:not(.theme-flatsome) .mwq .mwq-empty {
	padding: 30px 0;
	text-align: center;
}

.mwq .mwq-success {
	max-width: 620px;
	margin: 0 auto;
	text-align: center;
}

.mwq .mwq-success__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	margin-bottom: 12px;
	border-radius: 50%;
	background: #e7f6ec;
	color: #1d7a3d;
}

.mwq .mwq-success__number strong {
	color: var(--mwq-primary);
	letter-spacing: 0.04em;
}

/* Cart page call-to-action ------------------------------------------------ */

/* Classic cart (Flatsome): under "ดำเนินการสั่งซื้อ". */
.wc-proceed-to-checkout .mwq-cart-button.button {
	display: block;
	width: 100%;
	min-height: 48px;
	margin: 10px 0 0;
	border-radius: var(--mwq-radius, 7px);
	line-height: 46px;
	text-align: center;
}

/* Block cart: box after the cart. */
.mwq-cart-cta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 24px 0;
	padding: 16px 20px;
	border: 1px solid #f0f1f5;
	border-left: 4px solid var(--mwq-accent);
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 6px 25px rgba(0, 25, 75, 0.08);
}

.mwq-cart-cta .mwq-cart-button.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	margin: 0;
	padding: 10px 24px;
	border: 0;
	border-radius: var(--mwq-radius);
	background: var(--mwq-primary);
	color: #fff;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
}

.mwq-cart-cta .mwq-cart-button.button:hover,
.mwq-cart-cta .mwq-cart-button.button:focus-visible {
	background: var(--mwq-accent);
	color: #fff;
}

@media (prefers-reduced-motion: reduce) {
	.mwq *,
	.mwq-cart-cta * {
		transition: none !important;
	}
}
