/**
 * === Form Frontend CSS - Style cho bvyhct-form shortcode ===
 *
 * Mô tả: Layout, field styles, error states, submit button với spinner,
 *        honeypot ẩn, và responsive breakpoint 640px.
 *        Toast styles tái dụng từ quick-action-handler.css (không duplicate).
 *
 * Flow:
 *   1. .bvyhct-form base — flex column
 *   2. .bvyhct-form-field — row wrapper cho label + input
 *   3. label, input/select/textarea — consistent sizing
 *   4. focus + error states
 *   5. submit button + is-loading spinner
 *   6. honeypot off-screen
 *   7. responsive @media max-width 640px
 */

/* === Base form layout === */
.bvyhct-form {
	--bvyhct-form-primary: var(--color-brand-primary);
	--bvyhct-form-radius: 4px;
	--bvyhct-form-field-gap: 14px;
	--bvyhct-form-field-padding: 10px 12px;

	display: flex;
	flex-direction: column;
	gap: 0;
	max-width: 600px;
	width: 100%;
	margin: 0 auto;
}

/* === Layout modifiers === */
.bvyhct-form--layout-two-column {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--bvyhct-form-field-gap);
	max-width: 800px;
}
.bvyhct-form--layout-two-column .bvyhct-form-actions,
.bvyhct-form--layout-two-column .bvyhct-form-field--textarea {
	grid-column: 1 / -1;
}

.bvyhct-form--layout-inline {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 8px;
	max-width: none;
}
.bvyhct-form--layout-inline .bvyhct-form-field {
	flex: 1 1 180px;
	margin-bottom: 0;
}
.bvyhct-form--layout-inline label {
	font-size: var(--text-micro);
}

/* === Density modifiers === */
.bvyhct-form--density-compact {
	--bvyhct-form-field-gap: 8px;
	--bvyhct-form-field-padding: 6px 10px;
}
.bvyhct-form--density-spacious {
	--bvyhct-form-field-gap: 22px;
	--bvyhct-form-field-padding: 14px 16px;
}

/* === Border radius modifiers === */
.bvyhct-form--radius-sharp { --bvyhct-form-radius: 0; }
.bvyhct-form--radius-rounded { --bvyhct-form-radius: 4px; }
.bvyhct-form--radius-pill { --bvyhct-form-radius: 16px; }

/* === Field row === */
.bvyhct-form-field {
	margin-bottom: var( --bvyhct-form-field-gap, 14px );
}

.bvyhct-form-field:last-of-type {
	margin-bottom: 0;
}

/* === Label === */
.bvyhct-form label {
	display: block;
	font-weight: var(--weight-semibold);
	font-size: var(--text-nav);
	margin-bottom: 6px;
	color: #1d2327;
}

.bvyhct-form label .required {
	color: var(--color-error);
	margin-left: 2px;
	font-weight: var(--weight-bold);
}

/* === Input, select, textarea === */
.bvyhct-form input[type="text"],
.bvyhct-form input[type="email"],
.bvyhct-form input[type="tel"],
.bvyhct-form input[type="number"],
.bvyhct-form input[type="date"],
.bvyhct-form select,
.bvyhct-form textarea {
	display: block;
	width: 100%;
	padding: var( --bvyhct-form-field-padding, 10px 12px );
	border: 1px solid #c3c4c7;
	border-radius: var( --bvyhct-form-radius, 4px );
	font-size: var(--text-body-lg);
	font-family: inherit;
	color: #1d2327;
	background-color: var(--color-surface);
	line-height: 1.5;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	box-sizing: border-box;
	-webkit-appearance: none;
	appearance: none;
}

.bvyhct-form textarea {
	resize: vertical;
	min-height: 100px;
}

/* === Focus state === */
.bvyhct-form input:focus,
.bvyhct-form select:focus,
.bvyhct-form textarea:focus {
	outline: none;
	border-color: var( --bvyhct-form-primary, var(--color-brand-primary) );
	box-shadow: 0 0 0 3px rgba(27, 77, 62, 0.15);
}

/* === Checkbox field layout === */
.bvyhct-form-field--checkbox {
	display: flex;
	align-items: center;
	gap: 8px;
}

.bvyhct-form-field--checkbox label {
	margin-bottom: 0;
	font-weight: var(--weight-regular);
	cursor: pointer;
}

.bvyhct-form-field--checkbox input[type="checkbox"] {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	accent-color: var( --bvyhct-form-primary, var(--color-brand-primary) );
	cursor: pointer;
}

/* === Error state === */
.bvyhct-form-field.has-error input,
.bvyhct-form-field.has-error select,
.bvyhct-form-field.has-error textarea {
	border-color: var(--color-error);
	box-shadow: 0 0 0 3px rgba( 192, 57, 43, 0.15 );
}

.bvyhct-form-field .field-error-msg {
	display: block;
	margin-top: 4px;
	font-size: var(--text-micro);
	color: var(--color-error);
}

/* === Form actions row === */
.bvyhct-form-actions {
	margin-top: 20px;
}

/* === Submit button === */
.bvyhct-form-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 28px;
	background-color: var( --bvyhct-form-primary, var(--color-brand-primary) );
	color: #fff;
	border: none;
	border-radius: var( --bvyhct-form-radius, 4px );
	font-size: var(--text-button);
	font-weight: var(--weight-semibold);
	font-family: inherit;
	cursor: pointer;
	transition: background-color 0.2s ease, opacity 0.2s ease;
	min-width: 120px;
}

.bvyhct-form-submit:hover:not(:disabled) {
	background-color: var( --color-primary-dark, var(--color-brand-primary) );
}

/* === Loading state === */
.bvyhct-form-submit.is-loading {
	opacity: 0.65;
	pointer-events: none;
	cursor: wait;
	position: relative;
	color: transparent;
}

.bvyhct-form-submit.is-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 18px;
	height: 18px;
	margin: -9px 0 0 -9px;
	border: 2px solid rgba( 255, 255, 255, 0.5 );
	border-top-color: #fff;
	border-radius: 50%;
	animation: bvyhct-form-spin 0.7s linear infinite;
}

@keyframes bvyhct-form-spin {
	to { transform: rotate( 360deg ); }
}

/* === Honeypot — off-screen, không display:none vì bot có thể detect === */
.bvyhct-honeypot {
	position: absolute;
	left: -9999px;
	top: -9999px;
	height: 0;
	width: 0;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
}

/* === Error paragraph từ shortcode guard === */
.bvyhct-form-error {
	color: var(--color-error);
	font-size: var(--text-nav);
	padding: 10px 14px;
	border: 1px solid var(--color-error);
	border-radius: 4px;
	background: #fdf2f2;
}

/* === Responsive === */
@media ( max-width: 640px ) {
	.bvyhct-form {
		max-width: 100%;
	}

	.bvyhct-form input[type="text"],
	.bvyhct-form input[type="email"],
	.bvyhct-form input[type="tel"],
	.bvyhct-form input[type="number"],
	.bvyhct-form input[type="date"],
	.bvyhct-form select,
	.bvyhct-form textarea {
		font-size: var(--text-body-lg);
		padding: 9px 10px;
	}

	.bvyhct-form-submit {
		width: 100%;
		padding: 13px 16px;
	}
}
