/**
 * JC Competitive Pricing - front end.
 *
 * Every color, radius and font routes through a CSS custom property, so the
 * whole feature can be rebranded by redefining these in one place. Set them in
 * Competitive Pricing -> Settings -> Styling, or override in your theme.
 *
 * Class reference (stable, safe to target):
 *   .jc-cpr-trigger-wrap      wrapper around the request button
 *   .jc-cpr-trigger           the request button itself
 *   .jc-cpr-price-note        "your approved price" note, all locations
 *   .jc-cpr-modal             modal root
 *   .jc-cpr-modal__overlay    backdrop
 *   .jc-cpr-modal__dialog     dialog panel
 *   .jc-cpr-modal__close      close button
 *   .jc-cpr-modal__title      heading
 *   .jc-cpr-modal__product    product name under the heading
 *   .jc-cpr-modal__intro      optional intro paragraph
 *   .jc-cpr-disclaimer        comparability disclaimer block
 *   .jc-cpr-form              the form
 *   .jc-cpr-field             a field row
 *   .jc-cpr-field--check      checkbox field row
 *   .jc-cpr-field-row         two fields side by side
 *   .jc-cpr-req               required asterisk
 *   .jc-cpr-hint              helper text under a field
 *   .jc-cpr-error             field level error text
 *   .jc-cpr-form__footer      footer holding the SLA line and submit
 *   .jc-cpr-sla               turnaround line
 *   .jc-cpr-submit            submit button
 *   .jc-cpr-message           success / error message after submitting
 *   .jc-cpr-account-table     My Pricing table in the customer account
 */

:root {
	--jc-cpr-accent: #0f6e56;
	--jc-cpr-accent-dark: #0c5843;
	--jc-cpr-accent-tint: #f4f8f6;
	--jc-cpr-error: #b32d2e;
	--jc-cpr-focus-ring: rgba(15, 110, 86, 0.15);
	--jc-cpr-overlay: rgba(14, 24, 21, 0.55);
	--jc-cpr-radius: 2px;
	--jc-cpr-font: inherit;
}
.jc-cpr-trigger-wrap {
	margin: 0 0 1.25em;
}

.jc-cpr-trigger {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0;
	border: 0;
	border-bottom: 1px solid currentColor;
	border-radius: 0;
	background: none;
	color: var(--jc-cpr-accent, #0f6e56);
	font-size: 0.9rem;
	font-weight: 500;
	letter-spacing: 0.01em;
	line-height: 1.4;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.jc-cpr-trigger:hover,
.jc-cpr-trigger:focus {
	opacity: 0.7;
	background: none;
	color: var(--jc-cpr-accent, #0f6e56);
}

.jc-cpr-trigger:focus-visible {
	outline: 2px solid var(--jc-cpr-accent, #0f6e56);
	outline-offset: 3px;
}

/* The note is appended inside the price element, so it can land inside <ins>,
   <del> or a link and inherit strikethrough, underline and oversized type.
   Everything below resets what it might pick up rather than assuming. */
.jc-cpr-price-note {
	display: block;
	clear: both;
	width: 100%;
	max-width: 100%;
	margin: 0.4em 0 0;
	padding: 0;
	color: var(--jc-cpr-accent, #0f6e56);
	font-family: inherit;
	font-size: 0.72rem;
	font-style: normal;
	font-weight: 500;
	letter-spacing: 0.02em;
	line-height: 1.35;
	text-align: left;
	text-decoration: none;
	text-transform: uppercase;
	white-space: normal;
	vertical-align: baseline;
}

/* Product cards sit in tight grids next to quick-add buttons, so the note
   needs to stay out of their way. */
.woocommerce-loop-product__link .jc-cpr-price-note,
.products .jc-cpr-price-note {
	font-size: 0.65rem;
	letter-spacing: 0.01em;
	padding-right: 3.5em;
}

/* Cart and checkout are dense tables. Sentence case reads better there than
   the uppercase treatment used next to the product price. */
.woocommerce-cart-form .jc-cpr-price-note,
.woocommerce-checkout-review-order .jc-cpr-price-note,
.shop_table .jc-cpr-price-note {
	margin-top: 0.3em;
	font-size: 0.72rem;
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
}

/* Never let it show up in the mini-cart dropdown, which has no room for it. */
.widget_shopping_cart .jc-cpr-price-note,
.mini_cart_item .jc-cpr-price-note,
.elementor-menu-cart__product .jc-cpr-price-note {
	display: none;
}

/* Modal shell
   ---------------------------------------------------------------- */

.jc-cpr-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 5vh 16px;
	overflow-y: auto;
}

.jc-cpr-modal[hidden] {
	display: none;
}

.jc-cpr-modal__overlay {
	position: fixed;
	inset: 0;
	background: var(--jc-cpr-overlay, rgba(14, 24, 21, 0.55));
}

.jc-cpr-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 620px;
	margin: auto;
	padding: 40px;
	background: #fff;
	border-top: 3px solid var(--jc-cpr-accent, #0f6e56);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
	color: #1d1d1d;
	font-size: 15px;
	line-height: 1.55;
}

/* Two classes so the theme's global button styling does not turn the close
   glyph into a filled brand-colored button. */
.jc-cpr-modal .jc-cpr-modal__close,
.jc-cpr-modal__dialog .jc-cpr-modal__close {
	position: absolute;
	top: 6px;
	right: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: #8b8b8b;
	font-size: 28px;
	font-weight: 400;
	line-height: 1;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
}

.jc-cpr-modal .jc-cpr-modal__close:hover,
.jc-cpr-modal .jc-cpr-modal__close:focus {
	background: none;
	box-shadow: none;
	color: #1d1d1d;
}

.jc-cpr-modal__title {
	margin: 0 0 4px;
	font-size: 1.35rem;
	line-height: 1.25;
}

.jc-cpr-modal__product {
	margin: 0 0 20px;
	color: #6b6b6b;
	font-size: 0.9rem;
}

.jc-cpr-disclaimer {
	margin-bottom: 24px;
	padding: 14px 16px;
	background: var(--jc-cpr-accent-tint, #f4f8f6);
	border-left: 2px solid var(--jc-cpr-accent, #0f6e56);
	color: #40514b;
	font-size: 0.85rem;
	line-height: 1.5;
}

.jc-cpr-disclaimer p {
	margin: 0 0 8px;
}

.jc-cpr-disclaimer p:last-child {
	margin-bottom: 0;
}

/* Form
   ---------------------------------------------------------------- */

.jc-cpr-field-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0 18px;
}

.jc-cpr-field-row .jc-cpr-field {
	flex: 1 1 220px;
}

.jc-cpr-field {
	margin: 0 0 18px;
}

.jc-cpr-field label {
	display: block;
	margin-bottom: 5px;
	font-size: 0.82rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.jc-cpr-field input[type="text"],
.jc-cpr-field input[type="email"],
.jc-cpr-field input[type="url"],
.jc-cpr-field select,
.jc-cpr-field textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #d4d4d4;
	border-radius: 2px;
	background: #fff;
	color: inherit;
	font-family: inherit;
	font-size: 0.95rem;
	line-height: 1.4;
	box-sizing: border-box;
}

.jc-cpr-field input[type="file"] {
	width: 100%;
	font-size: 0.85rem;
}

.jc-cpr-field input:focus,
.jc-cpr-field select:focus,
.jc-cpr-field textarea:focus {
	border-color: var(--jc-cpr-accent, #0f6e56);
	outline: none;
	box-shadow: 0 0 0 2px var(--jc-cpr-focus-ring, rgba(15, 110, 86, 0.15));
}

.jc-cpr-field.is-invalid input,
.jc-cpr-field.is-invalid select,
.jc-cpr-field.is-invalid textarea {
	border-color: var(--jc-cpr-error, #b32d2e);
}

.jc-cpr-req {
	color: var(--jc-cpr-error, #b32d2e);
}

.jc-cpr-hint {
	display: block;
	margin-top: 5px;
	color: #7a7a7a;
	font-size: 0.78rem;
	line-height: 1.4;
}

.jc-cpr-error {
	display: none;
	margin-top: 5px;
	color: var(--jc-cpr-error, #b32d2e);
	font-size: 0.78rem;
}

.jc-cpr-error.is-visible {
	display: block;
}

/* Honeypot: kept in the layout flow for bots, invisible to people. */
.jc-cpr-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.jc-cpr-form__footer {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid #ececec;
}

.jc-cpr-sla {
	margin: 0;
	color: #7a7a7a;
	font-size: 0.8rem;
}

.jc-cpr-submit {
	padding: 13px 28px;
	border: 0;
	border-radius: 2px;
	background: var(--jc-cpr-accent, #0f6e56);
	color: #fff;
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.15s ease;
}

.jc-cpr-submit:hover:not(:disabled) {
	background: var(--jc-cpr-accent-dark, #0c5843);
}

.jc-cpr-submit:disabled {
	opacity: 0.6;
	cursor: default;
}

.jc-cpr-message {
	display: none;
	margin-top: 18px;
	padding: 12px 14px;
	font-size: 0.88rem;
	line-height: 1.5;
}

.jc-cpr-message.is-visible {
	display: block;
}

.jc-cpr-message.is-error {
	background: #fbeaea;
	border-left: 2px solid var(--jc-cpr-error, #b32d2e);
	color: #7d1f20;
}

.jc-cpr-message.is-success {
	background: var(--jc-cpr-accent-tint, #f4f8f6);
	border-left: 2px solid var(--jc-cpr-accent, #0f6e56);
	color: var(--jc-cpr-accent, #0f6e56);
}

.jc-cpr-form.is-complete .jc-cpr-field-row,
.jc-cpr-form.is-complete .jc-cpr-field,
.jc-cpr-form.is-complete .jc-cpr-form__footer {
	display: none;
}

@media (max-width: 600px) {
	.jc-cpr-modal {
		padding: 0;
	}

	.jc-cpr-modal__dialog {
		max-width: none;
		min-height: 100%;
		padding: 32px 20px;
	}

	.jc-cpr-form__footer {
		flex-direction: column-reverse;
		align-items: stretch;
	}

	.jc-cpr-submit {
		width: 100%;
	}
}

/* Sizing so the trigger sits happily beside another button in a flex row
   without wrapping onto two lines.

   Measured on the live PDP: the label needs 221px and the theme's 35px side
   padding left 223px of room. Two pixels of headroom is not a layout. The
   padding comes down so the text has real space, and the selectors carry two
   classes so they win against the theme's button rules. */
.jc-cpr-trigger-wrap {
	display: flex;
	width: 100%;
}

.jc-cpr-trigger-wrap .jc-cpr-trigger {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
	justify-content: center;
	text-align: center;
	white-space: nowrap;
	padding-left: 16px;
	padding-right: 16px;
	font-family: var(--jc-cpr-font, inherit);
}

/* When the plugin's own Elementor widget shares a flex row, take an equal
   share rather than sizing to the text. */
.elementor-widget-jc-competitive-pricing {
	flex: 1 1 0;
	min-width: 0;
}

.elementor-widget-jc-competitive-pricing .elementor-widget-container {
	width: 100%;
}

/* Very narrow columns: shrink the label rather than break it. */
@media (max-width: 480px) {
	.jc-cpr-trigger-wrap .jc-cpr-trigger {
		font-size: 0.85rem;
		padding-left: 10px;
		padding-right: 10px;
	}
}
