/*
 * Baseline styling for classic WooCommerce, Addify and Dokan markup (cart, checkout, account,
 * quote, vendor dashboard, legacy product templates). It only maps that markup onto the theme
 * tokens; the designed versions of these screens come in later phases.
 */

/* Form controls */
:where(.woocommerce, .woocommerce-page, .dokan-dashboard, .dokan-store, .addify-quote-form, .elecadi-classic-main)
	:where(input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], input[type="search"], select, textarea, .select2-selection) {
	border: 1px solid var(--wp--preset--color--hairline-strong);
	border-radius: var(--wp--preset--border-radius--sm);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--base);
	box-sizing: border-box;
	min-height: 44px;
	padding: 8px 12px;
}
:where(.woocommerce, .woocommerce-page, .dokan-dashboard, .elecadi-classic-main) :where(input, select, textarea):focus {
	border-color: var(--wp--preset--color--ink);
	outline: none;
	box-shadow: 0 0 0 3px rgb(24 21 18 / 0.1);
}

.woocommerce .quantity .qty {
	width: 4.5em;
	padding-inline: 4px;
	text-align: center;
}

/* Buttons: gold primary, ink on hover */
.woocommerce :where(a.button, button.button, input.button, #respond input#submit),
.woocommerce-page :where(a.button, button.button, input.button),
.dokan-btn-theme,
.elecadi-classic-main .dokan-btn-theme {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	background: var(--wp--preset--color--gold);
	border: 0;
	border-radius: var(--wp--preset--border-radius--sm);
	color: var(--wp--preset--color--ink);
	font-family: inherit;
	font-weight: 700;
	line-height: 1.4;
	min-height: 44px;
	padding: 8px 18px;
	text-decoration: none;
	transition: background-color var(--wp--custom--duration--fast) var(--wp--custom--ease), color var(--wp--custom--duration--fast) var(--wp--custom--ease);
}
.woocommerce :where(a.button, button.button, input.button):hover,
.woocommerce-page :where(a.button, button.button, input.button):hover,
.dokan-btn-theme:hover {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--on-dark);
}
.woocommerce :where(a.button, button.button).alt {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--on-dark);
}
.woocommerce :where(a.button, button.button).alt:hover {
	background: var(--wp--preset--color--gold);
	color: var(--wp--preset--color--ink);
}

/* Notices */
.woocommerce :where(.woocommerce-message, .woocommerce-info, .woocommerce-error),
.woocommerce-page :where(.woocommerce-message, .woocommerce-info, .woocommerce-error) {
	border: 1px solid var(--wp--preset--color--hairline);
	border-inline-start: 3px solid var(--wp--preset--color--gold);
	border-radius: var(--wp--preset--border-radius--sm);
	background: var(--wp--preset--color--paper);
	color: var(--wp--preset--color--ink);
}
.woocommerce .woocommerce-error,
.woocommerce-page .woocommerce-error {
	border-inline-start-color: var(--wp--preset--color--danger);
}

/* Tables (cart, order details, quotes, vendor lists) */
.woocommerce table.shop_table,
.dokan-table {
	border: 1px solid var(--wp--preset--color--hairline);
	border-radius: var(--wp--preset--border-radius--md);
	border-collapse: separate;
}
.woocommerce table.shop_table :where(th, td),
.dokan-table :where(th, td) {
	border-color: var(--wp--preset--color--hairline);
}

/* Prices */
.woocommerce :where(.price, .amount) {
	color: var(--wp--preset--color--ink);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}
.woocommerce .price del {
	color: var(--wp--preset--color--ink-muted);
	font-weight: 400;
}
/* Sale badge (product page, classic grids): the same gold badge as the product cards (cards.css). */
.woocommerce span.onsale {
	min-width: 0;
	min-height: auto;
	padding: 4px 10px;
	border-radius: var(--wp--preset--border-radius--sm);
	background: var(--wp--preset--color--gold);
	color: var(--wp--preset--color--ink);
	font-size: 12px;
	font-weight: 800;
	line-height: 1.5;
	box-shadow: 0 1px 2px rgb(24 21 18 / 0.18);
}

/* Classic product grid (legacy archive template) */
.woocommerce ul.products li.product {
	text-align: start;
}
.woocommerce ul.products li.product a img {
	aspect-ratio: 1;
	object-fit: contain;
	background: var(--wp--preset--color--paper-deep);
	border-radius: var(--wp--preset--border-radius--sm);
}
.woocommerce ul.products li.product .woocommerce-loop-product__title {
	font-size: var(--wp--preset--font-size--base);
	font-weight: 600;
	line-height: 1.6;
}
.woocommerce ul.products li.product .button {
	margin-top: 8px;
	margin-inline-end: 6px;
}

/* Account navigation */
.woocommerce-MyAccount-navigation ul {
	list-style: none;
	padding: 0;
	border: 1px solid var(--wp--preset--color--hairline);
	border-radius: var(--wp--preset--border-radius--md);
}
.woocommerce-MyAccount-navigation li a {
	display: block;
	padding: 10px 16px;
	text-decoration: none;
}
.woocommerce-MyAccount-navigation li.is-active a {
	background: var(--wp--preset--color--paper-deep);
	font-weight: 700;
}

/* Plugin pages rendered through header.php / footer.php */
.elecadi-classic-main {
	padding-top: var(--wp--preset--spacing--50);
	padding-bottom: var(--wp--preset--spacing--50);
}

/*
 * Dokan's anti-spam field sits at left:-999em. In a right-to-left page overflow to the left is
 * scrollable, so that added ~15,000px of sideways scroll. Hide it without moving it off-canvas.
 */
.elecadi-honeypot,
div:has(> input#trap) {
	position: absolute !important;
	left: auto !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* WooCommerce's "please wait" overlays (checkout, cart, account) set z-index:1000 inline. Where the page is
   scrolled, the top of the overlay sat behind the sticky header (z-index 50) and greyed it out. */
.blockUI.blockOverlay,
.blockUI.blockMsg {
	z-index: 40 !important;
}

/* Select2 multi-selects: the box takes the field style above, the search box typed into inside it
   must not (it drew a second bordered field, 44px tall, inside the first). "body" outranks the select2
   stylesheets that plugins load after this one. */
body .select2-container .select2-selection--multiple {
	display: flex;
	align-items: center;
	min-height: 44px;
	padding: 2px 8px;
}
body .select2-container .select2-selection--multiple .select2-selection__rendered {
	margin: 0;
	padding: 0;
}
body .select2-container .select2-search--inline .select2-search__field {
	min-height: 0;
	height: 32px;
	margin: 0;
	padding: 0 4px;
	border: 0;
	background: transparent;
	box-shadow: none;
	font-family: inherit;
}
/* Dokan's style.css gives every open dropdown margin-top: 32px, so outside its dashboard the governorate list
   opened 32px off the field and covered the next one. */
body:not(.dokan-dashboard) .select2-container--open .select2-dropdown {
	margin-top: 0;
}
/* The search box inside the dropdown: room around it, the site's field style, a search icon on the reading side. */
body:not(.dokan-dashboard) .select2-container--open .select2-search--dropdown {
	padding: 8px;
}
body:not(.dokan-dashboard) .select2-container--open .select2-search--dropdown .select2-search__field {
	height: 40px;
	padding-block: 0;
	padding-inline: 36px 12px;
	border: 1px solid var(--wp--preset--color--hairline-strong);
	border-radius: var(--wp--preset--border-radius--sm);
	background: var(--wp--preset--color--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2367635d' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat right 12px center;
	font-size: 14px;
}
body:not(.dokan-dashboard) .select2-container--open .select2-search--dropdown .select2-search__field:focus {
	border-color: var(--wp--preset--color--brass);
	outline: none;
}
/* Highlighted and chosen rows in the site's colours, not WordPress admin blue. The highlight is the focus mark,
   so no focus ring (the list clipped it to two brown lines above and below the row). */
body:not(.dokan-dashboard) .select2-container--open .select2-results__option {
	outline: none;
}
body:not(.dokan-dashboard) .select2-container--open .select2-results__option--highlighted[aria-selected],
body:not(.dokan-dashboard) .select2-container--open .select2-results__option--highlighted[data-selected] {
	background-color: var(--wp--preset--color--gold-soft);
	color: var(--wp--preset--color--ink);
}
body:not(.dokan-dashboard) .select2-container--open .select2-results__option[aria-selected="true"]:not(.select2-results__option--highlighted) {
	background-color: var(--wp--preset--color--paper-deep);
}
.select2-dropdown {
	border-color: var(--wp--preset--color--hairline-strong);
	border-radius: var(--wp--preset--border-radius--sm);
	font-family: inherit;
}
.select2-results__option {
	padding: 8px 12px;
	font-size: 14px;
}
