/*
 * Order form designs, field styles, coupon field and trust badges (src/OrderForm/). Loaded only on pages
 * showing a form, and only when the store chose something in Customizer > Order form > Design or turned
 * the coupon field on. Every rule is scoped by a body class (set by Design::classes()); the form's own
 * Customizer CSS uses ids and !important, hence "html body" and !important here.
 * Logical properties: works in RTL and LTR. Colours: --jof-accent, --jof-button (Design::inline_css()).
 */

body.jof {
	--jof-line: #e5e7eb;
	--jof-muted: #6b7280;
	--jof-field-bg: #ffffff;
}

/* ------------------------------------------------------------------ designs */

html body.jof-d-card #judecheckout-checkout {
	padding: clamp(16px, 3vw, 26px);
	border: 1px solid var(--jof-line) !important;
	border-radius: 18px;
	background: #ffffff !important;
	box-shadow: 0 14px 40px -18px rgba(15, 23, 42, 0.28);
}

html body.jof-d-compact #judecheckout-checkout {
	padding: 0;
	border: 0 !important;
	background: transparent !important;
	box-shadow: none;
}

html body.jof-d-compact #judecheckout_woo_single_form,
html body.jof-d-compact #judecheckout-checkout .form-footer {
	grid-gap: 10px;
}

html body.jof-d-bold #judecheckout-checkout {
	padding: clamp(16px, 3vw, 26px);
	border: 2px solid var(--jof-accent) !important;
	border-radius: 20px;
	background: color-mix(in srgb, var(--jof-accent) 6%, #ffffff) !important;
}

html body.jof-d-bold .judecheckout-checkout-title {
	color: var(--jof-accent);
	font-size: 1.12em;
	font-weight: 800;
}

body.jof .judecheckout-checkout-title {
	margin-block-end: 14px;
}

/* ------------------------------------------------------------------ fields */

html body.jof-l-one #judecheckout_woo_single_form {
	grid-template-columns: minmax(0, 1fr);
}

html body.jof-h #judecheckout_woo_single_form input:not([type="hidden"]):not([type="submit"]):not([type="radio"]):not([type="checkbox"]),
html body.jof-h #judecheckout_woo_single_form select,
html body.jof-h #judecheckout_state,
html body.jof-h #judecheckout_city,
html body.jof-h #judecheckout-checkout .jof-coupon-input {
	height: var(--jof-field-h) !important;
	min-height: var(--jof-field-h);
}

/* Shared: 16px text in the fields on phones (iPhone otherwise zooms in when a field is focused). */
@media (max-width: 767px) {
	body.jof #judecheckout_woo_single_form input,
	body.jof #judecheckout_woo_single_form select,
	body.jof #judecheckout_state,
	body.jof #judecheckout_city,
	body.jof .jof-coupon-input {
		font-size: 16px !important;
	}
}

html body.jof-f-outline #judecheckout_woo_single_form input:not([type="hidden"]):not([type="submit"]):not([type="radio"]):not([type="checkbox"]),
html body.jof-f-outline #judecheckout_woo_single_form select,
html body.jof-f-outline #judecheckout_state,
html body.jof-f-outline #judecheckout_city,
html body.jof-f-outline .jof-coupon-input {
	border: 1.5px solid #d1d5db !important;
	border-radius: 12px !important;
	background-color: #ffffff !important;
	box-shadow: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

html body.jof-f-filled #judecheckout_woo_single_form input:not([type="hidden"]):not([type="submit"]):not([type="radio"]):not([type="checkbox"]),
html body.jof-f-filled #judecheckout_woo_single_form select,
html body.jof-f-filled #judecheckout_state,
html body.jof-f-filled #judecheckout_city,
html body.jof-f-filled .jof-coupon-input {
	border: 1.5px solid transparent !important;
	border-radius: 12px !important;
	background-color: #f3f4f6 !important;
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

html body.jof-f-underline #judecheckout_woo_single_form input:not([type="hidden"]):not([type="submit"]):not([type="radio"]):not([type="checkbox"]),
html body.jof-f-underline #judecheckout_woo_single_form select,
html body.jof-f-underline #judecheckout_state,
html body.jof-f-underline #judecheckout_city,
html body.jof-f-underline .jof-coupon-input {
	border: 0 !important;
	border-block-end: 2px solid #d1d5db !important;
	border-radius: 0 !important;
	background-color: transparent !important;
	padding-inline: 4px;
}

html body.jof-f-outline #judecheckout_woo_single_form input:focus,
html body.jof-f-outline #judecheckout_woo_single_form select:focus,
html body.jof-f-filled #judecheckout_woo_single_form input:focus,
html body.jof-f-filled #judecheckout_woo_single_form select:focus,
html body.jof-f-outline .jof-coupon-input:focus,
html body.jof-f-filled .jof-coupon-input:focus {
	border-color: var(--jof-accent) !important;
	background-color: #ffffff !important;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--jof-accent) 18%, transparent);
}

html body.jof-f-underline #judecheckout_woo_single_form input:focus,
html body.jof-f-underline #judecheckout_woo_single_form select:focus,
html body.jof-f-underline .jof-coupon-input:focus {
	border-block-end-color: var(--jof-accent) !important;
}

/* Field icons (inline start). */
html body.jof-icons #judecheckout_woo_single_form input[name="full_name"],
html body.jof-icons #judecheckout_woo_single_form input[name="phone_number"],
html body.jof-icons #judecheckout_woo_single_form input[name="full_address"],
html body.jof-icons #judecheckout_woo_single_form select,
html body.jof-icons #judecheckout_state,
html body.jof-icons #judecheckout_city {
	background-repeat: no-repeat !important;
	background-size: 18px 18px !important;
	background-position: left 12px center !important;
	padding-left: 40px !important;
}

html body.jof-icons.rtl #judecheckout_woo_single_form input[name="full_name"],
html body.jof-icons.rtl #judecheckout_woo_single_form input[name="phone_number"],
html body.jof-icons.rtl #judecheckout_woo_single_form input[name="full_address"],
html body.jof-icons.rtl #judecheckout_woo_single_form select,
html body.jof-icons.rtl #judecheckout_state,
html body.jof-icons.rtl #judecheckout_city {
	background-position: right 12px center !important;
	padding-left: 12px !important;
	padding-right: 40px !important;
}

html body.jof-icons #judecheckout_woo_single_form input[name="full_name"] {
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='8' r='4'/><path d='M4 21c0-4 4-6 8-6s8 2 8 6'/></svg>") !important;
}

html body.jof-icons #judecheckout_woo_single_form input[name="phone_number"] {
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1.9.4 1.8.7 2.7a2 2 0 0 1-.5 2.1L8 9.8a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.5c.9.3 1.8.6 2.7.7a2 2 0 0 1 1.7 2z'/></svg>") !important;
}

html body.jof-icons #judecheckout_woo_single_form select,
html body.jof-icons #judecheckout_state,
html body.jof-icons #judecheckout_city {
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 22s7-6.2 7-12a7 7 0 0 0-14 0c0 5.8 7 12 7 12z'/><circle cx='12' cy='10' r='2.5'/></svg>") !important;
}

html body.jof-icons #judecheckout_woo_single_form input[name="full_address"] {
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 10.5 12 3l9 7.5V21H3z'/><path d='M9 21v-6h6v6'/></svg>") !important;
}

/* ------------------------------------------------------------------ order button */

html body.jof-b-large input#nrwooconfirm,
html body.jof-b-large #formnrwooconfirm.atc-buy-button input,
html body.jof-b-large #formnrwooconfirm.atc-buy-button .button {
	height: 58px !important;
	line-height: 58px !important;
	font-size: 18px !important;
	font-weight: 800 !important;
}

html body.jof-b-large #judecheckout-checkout .form-footer {
	align-items: stretch;
}

html body.jof-b-large .form-qte {
	height: 58px;
}

html body.jof-btn-icon input#nrwooconfirm {
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='21' r='1.5'/><circle cx='19' cy='21' r='1.5'/><path d='M1 1h4l2.7 13.4a2 2 0 0 0 2 1.6h9.7a2 2 0 0 0 2-1.6L23 6H6'/></svg>") !important;
	background-repeat: no-repeat !important;
	background-size: 20px 20px !important;
	background-position: right 18px center !important;
	padding-right: 48px !important;
}

html body.jof-btn-icon.rtl input#nrwooconfirm {
	background-position: left 18px center !important;
	padding-right: 0 !important;
	padding-left: 48px !important;
}

html body.jof-no-shake .wdk-shaked {
	animation: none !important;
}

body.jof input#nrwooconfirm {
	transition: filter 0.15s ease, transform 0.15s ease;
}

/* A long label (or the total added to it) must not make the button wider than its column. */
html body.jof #judecheckout-checkout .form-footer > *,
html body.jof #formnrwooconfirm > * {
	min-width: 0;
}

html body.jof input#nrwooconfirm {
	width: 100%;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	padding-inline: 12px;
}

@media (max-width: 480px) {
	html body.jof input#nrwooconfirm {
		font-size: 15px !important;
	}

	html body.jof-b-large input#nrwooconfirm {
		font-size: 16px !important;
	}
}

body.jof input#nrwooconfirm:hover {
	filter: brightness(1.07);
}

body.jof input#nrwooconfirm:active {
	transform: translateY(1px);
}

/* ------------------------------------------------------------------ summary */

html body.jof-s-clean #judecheckout-checkout #judecheckout_show_hide table td,
html body.jof-s-clean #judecheckout-checkout #judecheckout_show_hide table tr {
	border: 0 !important;
	border-style: none !important;
}

html body.jof-s-clean #judecheckout-checkout #judecheckout_show_hide table td {
	padding-block: 9px !important;
}

html body.jof-s-clean #judecheckout-checkout #judecheckout_show_hide table tr + tr td {
	border-block-start: 1px solid var(--jof-line) !important;
}

html body.jof-s-clean #judecheckout-checkout #judecheckout_show_hide .full-price td {
	font-size: 1.12em;
	font-weight: 800;
}

/* ------------------------------------------------------------------ coupon */

.jof-coupon {
	margin-block: 12px 4px;
}

.jof-coupon-toggle {
	padding: 0;
	border: 0;
	background: none;
	color: var(--jof-accent, #453ec1);
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.jof-coupon-box {
	display: flex;
	gap: 8px;
	margin-block-start: 8px;
}

.jof-coupon.is-open .jof-coupon-box {
	margin-block-start: 0;
}

.jof-coupon-box[hidden] {
	display: none;
}

.jof-coupon-input {
	flex: 1;
	min-width: 0;
	height: 46px;
	padding-inline: 12px;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	background: #ffffff;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.jof-coupon-input.is-valid {
	border-color: #16a34a !important;
}

.jof-coupon-input.is-invalid {
	border-color: #dc2626 !important;
}

.jof-coupon-apply {
	flex: none;
	min-height: 46px;
	padding: 0 18px;
	border: 0;
	border-radius: 10px;
	background: #111827;
	color: #ffffff;
	font-weight: 700;
	cursor: pointer;
}

.jof-coupon-apply[disabled] {
	opacity: 0.6;
	cursor: wait;
}

.jof-coupon-msg {
	margin: 6px 0 0;
	font-size: 13px;
}

.jof-coupon-msg:empty {
	display: none;
}

.jof-coupon-msg.is-ok {
	color: #15803d;
}

.jof-coupon-msg.is-error {
	color: #b91c1c;
}

.jof-coupon-msg button {
	margin-inline-start: 8px;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	text-decoration: underline;
	cursor: pointer;
}

#judecheckout-checkout .jof-coupon-row td {
	color: #15803d !important;
	font-weight: 700;
}

/* ------------------------------------------------------------------ trust badges */

.jof-trust {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px 16px;
	margin: 12px 0 2px;
	padding: 0;
	list-style: none;
	color: var(--jof-muted);
	font-size: 13px;
}

.jof-trust li {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
}

.jof-trust i {
	color: var(--jof-accent, #453ec1);
}
