/**
 * Qhalesaa Shop Kit — product purchase form.
 *
 * Attribute buttons, quantity stepper and add-to-cart bar, matching the
 * design sample. Colours are custom properties; the maroon follows the
 * Elementor primary global so client rebrands carry through.
 */

form.cart {
	--qav-form-accent: var(--e-global-color-primary, #330917);
	--qav-form-accent-hover: var(--e-global-color-secondary, #5c1a32);
	--qav-form-border: #d8cccf;
	--qav-form-disabled: #b7a8ad;
	--qav-form-stock: #4db2b9;
}

/* ---------------------------------------------------------------------------
   Attribute buttons
   --------------------------------------------------------------------------- */

/* The real select stays for WooCommerce's script; shoppers see the buttons. */
.qav-swatch-select {
	display: none !important;
}

.qav-swatches {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 0px;
}

.qav-swatch {
	min-width: unset;
	padding: 10px 10px;
	/* !important: outguns the theme's own button background. */
	background: white !important;
	border: 1px solid var(--qav-form-border, #d8cccf);
	border-radius: 0;
	color: inherit;
	font-size: 13px !important;
	line-height: 1;
	text-align: center;
	cursor: pointer;
	transition: border-color 120ms ease-out, background-color 120ms ease-out, color 120ms ease-out;
}

.qav-swatch:hover:not(.is-disabled):not(.is-active) {
	border-color: var(--qav-form-accent, #330917);
}

/* Hover tints the label; the .is-active rule below outranks it for the
   selected button, which keeps its white text. */
.qav-swatch:hover {
	color: var(--qav-form-accent, #330917);
}

.qav-swatch.is-active {
	background: var(--qav-form-accent, #330917) !important;
	border-color: var(--qav-form-accent, #330917);
	color: #fff;
}

.qav-swatch.is-disabled {
	color: var(--qav-form-disabled, #b7a8ad);
	border-color: var(--qav-form-border, #d8cccf);
	text-decoration: line-through;
	cursor: not-allowed;
	opacity: 0.7;
}

.qav-swatch:focus-visible {
	outline: 2px solid var(--qav-form-accent, #330917);
	outline-offset: 2px;
}

/* The variations table markup stays, but its chrome goes. */
form.variations_form table.variations,
form.variations_form table.variations td,
form.variations_form table.variations th {
	border: 0;
	padding-left: 0;
	background: transparent;
}

.woocommerce div.product form.cart .variations th {
	padding: 0;
	width: 60px;
}

form.variations_form table.variations th.label {
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 2px;
	text-align: left;
	vertical-align: middle;
}

/* Stock hint under the chosen size, teal as in the sample. */
.woocommerce-variation-availability p.stock,
form.cart ~ p.stock,
div.product p.stock {
	color: var(--qav-form-stock, #4db2b9);
}

.woocommerce div.product p.stock {
	font-size: 12px;
	margin-top: -15px;
	padding-bottom: 15px;
}

/* Out of stock: brand-colour block, white uppercase text. */
.stock.out-of-stock {
	background-color: var(--e-global-color-primary);
	color: white !important;
	width: fit-content;
	margin-top: 1px !important;
	padding: 15px 20px 0px 20px;
	text-transform: uppercase;
	margin-bottom: 0;
}

/* ---------------------------------------------------------------------------
   Quantity stepper
   --------------------------------------------------------------------------- */

form.cart div.quantity.qav-qty {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid rgba(51, 9, 23, 0.3);
	background: transparent;
}

.qav-qty input[type='number'] {
	width: 56px;
	border: 0;
	background: transparent;
	text-align: center;
	font-size: 16px;
	-moz-appearance: textfield;
	appearance: textfield;
}

/* The steppers replace the browser spin buttons. */
.qav-qty input[type='number']::-webkit-outer-spin-button,
.qav-qty input[type='number']::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.qav-qty-step {
	/* !important: the theme paints form buttons in the brand colour. */
	background-color: transparent !important;
	width: 20px;
	padding: 14px 0;
	border: 0;
	background: none;
	color: inherit;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.qav-qty-step:hover {
	color: var(--qav-form-accent-hover, #5c1a32);
}

/* ---------------------------------------------------------------------------
   Add to cart bar
   --------------------------------------------------------------------------- */

/* Quantity and button on one row. Simple products: the form itself is the
   row. Variable products: the row is the .woocommerce-variation-add-to-cart
   div inside the form, so the variations table above keeps its own space. */
form.cart:not(.variations_form),
form.cart .woocommerce-variation-add-to-cart {
	display: flex;
	align-items: stretch;
	gap: 16px;
	flex-wrap: wrap;
}

form.cart .single_add_to_cart_button {
	flex: 1;
	padding: 18px 24px;
	background: var(--qav-form-accent, #330917);
	border: 0;
	border-radius: 0;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 3px;
	cursor: pointer;
	transition: background-color 150ms ease-out;
}

/* Simple products: quantity flush against the button, like variable ones. */
form.cart:not(.variations_form) {
	gap: 0;
}

/* The theme's own end-margin on the quantity box would reopen the gap. */
.woocommerce div.product form.cart div.quantity {
	margin-inline-end: unset;
}

/* Theme paints .button.alt with its own colour at higher specificity. */
.single_add_to_cart_button.button.alt {
	background-color: var(--qav-form-accent, #330917) !important;
}

form.cart .woocommerce-variation-add-to-cart {
	gap: 0px;
}

form.cart .single_add_to_cart_button:hover {
	background: var(--qav-form-accent-hover, #5c1a32);
}

form.cart .single_add_to_cart_button.disabled,
form.cart .single_add_to_cart_button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
