/**
 * Domain Editor — match active theme tokens (Shadcn / block themes).
 */

.domain-editor {
	--de-height: 14rem;
	--de-font: var(
		--wp--preset--font-family--system-fonts,
		var(
			--wp--preset--font-family--body,
			-apple-system,
			BlinkMacSystemFont,
			"Segoe UI",
			Roboto,
			Oxygen-Sans,
			Ubuntu,
			Cantarell,
			"Helvetica Neue",
			sans-serif
		)
	);
	--de-size: var(--wp--preset--font-size--base, 1rem);
	--de-weight: 400;
	--de-line: 1.625;
	--de-radius: 0.5rem;
	--de-pad-y: 0.75rem;
	--de-pad-x: 0.85rem;
	--de-gutter-x: 0.65rem;
	--de-border: var(--wp--preset--color--border, var(--border, #e5e5e5));
	--de-input: var(--wp--preset--color--input, var(--input, #e5e5e5));
	--de-muted: var(--wp--preset--color--muted, var(--muted, #f5f5f5));
	--de-muted-fg: var(--wp--preset--color--muted-foreground, var(--muted-foreground, #737373));
	--de-bg: var(--wp--preset--color--card, var(--wp--preset--color--background, var(--card, #fff)));
	--de-fg: var(--wp--preset--color--card-foreground, var(--wp--preset--color--foreground, var(--foreground, #0a0a0a)));
	--de-ring: var(--wp--preset--color--ring, var(--ring, #a1a1a1));
	--de-primary: var(--wp--preset--color--primary, var(--primary, #171717));
	/*
	 * Do not set max-width here. Theme constrained layouts apply
	 * --wp--style--global--content-size via :where() (0 specificity).
	 * A plugin max-width would override that and ignore Styles → Layout.
	 */
	box-sizing: border-box;
	width: 100%;
	color: var(--de-fg);
	font-family: var(--de-font);
	font-size: var(--de-size);
	font-weight: var(--de-weight);
	line-height: var(--de-line);
}

.domain-editor__field {
	margin-bottom: 1.15rem;
}

.domain-editor__label {
	display: block;
	margin-bottom: 0.45rem;
	font-family: inherit;
	font-size: inherit;
	font-weight: 600;
	line-height: inherit;
	color: inherit;
}

.domain-editor__hint {
	margin: 0.45rem 0 0;
	font-family: inherit;
	font-size: var(--wp--preset--font-size--sm, 0.875em);
	font-weight: 400;
	line-height: 1.5;
	color: var(--de-muted-fg);
}

/* Card shell */
.domain-editor__editor {
	border: 1px solid var(--de-border);
	border-radius: var(--de-radius);
	background: var(--de-bg);
	overflow: hidden;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.domain-editor__editor:focus-within {
	border-color: var(--de-ring);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--de-ring) 35%, transparent);
}

/* Toolbar */
.domain-editor__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.55rem var(--de-pad-x);
	background: var(--de-muted);
	border-bottom: 1px solid var(--de-border);
	font-family: inherit;
}

.domain-editor__toolbar-label {
	font-family: inherit;
	font-size: var(--wp--preset--font-size--sm, 0.8em);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--de-muted-fg);
}

.domain-editor__count {
	display: inline-flex;
	align-items: center;
	padding: 0.15rem 0.55rem;
	border-radius: 999px;
	font-family: inherit;
	font-size: var(--wp--preset--font-size--sm, 0.75em);
	font-weight: 500;
	line-height: 1.3;
	color: var(--de-fg);
	background: var(--de-bg);
	border: 1px solid var(--de-border);
}

/* Fixed-height scroll area */
.domain-editor__lined {
	display: flex;
	align-items: stretch;
	height: var(--de-height);
	max-height: var(--de-height);
	overflow: hidden;
	background: var(--de-bg);
}

/* Shared typography — must match for line alignment */
.domain-editor__line-numbers,
.domain-editor__textarea {
	margin: 0;
	border: 0;
	font-family: var(--de-font) !important;
	font-size: var(--de-size) !important;
	font-weight: var(--de-weight) !important;
	font-style: normal !important;
	line-height: var(--de-line) !important;
	letter-spacing: normal;
	box-sizing: border-box;
}

.domain-editor__line-numbers {
	padding: var(--de-pad-y) var(--de-gutter-x);
	min-width: 2.5rem;
	height: 100%;
	text-align: right;
	color: var(--de-muted-fg);
	background: var(--de-muted);
	border-right: 1px solid var(--de-border);
	overflow-x: hidden;
	overflow-y: auto;
	scrollbar-width: none;
	user-select: none;
	white-space: pre;
	font-variant-numeric: tabular-nums;
}

.domain-editor__line-numbers::-webkit-scrollbar {
	width: 0;
	height: 0;
}

.domain-editor__textarea {
	flex: 1 1 auto;
	width: 100%;
	height: 100%;
	min-height: 0;
	padding: var(--de-pad-y) var(--de-pad-x);
	resize: none;
	background: transparent;
	color: var(--de-fg) !important;
	caret-color: var(--de-primary);
	outline: none;
	white-space: pre;
	overflow: auto;
	appearance: none;
	-webkit-appearance: none;
	-webkit-overflow-scrolling: touch;
}

.domain-editor__textarea::placeholder {
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
	color: var(--de-muted-fg);
	opacity: 1;
}

.domain-editor__footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	align-items: center;
	gap: 0.85rem 1.15rem;
	padding: 0.55rem var(--de-pad-x);
	background: var(--de-muted);
	border-top: 1px solid var(--de-border);
}

.domain-editor__check {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	margin: 0;
	font-family: inherit;
	font-size: var(--wp--preset--font-size--sm, 0.8125rem);
	font-weight: 500;
	line-height: 1.3;
	color: var(--de-muted-fg);
	cursor: pointer;
	user-select: none;
}

.domain-editor__check input {
	margin: 0;
	width: 1rem;
	height: 1rem;
	accent-color: var(--de-primary);
	cursor: pointer;
}

.domain-editor__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin-top: 0.15rem;
	margin-bottom: 0.85rem;
}

.domain-editor__message {
	margin: 0 0 0.85rem;
	padding: 0.7rem 0.85rem;
	border-radius: var(--de-radius);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--sm, 0.925em);
	line-height: 1.5;
}

.domain-editor__message[hidden] {
	display: none !important;
}

.domain-editor__message.is-success:not(.woocommerce-message) {
	background: color-mix(in srgb, #16a34a 12%, transparent);
	border: 1px solid color-mix(in srgb, #16a34a 28%, transparent);
	border-left: 3px solid #16a34a;
	color: #16a34a;
}

.domain-editor__message.is-info:not(.woocommerce-info) {
	background: color-mix(in srgb, #2563eb 12%, transparent);
	border: 1px solid color-mix(in srgb, #2563eb 28%, transparent);
	border-left: 3px solid #2563eb;
	color: #2563eb;
}

.domain-editor__message.is-error:not(.woocommerce-error) {
	background: color-mix(in srgb, var(--wp--preset--color--destructive, #dc2626) 12%, transparent);
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--destructive, #dc2626) 28%, transparent);
	border-left: 3px solid var(--wp--preset--color--destructive, #dc2626);
	color: var(--wp--preset--color--destructive, #dc2626);
}

.domain-editor__message.is-warning {
	background: color-mix(in srgb, #d97706 12%, transparent);
	border: 1px solid color-mix(in srgb, #d97706 28%, transparent);
	border-left: 3px solid #d97706;
	color: #d97706;
}
