/**
 * SAM 1.11 buyer UX layer (Ux::on()). Loaded everywhere except the Dokan
 * seller dashboard (that is styled by dokan-theme.css / Seller_Ux).
 *
 * :root:root beats Woodmart's inline :root theme-settings block without
 * !important, so the kill switch (no stylesheet) restores the theme exactly.
 */

/* ---------- A2 colours + readable text ---------- */
:root:root {
	--sam-brand: #355FB7;
	--sam-brand-dark: #2b4f9a;
	--sam-ink: #1f2a44;
	--sam-muted: #6b6b6b;
	--sam-line: #d9dee8;
	--sam-soft: #eef3fb;
	--sam-error: #c62828;
	--sam-error-ink: #8a1c1c;
	--sam-ok: #1e7b3c;
	--wd-text-color: #4a4a4a;
	--btn-accented-bgcolor: #355FB7;
	--btn-accented-bgcolor-hover: #2b4f9a;
}

body:not(.dokan-dashboard) {
	color: #4a4a4a;
}

@media (max-width: 768px) {
	:root:root {
		--wd-text-font-size: 16px;
	}
	body:not(.dokan-dashboard) :is(input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]), select, textarea) {
		font-size: 16px;
	}
	/* The Elementor checkout widget sets 14px with 1 id + 4 classes. */
	body .elementor-widget-woocommerce-checkout-page .woocommerce #customer_details .form-row :is(.input-text, select, textarea),
	body .elementor-widget-woocommerce-checkout-page .woocommerce :is(#sam-locker-search, #coupon_code) {
		font-size: 16px;
	}
}

/* Content links: brand blue + underline (content areas only, not menus). */
body:not(.dokan-dashboard) :is(.entry-content, .wd-entry-content, .woocommerce-Tabs-panel, .woocommerce-product-details__short-description, .elementor-widget-text-editor, .woocommerce-privacy-policy-text, .woocommerce-terms-and-conditions-wrapper, .sam-pricebox, .sam-delivery-tab, .sam-empty, .sam-next) :is(p, li, td, dd, small, span) > a:not(.button):not(.btn):not([class*="wd-"]):not(.sam-btn):not(.sam-recent-empty-btn):not(.elementor-button):not(.category-nav-link):not(:is(nav, .wd-nav, .menu, .elementor-widget-wd_product_categories, .elementor-button-wrapper) a) {
	color: #2f56a8;
	text-decoration: underline;
	text-underline-offset: 2px;
}

body:not(.dokan-dashboard) :is(.entry-content, .wd-entry-content, .woocommerce-Tabs-panel, .elementor-widget-text-editor, .sam-pricebox) :is(p, li, td, dd, small, span) > a:not(.button):not(.btn):not([class*="wd-"]):hover {
	color: #22407e;
}

/* Meta greys that measured < 4.5:1. */
.wd-product-cats,
.wd-product-cats a,
.wd-post-author,
.wd-post-author a,
.cart-info .quantity {
	color: #6b6b6b;
}

.nav-link-count {
	color: rgba( 255, 255, 255, 0.9 );
}

.page-title .wd-breadcrumbs a,
.page-title .wd-breadcrumbs .wd-delimiter {
	color: rgba( 255, 255, 255, 0.92 );
}

.wd-nav-mob-tab .nav-link-text {
	color: #333;
	font-size: 14px;
}

/* Buttons: readable size + finger-sized (not header icons, not product cards). */
.main-page-wrapper :is(.button, .btn, button[type=submit]):not(.wd-product *):not(.wd-action-btn *):not(.minus):not(.plus):not(.wd-btn-arrow):not(.searchsubmit):not(.wd-search-submit) {
	min-height: 48px;
	font-size: 15px;
	letter-spacing: 0.2px;
}

.wd-empty-mini-cart .btn {
	min-height: 44px;
	font-size: 15px;
}

/* Bottom toolbar + header. */
.wd-toolbar .wd-toolbar-label {
	font-size: 13px;
}

.wd-cart-number {
	font-size: 11px;
	min-width: 18px;
	height: 18px;
	line-height: 18px;
}

.wd-header-mobile-nav .wd-tools-text {
	font-size: 14px;
}

/* Footer tap targets. */
.footer-container :is(.wd-col-start, .widget, .wd-footer-copyrights, .copyrights-wrapper) a:not(.wd-social-icon) {
	display: inline-block;
	padding-block: 10px;
}

.wd-social-icons .wd-social-icon {
	min-width: 44px;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* Focus ring that shows on blue and on white. */
body:not(.dokan-dashboard) :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid #f39200;
	outline-offset: 2px;
}

body:not(.dokan-dashboard) input.s:focus-visible {
	outline: 3px solid var(--sam-brand);
}

/* Bigger ticks + radios. */
body:not(.dokan-dashboard) :is(.woocommerce, .woocommerce-page, .wd-entry-content) :is(input[type=checkbox], input[type=radio]) {
	width: 20px;
	height: 20px;
	vertical-align: middle;
	accent-color: var(--sam-brand);
}

#terms,
#ship-to-different-address-checkbox,
#createaccount {
	width: 22px;
	height: 22px;
}

.woocommerce-privacy-policy-text p {
	font-size: 14px;
}

/* reCAPTCHA badge clear of the bottom toolbar / sticky add-to-cart. */
@media (max-width: 1024px) {
	.grecaptcha-badge {
		bottom: calc( 67px + var( --wd-sticky-btn-height, 0px ) ) !important;
	}
}

/* ---------- Notices: neutral info, readable errors ---------- */
body:not(.dokan-dashboard) :is(.woocommerce-info, .dokan-info, .woocommerce-message) {
	background-color: var(--sam-soft);
	color: var(--sam-ink);
	border-radius: 8px;
}

body:not(.dokan-dashboard) :is(.woocommerce-info, .dokan-info, .woocommerce-message) a:not(.button) {
	color: var(--sam-ink);
	text-decoration: underline;
}

body:not(.dokan-dashboard) :is(.woocommerce-info, .woocommerce-message)::before {
	color: var(--sam-brand);
}

body .woocommerce-message a.button.wc-forward {
	color: #fff;
	background-color: var(--sam-brand);
}

body:not(.dokan-dashboard) .woocommerce-error {
	background-color: #fdecec;
	color: var(--sam-error-ink);
	border-left: 4px solid var(--sam-error);
	border-radius: 8px;
}

body:not(.dokan-dashboard) .woocommerce-error,
body:not(.dokan-dashboard) .woocommerce-error :is(li, a, strong) {
	color: var(--sam-error-ink) !important;
}

body:not(.dokan-dashboard) .woocommerce-error::before {
	color: var(--sam-error);
}

body:not(.dokan-dashboard) .woocommerce-invalid :is(.input-text, select, .select2-selection) {
	border: 2px solid var(--sam-error) !important;
	background-color: #fff6f6;
}

body:not(.dokan-dashboard) .woocommerce-invalid .checkout-inline-error-message {
	color: var(--sam-error);
}

/* ---------- Shared SAM buttons ---------- */
.sam-btnrow {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
}

.sam-btnrow .sam-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 10px 20px;
	border-radius: 35px;
	background: var(--sam-brand);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	text-transform: none;
	text-decoration: none;
}

.sam-btnrow .sam-btn:hover {
	background: var(--sam-brand-dark);
	color: #fff;
}

.sam-btnrow .sam-btn--ghost {
	background: #fff;
	color: var(--sam-brand);
	box-shadow: inset 0 0 0 2px var(--sam-brand);
}

.sam-btnrow .sam-btn--ghost:hover {
	background: var(--sam-soft);
	color: var(--sam-brand-dark);
}

@media (max-width: 480px) {
	.sam-btnrow .sam-btn {
		flex: 1 1 100%;
	}
}

/* ---------- A3 product price + protection box ---------- */
.sam-pricebox {
	margin: 18px 0;
	padding: 14px 16px;
	border: 1px solid var(--sam-line);
	border-radius: 10px;
	background: #fafbfd;
	color: #3a3a3a;
	font-size: 15px;
	line-height: 1.5;
}

.sam-pricebox p {
	margin: 0 0 8px;
}

.sam-pricebox p:last-child {
	margin-bottom: 0;
}

.sam-pricebox strong {
	color: var(--sam-ink);
}

.sam-pricebox .woocommerce-Price-amount {
	font-weight: 600;
	color: var(--sam-ink);
}

.sam-pricebox__safe {
	display: flex;
	gap: 8px;
	align-items: flex-start;
}

.sam-pricebox__icon {
	flex: 0 0 auto;
	line-height: 1.4;
}

.sam-pricebox__links {
	font-size: 14px;
}

.sam-pricebox__links a {
	display: inline-block;
	padding-block: 6px;
	color: #2f56a8;
	text-decoration: underline;
}

.sam-pricebox__soldout {
	margin-bottom: 12px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--sam-line);
}

/* A4: no empty 0-star rating on the summary seller card. */
body .dokan-vendor-info-wrap .dokan-vendor-rating:not(:has(.dashicons-star-filled, .dashicons-star-half)) {
	display: none !important;
}

.sam-delivery-tab ul {
	margin-bottom: 1em;
}

.sam-delivery-tab li {
	margin-bottom: 6px;
}

/* ---------- A5 add to basket ---------- */
.single-product .summary form.cart .single_add_to_cart_button {
	flex: 1 1 auto;
	min-height: 52px;
	font-size: 16px;
	text-transform: none;
	letter-spacing: 0;
}

.single-product .summary form.cart .quantity :is(.minus, .plus) {
	min-width: 44px;
	min-height: 48px;
}

.single-product .summary form.cart .quantity .qty {
	min-height: 48px;
}

.wd-sticky-btn .single_add_to_cart_button {
	font-size: 16px;
	text-transform: none;
	letter-spacing: 0;
}

@media (max-width: 768px) {
	.single-product .summary form.cart {
		display: flex;
		flex-wrap: wrap;
		gap: 10px;
		align-items: stretch;
	}
	.single-product .summary form.cart .single_add_to_cart_button {
		flex: 1 1 60%;
	}
}

/* ---------- A6 empty states ---------- */
.sam-empty {
	max-width: 720px;
	margin: 10px auto 30px;
	padding: 24px 20px;
	border: 1px solid var(--sam-line);
	border-radius: 12px;
	background: #fafbfd;
	text-align: left;
}

.sam-empty__title {
	margin: 0 0 8px;
	font-size: 22px;
	color: var(--sam-ink);
}

.sam-empty__text {
	margin: 0 0 16px;
	font-size: 16px;
}

.sam-empty__search {
	margin-top: 18px;
}

/* ---------- A9 / A10 checkout ---------- */
.elementor-widget-woocommerce-checkout-page {
	--links-normal-color: #355FB7;
	--links-hover-color: #2b4f9a;
	--forms-buttons-border-color: #355FB7;
}

body .elementor-widget-woocommerce-checkout-page .woocommerce-checkout #payment #place_order {
	background-color: #355FB7;
	min-height: 52px;
	font-size: 16px;
	text-transform: none;
	letter-spacing: 0;
}

body .elementor-widget-woocommerce-checkout-page .woocommerce-checkout #payment #place_order:hover {
	background-color: #2b4f9a;
}

/* Elementor pads selects 16px inside a 42px box, which clips the text. */
.elementor-widget-woocommerce-checkout-page .woocommerce select {
	padding-top: 0;
	padding-bottom: 0;
	min-height: 48px;
}

.elementor-widget-woocommerce-checkout-page .woocommerce #customer_details .form-row .input-text {
	min-height: 48px;
}

.sam-next {
	margin: 0 0 16px;
	padding: 14px 16px;
	border-radius: 10px;
	background: var(--sam-soft);
	color: var(--sam-ink);
	font-size: 15px;
	line-height: 1.5;
}

.sam-next__title {
	margin: 0 0 6px;
	font-weight: 700;
}

.sam-next__list {
	margin: 0;
	padding-left: 1.3em;
}

.sam-next__list li {
	margin: 0 0 6px;
}

.sam-next__list li:last-child {
	margin-bottom: 0;
}

.sam-fee-gloss {
	display: block;
	margin-top: 2px;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.4;
	color: #555;
}

.sam-fee-gloss a {
	color: #2f56a8 !important;
	text-decoration: underline;
}

#shipping_method li,
.woocommerce-shipping-methods li {
	margin-bottom: 8px;
}

#shipping_method li label,
.woocommerce-shipping-methods li label {
	display: inline;
	padding: 8px 0;
	line-height: 1.5;
}

.sam-ship-explain {
	display: block;
	margin: 2px 0 0 28px;
	font-size: 13px;
	line-height: 1.4;
	color: #555;
	text-align: left;
}

/* ---------- A11 locker picker ---------- */
tr.sam-locker-row--ux > td {
	padding-top: 4px;
	padding-bottom: 16px;
	text-align: left;
}

.sam-locker {
	text-align: left;
}

.sam-locker__label {
	display: block;
	margin: 0 0 8px;
	font-weight: 700;
	font-size: 15px;
	color: var(--sam-ink);
}

.sam-locker [hidden] {
	display: none !important;
}

body .sam-locker #sam-locker-search {
	width: 100%;
	min-height: 48px;
	font-size: 16px;
	padding: 0 14px;
	border-radius: 8px;
}

body .sam-locker #sam-locker-geo {
	width: 100%;
	min-height: 44px;
	margin-top: 8px;
	font-size: 15px;
	text-transform: none;
}

.sam-locker__results {
	margin-top: 8px;
	font-size: 15px;
}

.sam-locker .sam-locker-card {
	display: block;
	width: 100%;
	margin: 0 0 8px;
	padding: 12px 14px;
	border: 1px solid var(--sam-line);
	border-radius: 8px;
	background: #fff;
	color: var(--sam-ink);
	font-size: 15px;
	font-weight: 400;
	line-height: 1.4;
	text-align: left;
	text-transform: none;
	letter-spacing: 0;
	white-space: normal;
	min-height: 48px;
	cursor: pointer;
	box-shadow: none;
}

.sam-locker .sam-locker-card:hover,
.sam-locker .sam-locker-card:focus-visible {
	border-color: var(--sam-brand);
	background: var(--sam-soft);
}

.sam-locker-card__name {
	display: block;
	font-weight: 700;
}

.sam-locker-card__addr,
.sam-locker-card__dist {
	display: block;
	font-size: 14px;
	color: #555;
}

.sam-locker__picked {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 14px;
	border: 2px solid var(--sam-ok);
	border-radius: 8px;
	background: #eef8f0;
	color: var(--sam-ink);
}

.sam-locker__tick {
	flex: 0 0 auto;
	color: var(--sam-ok);
	font-weight: 700;
	font-size: 18px;
	line-height: 1.3;
}

.sam-locker__picked-text {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 15px;
	line-height: 1.4;
}

.sam-locker__picked-title,
.sam-locker__picked-name,
.sam-locker__picked-addr {
	display: block;
}

.sam-locker__picked-addr {
	font-size: 14px;
	color: #555;
}

body .sam-locker .sam-locker__change {
	flex: 0 0 auto;
	min-height: 44px;
	padding: 0 14px;
	border: 0;
	background: transparent;
	color: #2f56a8;
	font-size: 15px;
	text-decoration: underline;
	text-transform: none;
	box-shadow: none;
}

.sam-locker__msg {
	margin: 8px 0 0;
	font-size: 14px;
}

.sam-locker__msg:empty {
	display: none;
}

.sam-locker__msg.is-error {
	color: var(--sam-error);
	font-weight: 600;
}

/* Mobile: delivery choice gets the full row width, left-aligned. */
@media (max-width: 768px) {
	/* Woodmart makes this row a flex box on mobile: wrap it instead. */
	body .woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals,
	body .cart_totals tr.woocommerce-shipping-totals {
		flex-wrap: wrap;
	}
	body .woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals > :is(th, td),
	body .cart_totals tr.woocommerce-shipping-totals > :is(th, td) {
		display: block;
		flex: 1 1 100%;
		width: 100%;
		max-width: 100%;
		text-align: left;
	}
	.woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals > th,
	.cart_totals tr.woocommerce-shipping-totals > th {
		padding-bottom: 4px;
		border-bottom: 0;
	}
	tr.woocommerce-shipping-totals #shipping_method li {
		display: grid;
		grid-template-columns: 24px 1fr;
		column-gap: 8px;
		align-items: start;
		text-align: left;
	}
	tr.woocommerce-shipping-totals #shipping_method li input.shipping_method {
		margin: 4px 0 0;
	}
	tr.woocommerce-shipping-totals #shipping_method li .sam-ship-explain {
		grid-column: 2;
		margin-left: 0;
	}
}

.sam-escrow-note__pay {
	text-align: left;
}

/* Order notes are switched off; Elementor still draws their empty box. */
.elementor-widget-woocommerce-checkout-page .woocommerce-additional-fields:not(:has(textarea, input, select)) {
	display: none;
}

/* Store pages: Dokan's store sidebar only holds a blog "Recent posts" widget. */
.dokan-store-wrap .dokan-store-sidebar { display: none !important; }
.dokan-store-wrap.layout-left #dokan-primary,
.dokan-store-wrap.layout-right #dokan-primary { width: 100% !important; float: none !important; margin: 0 !important; }
@media (max-width: 768px) {
	.dokan-store .store-name, .profile-info .store-name { font-size: 24px !important; text-align: center; }
}

/* Post-deploy QA fixes (2026-10-16). */
/* D1: Elementor still borders the (now empty) order-notes box. */
.elementor-widget-woocommerce-checkout-page .woocommerce-additional-fields:not(:has(*)),
.elementor-widget-woocommerce-checkout-page .woocommerce-additional-fields:not(:has(:is(input, textarea, select))) {
	display: none !important;
}
/* D2: "View basket" is pointless on the basket itself; elsewhere make it a real button. */
.woocommerce-cart .woocommerce-message a.wc-forward { display: none; }
body:not(.dokan-dashboard) .woocommerce-message a.button.wc-forward {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 16px;
	border-radius: 6px;
	background: #fff;
	color: #355FB7;
	font-size: 15px;
	text-decoration: none;
	text-transform: none;
}
/* D3: the classic cart prints the shipping label twice on phones (th + td::before). */
@media (max-width: 768px) {
	.cart_totals tr.woocommerce-shipping-totals > td::before { display: none !important; }
}
/* D7: desktop sticky add-to-cart bar — keep the reCAPTCHA badge above it. */
@media (min-width: 1025px) {
	.single-product .grecaptcha-badge { bottom: calc( 14px + var( --wd-sticky-btn-height, 0px ) ) !important; }
}
