/* Override these variables in your theme's stylesheet to match each site's design system. */
.pqf-form {
	--pqf-primary: #1a1a1a;
	--pqf-primary-hover: #333333;
	--pqf-text: #1a1a1a;
	--pqf-muted: #6b6b6b;
	--pqf-border: #e0e0e0;
	--pqf-radius: 6px;
	--pqf-error: #c8102e;
	--pqf-success: #1a7a3c;

	max-width: 640px;
	font-family: inherit;
	color: var(--pqf-text);
}

.pqf-form .pqf-row {
	margin-bottom: 1.1em;
	display: flex;
	flex-direction: column;
}

/* Native <fieldset>/<legend> carry browser default border/padding/margin
   that would otherwise show up as an unwanted box and offset spacing -
   reset them to blend in exactly like the plain <div>s they replaced.
   min-width:0 avoids a long-standing fieldset-as-flex-item sizing quirk. */
.pqf-form fieldset {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.pqf-form legend {
	display: block;
	width: 100%;
	padding: 0;
	margin: 0 0 0.35em;
	font-weight: 600;
	font-size: 0.95em;
}

/* Layout: fields flow in a wrapping row so "half width" fields sit two per
   line (Name/Email, Phone/Quantity, etc.), matching how most quote forms are
   laid out. Falls back to full-width stacking on narrow phones. */
.pqf-fields-wrap,
.pqf-step {
	display: flex;
	flex-wrap: wrap;
	column-gap: 1.25em;
}

.pqf-row.pqf-w-full {
	flex: 0 0 100%;
	max-width: 100%;
}

.pqf-row.pqf-w-half {
	flex: 0 0 100%;
	max-width: 100%;
}

/* 1.10.6: container query - half-width fields pair up based on the width
   the form actually has (sidebar, column, popup), not the screen width. */
.pqf-form {
	container: pqf-form / inline-size;
}

@container pqf-form (min-width: 480px) {
	.pqf-row.pqf-w-half {
		flex: 0 0 calc(50% - 0.625em);
		max-width: calc(50% - 0.625em);
	}
}

.pqf-checkbox-label {
	display: flex !important;
	flex-direction: row !important;
	align-items: center;
	gap: 0.5em;
	font-weight: normal !important;
}

/* Inline field validation - a red border plus a small warning-triangle
   message under the field, shown on blur or on attempted submit/step
   advance, replacing the browser's own validation tooltip. */
.pqf-field-error {
	display: flex;
	align-items: center;
	gap: 0.4em;
	margin-top: 0.45em;
	color: var(--pqf-error);
	font-size: 0.85em;
	line-height: 1.3;
}

.pqf-field-error svg {
	flex-shrink: 0;
}

.pqf-form input.pqf-invalid,
.pqf-form select.pqf-invalid,
.pqf-form textarea.pqf-invalid {
	border-color: var(--pqf-error) !important;
}

/* Drag-and-drop upload zone */
.pqf-dropzone-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 0.4em;
	padding: 1.75em 1em;
	border: 2px dashed var(--pqf-border);
	border-radius: var(--pqf-radius);
	cursor: pointer;
	color: var(--pqf-muted);
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.pqf-dropzone-inner:hover,
.pqf-dropzone.pqf-dropzone-hover .pqf-dropzone-inner {
	border-color: var(--pqf-primary);
	background: rgba(0, 0, 0, 0.02);
}

.pqf-dropzone-inner svg {
	color: var(--pqf-muted);
}

.pqf-dropzone-text {
	font-size: 0.95em;
	color: var(--pqf-text);
}

.pqf-choose-link {
	color: var(--pqf-primary);
	text-decoration: underline;
	font-weight: 600;
}

.pqf-dropzone-hint {
	font-size: 0.8em;
	color: var(--pqf-muted);
}

.pqf-file-list {
	list-style: none;
	margin: 0.6em 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.4em;
}

.pqf-file-item {
	display: flex;
	align-items: center;
	gap: 0.7em;
	padding: 0.5em 0.7em;
	background: #f7f7f7;
	border-radius: var(--pqf-radius);
	font-size: 0.85em;
}

.pqf-file-thumb {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border-radius: 4px;
	overflow: hidden;
	background: #222;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pqf-file-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.pqf-file-thumb-generic {
	color: #fff;
	font-size: 0.65em;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.pqf-file-info {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.15em;
	min-width: 0;
}

.pqf-file-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pqf-file-size {
	color: var(--pqf-muted);
	font-size: 0.9em;
}

.pqf-file-remove {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 1.2em;
	line-height: 1;
	color: var(--pqf-muted);
	padding: 0 0.2em;
}

.pqf-file-remove:hover {
	color: var(--pqf-error);
}

.pqf-form label {
	font-weight: 600;
	margin-bottom: 0.35em;
	font-size: 0.95em;
}

.pqf-form .pqf-req {
	color: var(--pqf-error);
	margin-left: 2px;
}

.pqf-form input[type="text"],
.pqf-form input[type="email"],
.pqf-form input[type="tel"],
.pqf-form input[type="number"],
.pqf-form input[type="file"],
.pqf-form select,
.pqf-form textarea {
	padding: 0.65em 0.8em;
	border: 1px solid var(--pqf-border);
	border-radius: var(--pqf-radius);
	font-size: 1em;
	font-family: inherit;
	width: 100%;
	box-sizing: border-box;
}

.pqf-form textarea {
	resize: vertical;
}

.pqf-hp-wrap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.pqf-submit-row {
	flex-direction: row;
	align-items: center;
	gap: 0.75em;
}

.pqf-submit-btn {
	background: var(--pqf-primary);
	color: #fff;
	border: none;
	padding: 0.8em 1.6em;
	border-radius: var(--pqf-radius);
	font-size: 1em;
	font-weight: 600;
	cursor: pointer;
}

.pqf-submit-btn:hover {
	background: var(--pqf-primary-hover);
}

.pqf-submit-btn:disabled {
	opacity: 0.6;
	cursor: default;
}

.pqf-spinner {
	color: var(--pqf-muted);
	font-size: 0.9em;
}

.pqf-message {
	margin-top: 1em;
	padding: 0.8em 1em;
	border-radius: var(--pqf-radius);
	font-size: 0.95em;
}

.pqf-message.pqf-success {
	background: rgba(26, 122, 60, 0.1);
	color: var(--pqf-success);
}

.pqf-message.pqf-error {
	background: rgba(200, 16, 46, 0.08);
	color: var(--pqf-error);
}

/* ---- Multi-step wizard (v1.3) ---- */

/* Native <progress> element, restyled to match the original custom bar look.
   The track/fill split that a nested-div bar gets automatically has to be
   done via these pseudo-elements instead - Firefox uses ::-moz-progress-bar
   for the fill (and the value color is set on the host element itself for
   the track), WebKit/Blink use ::-webkit-progress-bar/-value. */
.pqf-progress-bar {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	display: block;
	width: 100%;
	height: 6px;
	border: none;
	border-radius: 999px;
	overflow: hidden;
	background: var(--pqf-border);
	margin-bottom: 0.6em;
}

.pqf-progress-bar::-webkit-progress-bar {
	background: var(--pqf-border);
	border-radius: 999px;
}

.pqf-progress-bar::-webkit-progress-value {
	background: var(--pqf-primary);
	border-radius: 999px;
	transition: width 0.25s ease;
}

.pqf-progress-bar::-moz-progress-bar {
	background: var(--pqf-primary);
	border-radius: 999px;
	transition: width 0.25s ease;
}

.pqf-step-title {
	margin: 0 0 1.2em;
	font-size: 0.85em;
	font-weight: 600;
	color: var(--pqf-muted);
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.pqf-step-nav {
	flex-direction: row;
	justify-content: space-between;
	align-items: center;
}

.pqf-step-next,
.pqf-step-back {
	padding: 0.75em 1.5em;
	border-radius: var(--pqf-radius);
	font-size: 0.95em;
	font-weight: 600;
	cursor: pointer;
}

.pqf-step-next {
	background: var(--pqf-primary);
	color: #fff;
	border: none;
	margin-left: auto;
}

.pqf-step-next:hover {
	background: var(--pqf-primary-hover);
}

.pqf-step-back {
	background: transparent;
	color: var(--pqf-text);
	border: 1px solid var(--pqf-border);
}

.pqf-submit-row .pqf-step-back {
	margin-right: auto;
}

/* ---- CAPTCHA (v1.3) ---- */

.pqf-captcha-row input[type="number"] {
	max-width: 140px;
}

.pqf-status-completed {
	color: #1a7a3c;
	font-weight: 600;
}

.pqf-status-abandoned {
	color: #a06a00;
	font-weight: 600;
}

.pqf-unread-row {
	font-weight: 700;
}

.pqf-unread-row .pqf-status-completed,
.pqf-unread-row .pqf-status-abandoned {
	font-weight: 700;
}

.pqf-star {
	text-decoration: none;
	font-size: 1.3em;
	color: #c0c0c0;
}

.pqf-star-on {
	color: #e0a800;
}

.pqf-lead {
	display: inline-block;
	padding: 2px 9px;
	border-radius: 999px;
	font-size: 0.82em;
	font-weight: 600;
}

.pqf-lead-new {
	background: #eef0f2;
	color: #50575e;
}

.pqf-lead-contacted {
	background: #e0f0ff;
	color: #0a5ca8;
}

.pqf-lead-quoted {
	background: #fff3d9;
	color: #a06a00;
}

.pqf-lead-won {
	background: #e5f5ea;
	color: #1a7a3c;
}

.pqf-lead-lost {
	background: #fbe6e8;
	color: #b32d2e;
}

/* Entry detail screen */
.pqf-detail-wrap {
	display: flex;
	gap: 20px;
	align-items: flex-start;
	margin-top: 16px;
}

.pqf-detail-main {
	flex: 2;
	min-width: 0;
}

.pqf-detail-side {
	flex: 1;
	min-width: 260px;
}

.pqf-box {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	margin-bottom: 20px;
}

.pqf-box-header {
	padding: 12px 16px;
	border-bottom: 1px solid #dcdcde;
	font-weight: 600;
}

.pqf-box-body {
	padding: 0;
}

.pqf-detail-row {
	display: flex;
	justify-content: space-between;
	padding: 10px 16px;
	border-bottom: 1px solid #f0f0f1;
}

.pqf-detail-row:nth-child(odd) {
	background: #f9f9fa;
}

.pqf-detail-row .pqf-detail-label {
	font-weight: 600;
	width: 40%;
}

.pqf-side-list {
	list-style: none;
	margin: 0;
	padding: 12px 16px;
}

.pqf-side-list li {
	padding: 6px 0;
	display: flex;
	align-items: center;
	gap: 8px;
}

.pqf-journey-day {
	background: #f0f0f1;
	padding: 8px 16px;
	font-weight: 600;
	font-size: 0.9em;
}

.pqf-journey-row {
	display: flex;
	justify-content: space-between;
	padding: 10px 16px;
	border-bottom: 1px solid #f0f0f1;
	font-size: 0.92em;
}

.pqf-journey-row.pqf-journey-submit {
	color: #1a7a3c;
	font-weight: 600;
}

@media print {
	.pqf-detail-side, #adminmenumain, #wpadminbar, .wrap > h1, #wpfooter {
		display: none !important;
	}
	.pqf-detail-wrap {
		display: block;
	}
}

/* Dashboard */
.pqf-dash-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.pqf-dash-range select {
	padding: 4px 8px;
}

.pqf-forms-table {
	margin-top: 20px;
}

.pqf-forms-table td,
.pqf-forms-table th {
	padding: 10px 12px;
}

.pqf-sparkline-cell {
	width: 150px;
}

.pqf-entries-toplinks {
	margin: 8px 0 14px;
}

@container pqf-form (max-width: 480px) {
	.pqf-step-nav {
		flex-wrap: wrap;
		gap: 0.6em;
	}
}

/* Radio buttons - vertical list of native radios with labels, styled to sit
   comfortably alongside the plugin's other fields. */
.pqf-radio-group {
	display: flex;
	flex-direction: column;
	gap: 0.5em;
	padding-top: 0.2em;
}
.pqf-radio-label {
	display: flex !important;
	flex-direction: row !important;
	align-items: center;
	gap: 0.5em;
	font-weight: normal !important;
	cursor: pointer;
}
.pqf-radio-group.pqf-invalid {
	outline: 1px solid var(--pqf-error);
	outline-offset: 4px;
	border-radius: var(--pqf-radius);
}

/* Star rating - a row of radios rendered high-to-low in the markup so the
   sibling selector below can fill "this star and every star to its right"
   (which is visually to the left, since flex-direction is reversed). Pure
   CSS: no JS needed for the hover/checked fill. */
.pqf-rating {
	display: inline-flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
	gap: 0.15em;
	font-size: 1.9rem;
	line-height: 1;
	padding-top: 0.1em;
}
.pqf-rating .pqf-star-input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}
.pqf-rating .pqf-star {
	color: var(--pqf-border);
	cursor: pointer;
	transition: color 0.15s ease;
	margin: 0;
}
/* Hover: highlight the hovered star and all that follow it in DOM order
   (visually to its left). Checked: same, persistently. */
.pqf-rating .pqf-star:hover,
.pqf-rating .pqf-star:hover ~ .pqf-star,
.pqf-rating .pqf-star-input:checked ~ .pqf-star {
	color: #e0a800;
}
.pqf-rating.pqf-invalid {
	outline: 1px solid var(--pqf-error);
	outline-offset: 4px;
	border-radius: var(--pqf-radius);
}

/* Field help text (sub-label) shown under the field label on the live form. */
.pqf-field-desc {
	display: block;
	font-size: 0.85em;
	color: var(--pqf-muted);
	margin: -0.15em 0 0.5em;
	line-height: 1.4;
}

/* File upload problems (over size / over count / wrong type / missing required file):
   red dropzone border and the offending file flagged until removed. Added 1.10.0. */
.pqf-dropzone.pqf-invalid .pqf-dropzone-inner {
	border-color: var(--pqf-error) !important;
}

.pqf-file-item.pqf-file-invalid {
	background: #fdecec;
	outline: 1px solid var(--pqf-error);
}

.pqf-file-item.pqf-file-invalid .pqf-file-size {
	color: var(--pqf-error);
	font-weight: 600;
}

/* 1.10.5: semantic markup. Rows, step nav, captcha, honeypot and the
   radio/star option lists are now <p> elements, and the status message is
   an <output> - reset the browser's default <p> margins and make <output>
   a block so everything sits exactly as the old <div>s did. */
.pqf-form p.pqf-row,
.pqf-form p.pqf-hp-wrap,
.pqf-form p.pqf-radio-group,
.pqf-form p.pqf-rating {
	margin-top: 0;
}
.pqf-form p.pqf-radio-group,
.pqf-form p.pqf-rating {
	margin-bottom: 0;
}
.pqf-form output.pqf-message {
	display: block;
}
.pqf-form output.pqf-message[hidden] {
	display: none;
}

/* 1.10.6: native validation states. The JS calls setCustomValidity() with
   its own messages, so :user-invalid matches exactly when a field is
   invalid AND the visitor has interacted with it (never on page load).
   The .pqf-invalid class stays as a fallback (and covers a submit attempt
   on untouched fields). */
.pqf-form input:user-invalid,
.pqf-form select:user-invalid,
.pqf-form textarea:user-invalid {
	border-color: var(--pqf-error) !important;
}

/* Style the whole field group from its state with :has() - the label or
   legend turns red while the field inside it is invalid. */
.pqf-form .pqf-row:has(.pqf-invalid, [aria-invalid="true"]) > label,
.pqf-form .pqf-row:has(.pqf-invalid, [aria-invalid="true"]) > legend {
	color: var(--pqf-error);
}
/* Kept in its own rule: a browser without :user-invalid drops only this. */
.pqf-form .pqf-row:has(:user-invalid) > label,
.pqf-form .pqf-row:has(:user-invalid) > legend {
	color: var(--pqf-error);
}

/* The error box and anything else carrying the hidden attribute must stay
   hidden even where the stylesheet gives it a display value. */
.pqf-form [hidden] {
	display: none !important;
}

/* 1.10.7: visually hidden but still read by screen readers and, for the
   file input, still reachable with the keyboard (unlike the hidden attr). */
.pqf-form .pqf-visually-hidden {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0 0 0 0) !important;
	clip-path: inset(50%) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Keyboard focus on the (visually hidden) file input shows on the drop zone. */
.pqf-form .pqf-dropzone-input:focus-visible + .pqf-dropzone-inner {
	outline: 2px solid var(--pqf-primary);
	outline-offset: 3px;
}
