/**
 * Forms — admin (builder + entries) styles.
 *
 * Uses the module's own `.bef-` namespace (Blaminhor Essentials Forms) for the
 * genuinely new builder patterns; reuses the global design-system components
 * (.be-section, .be-empty-state, .be-badge, .wp-list-table, native .button …)
 * directly in the markup instead of re-creating them here.
 */

.bef-shortcode {
	cursor: pointer;
	user-select: all;
}

/* Builder */
.bef-builder__list {
	display: flex;
	flex-direction: column;
	gap: var(--be-space-2, 12px);
	margin-bottom: var(--be-space-3, 16px);
}

.bef-field-card {
	border: 1px solid var(--be-surface-border, #dcdcde);
	border-radius: var(--be-radius-md, 6px);
	background: var(--be-surface-card, #fff);
}

.bef-field-card__head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	border-bottom: 1px solid var(--be-surface-border, #dcdcde);
	background: var(--be-color-gray-50, #f6f7f7);
	border-radius: var(--be-radius-md, 6px) var(--be-radius-md, 6px) 0 0;
}

.bef-field-card.is-collapsed .bef-field-card__head {
	border-bottom: 0;
	border-radius: var(--be-radius-md, 6px);
}

.bef-field-card__drag {
	color: var(--be-text-muted, #646970);
	cursor: grab;
}

.bef-field-card__head[draggable="true"]:active {
	cursor: grabbing;
}

/* The header toggle is the clickable expand/collapse region. */
.bef-field-card__toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1 1 auto;
	min-width: 0;
	padding: 4px 2px;
	border: 0;
	background: none;
	cursor: pointer;
	font: inherit;
	text-align: left;
	color: inherit;
}

.bef-field-card__chevron {
	color: var(--be-text-muted, #646970);
	transition: transform var(--be-duration, 150ms) ease;
}

.bef-field-card:not(.is-collapsed) .bef-field-card__chevron {
	transform: rotate(90deg);
}

.bef-field-card__title {
	color: var(--be-text-muted, #646970);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.bef-field-card__req {
	flex: 0 0 auto;
}

/* .be-badge sets `display`, which beats the `hidden` attribute's UA display:none,
   so a non-required field would wrongly show the "Required" badge. Re-assert it. */
.bef-field-card__req[hidden] {
	display: none;
}

.bef-field-card--dragging {
	opacity: 0.5;
	outline: 2px dashed var(--be-color-primary, #2271b1);
}

/* Drop target line shown while dragging a field type from the palette. */
.bef-drop-indicator {
	height: 2px;
	margin: calc( var(--be-space-1, 4px) * -0.5 ) 0;
	background: var(--be-color-primary, #2271b1);
	border-radius: var(--be-radius-sm, 4px);
}

.bef-field-card__type {
	font-weight: 600;
}

.bef-field-card__controls {
	margin-left: auto;
	display: inline-flex;
	gap: 2px;
}

.bef-field-card__controls .button-link {
	color: var(--be-text-muted, #646970);
	padding: 2px;
}

.bef-field-card__controls .bef-field-card__remove:hover {
	color: var(--be-color-danger, #d63638);
}

.bef-field-card__body {
	padding: 12px;
}

/* Captcha cards: link out to the keys settings (opens in a new tab). */
.bef-field-card__settings-link {
	display: inline-flex;
	align-items: center;
	gap: var(--be-space-1, 4px);
}

.bef-field-card__settings-link .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

.bef-field-card__row {
	margin: 0 0 10px;
}

.bef-field-card__row--inline {
	display: flex;
	align-items: center;
	gap: var(--be-space-3, 16px);
	flex-wrap: wrap;
}

/* A per-type block hidden for the current field type must stay hidden even when
   it also carries a display rule (e.g. the inline range row's flex). The HTML
   `hidden` attribute alone loses to an author `display`, so enforce it here. */
.bef-field-card [data-be-block][hidden] {
	display: none;
}

.bef-field-card__width {
	display: inline-flex;
	align-items: center;
	gap: var(--be-space-2, 8px);
}

/* Segmented width picker: radios hidden, their labels form a single joined bar;
   the checked option fills dark. Native radios = submits + keyboard a11y free. */
.bef-field-card__width-seg {
	display: inline-flex;
	border: 1px solid var(--be-surface-border, #c3c4c7);
	border-radius: var(--be-radius-md, 6px);
	overflow: hidden;
	background: #fff;
}

.bef-field-card__width-opt {
	margin: 0;
}

.bef-field-card__width-opt input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.bef-field-card__width-opt span {
	display: block;
	padding: 4px 10px;
	font-size: 12px;
	line-height: 1.6;
	cursor: pointer;
	border-left: 1px solid var(--be-surface-border, #c3c4c7);
	white-space: nowrap;
}

.bef-field-card__width-opt:first-child span {
	border-left: 0;
}

.bef-field-card__width-opt input:checked + span {
	background: var(--be-color-gray-900, #1d2327);
	color: var(--be-text-on-dark, #fff);
}

.bef-field-card__width-opt input:focus-visible + span {
	outline: 2px solid var(--be-color-primary, #2271b1);
	outline-offset: -2px;
}

.bef-field-card__options {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px dashed var(--be-surface-border, #dcdcde);
}

.bef-field-card__options-label {
	margin: 0 0 6px;
	font-weight: 600;
}

.bef-option-row {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0 0 6px;
}

.bef-option-row input {
	flex: 1 1 auto;
}

.bef-builder__add {
	display: flex;
	align-items: center;
	gap: 8px;
}

.bef-field-card__cond {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px dashed var(--be-surface-border, #dcdcde);
}

.bef-field-card__cond-rule {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-top: 6px;
}

.bef-edit__save {
	margin-top: var(--be-space-3, 16px);
}

/* Entries — submission detail disclosure (filters/pills/table reuse the
   global .be-data-view + .be-stat-card components in the markup). */
.bef-entry__detail {
	margin: 8px 0 0;
}

.bef-entry__detail dt {
	font-weight: 600;
	margin-top: 6px;
}

.bef-entry__detail dd {
	margin: 0 0 4px;
}

/* Template picker */
.bef-templates {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 200px, 1fr ) );
	gap: var(--be-space-2, 12px);
}

.bef-template {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 12px;
	text-align: left;
	border: 1px solid var(--be-surface-border, #dcdcde);
	border-radius: var(--be-radius-md, 6px);
	background: var(--be-surface-card, #fff);
	cursor: pointer;
	transition: border-color var(--be-duration, 150ms) ease, box-shadow var(--be-duration, 150ms) ease;
}

.bef-template:hover,
.bef-template:focus {
	border-color: var(--be-color-primary, #2271b1);
	box-shadow: var(--be-shadow-card, 0 1px 2px rgba( 0, 0, 0, 0.08 ));
}

.bef-template .dashicons {
	color: var(--be-color-primary, #2271b1);
}

.bef-template__label {
	font-weight: 600;
}

.bef-template__desc {
	font-size: 0.85em;
	color: var(--be-text-muted, #646970);
}

/* Honeypot reassurance banner */
.bef-honeypot-note {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 var(--be-space-2, 12px);
	padding: 8px 12px;
	border-radius: var(--be-radius-sm, 4px);
	background: var(--be-color-success-soft, #edfaef);
	color: var(--be-text-default, #1d2327);
	font-size: 0.9em;
}

.bef-honeypot-note .dashicons {
	color: var(--be-color-success, #00a32a);
}

/* Field palette */
.bef-palette {
	margin-top: var(--be-space-3, 16px);
	padding-top: var(--be-space-3, 16px);
	border-top: 1px solid var(--be-surface-border, #dcdcde);
	display: flex;
	flex-direction: column;
	gap: var(--be-space-2, 12px);
}

.bef-palette__hint {
	margin: 0 0 var(--be-space-2, 12px);
}

.bef-palette__heading {
	margin: 0 0 4px;
	font-size: 0.75em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--be-text-muted, #646970);
}

.bef-palette__items {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.bef-palette__item {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	cursor: grab;
}

.bef-palette__item:active {
	cursor: grabbing;
}

.bef-palette__item .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}
