/**
 * LilVastr global form design system.
 *
 * Reusable form COMPONENTS only. The base inputs/selects/textareas and the
 * .lv-btn button system already live in main.css — this file never redefines
 * them, it composes on top: field wrappers, labels, validation states, custom
 * checkbox/radio, password toggle, strength meter, and form-level feedback.
 * Every branded form (auth, account, contact, reviews, newsletter) uses these.
 */

/* ---------- Field wrapper ---------- */
.lv-field { display: grid; gap: 7px; margin: 0 0 18px; }
.lv-field:last-child { margin-bottom: 0; }
.lv-field__label {
	font-size: 13px;
	font-weight: 600;
	color: var(--lv-text, #141414);
	display: inline-flex;
	align-items: center;
	gap: 4px;
}
.lv-field__label .lv-req { color: var(--lv-sale, #e04f4f); }
.lv-field__help { font-size: 12px; color: var(--lv-muted, #767676); }
.lv-field__error {
	font-size: 12px;
	color: var(--lv-sale, #e04f4f);
	min-height: 0;
	display: none;
	align-items: center;
	gap: 5px;
}

/* Validation states (added by forms.js or the server). */
.lv-field.is-error .lv-input,
.lv-field.is-error .lv-select,
.lv-field.is-error .lv-textarea,
.lv-field.is-error input,
.lv-field.is-error textarea {
	border-color: var(--lv-sale, #e04f4f);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--lv-sale, #e04f4f) 15%, transparent);
}
.lv-field.is-error .lv-field__error { display: flex; }
.lv-field.is-success .lv-input,
.lv-field.is-success input {
	border-color: #2a9d63;
}

/* Two-column field grid (name rows, address rows). */
.lv-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 560px) { .lv-field-grid { grid-template-columns: 1fr; } }

/* Grouped section inside a form. */
.lv-fieldset { border: 0; padding: 0; margin: 0 0 26px; }
.lv-fieldset__legend {
	font-family: var(--lv-font-heading, inherit);
	font-weight: 700;
	font-size: 16px;
	margin: 0 0 14px;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--lv-border, #dfe0df);
}

/* ---------- Custom checkbox / radio ---------- */
.lv-check, .lv-radio {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	color: var(--lv-text, #141414);
	cursor: pointer;
	user-select: none;
}
/* Count pill on the far right of filter rows (checkbox — label — count). */
.lv-check__count { margin-left: auto; font-style: normal; font-size: 12px; color: var(--lv-muted, #767676); }
.lv-check > input, .lv-radio > input {
	appearance: none;
	-webkit-appearance: none;
	width: 18px;
	height: 18px;
	margin: 0;
	flex-shrink: 0;
	border: 1.5px solid var(--lv-border, #dfe0df);
	background: #fff;
	display: grid;
	place-content: center;
	cursor: pointer;
	transition: border-color .15s, background .15s;
}
.lv-check > input { border-radius: 5px; }
.lv-radio > input { border-radius: 50%; }
.lv-check > input::before {
	content: "";
	width: 10px; height: 10px;
	transform: scale(0);
	transition: transform .12s ease-in-out;
	box-shadow: inset 1em 1em #fff;
	clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
}
.lv-radio > input::before {
	content: "";
	width: 8px; height: 8px;
	border-radius: 50%;
	transform: scale(0);
	transition: transform .12s ease-in-out;
	box-shadow: inset 1em 1em #fff;
}
.lv-check > input:checked, .lv-radio > input:checked {
	background: var(--lv-primary, #000);
	border-color: var(--lv-primary, #000);
}
.lv-check > input:checked::before, .lv-radio > input:checked::before { transform: scale(1); }
.lv-check > input:focus-visible, .lv-radio > input:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--lv-primary, #000) 15%, transparent);
}

/* ---------- Password field (show/hide + strength) ---------- */
/* The toggle is absolutely positioned inside .lv-field__control, which wraps
   ONLY the input — so it stays vertically centered on the input no matter what
   else the field contains (label above, error / strength meter below). */
.lv-field__control { position: relative; display: block; }
.lv-field--password .lv-input,
.lv-field--password .lv-field__control .lv-input { padding-right: 48px; }
.lv-pwd-toggle {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	width: 32px; height: 32px;
	display: inline-grid;
	place-content: center;
	border: 0;
	padding: 0;
	background: none;
	color: var(--lv-muted, #767676);
	cursor: pointer;
	border-radius: 8px;
	transition: color var(--lv-transition, .2s ease), background var(--lv-transition, .2s ease);
}
.lv-pwd-toggle:hover { color: var(--lv-text, #141414); background: var(--lv-surface, #f7f7f7); }
.lv-pwd-toggle svg { display: block; }

.lv-pwd-strength { display: none; gap: 8px; align-items: center; margin-top: 8px; }
.lv-field--password.is-typed .lv-pwd-strength { display: flex; }
.lv-pwd-strength__bar { flex: 1; height: 5px; border-radius: 999px; background: var(--lv-border, #dfe0df); overflow: hidden; }
.lv-pwd-strength__fill { height: 100%; width: 0; border-radius: 999px; transition: width .25s, background .25s; }
.lv-pwd-strength__label { font-size: 12px; font-weight: 600; color: var(--lv-muted, #767676); min-width: 54px; text-align: right; }
.lv-pwd-strength[data-score="1"] .lv-pwd-strength__fill { width: 25%;  background: var(--lv-sale, #e04f4f); }
.lv-pwd-strength[data-score="2"] .lv-pwd-strength__fill { width: 50%;  background: #e8a13a; }
.lv-pwd-strength[data-score="3"] .lv-pwd-strength__fill { width: 75%;  background: #c9c020; }
.lv-pwd-strength[data-score="4"] .lv-pwd-strength__fill { width: 100%; background: #2a9d63; }

/* ---------- Button spinner (composes with main.css .lv-btn.is-loading) ---------- */
.lv-btn.is-loading { position: relative; color: transparent !important; }
.lv-btn.is-loading::after {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 18px; height: 18px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	color: #fff;
	animation: lv-spin .6s linear infinite;
}
.lv-btn--ghost.is-loading::after, .lv-btn--secondary.is-loading::after { color: var(--lv-text, #141414); }
@keyframes lv-spin { to { transform: rotate(360deg); } }

/* ---------- Form-level feedback banner ---------- */
.lv-form-feedback {
	margin: 0;
	font-size: 13.5px;
	line-height: 1.5;
	border-radius: calc(var(--lv-radius, 8px) * .7);
	display: none;
}
.lv-form-feedback.is-success,
.lv-form-feedback.is-error {
	display: block;
	padding: 11px 14px;
	margin-bottom: 16px;
}
.lv-form-feedback.is-success { background: #e7f6ee; color: #1c7a49; }
.lv-form-feedback.is-error { background: #fdecec; color: #b32d2e; }

/* Full-width submit inside branded card forms. */
.lv-form__submit { width: 100%; margin-top: 4px; }

/* ---------- Contact form (shortcode [lilvastr_contact]) ---------- */
.lv-contact { max-width: 560px; margin-inline: auto; }
.lv-contact__card {
	background: var(--lv-bg, #fff);
	border: 1px solid var(--lv-border, #dfe0df);
	border-radius: calc(var(--lv-radius, 8px) * 1.4);
	padding: clamp(24px, 4vw, 40px);
	box-shadow: var(--lv-shadow-sm, 0 1px 3px rgb(16 24 40 / .07));
}
.lv-contact__head { text-align: center; margin-bottom: 26px; }
.lv-contact__title { font-size: clamp(22px, 3vw, 30px); margin: 0 0 6px; }
.lv-contact__sub { color: var(--lv-muted, #767676); margin: 0; font-size: 14px; }
/* Even, full-width stacked fields (matches the auth form's clean layout). */
.lv-contact__form .lv-field { margin: 0 0 18px; }
.lv-contact__form .lv-input,
.lv-contact__form .lv-textarea { width: 100%; }
.lv-contact__form textarea { min-height: 140px; resize: vertical; }
.lv-contact__submit { width: 100%; margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
	.lv-btn.is-loading::after { animation-duration: 1.4s; }
	.lv-check > input::before, .lv-radio > input::before,
	.lv-pwd-strength__fill { transition: none; }
}
