/**
 * Deer Texas — AWPCP member-facing form system
 * v0.3.0 — rewritten after production QA.
 *
 * WHY v0.2.1 FAILED (two separate, proven defects)
 *
 *  1. SPECIFICITY TIE, LOST ON SOURCE ORDER.
 *     Salient ships body[data-form-style="minimal"] rules in the GENERATED
 *     stylesheet /wp-content/uploads/salient/salient-dynamic-styles.css.
 *     Production body carries data-form-style="minimal" (verified), which is
 *     Salient's underline-only input mode.
 *       Salient : body[data-form-style="minimal"] input[type=text]   -> (0,2,2)
 *       v0.2.1  : body .awpcp-submit-listing-section input[type=text] -> (0,2,2)
 *     A tie is resolved by load order, and the generated stylesheet wins.
 *     FIX: every rule here is scoped with
 *          body[data-form-style] .awpcp-submit-listing-section ...   -> (0,3,2)
 *     which beats it on specificity, independent of load order.
 *
 *  2. MISSING PROPERTY.
 *     AWPCP sets .awpcp-submit-listing-section-title{background:#d2d2d2}.
 *     v0.2.1 restyled that selector but never declared `background`, so the
 *     grey bar survived. That is why the section headers still looked stock.
 *
 * AWPCP's own stylesheet contains exactly ONE !important site-wide, so it is
 * not fighting us. This remains a pure CSS pass: no markup is replaced, no
 * control is faked, and every AWPCP name/id/validation/AJAX hook is untouched.
 *
 * SCOPE: only the AWPCP submit/edit listing sections. Nothing global.
 */

/* ---------- tokens (reuse the live MemberPress account system) ---------- */
body[data-form-style] .awpcp-submit-listing-section,
body[data-form-style] .awpcp-submit-listing-section-container,
.dtx-seller-guide {
	--f-surface: var(--dt-acct-surface, #fffefb);
	--f-ink:     var(--dt-acct-ink, #1b1b1b);
	--f-body:    var(--dt-acct-body, #575757);
	--f-muted:   var(--dt-acct-muted, #8d8d8d);
	--f-line:    var(--dt-acct-line, #d7d7d2);
	--f-soft:    var(--dt-acct-line-soft, #ecebe6);
	--f-gold:    var(--dt-acct-gold, #e8c33c);
	--f-gold-dp: var(--dt-acct-gold-deep, #cfa724);
	--f-gold-ink:var(--dt-acct-gold-ink, #8a6a0c);
	--f-radius:  var(--dt-acct-radius, 12px);
	--f-field-h: var(--dt-acct-field-h, 48px);
	--f-field-r: var(--dt-acct-field-r, 7px);
	--f-error:   var(--dt-acct-error, #b3423c);
}

/* ---------- section cards ---------- */
body[data-form-style] .awpcp-submit-listing-section {
	background: var(--f-surface);
	border: 1px solid var(--f-soft);
	border-radius: var(--f-radius);
	padding: 0 26px 24px;
	margin: 0 0 20px;
	box-shadow: var(--dt-shadow, 0 1px 2px rgba(0,0,0,.03), 0 10px 30px -18px rgba(0,0,0,.35));
	overflow: hidden;
}

/* THE GREY BAR FIX — `background` is the property v0.2.1 omitted. */
body[data-form-style] .awpcp-submit-listing-section .awpcp-submit-listing-section-title,
body[data-form-style] .awpcp-submit-listing-section-title {
	background: transparent;
	background-color: transparent;
	background-image: none;
	color: var(--f-ink);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	margin: 0 -26px 20px;
	padding: 18px 26px 13px;
	border: 0;
	border-bottom: 1px solid var(--f-soft);
	border-radius: 0;
}

/* Other stock grey bars AWPCP paints. */
body[data-form-style] .awpcp-submit-listing-section .awpcp-title,
body[data-form-style] .awpcp-submit-listing-section .awpcp-uploaded-files-group-title,
body[data-form-style] .awpcp-media-center .awpcp-uploaded-files-group-title {
	background: transparent;
	color: var(--f-muted);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .05em;
	text-transform: uppercase;
	padding: 0 0 8px;
	border: 0;
}

/* ---------- responsive field grid ---------- */
/* auto-fit rather than a forced 2-up, so narrow/semantic fields are not
   jammed side by side; long fields opt out below. */
body[data-form-style] .awpcp-submit-listing-section-content .awpcp-fields,
body[data-form-style] .awpcp-listing-fields-submit-listing-section .awpcp-submit-listing-section-content {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
	gap: 4px 22px;
	align-items: start;
}

body[data-form-style] .awpcp-form-field,
body[data-form-style] .awpcp-extra-field {
	margin: 0 0 18px;
	float: none;
	width: auto;
	min-width: 0;
}

/* Long-form fields always span the full row. */
body[data-form-style] .awpcp-form-field:has(textarea),
body[data-form-style] .awpcp-extra-field:has(textarea),
body[data-form-style] .awpcp-form-field:has(.deertexas-options),
body[data-form-style] .awpcp-extra-field:has(.deertexas-options),
body[data-form-style] .awpcp-form-field--full,
body[data-form-style] .awpcp-media-manager,
body[data-form-style] .awpcp-media-manager-upload-form {
	grid-column: 1 / -1;
}

/* ---------- labels ---------- */
body[data-form-style] .awpcp-submit-listing-section .awpcp-form-field__label,
body[data-form-style] .awpcp-submit-listing-section .awpcp-form-field > label,
body[data-form-style] .awpcp-submit-listing-section .awpcp-extra-field > label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .01em;
	color: var(--f-ink);
	margin: 0 0 7px;
	text-transform: none;
	line-height: 1.35;
}

body[data-form-style] .awpcp-submit-listing-section .required {
	color: var(--f-error);
	margin-left: 3px;
}

/* ---------- inputs: (0,3,2) beats Salient's (0,2,2) ---------- */
body[data-form-style] .awpcp-submit-listing-section input[type="text"],
body[data-form-style] .awpcp-submit-listing-section input[type="email"],
body[data-form-style] .awpcp-submit-listing-section input[type="url"],
body[data-form-style] .awpcp-submit-listing-section input[type="tel"],
body[data-form-style] .awpcp-submit-listing-section input[type="number"],
body[data-form-style] .awpcp-submit-listing-section input[type="date"],
body[data-form-style] .awpcp-submit-listing-section input[type="password"],
body[data-form-style] .awpcp-submit-listing-section select,
body[data-form-style] .awpcp-submit-listing-section textarea {
	display: block;
	width: 100%;
	box-sizing: border-box;
	min-height: var(--f-field-h);
	height: auto;
	margin: 0;
	padding: 11px 14px;
	font-size: 15px;
	line-height: 1.4;
	color: var(--f-ink);
	background: #fff;
	background-color: #fff;
	border: 1px solid var(--f-line);
	border-radius: var(--f-field-r);
	box-shadow: none;
	transition: border-color .15s ease, box-shadow .15s ease;
	-webkit-appearance: none;
	appearance: none;
}

body[data-form-style] .awpcp-submit-listing-section textarea {
	min-height: 170px;
	line-height: 1.55;
	resize: vertical;
}

body[data-form-style] .awpcp-submit-listing-section select {
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%238d8d8d' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 38px;
}

body[data-form-style] .awpcp-submit-listing-section input:focus,
body[data-form-style] .awpcp-submit-listing-section select:focus,
body[data-form-style] .awpcp-submit-listing-section textarea:focus {
	outline: none;
	border-color: var(--f-gold-dp);
	box-shadow: 0 0 0 3px rgba(232,195,60,.22);
}

body[data-form-style] .awpcp-submit-listing-section input[disabled],
body[data-form-style] .awpcp-submit-listing-section select[disabled] {
	background: #f6f6f4;
	color: var(--f-muted);
	cursor: not-allowed;
}

/* ---------- choice groups ----------
   .deertexas-options is the Deer Texas custom-field wrapper (verified in
   deertexas-awpcp-fields-bridge.php) used by Lease Type, Game Type,
   Accommodations and Lodging. Native inputs are kept — only the chrome
   around them changes, so checked/disabled/keyboard semantics are intact. */
body[data-form-style] .awpcp-submit-listing-section .deertexas-options {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
	gap: 8px;
	margin-top: 2px;
}

body[data-form-style] .awpcp-submit-listing-section .deertexas-options label {
	display: flex;
	align-items: center;
	gap: 9px;
	min-height: 42px;
	margin: 0;
	padding: 8px 13px;
	font-size: 14px;
	font-weight: 500;
	color: var(--f-ink);
	background: #fff;
	border: 1px solid var(--f-line);
	border-radius: var(--f-field-r);
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease;
}

body[data-form-style] .awpcp-submit-listing-section .deertexas-options label:hover {
	border-color: var(--f-gold-dp);
	background: #fffdf3;
}

body[data-form-style] .awpcp-submit-listing-section .deertexas-options input[type="checkbox"],
body[data-form-style] .awpcp-submit-listing-section .deertexas-options input[type="radio"] {
	width: 17px;
	height: 17px;
	min-height: 0;
	margin: 0;
	flex: 0 0 auto;
	accent-color: var(--f-gold-dp);
	cursor: pointer;
}

body[data-form-style] .awpcp-submit-listing-section .deertexas-options label:focus-within {
	border-color: var(--f-gold-dp);
	box-shadow: 0 0 0 3px rgba(232,195,60,.22);
}

/* Native AWPCP radio/checkbox rows that are not in .deertexas-options. */
body[data-form-style] .awpcp-submit-listing-section input[type="checkbox"],
body[data-form-style] .awpcp-submit-listing-section input[type="radio"] {
	width: 17px;
	height: 17px;
	min-height: 0;
	accent-color: var(--f-gold-dp);
	vertical-align: middle;
}

/* ---------- buttons (AWPCP listing forms only) ---------- */
body[data-form-style] .awpcp-submit-listing-section input[type="submit"],
body[data-form-style] .awpcp-submit-listing-section button[type="submit"],
body[data-form-style] .awpcp-submit-listing-section .awpcp-order-submit-listing-section--continue-button,
body[data-form-style] .awpcp-submit-listing-section .awpcp-order-submit-listing-section--change-selection-button,
body[data-form-style] .awpcp-actions-submit-listing-section input[type="submit"],
body[data-form-style] .awpcp-save-submit-listing-section input[type="submit"] {
	display: inline-block;
	width: auto;
	min-height: var(--f-field-h);
	padding: 0 26px;
	font-size: 15px;
	font-weight: 700;
	line-height: var(--f-field-h);
	color: var(--f-gold-ink);
	background: var(--f-gold);
	border: 1px solid var(--f-gold-dp);
	border-radius: var(--f-field-r);
	box-shadow: none;
	cursor: pointer;
	transition: background .15s ease, transform .15s ease;
}

body[data-form-style] .awpcp-submit-listing-section input[type="submit"]:hover,
body[data-form-style] .awpcp-submit-listing-section button[type="submit"]:hover {
	background: var(--f-gold-dp);
	transform: translateY(-1px);
}

/* Secondary action reads as secondary. */
body[data-form-style] .awpcp-submit-listing-section .awpcp-order-submit-listing-section--change-selection-button {
	color: var(--f-ink);
	background: #fff;
	border-color: var(--f-line);
}

/* ---------- order / category section ---------- */
body[data-form-style] .awpcp-order-submit-listing-section--selected-categories {
	padding: 12px 14px;
	background: #fff;
	border: 1px solid var(--f-line);
	border-radius: var(--f-field-r);
	font-size: 14.5px;
	color: var(--f-ink);
}

body[data-form-style] .awpcp-order-submit-listing-section--loading-message {
	color: var(--f-muted);
	font-size: 14px;
}

/* ---------- upload area ---------- */
body[data-form-style] .awpcp-media-manager-upload-form {
	position: relative;
	padding: 34px 24px;
	text-align: center;
	background: linear-gradient(180deg, #fffdf6 0%, var(--f-surface) 100%);
	border: 2px dashed var(--f-line);
	border-radius: var(--f-field-r);
	transition: border-color .15s ease, background .15s ease;
}

body[data-form-style] .awpcp-media-manager-upload-form:hover {
	border-color: var(--f-gold-dp);
	background: #fffbea;
}

body[data-form-style] .awpcp-media-manager-file-list {
	margin-top: 14px;
}

/* ---------- validation ---------- */
body[data-form-style] .awpcp-submit-listing-section .awpcp-error,
body[data-form-style] .awpcp-submit-listing-section .error {
	display: block;
	margin-top: 6px;
	font-size: 12.5px;
	color: var(--f-error);
}

body[data-form-style] .awpcp-submit-listing-section input.awpcp-error,
body[data-form-style] .awpcp-submit-listing-section select.awpcp-error,
body[data-form-style] .awpcp-submit-listing-section textarea.awpcp-error {
	border-color: var(--f-error);
}

/* ---------- whitespace control ---------- */
body[data-form-style] .awpcp-submit-listing-section .awpcp-form-spacer {
	margin-bottom: 0;
	padding: 0;
}

body[data-form-style] .awpcp-submit-listing-section br {
	display: none;
}

body[data-form-style] .awpcp-submit-listing-section-content > p:empty {
	display: none;
}

/* ---------- seller guidance panel ---------- */
.dtx-seller-guide {
	background: var(--f-surface);
	border: 1px solid var(--f-soft);
	border-left: 3px solid var(--f-gold);
	border-radius: var(--f-radius);
	padding: 20px 24px;
	margin: 0 0 20px;
}

.dtx-seller-guide__title {
	font-size: 16px;
	font-weight: 700;
	color: var(--f-ink);
	margin: 0 0 6px;
	text-transform: none;
}

.dtx-seller-guide__lead {
	font-size: 14px;
	color: var(--f-body);
	margin: 0 0 12px;
}

.dtx-seller-guide__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 6px 22px;
}

.dtx-seller-guide__list li {
	position: relative;
	padding-left: 15px;
	font-size: 13.5px;
	line-height: 1.5;
	color: var(--f-body);
}

.dtx-seller-guide__list li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 8px;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--f-gold-dp);
}

.dtx-seller-guide__list strong { color: var(--f-ink); font-weight: 650; }

.dtx-upload-help {
	font-size: 13.5px;
	line-height: 1.55;
	color: var(--f-body);
	max-width: 520px;
	margin: 0 auto 14px;
}

/* ---------- responsive ---------- */
@media (max-width: 782px) {
	body[data-form-style] .awpcp-submit-listing-section-content .awpcp-fields,
	body[data-form-style] .awpcp-listing-fields-submit-listing-section .awpcp-submit-listing-section-content {
		grid-template-columns: 1fr;
	}

	body[data-form-style] .awpcp-submit-listing-section {
		padding: 0 16px 18px;
		border-radius: 10px;
	}

	body[data-form-style] .awpcp-submit-listing-section-title {
		margin: 0 -16px 15px;
		padding: 15px 16px 11px;
	}

	body[data-form-style] .awpcp-submit-listing-section input[type="text"],
	body[data-form-style] .awpcp-submit-listing-section input[type="tel"],
	body[data-form-style] .awpcp-submit-listing-section input[type="email"],
	body[data-form-style] .awpcp-submit-listing-section input[type="number"],
	body[data-form-style] .awpcp-submit-listing-section select,
	body[data-form-style] .awpcp-submit-listing-section textarea {
		font-size: 16px; /* prevents iOS zoom-on-focus */
	}

	body[data-form-style] .awpcp-submit-listing-section .deertexas-options {
		grid-template-columns: 1fr 1fr;
	}

	body[data-form-style] .awpcp-media-manager-upload-form { padding: 26px 16px; }

	.dtx-seller-guide { padding: 16px 18px; }
	.dtx-seller-guide__list { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
	body[data-form-style] .awpcp-submit-listing-section .deertexas-options {
		grid-template-columns: 1fr;
	}
}
