.looq-form-wrap {
	--looq-primary: #C61531;
	--looq-accent: #9E1127;
	--looq-text: #1f2937;
	--looq-muted: #6b7280;
	--looq-surface: #fff;
	--looq-border: #d1d5db;
	--looq-error: #b91c1c;
	--looq-radius: 8px;
	--looq-hover: #f1f3f4;
	--looq-outside: #a0a7b1;
	color: var(--looq-text);

	/*
	 * The form takes the surrounding theme's typeface. Set --looq-font on this
	 * wrapper (or any ancestor) to override it for a single form or site-wide.
	 */
	font-family: var(--looq-font, inherit);
}

.looq-form {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 18px;
}

.looq-field {
	display: grid;
	gap: 8px;
	font-size: .9rem;
	font-weight: 700;
}

.looq-field--wide,
.looq-section,
.looq-html {
	grid-column: 1 / -1;
}

/*
 * Single column is the default. Half-width fields only pair up when the form
 * itself opts into the two-column layout, so a narrow theme never gets a
 * cramped row it did not ask for.
 */
.looq-form-wrap:not(.looq-layout-two-column) .looq-field {
	grid-column: 1 / -1;
}

@media screen and (max-width: 600px) {
	.looq-form {
		grid-template-columns: minmax(0, 1fr);
	}
}

.looq-label {
	display: block;
}

.looq-form input,
.looq-form select,
.looq-form textarea {
	box-sizing: border-box;
	width: 100%;
	min-height: 48px;
	padding: 11px 13px;
	border: 1px solid var(--looq-border);
	border-radius: var(--looq-radius);
	background: var(--looq-surface);
	color: var(--looq-text);
	font: inherit;
}

.looq-form textarea {
	min-height: 128px;
	resize: vertical;
}

/*
 * Date fields: the native <input type="date"> (Gregorian) and the Jalali/Hijri
 * text input share one calendar icon, drawn as the input's own background. The
 * native picker indicator is kept (so its popup still opens) but made
 * transparent and stretched over the icon area.
 */
.looq-form-wrap {
	--looq-date-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2'/><path d='M16 2v4M8 2v4M3 10h18'/></svg>");
}

.looq-form input[type="date"],
.looq-form input[data-looq-date-calendar] {
	position: relative;
	padding-inline-end: 44px;
	background-image: var(--looq-date-icon);
	background-repeat: no-repeat;
	background-position: right 14px center;
	background-size: 16px 16px;
}

[dir="rtl"] .looq-form input[type="date"],
[dir="rtl"] .looq-form input[data-looq-date-calendar] {
	background-position: left 14px center;
}

.looq-form input[type="date"]::-webkit-calendar-picker-indicator {
	position: absolute;
	top: 0;
	bottom: 0;
	right: 0;
	left: auto;
	width: 44px;
	height: auto;
	margin: 0;
	padding: 0;
	opacity: 0;
	cursor: pointer;
}

/* Physical sides on purpose: the icon is drawn at the left in RTL, so the
   (transparent) click area has to move with it. */
[dir="rtl"] .looq-form input[type="date"]::-webkit-calendar-picker-indicator {
	right: auto;
	left: 0;
}

.looq-form input:read-only {
	background: #f6f7f7;
	color: var(--looq-muted);
}

.looq-form input:focus,
.looq-form select:focus,
.looq-form textarea:focus,
.looq-fieldset[tabindex="-1"]:focus {
	border-color: var(--looq-primary);
	outline: 3px solid color-mix(in srgb, var(--looq-primary) 22%, transparent);
	outline-offset: 2px;
}

.looq-form button {
	grid-column: 1 / -1;
	justify-self: end;
	min-height: 44px;
	padding: 0 22px;
	border: 0;
	border-radius: var(--looq-radius);
	background: var(--looq-primary);
	color: #fff;
	font-weight: 700;
	font-size: .95rem;
	line-height: 1;
	cursor: pointer;
}

.looq-form button:hover,
.looq-form button:focus-visible {
	background: var(--looq-accent);
}

.looq-section {
	margin-top: 18px;
	padding-top: 24px;
	border-top: 1px solid var(--looq-border);
}

.looq-section:first-child {
	margin-top: 0;
	padding-top: 0;
	border-top: 0;
}

.looq-section h2 {
	margin: 0 0 6px;
	font-size: 1.35rem;
}

.looq-section p,
.looq-help {
	margin: 0;
	color: var(--looq-muted);
	font-weight: 400;
}

.looq-fieldset {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.looq-choice-group {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.looq-choice-group label,
.looq-checkbox {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 13px;
	border: 1px solid var(--looq-border);
	border-radius: 8px;
	background: var(--looq-surface);
	font-weight: 500;
	cursor: pointer;
}

.looq-choice-group input,
.looq-checkbox input {
	width: 18px;
	min-height: 18px;
	margin: 0;
	padding: 0;
	accent-color: var(--looq-primary);
}

.looq-scale {
	display: grid;
	grid-template-columns: repeat(5, minmax(44px, 1fr));
}

.looq-scale label {
	justify-content: center;
}

.looq-notice {
	margin: 0 0 20px;
	padding: 14px 16px;
	border-radius: 8px;
	background: #dcfce7;
	color: #14532d;
}

.looq-notice.is-error {
	background: #fee2e2;
	color: #7f1d1d;
}

.looq-notice:focus {
	outline: 3px solid currentColor;
	outline-offset: 3px;
}

.looq-error-summary p {
	margin: 0;
}

.looq-error-summary ul {
	margin: 10px 0 0;
	padding-inline-start: 22px;
}

.looq-error-summary a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.looq-field.is-invalid input,
.looq-field.is-invalid select,
.looq-field.is-invalid textarea,
.looq-fieldset.is-invalid .looq-choice-group label {
	border-color: var(--looq-error);
}

.looq-field-error {
	margin: 0;
	color: var(--looq-error);
	font-size: .875rem;
	font-weight: 600;
}

.looq-honeypot {
	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;
}

[dir="rtl"].looq-form-wrap .looq-form button {
	justify-self: start;
}

@media (max-width: 700px) {
	.looq-form {
		grid-template-columns: 1fr;
	}

	.looq-form button,
	[dir="rtl"].looq-form-wrap .looq-form button {
		justify-self: stretch;
		width: 100%;
	}

	.looq-scale {
		grid-template-columns: repeat(5, minmax(36px, 1fr));
	}

	.looq-scale label {
		padding: 9px 5px;
	}
}

/* Structured address: a labelled group of inputs posted as name[part]. */
.looq-address__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
	margin-top: 8px;
}

.looq-address__part {
	display: grid;
	gap: 6px;
	font-size: .85rem;
	font-weight: 600;
}

.looq-address__part--wide {
	grid-column: 1 / -1;
}

.looq-address.is-invalid input,
.looq-address.is-invalid select,
.looq-address.is-invalid textarea {
	border-color: var(--looq-error);
}

@media screen and (max-width: 600px) {
	.looq-address__grid {
		grid-template-columns: 1fr;
	}
}

.looq-tracking {
	display: block;
	margin-top: 8px;
}

.looq-tracking__code {
	padding: 2px 8px;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.7);
	font-size: 1.05em;
	letter-spacing: 0.04em;
	unicode-bidi: isolate;
}

.looq-copy {
	margin-inline-start: 8px;
	padding: 4px 12px;
	min-height: 32px;
	border: 1px solid currentColor;
	border-radius: 6px;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.looq-copy:hover {
	background: rgba(255, 255, 255, 0.6);
}

.looq-copy:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 2px;
}

.looq-form-wrap .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
