/*
 * Bloom & Thread – out-of-stock + back-in-stock popup UI
 * Loaded on single product pages only (see ../bloom-bis-oos-ui.php).
 * Presentation only: no element is hidden, removed or re-wired.
 *
 * !important is used only where the theme or plugin already use !important
 * or inline style="" attributes that cannot be overridden otherwise
 * (each such place is commented).
 */

:root {
	--bloom-ink: var(--text-color, #070707);
	--bloom-body: var(--text-color-body, #454545);
	--bloom-muted: var(--text-color-light, #838383);
	--bloom-line: var(--border-color-light, #E3E3E3);
	--bloom-gold: #E2B95A;        /* logo gold (#EEC864), slightly deepened for thin lines */
	--bloom-gold-dark: #8A6A1F;   /* AA-contrast gold for text/hover on white */
	--bloom-red: var(--red-color, #DA432E);
}

/* ------------------------------------------------------------------ *
 * 1. Out-of-stock message (selected variation)
 * ------------------------------------------------------------------ */
.woocommerce-variation-availability .bloom-oos {
	margin: 26px 0 0;
	padding: 2px 0 2px 14px;
	border-left: 2px solid var(--bloom-gold);
}

/* Theme sets margin-top:30px; margin-bottom:-20px !important on this <p>,
   which pulled the notify button over the "Out of stock" text. */
.woocommerce-variation-availability .bloom-oos .stock.bloom-oos__title {
	margin: 0 !important;
	font-size: 12px;
	line-height: 1.5;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--bloom-red);
}

.woocommerce-variation-availability .bloom-oos__note {
	margin: 4px 0 0;
	font-size: 13px;
	line-height: 1.5;
	letter-spacing: 0;
	text-transform: none;
	color: var(--bloom-body);
}

/* ------------------------------------------------------------------ *
 * 2. "Let me know when available" button (same element, same trigger)
 * ------------------------------------------------------------------ */
.woocommerce-variation-availability .cwg_popup_submit,
.c-product__atc-wrap .cwg_popup_submit {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	min-height: 50px;
	margin: 16px 0 24px;
	padding: 12px 20px;
	border: 1px solid var(--bloom-ink);
	border-radius: 0;
	background: var(--bloom-ink);
	color: #fff;
	font-family: inherit;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	transition: background-color .2s ease, color .2s ease;
}

/* When the plain WooCommerce stock line is still used (no Bloom message), keep the
   button clear of the text the theme pulls up with its negative margin. */
.woocommerce-variation-availability .stock.out-of-stock:not(.bloom-oos__title) + .cwg_popup_submit {
	margin-top: 32px;
}

/* Hover: the theme's own button hover (same as Add to Cart) is kept on purpose. */

.woocommerce-variation-availability .cwg_popup_submit:focus,
.c-product__atc-wrap .cwg_popup_submit:focus {
	outline: none;
}

.woocommerce-variation-availability .cwg_popup_submit:focus-visible,
.c-product__atc-wrap .cwg_popup_submit:focus-visible {
	outline: 2px solid var(--bloom-ink);
	outline-offset: 3px;
}

/* ------------------------------------------------------------------ *
 * 3. Purchase controls while an OUT-OF-STOCK variation is selected
 *    Visual only – WooCommerce/theme already block these clicks.
 *    Matches only when the shown availability is "out of stock" AND
 *    WooCommerce has flagged the button as unavailable, so it reverts
 *    the moment an in-stock size is selected or the selection is cleared.
 * ------------------------------------------------------------------ */
.variations_form:has(.woocommerce-variation-availability .out-of-stock) .single_add_to_cart_button.wc-variation-is-unavailable,
.variations_form:has(.woocommerce-variation-availability .out-of-stock) .woocommerce-variation-add-to-cart:has(.single_add_to_cart_button.wc-variation-is-unavailable) .js-buy-now {
	opacity: 0.35;
	cursor: not-allowed;
}

/* ------------------------------------------------------------------ *
 * 4. Subscription popup (SweetAlert2 popup that contains the notifier form)
 *    Scoped with :has() so no other SweetAlert usage is affected.
 * ------------------------------------------------------------------ */
.swal2-container:has(.cwginstock-subscribe-form) {
	padding: 16px;
}

.swal2-popup:has(.cwginstock-subscribe-form) {
	box-sizing: border-box;
	width: 100%;
	max-width: 460px;
	padding: 0;
	border-radius: 2px;
	border-top: 3px solid var(--bloom-gold);
	background: #fff;
	box-shadow: 0 24px 60px rgba(7, 7, 7, .18);
	font-family: var(--font-text, "Manrope", sans-serif);
	color: var(--bloom-ink);
	text-align: left;
}

.swal2-popup:has(.cwginstock-subscribe-form) .swal2-header {
	padding: 0;
}

.swal2-popup:has(.cwginstock-subscribe-form) .swal2-content {
	padding: 0;
	font-size: 14px;
	text-align: left;
}

/* Close button */
.swal2-popup:has(.cwginstock-subscribe-form) .swal2-close {
	top: 10px;
	right: 10px;
	width: 40px;
	height: 40px;
	font-family: Arial, sans-serif;
	font-size: 28px;
	line-height: 40px;
	color: var(--bloom-ink);
	background: transparent;
	border-radius: 0;
	box-shadow: none;
	z-index: 2;
	transition: color .2s ease, background-color .2s ease;
}

.swal2-popup:has(.cwginstock-subscribe-form) .swal2-close:hover {
	color: var(--bloom-ink);
	background: #F4F4F4;
	transform: none;
}

.swal2-popup:has(.cwginstock-subscribe-form) .swal2-close:focus {
	box-shadow: none;
	outline: none;
}

.swal2-popup:has(.cwginstock-subscribe-form) .swal2-close:focus-visible {
	outline: 2px solid var(--bloom-ink);
	outline-offset: -2px;
}

/* Form shell */
.swal2-popup .cwginstock-subscribe-form .cwginstock-panel-primary {
	/* The "Card" form design sets overflow:hidden (for its rounded corners),
	   which clipped the phone country list. Corners are square here. */
	overflow: visible;
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: #fff;
}

.swal2-popup .cwginstock-subscribe-form .cwginstock-panel-primary > .cwginstock-panel-heading {
	padding: 30px 60px 0 28px;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--bloom-ink);
	text-align: left;
}

.swal2-popup .cwginstock-subscribe-form .cwginstock-panel-heading h4 {
	margin: 0;
	font-family: inherit;
	font-size: 20px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: -0.01em;
	color: var(--bloom-ink);
	text-transform: none;
	text-align: left !important; /* overrides inline style="text-align: center" */
}

.swal2-popup .cwginstock-subscribe-form .cwginstock-panel-body {
	padding: 20px 28px 28px;
}

.swal2-popup .cwginstock-subscribe-form .cwginstock-panel-body .row,
.swal2-popup .cwginstock-subscribe-form .cwginstock-panel-body [class*="col-"] {
	margin-left: 0;
	margin-right: 0;
	padding-left: 0;
	padding-right: 0;
	width: 100%;
	float: none;
}

.swal2-popup .cwginstock-subscribe-form .form-group {
	margin: 0;
	text-align: left;
}

/* Field labels: the notifier prints them visually hidden via an inline
   style="" attribute, so !important is the only way to show them. */
.swal2-popup .cwginstock-subscribe-form .form-group > label {
	position: static !important;
	width: auto !important;
	height: auto !important;
	margin: 0 0 6px !important;
	padding: 0 !important;
	overflow: visible !important;
	clip: auto !important;
	white-space: normal !important;
	display: block;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--bloom-ink);
}

/* Inputs */
.swal2-popup .cwginstock-subscribe-form input.cwgstock_name,
.swal2-popup .cwginstock-subscribe-form input.cwgstock_email,
.swal2-popup .cwginstock-subscribe-form input.cwgstock_phone {
	box-sizing: border-box;
	width: 100%;
	height: 48px;
	margin: 0 0 16px;
	padding: 0 14px;
	border: 1px solid #D6D6D6;
	border-radius: 0;
	background: #fff;
	box-shadow: none;
	font-family: inherit;
	font-size: 16px; /* 16px stops iOS Safari zooming in on focus */
	font-weight: 500;
	line-height: 46px;
	color: var(--bloom-ink);
	text-align: left !important; /* overrides inline style="text-align:center" */
}

.swal2-popup .cwginstock-subscribe-form input.cwgstock_name::placeholder,
.swal2-popup .cwginstock-subscribe-form input.cwgstock_email::placeholder,
.swal2-popup .cwginstock-subscribe-form input.cwgstock_phone::placeholder {
	color: #A3A3A3;
	opacity: 1;
}

.swal2-popup .cwginstock-subscribe-form input.cwgstock_name:focus,
.swal2-popup .cwginstock-subscribe-form input.cwgstock_email:focus,
.swal2-popup .cwginstock-subscribe-form input.cwgstock_phone:focus {
	border-color: var(--bloom-ink);
	box-shadow: 0 0 0 1px var(--bloom-ink);
	outline: none;
}

/* Phone: intl-tel-input wrapper + country selector */
.swal2-popup .cwginstock-subscribe-form .iti {
	display: block;
	width: 100%;
	margin: 0 0 16px;
}

.swal2-popup .cwginstock-subscribe-form .iti input.cwgstock_phone {
	margin-bottom: 0;
}

.swal2-popup .cwginstock-subscribe-form .iti__selected-country {
	padding: 0 6px 0 14px;
	border-radius: 0;
	color: var(--bloom-ink);
}

.swal2-popup .cwginstock-subscribe-form .iti__selected-country:focus-visible {
	outline: 2px solid var(--bloom-ink);
	outline-offset: -2px;
}

.swal2-popup .cwginstock-subscribe-form .iti__selected-dial-code {
	font-size: 15px;
	font-weight: 500;
	color: var(--bloom-ink);
}

.swal2-popup .cwginstock-subscribe-form .iti__dropdown-content {
	border-color: #D6D6D6;
	border-radius: 0;
	text-align: left;
	z-index: 5;
}

/* Consent checkbox + Privacy Policy */
.swal2-popup .cwginstock-subscribe-form .cwg_iagree_checkbox {
	margin: 4px 0 20px;
	text-align: left;
}

.swal2-popup .cwginstock-subscribe-form .cwg_iagree_checkbox label {
	display: block;
	margin: 0;
	padding-left: 30px;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.55;
	color: var(--bloom-body);
	cursor: pointer;
	text-align: left;
}

.swal2-container .swal2-popup .cwginstock-subscribe-form .cwg_iagree_checkbox label > input.cwg_iagree_checkbox_input[type="checkbox"] {
	/* Theme forces position:relative !important on all checkboxes, so use a
	   hanging indent instead of absolute positioning. */
	top: 0;
	left: 0;
	width: 18px;
	height: 18px;
	margin: 0 10px 0 -30px;
	vertical-align: -4px;
	flex-shrink: 0;
	accent-color: var(--bloom-ink);
	cursor: pointer;
}

.swal2-popup .cwginstock-subscribe-form .cwg_iagree_checkbox input.cwg_iagree_checkbox_input:focus-visible {
	outline: 2px solid var(--bloom-ink);
	outline-offset: 2px;
}

.swal2-popup .cwginstock-subscribe-form .cwg_iagree_checkbox a {
	color: var(--bloom-ink);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-color: var(--bloom-gold);
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
	/* Keep "Privacy Policy" on one line: if it wraps, a click between its two
	   line boxes lands on the <label> and toggles the consent checkbox instead. */
	white-space: nowrap;
	display: inline-block;
	padding: 2px 0;
}

.swal2-popup .cwginstock-subscribe-form .cwg_iagree_checkbox a:hover {
	color: var(--bloom-gold-dark);
}

/* Submit button */
.swal2-popup .cwginstock-subscribe-form .cwgstock_button {
	display: block;
	box-sizing: border-box;
	width: 100%;
	min-height: 50px;
	margin: 0;
	padding: 14px 20px;
	border: 1px solid var(--bloom-ink);
	border-radius: 0;
	background: var(--bloom-ink);
	color: #fff;
	font-family: inherit;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	box-shadow: none;
	transition: background-color .2s ease, color .2s ease;
}

.swal2-popup .cwginstock-subscribe-form .cwgstock_button:hover {
	/* same hover colour as the theme's Add to Cart / notify buttons */
	border-color: var(--button-color-hover, #FC5F49);
	background: var(--button-color-hover, #FC5F49);
	color: #fff;
}

.swal2-popup .cwginstock-subscribe-form .cwgstock_button:focus {
	outline: none;
	box-shadow: none;
}

.swal2-popup .cwginstock-subscribe-form .cwgstock_button:focus-visible {
	outline: 2px solid var(--bloom-ink);
	outline-offset: 3px;
}

/* Success / error messages – the notifier prints color via inline style="" */
.swal2-popup .cwginstock-subscribe-form .cwgstock_output {
	text-align: left;
}

.swal2-popup .cwginstock-subscribe-form .cwgstock_output .cwginstockerror,
.swal2-popup .cwginstock-subscribe-form .cwgstock_output .cwginstocksuccess {
	margin: 16px 0 0;
	padding: 12px 14px;
	border-left: 3px solid;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.5;
	text-align: left;
}

.swal2-popup .cwginstock-subscribe-form .cwgstock_output .cwginstockerror {
	color: #A3271A !important;          /* overrides inline color:red */
	background: #FDF2F0;
	border-left-color: var(--bloom-red);
}

.swal2-popup .cwginstock-subscribe-form .cwgstock_output .cwginstocksuccess {
	color: var(--bloom-ink) !important; /* overrides inline color:green */
	background: #FBF6EA;
	border-left-color: var(--bloom-gold);
}

/* Small screens */
@media (max-width: 480px) {
	.swal2-container:has(.cwginstock-subscribe-form) {
		padding: 12px;
	}

	.swal2-popup .cwginstock-subscribe-form .cwginstock-panel-primary > .cwginstock-panel-heading {
		padding: 24px 56px 0 20px;
	}

	.swal2-popup .cwginstock-subscribe-form .cwginstock-panel-heading h4 {
		font-size: 18px;
	}

	.swal2-popup .cwginstock-subscribe-form .cwginstock-panel-body {
		padding: 16px 20px 22px;
	}

	.swal2-popup:has(.cwginstock-subscribe-form) .swal2-close {
		top: 6px;
		right: 6px;
		width: 44px;
		height: 44px;
		line-height: 44px;
	}
}
