/**
 * RM Forms — Conditional Logic builder styles (shared by wp-admin and the
 * Guest builder).
 *
 * Scoped under .rm-cl-root so it cannot leak into either host. Colours come
 * from custom properties with fallbacks, so the Guest builder's RM Events
 * palette applies automatically while wp-admin gets sane defaults without
 * having to define anything.
 */

.rm-cl-root {
	--cl-navy: var(--rm-navy, #0b1e3f);
	--cl-red: var(--rm-red, #ab1c1b);
	--cl-line: var(--rm-line, #e3e7ee);
	--cl-muted: var(--rm-muted, #6b7688);
	--cl-faint: var(--rm-faint, #9aa4b5);
	--cl-surface: #fff;
	--cl-sunken: #f6f8fb;
	font-size: 13px;
	color: var(--rm-ink, #1a2332);
}

.rm-cl-root *,
.rm-cl-root *::before,
.rm-cl-root *::after { box-sizing: border-box; }

.rm-cl-sr-only {
	position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- empty state ---------- */
.rm-cl-empty {
	text-align: center; padding: 42px 24px; background: var(--cl-surface);
	border: 1px dashed #cbd3e0; border-radius: 14px;
}
.rm-cl-empty-icon { font-size: 30px; color: var(--cl-faint); margin-bottom: 8px; }
.rm-cl-empty h4 { margin: 0 0 6px; font-size: 15px; font-weight: 800; color: var(--cl-navy); }
.rm-cl-empty p { margin: 0 auto 16px; max-width: 420px; font-size: 12.5px; color: var(--cl-muted); line-height: 1.6; }

/* ---------- buttons ---------- */
.rm-cl-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 5px;
	padding: 8px 14px; border-radius: 9px; border: 1px solid transparent;
	font-size: 12.5px; font-weight: 700; font-family: inherit; line-height: 1.2;
	cursor: pointer; text-decoration: none; -webkit-appearance: none; appearance: none;
	text-transform: none; letter-spacing: normal; box-shadow: none;
	transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.rm-cl-btn-primary { background: var(--cl-navy); color: #fff; }
.rm-cl-btn-primary:hover { background: var(--rm-navy-600, #132a52); color: #fff; }
.rm-cl-btn-ghost { background: var(--cl-surface); border-color: var(--cl-line); color: var(--cl-muted); }
.rm-cl-btn-ghost:hover { border-color: var(--cl-navy); color: var(--cl-navy); }
.rm-cl-add-rule { margin-top: 4px; }

.rm-cl-icon-btn {
	flex: none; width: 26px; height: 26px; border-radius: 7px; border: 1px solid transparent;
	background: transparent; color: var(--cl-faint); font-size: 16px; line-height: 1;
	cursor: pointer; -webkit-appearance: none; appearance: none; padding: 0;
	display: inline-flex; align-items: center; justify-content: center;
	transition: background .13s ease, color .13s ease;
}
.rm-cl-icon-btn:hover { background: #eef1f7; color: var(--cl-navy); }
.rm-cl-icon-btn.rm-cl-danger:hover { background: #fdf2f2; color: var(--cl-red); }
.rm-cl-root :focus-visible { outline: 2px solid var(--cl-navy); outline-offset: 2px; }

/* ---------- rule card ---------- */
.rm-cl-rule {
	background: var(--cl-surface); border: 1px solid var(--cl-line);
	border-radius: 14px; padding: 16px 18px; margin-bottom: 14px;
	box-shadow: 0 1px 2px rgba(11, 30, 63, .05);
}
.rm-cl-rule.is-disabled { opacity: .58; }
.rm-cl-rule-head {
	display: flex; align-items: center; justify-content: space-between;
	gap: 10px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--cl-line);
}
.rm-cl-rule-num {
	font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
	color: var(--cl-red);
}
.rm-cl-rule-tools { display: flex; align-items: center; gap: 10px; }
.rm-cl-toggle, .rm-cl-clear {
	display: inline-flex; align-items: center; gap: 5px;
	font-size: 11.5px; font-weight: 600; color: var(--cl-muted); cursor: pointer; margin: 0;
}
.rm-cl-toggle input, .rm-cl-clear input { accent-color: var(--cl-navy); margin: 0; }

/* ---------- IF / THEN keywords ---------- */
.rm-cl-keyword {
	font-size: 11px; font-weight: 800; letter-spacing: .1em; color: var(--cl-navy);
	margin: 0 0 8px;
}
.rm-cl-keyword-then { margin-top: 14px; }

/* ---------- groups ---------- */
.rm-cl-group {
	border: 1px solid var(--cl-line); border-left: 3px solid var(--cl-navy);
	border-radius: 10px; padding: 12px; background: var(--cl-sunken);
}
.rm-cl-group.rm-cl-match-any { border-left-color: var(--cl-red); }
.rm-cl-group-root { background: transparent; }
.rm-cl-group .rm-cl-group { margin: 0; background: var(--cl-surface); }

.rm-cl-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.rm-cl-match {
	font-size: 11px; font-weight: 700; padding: 5px 9px; border-radius: 7px;
	border: 1px solid var(--cl-line); background: var(--cl-surface); color: var(--cl-navy);
	font-family: inherit; cursor: pointer;
}
.rm-cl-group-body { display: flex; flex-direction: column; gap: 8px; }
.rm-cl-group-foot { display: flex; gap: 6px; margin-top: 10px; }

/* The AND/OR joiner between siblings — this is what makes the relationship
   visually obvious rather than something you infer from a dropdown. */
.rm-cl-joiner {
	align-self: flex-start; font-size: 10px; font-weight: 800; letter-spacing: .08em;
	color: var(--cl-muted); background: #eef1f7; border-radius: 999px;
	padding: 2px 9px; margin: 1px 0 1px 4px;
}
.rm-cl-match-any > .rm-cl-group-body > .rm-cl-joiner { background: #fdf2f2; color: var(--cl-red); }

/* ---------- condition / action rows ---------- */
.rm-cl-condition, .rm-cl-action {
	display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
	background: var(--cl-surface); border: 1px solid var(--cl-line);
	border-radius: 9px; padding: 7px 9px;
}
.rm-cl-condition.has-error, .rm-cl-action.has-error { border-color: #f0c9c9; background: #fdf7f7; }

.rm-cl-sel, .rm-cl-val {
	padding: 7px 9px; border: 1px solid #d7dce5; border-radius: 7px;
	font-size: 12.5px; font-family: inherit; color: inherit; background: #fff;
	min-width: 0; max-width: 100%;
}
.rm-cl-sel:focus, .rm-cl-val:focus {
	outline: none; border-color: var(--cl-navy); box-shadow: 0 0 0 3px rgba(11, 30, 63, .10);
}
.rm-cl-sel-field, .rm-cl-sel-target { flex: 1 1 150px; }
.rm-cl-sel-op, .rm-cl-sel-action { flex: 0 1 150px; }
.rm-cl-val { flex: 1 1 130px; }
.rm-cl-val-multi { min-height: 62px; }
.rm-cl-value-none { color: var(--cl-faint); flex: 1 1 130px; padding-left: 4px; }

.rm-cl-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.rm-cl-actions .rm-cl-action { width: 100%; }

/* ---------- warnings ---------- */
.rm-cl-warn {
	background: #fdf7f7; border: 1px solid #f0c9c9; border-radius: 9px;
	padding: 9px 11px; margin-bottom: 12px; font-size: 11.5px; color: #8d1615; line-height: 1.6;
}
.rm-cl-warn div + div { margin-top: 3px; }

@media (max-width: 640px) {
	.rm-cl-sel-field, .rm-cl-sel-op, .rm-cl-sel-action, .rm-cl-sel-target, .rm-cl-val {
		flex: 1 1 100%;
	}
}

/* ---------- frontend: hidden-field transition ----------
   Kept here so the public form and both builders' previews agree. Uses
   max-height/opacity rather than display:none so showing a field animates;
   the engine additionally disables the inputs, which is what actually keeps
   them out of the submission and out of the tab order. */
.rm-cl-hidden {
	max-height: 0 !important;
	opacity: 0 !important;
	margin: 0 !important;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	overflow: hidden !important;
	pointer-events: none !important;
	border-width: 0 !important;
}
