/**
 * Front-end styling for [crm_form] (Phase 8): the popup overlay/modal and
 * the multi-step progress bar. Ordinary field styling is deliberately left
 * to the site's own theme, same as before this phase — only the two things
 * that can't work at all without CSS (a hidden-until-triggered modal, a
 * progress indicator) get their own rules here, scoped under .adromax-crm-*
 * classes so nothing here can leak into the rest of the page.
 */

.adromax-crm-popup-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(15, 23, 42, 0.55);
	padding: 20px;
}

.adromax-crm-popup-overlay.is-open {
	display: flex;
}

.adromax-crm-popup-inner {
	position: relative;
	background: #fff;
	border-radius: 12px;
	padding: 32px;
	max-width: 480px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.adromax-crm-popup-close {
	position: absolute;
	top: 10px;
	right: 14px;
	background: none;
	border: none;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	color: #5D7682;
}

.adromax-crm-popup-close:hover {
	color: #0B191F;
}

.adromax-crm-form-progress {
	width: 100%;
	height: 6px;
	background: #deeaee;
	border-radius: 999px;
	overflow: hidden;
	margin-bottom: 20px;
}

.adromax-crm-form-progress-bar {
	height: 100%;
	background: var( --adromax-form-accent, #0F75A1 );
	border-radius: 999px;
	transition: width 0.25s ease;
	width: 0%;
}

/* ---- Alternate progress indicators (Phase 9: dots / numbered steps) ---- */

.adromax-crm-form-progress-dots {
	display: flex;
	gap: 8px;
	justify-content: center;
	margin-bottom: 20px;
}

.adromax-crm-form-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #deeaee;
}

.adromax-crm-form-dot.is-active {
	background: var( --adromax-form-accent, #0F75A1 );
}

.adromax-crm-form-progress-steps {
	display: flex;
	align-items: center;
	margin-bottom: 20px;
}

.adromax-crm-form-step-badge {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: #deeaee;
	color: #5D7682;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 600;
	flex-shrink: 0;
}

.adromax-crm-form-step-badge.is-done,
.adromax-crm-form-step-badge.is-current {
	background: var( --adromax-form-accent, #0F75A1 );
	color: var(--adromax-form-on-accent, #fff);
}

.adromax-crm-form-step-line {
	flex: 1;
	height: 2px;
	background: #deeaee;
}

.adromax-crm-form-step-title {
	margin: 0 0 16px;
}

.adromax-crm-form-step-nav {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	margin-top: 16px;
}

/*
 * The form's own buttons.
 *
 * Until 2.49.2 the only rule here was `cursor: pointer`, so the Submit
 * button on every client form rendered as the raw browser default — grey,
 * square, and visibly not part of the site. The Accent Color setting in
 * the builder was being written to --adromax-form-accent and then used
 * for progress bars and focus rings but never for the one element the
 * whole form exists to get clicked.
 */
.adromax-crm-form-step-nav button {
	cursor: pointer;
	padding: 11px 22px;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 600;
	font-family: inherit;
	line-height: 1.2;
	transition: filter .15s ease, background-color .15s ease;
}

.adromax-crm-form-step-nav button[type="submit"],
.adromax-crm-form-step-nav .adromax-crm-form-next {
	border: 0;
	background: var(--adromax-form-accent, #0F75A1);
	color: var(--adromax-form-on-accent, #fff);
}

.adromax-crm-form-step-nav button[type="submit"]:hover,
.adromax-crm-form-step-nav .adromax-crm-form-next:hover {
	filter: brightness(0.94);
}

/* Back is secondary: it must be reachable without competing with the
   primary action, so it is outlined rather than filled. */
.adromax-crm-form-step-nav .adromax-crm-form-back {
	border: 1px solid var(--adromax-form-accent, #0F75A1);
	background: transparent;
	color: var(--adromax-form-accent, #0F75A1);
}

.adromax-crm-form-step-nav button:disabled {
	opacity: .55;
	cursor: not-allowed;
}

.adromax-crm-form-step-nav button:focus-visible {
	outline: 2px solid var(--adromax-form-accent, #0F75A1);
	outline-offset: 2px;
}

/* ---- GHL-style field types (Phase 9) ------------------------------------ */

.adromax-crm-choice-option {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 400;
	padding: 4px 0;
	cursor: pointer;
}

.adromax-crm-rating {
	display: flex;
	gap: 4px;
}

.adromax-crm-rating-star {
	background: none;
	border: none;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	color: #c6d7de;
	padding: 2px;
}

.adromax-crm-rating-star.is-active,
.adromax-crm-rating-star:hover {
	color: #f59e0b;
}

.adromax-crm-signature-pad {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
}

.adromax-crm-signature-canvas {
	border: 1.5px dashed #c6d7de;
	border-radius: 8px;
	background: #fff;
	touch-action: none;
	max-width: 100%;
}

.adromax-crm-signature-clear {
	background: none;
	border: 1px solid #c6d7de;
	border-radius: 6px;
	padding: 4px 10px;
	font-size: 12px;
	cursor: pointer;
}

.adromax-crm-monetary {
	display: flex;
	align-items: center;
	gap: 6px;
}

.adromax-crm-monetary-symbol {
	font-weight: 600;
	color: #425660;
}

.adromax-crm-html-block {
	line-height: 1.6;
}

.adromax-crm-image-block {
	max-width: 100%;
	border-radius: 8px;
	display: block;
}

.adromax-crm-product-picker,
.adromax-crm-payment-summary {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.adromax-crm-product-option {
	justify-content: space-between;
	border: 1px solid #deeaee;
	border-radius: 8px;
	padding: 8px 12px;
}

.adromax-crm-payment-summary {
	flex-direction: row;
	justify-content: space-between;
	align-items: center;
	border: 1px solid #deeaee;
	border-radius: 8px;
	padding: 8px 12px;
}

.adromax-crm-product-price {
	font-weight: 600;
	color: #0B191F;
}

.adromax-crm-textlist {
	font-family: monospace;
}

/* ---- Calculation / total fields ------------------------------------ */
.adromax-crm-calc {
	display: flex;
	align-items: baseline;
	gap: 2px;
	padding: 10px 12px;
	border-radius: 8px;
	background: #f1f7fa;
	border: 1px solid #d6e5eb;
	font-size: 20px;
	font-weight: 700;
	color: #0C1A1F;
}

.adromax-crm-calc-prefix,
.adromax-crm-calc-suffix {
	font-size: 15px;
	font-weight: 600;
	opacity: 0.7;
}

.adromax-crm-calc-value {
	font-variant-numeric: tabular-nums;
}

/* ---- [crm_subscribe] newsletter signup ----------------------------- */
.adromax-crm-subscribe {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	max-width: 560px;
}

.adromax-crm-subscribe-title {
	flex: 1 0 100%;
	margin: 0 0 4px;
	font-size: 17px;
}

.adromax-crm-subscribe-input {
	flex: 1 1 180px;
	min-width: 0;
	padding: 11px 13px;
	border: 1px solid #d0dee3;
	border-radius: 8px;
	font-size: 15px;
}

.adromax-crm-subscribe-input:focus {
	outline: 2px solid var(--adromax-form-accent, #0F75A1);
	outline-offset: -1px;
	border-color: transparent;
}

.adromax-crm-subscribe-btn {
	padding: 11px 20px;
	border: 0;
	border-radius: 8px;
	background: var(--adromax-form-accent, #0F75A1);
	color: var(--adromax-form-on-accent, #fff);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.adromax-crm-subscribe-btn:hover {
	filter: brightness(0.94);
}

.adromax-crm-subscribe-done {
	flex: 1 0 100%;
	margin: 4px 0 0;
	color: #4C7C2C;
	font-size: 14px;
}

/* ---- First-party reviews: collection form + display ---------------- */
.adromax-crm-review-form {
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-width: 560px;
}

.adromax-crm-review-input {
	padding: 11px 13px;
	border: 1px solid #d0dee3;
	border-radius: 8px;
	font-size: 15px;
	font-family: inherit;
	width: 100%;
	box-sizing: border-box;
}

.adromax-crm-review-btn {
	align-self: flex-start;
	padding: 11px 22px;
	border: 0;
	border-radius: 8px;
	background: var(--adromax-form-accent, #0F75A1);
	color: var(--adromax-form-on-accent, #fff);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.adromax-crm-review-thanks {
	margin: 0;
	color: #4C7C2C;
	font-weight: 600;
}

/*
 * The star picker renders in reverse DOM order (5 → 1) so that a pure-CSS
 * sibling selector can highlight the chosen star AND every star to its
 * left. `~` only reaches forward, so 5-first is what makes "3 stars" light
 * three of them without any JavaScript.
 */
.adromax-crm-review-stars {
	display: inline-flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
	gap: 2px;
	font-size: 30px;
	line-height: 1;
}

.adromax-crm-review-stars input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.adromax-crm-review-stars label {
	color: #d0dee3;
	cursor: pointer;
	transition: color 0.12s ease;
}

.adromax-crm-review-stars input:checked ~ label,
.adromax-crm-review-stars label:hover,
.adromax-crm-review-stars label:hover ~ label {
	color: #f59e0b;
}

.adromax-crm-review-stars input:focus-visible + label {
	outline: 2px solid var(--adromax-form-accent, #0F75A1);
	outline-offset: 2px;
}

.adromax-crm-reviews {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.adromax-crm-reviews-summary {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 17px;
}

.adromax-crm-reviews-stars {
	color: #f59e0b;
	letter-spacing: 1px;
}

.adromax-crm-review {
	padding: 16px;
	border: 1px solid #e3ecf1;
	border-radius: 10px;
	background: #fff;
}

.adromax-crm-review-head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 8px;
}

.adromax-crm-review-author {
	font-weight: 600;
}

.adromax-crm-review-body {
	margin: 0;
	line-height: 1.6;
	color: #2F434B;
}

.adromax-crm-review-reply {
	margin-top: 12px;
	padding: 12px;
	border-radius: 8px;
	background: #f1f7fa;
	border-left: 3px solid var(--adromax-form-accent, #0F75A1);
	font-size: 14px;
}

.adromax-crm-review-reply p {
	margin: 4px 0 0;
	color: #425660;
}

/* =========================================================================
 * 2.50.0 — presentation system.
 *
 * Every rule below is scoped to a class on the form element, so a site
 * that never picks a style keeps exactly the look it had. Three axes —
 * style, corners, density — compose, rather than six complete themes
 * that would each drift out of sync with the others.
 *
 * All of it derives from --adromax-form-accent, so changing a site's
 * colour changes the whole form and the styles stay on-brand.
 * ========================================================================= */

.adromax-crm-form {
	--adx-radius: 9px;
	--adx-pad-y: 11px;
	--adx-pad-x: 13px;
	--adx-gap: 16px;
	--adx-border: #d6dfe6;
	--adx-field-bg: #fff;
	--adx-label: #1d2433;
	--adx-muted: #5d6675;
	box-sizing: border-box;
	max-width: 100%;
}

.adromax-crm-form *,
.adromax-crm-form *::before,
.adromax-crm-form *::after { box-sizing: border-box; }

/* ---- the control baseline: one set of rules, every input type ---- */
.adromax-crm-form input[type="text"],
.adromax-crm-form input[type="email"],
.adromax-crm-form input[type="tel"],
.adromax-crm-form input[type="url"],
.adromax-crm-form input[type="number"],
.adromax-crm-form input[type="date"],
.adromax-crm-form input[type="time"],
.adromax-crm-form select,
.adromax-crm-form textarea {
	display: block;
	width: 100%;
	min-width: 0;
	padding: var(--adx-pad-y) var(--adx-pad-x);
	border: 1px solid var(--adx-border);
	border-radius: var(--adx-radius);
	background: var(--adx-field-bg);
	color: var(--adx-label);
	font: inherit;
	font-size: 16px; /* under 16px, iOS Safari zooms the page on focus */
	line-height: 1.4;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.adromax-crm-form textarea { min-height: 110px; resize: vertical; }

.adromax-crm-form input:focus,
.adromax-crm-form select:focus,
.adromax-crm-form textarea:focus {
	outline: none;
	border-color: var(--adromax-form-accent, #0F75A1);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--adromax-form-accent, #0F75A1) 22%, transparent);
}

.adromax-crm-form label {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
	font-size: .92rem;
	color: var(--adx-label);
	line-height: 1.45;
}

.adromax-crm-form .adromax-crm-field { margin-bottom: var(--adx-gap); }

/* A required marker that does not rely on colour alone. */
.adromax-crm-form label .adx-req,
.adromax-crm-form label abbr[title] {
	color: var(--adromax-form-accent, #0F75A1);
	text-decoration: none;
	margin-left: 2px;
}

/* ---- the name row (see Crm_Form_Builder::render_field) ---- */
.adromax-crm-name-row { display: flex; gap: 8px; }
.adromax-crm-name-row input { flex: 1 1 0; min-width: 0; }

@media (max-width: 420px) {
	.adromax-crm-name-row { flex-direction: column; }
}

/* ---- two-column layout, on wide containers only ---- */
@media (min-width: 680px) {
	.adromax-crm-form.adx-cols-two .adromax-crm-step {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 0 var(--adx-gap);
	}
	/* Things that must never be half-width. */
	.adromax-crm-form.adx-cols-two .adromax-crm-step > .adromax-crm-form-step-nav,
	.adromax-crm-form.adx-cols-two .adromax-crm-step > .adromax-crm-form-step-title,
	.adromax-crm-form.adx-cols-two .adromax-crm-step > .adx-full { grid-column: 1 / -1; }
}

/* ---- density ---- */
.adromax-crm-form.adx-density-compact { --adx-pad-y: 8px; --adx-pad-x: 11px; --adx-gap: 11px; }
.adromax-crm-form.adx-density-roomy   { --adx-pad-y: 15px; --adx-pad-x: 16px; --adx-gap: 24px; }

/* ---- corners ---- */
.adromax-crm-form.adx-corners-square  { --adx-radius: 0; }
.adromax-crm-form.adx-corners-rounded { --adx-radius: 9px; }
.adromax-crm-form.adx-corners-pill    { --adx-radius: 999px; }
/* A pill textarea looks broken, so it keeps a sane radius. */
.adromax-crm-form.adx-corners-pill textarea { border-radius: 14px; }

/* ---- style: classic ----
 * The baseline look, stated rather than implied. The custom properties
 * on .adromax-crm-form already hold these values, so this block changes
 * nothing today — but "classic" is one of six choices in a dropdown, and
 * a choice that matches no rule is a choice that silently stops working
 * the first time somebody edits the defaults above. */
.adromax-crm-form.adx-style-classic {
	--adx-border: #d6dfe6;
	--adx-field-bg: #fff;
}

.adromax-crm-form.adx-style-classic label { font-weight: 600; }

/* ---- style: minimal ---- */
.adromax-crm-form.adx-style-minimal { --adx-border: #e7ebf0; }
.adromax-crm-form.adx-style-minimal label { font-weight: 500; color: var(--adx-muted); font-size: .86rem; letter-spacing: .01em; }

/* ---- style: underline ---- */
.adromax-crm-form.adx-style-underline input[type="text"],
.adromax-crm-form.adx-style-underline input[type="email"],
.adromax-crm-form.adx-style-underline input[type="tel"],
.adromax-crm-form.adx-style-underline input[type="url"],
.adromax-crm-form.adx-style-underline input[type="number"],
.adromax-crm-form.adx-style-underline select,
.adromax-crm-form.adx-style-underline textarea {
	border: 0;
	border-bottom: 1.5px solid var(--adx-border);
	border-radius: 0;
	padding-left: 0;
	padding-right: 0;
	background: transparent;
}

.adromax-crm-form.adx-style-underline input:focus,
.adromax-crm-form.adx-style-underline select:focus,
.adromax-crm-form.adx-style-underline textarea:focus {
	box-shadow: none;
	border-bottom-color: var(--adromax-form-accent, #0F75A1);
	border-bottom-width: 2px;
}

/* ---- style: card ---- */
.adromax-crm-form.adx-style-card {
	background: #fff;
	border: 1px solid #e7ebf0;
	border-radius: 16px;
	padding: 26px 22px;
	box-shadow: 0 2px 18px rgba(22, 36, 62, .07);
}

@media (max-width: 520px) {
	.adromax-crm-form.adx-style-card { padding: 20px 16px; }
}

/* ---- style: contrast ---- */
.adromax-crm-form.adx-style-contrast { --adx-field-bg: #f3f5f8; --adx-border: transparent; }
.adromax-crm-form.adx-style-contrast label { font-weight: 700; font-size: .95rem; }
.adromax-crm-form.adx-style-contrast input:focus,
.adromax-crm-form.adx-style-contrast select:focus,
.adromax-crm-form.adx-style-contrast textarea:focus { --adx-field-bg: #fff; border-color: var(--adromax-form-accent, #0F75A1); }

/* ---- style: dark ---- */
.adromax-crm-form.adx-style-dark {
	--adx-field-bg: rgba(255, 255, 255, .06);
	--adx-border: rgba(255, 255, 255, .22);
	--adx-label: #f2f5fa;
	--adx-muted: #c3ccda;
	color: #f2f5fa;
}

.adromax-crm-form.adx-style-dark input,
.adromax-crm-form.adx-style-dark select,
.adromax-crm-form.adx-style-dark textarea { color: #f2f5fa; }

.adromax-crm-form.adx-style-dark input::placeholder,
.adromax-crm-form.adx-style-dark textarea::placeholder { color: rgba(255, 255, 255, .5); }

.adromax-crm-form.adx-style-dark .adromax-crm-choice-option,
.adromax-crm-form.adx-style-dark .adromax-crm-form-message { color: #f2f5fa; }

/* ---- the message line ---- */
.adromax-crm-form .adromax-crm-form-message { margin: 14px 0 0; font-size: .95rem; line-height: 1.6; }
.adromax-crm-form .adromax-crm-form-message.is-success { color: #166534; font-weight: 600; }
.adromax-crm-form .adromax-crm-form-message.is-error { color: #b42318; font-weight: 600; }
.adromax-crm-form.adx-style-dark .adromax-crm-form-message.is-success { color: #86efac; }
.adromax-crm-form.adx-style-dark .adromax-crm-form-message.is-error { color: #fca5a5; }

/* A field the browser or our own validation rejected. */
.adromax-crm-form input[aria-invalid="true"],
.adromax-crm-form select[aria-invalid="true"],
.adromax-crm-form textarea[aria-invalid="true"] { border-color: #b42318; }
