/**
 * Vendor edit form — restyled to match the supplied reference design
 * (chefcations-listing-form.html), same system as listing-edit-form.css.
 *
 * Design tokens, spacing, radii, control sizing, focus rings and the
 * 12-column span system are ported verbatim from that file so the two
 * forms read as the same product. Selectors are mapped onto HivePress's
 * real markup for THIS form — confirmed live on /account/settings/ rather
 * than assumed, since several details differ from the listing form:
 *
 *   - The vendor form's own class is `.hp-form--user-update` (this form
 *     covers both HivePress's core account fields and this theme's
 *     custom vendor attributes in one submit), not `-vendor-update`.
 *   - `skills[]` and `service_area[]` render as native checkbox lists
 *     (`.hp-form__field--checkboxes`, plural), not Select2 — no
 *     Select2 padding fix needed here.
 *   - Every checkbox-type field (`accepting_requests`, `verified_identity`)
 *     carries its own field-level label + description ABOVE the actual
 *     checkbox row, unlike the listing form's `booking_moderated`, which
 *     has no description. The checkbox rule below accounts for both.
 *
 * Everything is scoped under .ec-vendor-form so the listing edit form
 * (and every other HivePress form) is untouched.
 */

/* Card shell — applied to HivePress's own form-level class (ancestor of
 * both .hp-form__fields and the sibling .hp-form__footer) so the submit
 * button ends up visually inside the card, same reasoning as the listing
 * form. Confirmed unique to this one form on /account/settings/ — the
 * "delete account" mini-form is `.hp-form--user-delete`, unaffected. */
.hp-form--user-update {
	background: #ffffff;
	border: 1px solid #dce3e5;
	border-radius: 16px;
	box-shadow: 0 8px 28px rgba( 24, 35, 38, .06 );
	overflow: hidden;
}

.ec-vendor-form {
	--ecf-surface: #ffffff;
	--ecf-text: #182326;
	--ecf-muted: #667277;
	--ecf-line: #dce3e5;
	--ecf-accent: #087d78;
	--ecf-accent-dark: #05645f;
	--ecf-focus: rgba( 8, 125, 120, .18 );
	--ecf-danger: #b42318;

	color: var( --ecf-text );
}

/* ---------------------------------------------------------- sections */

.ec-vendor-form .ec-form-section {
	padding: 30px;
}

.ec-vendor-form .ec-form-section + .ec-form-section {
	border-top: 1px solid var( --ecf-line );
}

.ec-vendor-form .ec-section-heading {
	margin-bottom: 22px;
}

.ec-vendor-form .ec-section-heading h2 {
	margin: 0 0 4px;
	font-size: 1.15rem;
	line-height: 1.35;
	color: var( --ecf-text );
}

.ec-vendor-form .ec-section-heading p {
	margin: 0;
	color: var( --ecf-muted );
	font-size: .9rem;
}

/* ------------------------------------------------------- 12-col grid */

.ec-vendor-form .ec-field-grid {
	display: grid;
	grid-template-columns: repeat( 12, minmax( 0, 1fr ) );
	gap: 20px 18px;
	align-items: stretch;
}

/* Fields default to full width; explicit spans come from the JS config.
 * Span selectors repeat .ec-field-grid so they out-specify this default
 * rule — otherwise the 3-class default beats a 2-class span and every
 * field renders full width (same gotcha as the listing form). */
.ec-vendor-form .ec-field-grid > .hp-form__field {
	grid-column: span 12;
	min-width: 0;
}

.ec-vendor-form .ec-field-grid > .ec-span-3 { grid-column: span 3; }
.ec-vendor-form .ec-field-grid > .ec-span-4 { grid-column: span 4; }
.ec-vendor-form .ec-field-grid > .ec-span-6 { grid-column: span 6; }
.ec-vendor-form .ec-field-grid > .ec-span-8 { grid-column: span 8; }
.ec-vendor-form .ec-field-grid > .ec-span-12 { grid-column: span 12; }

/* Each field is a flex column so label/control/description can be
 * reordered independent of HivePress's own markup order (see below).
 * Checkbox-type fields keep their own natural layout — see the checkbox
 * block further down. */
.ec-vendor-form .ec-field-grid > .hp-form__field:not( .hp-form__field--checkbox ) {
	display: flex;
	flex-direction: column;
}

/* ------------------------------------------------------------ labels */

.ec-vendor-form .hp-field__label {
	display: block;
	margin: 0 0 7px;
	padding: 0;
	background: none;
	border: 0;
	color: var( --ecf-text );
	font-size: .93rem;
	font-weight: 650;
	text-transform: none; /* reference uses sentence case, not the theme's uppercase */
	letter-spacing: normal;
}

/* order only matters inside the column-flex fields this reordering
 * scheme targets — the checkbox field's own row layout has its own
 * natural sequence, and applying order:1 there would scramble it (same
 * gotcha as the listing form's booking_moderated). */
.ec-vendor-form .hp-form__field:not( .hp-form__field--checkbox ) > .hp-field__label {
	order: 1;
}

.ec-vendor-form .hp-field__label .ec-required {
	color: var( --ecf-danger );
}

/* Only required fields get a marker (the red asterisk hp-forms.js adds
 * next to the label text) — the "(optional)" tag HivePress renders for
 * every non-required field is removed entirely rather than
 * hidden-but-still-taking-space, since it no longer carries information
 * once required fields are the only ones marked. */
.ec-vendor-form .hp-field__label small {
	display: none;
}

/* Label → field box → help text. HivePress's own markup order is label,
 * then description, then the control — description sitting between
 * label and input is what caused uneven row alignment on the listing
 * form, so it's moved below the control via flex order here too. */
.ec-vendor-form .ec-field-grid > .hp-form__field:not( .hp-form__field--checkbox ) > *:last-child {
	order: 2;
}

.ec-vendor-form .hp-field__description {
	display: block;
	margin-top: 6px;
	color: var( --ecf-muted );
	font-size: .82rem;
	line-height: 1.45;
	order: 3;
}

/* ---------------------------------------------------------- controls */

.ec-vendor-form input[type="text"],
.ec-vendor-form input[type="number"],
.ec-vendor-form input[type="email"],
.ec-vendor-form input[type="url"],
.ec-vendor-form input[type="tel"],
.ec-vendor-form input[type="time"],
.ec-vendor-form input[type="password"],
.ec-vendor-form select,
.ec-vendor-form textarea {
	width: 100%;
	max-width: none; /* overrides the width caps in hp-forms.css — spans size fields here */
	min-height: 44px;
	border: 1px solid #bfc9cc;
	border-radius: 8px;
	background: #fff;
	color: var( --ecf-text );
	font: inherit;
	padding: 10px 12px;
	transition: border-color .15s, box-shadow .15s;
}

.ec-vendor-form input:focus,
.ec-vendor-form select:focus,
.ec-vendor-form textarea:focus {
	outline: 0;
	border-color: var( --ecf-accent );
	box-shadow: 0 0 0 4px var( --ecf-focus );
}

.ec-vendor-form textarea {
	min-height: 130px;
	resize: vertical;
}

/* The long-form field the reference marks as .tall */
.ec-vendor-form [name="description"] {
	min-height: 210px;
}

/* File/attachment upload (image, gallery) — dashed dropzone per the
 * reference. Padding matched to the standard input padding (10px 12px)
 * rather than the reference's own 16px, which read noticeably bulkier
 * than every other field box once placed next to them (same tweak as
 * the listing form's `images` field). */
.ec-vendor-form .hp-form__field--attachment-upload .hp-field--attachment-upload {
	border: 1px dashed #aebbbf;
	border-radius: 10px;
	background: #fafcfc;
	padding: 10px 12px;
}

.ec-vendor-form .hp-form__field--attachment-upload button,
.ec-vendor-form .hp-form__field--attachment-upload .button {
	border: 0;
	border-radius: 6px;
	background: #e8f3f2;
	color: var( --ecf-accent-dark );
	font-weight: 650;
	padding: 7px 11px;
	min-height: 0;
	cursor: pointer;
}

/* Round the profile image thumbnail specifically, matching the
 * reference's circular avatar preview — the gallery upload keeps square
 * thumbnails since it holds multiple photos/videos, not one portrait. */
.ec-vendor-form .hp-form__field:has( [name="image"] ) .attachment-thumbnail {
	border-radius: 50%;
	object-fit: cover;
}

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

/* Single checkbox-type fields (accepting_requests, verified_identity).
 * Unlike the listing form's booking_moderated (title + bare checkbox
 * row, no description), every checkbox on this form also carries a
 * field-level description between the title and the checkbox row, so
 * this is a column stack rather than a single flex row. */
.ec-vendor-form .hp-form__field--checkbox {
	display: flex;
	flex-direction: column;
	gap: 6px;
	border: 1px solid var( --ecf-line );
	border-radius: 9px;
	background: #fafcfc;
	padding: 14px;
}

.ec-vendor-form .hp-form__field--checkbox > .hp-field__label {
	margin: 0;
	font-weight: 650;
}

.ec-vendor-form .hp-form__field--checkbox > .hp-field__description {
	margin: 0;
}

/* The actual toggle: HivePress renders it as its own
 * `label.hp-field--checkbox` wrapping the input and its caption text. */
.ec-vendor-form .hp-form__field--checkbox .hp-field--checkbox {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 4px;
	font-weight: 600;
	cursor: pointer;
}

.ec-vendor-form .hp-form__field--checkbox input[type="checkbox"] {
	flex: 0 0 18px;
	width: 18px;
	height: 18px;
	min-height: 18px;
	margin: 0;
	padding: 0;
	accent-color: var( --ecf-accent );
}

/* ------------------------------------------------- checkbox-list fields */

/* skills[] and service_area[] — native checkbox lists (not Select2 on
 * this form), styled as the reference's bordered choice grid. */
/* HivePress's own JS sets an inline max-height + overflow:auto on this
 * wrapper div (not the ul) to make its default vertical checkbox list
 * independently scrollable — irrelevant once it's a wrapping grid, and
 * an inline style needs !important to override from a stylesheet. */
.ec-vendor-form .hp-field.hp-field--checkboxes {
	max-height: none !important;
	overflow: visible !important;
}

.ec-vendor-form .hp-field--checkboxes ul {
	display: grid;
	grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
	gap: 9px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* service_area[] holds short one-word town names — four columns fits
 * them without the cramped wrapping three columns would cause. */
.ec-vendor-form .hp-form__field:has( [name="service_area[]"] ) .hp-field--checkboxes ul {
	grid-template-columns: repeat( 4, minmax( 0, 1fr ) );
}

.ec-vendor-form .hp-field--checkboxes ul li {
	display: block;
}

.ec-vendor-form .hp-field--checkboxes label.hp-field--checkbox {
	display: flex;
	flex-flow: row nowrap;
	align-items: flex-start;
	gap: 10px;
	min-height: 42px;
	border: 1px solid var( --ecf-line );
	border-radius: 8px;
	background: #fafcfc;
	padding: 10px;
	cursor: pointer;
	font-size: .88rem;
	line-height: 1.3;
}

.ec-vendor-form .hp-field--checkboxes label.hp-field--checkbox:hover {
	border-color: #a8b6ba;
	background: #f6faf9;
}

.ec-vendor-form .hp-field--checkboxes label.hp-field--checkbox input[type="checkbox"] {
	flex: 0 0 18px;
	width: 18px;
	height: 18px;
	min-height: 18px;
	margin: 1px 0 0;
	padding: 0;
	accent-color: var( --ecf-accent );
}

/* ----------------------------------------------------------- actions */

/* Reference's .form-actions: right-aligned button on a tinted footer
 * strip inside the card. This form's submit renders as a
 * <button type="submit"> inside .hp-form__footer. */
.hp-form--user-update .hp-form__footer {
	display: flex;
	justify-content: flex-end;
	margin: 0;
	padding: 20px 30px;
	border-top: 1px solid #dce3e5;
	background: #fafcfc;
}

.hp-form--user-update .hp-form__footer input[type="submit"],
.hp-form--user-update .hp-form__footer button[type="submit"] {
	width: auto;
	min-height: 46px;
	border: 0;
	border-radius: 8px;
	background: #087d78;
	color: #fff;
	font: inherit;
	font-weight: 700;
	padding: 11px 24px;
	cursor: pointer;
	transition: background .15s;
}

.hp-form--user-update .hp-form__footer input[type="submit"]:hover,
.hp-form--user-update .hp-form__footer button[type="submit"]:hover {
	background: #05645f;
}

.hp-form--user-update .hp-form__footer input[type="submit"]:focus-visible,
.hp-form--user-update .hp-form__footer button[type="submit"]:focus-visible {
	outline: 4px solid rgba( 8, 125, 120, .18 );
	outline-offset: 2px;
}

/* -------------------------------------------------------- responsive */

@media ( max-width: 720px ) {
	.ec-vendor-form .ec-form-section {
		padding: 24px 20px;
	}

	/* Must repeat .ec-field-grid to out-specify the desktop default
	 * (.ec-vendor-form .ec-field-grid > .hp-form__field), otherwise the
	 * 3-class default beats these and nothing collapses on mobile. */
	.ec-vendor-form .ec-field-grid > .ec-span-3,
	.ec-vendor-form .ec-field-grid > .ec-span-4,
	.ec-vendor-form .ec-field-grid > .ec-span-6,
	.ec-vendor-form .ec-field-grid > .ec-span-8 {
		grid-column: span 12;
	}

	.ec-vendor-form .hp-field--checkboxes ul,
	.ec-vendor-form .hp-form__field:has( [name="service_area[]"] ) .hp-field--checkboxes ul {
		grid-template-columns: 1fr;
	}
}

@media ( min-width: 721px ) and ( max-width: 840px ) {
	.ec-vendor-form .ec-field-grid > .ec-span-3 {
		grid-column: span 6;
	}

	.ec-vendor-form .hp-field--checkboxes ul,
	.ec-vendor-form .hp-form__field:has( [name="service_area[]"] ) .hp-field--checkboxes ul {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}
}
