/**
 * Repeater field — frontend styles.
 *
 * Covers the outer wrapper, the rows container, individual row layout,
 * sub-field inputs, the remove button, and the add-row button with its
 * disabled / max-reached state.
 */

/* ==========================================================================
   Outer wrapper
   ========================================================================== */

.bf-repeater {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* ==========================================================================
   Rows container
   ========================================================================== */

.bf-repeater__rows {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* ==========================================================================
   Individual row
   ========================================================================== */

.bf-repeater__row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: flex-end;
	padding: 12px;
	border: 1.5px solid #e2e8f0;
	border-radius: 8px;
	background: #f8fafc;
	position: relative;
}

/* ==========================================================================
   Sub-field wrapper
   ========================================================================== */

.bf-repeater__sub-field {
	flex: 1 1 120px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.bf-repeater__sub-label {
	font-size: 12px;
	font-weight: 500;
	color: #374151;
	line-height: 1.4;
}

.bf-repeater__sub-required {
	color: #ef4444;
	margin-left: 2px;
}

/* ==========================================================================
   Sub-field inputs — inherit the global BoldForm field look
   ========================================================================== */

.bf-repeater__sub-input,
.bf-repeater__row input,
.bf-repeater__row textarea,
.bf-repeater__row select {
	width: 100%;
	padding: 6px 10px;
	font-size: 13px;
	line-height: 1.5;
	color: #111827;
	background: #ffffff;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	box-sizing: border-box;
}

.bf-repeater__row input:focus,
.bf-repeater__row textarea:focus,
.bf-repeater__row select:focus,
.bf-repeater__sub-input:focus {
	border-color: var( --bf-focus-color, #0f766e );
	box-shadow: 0 0 0 3px color-mix( in srgb, var( --bf-focus-color, #0f766e ) 12%, transparent );
}

.bf-repeater__row textarea {
	resize: vertical;
	min-height: 60px;
}

/* ==========================================================================
   Remove button
   ========================================================================== */

.bf-repeater__remove {
	flex-shrink: 0;
	height: 38px;
	padding: 0 12px;
	border: 1.5px solid #fecaca;
	border-radius: 6px;
	background: #ffffff;
	color: #ef4444;
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
	line-height: 1;
	transition: background 0.15s ease, border-color 0.15s ease;
	white-space: nowrap;
}

.bf-repeater__remove:hover {
	background: #fef2f2;
	border-color: #fca5a5;
}

/* ==========================================================================
   Add row button
   ========================================================================== */

.bf-repeater__add {
	align-self: flex-start;
	padding: 8px 16px;
	border: 1.5px dashed #cbd5e1;
	border-radius: 8px;
	background: transparent;
	color: #64748b;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: border-color 0.15s ease, color 0.15s ease;
	line-height: 1.5;
}

.bf-repeater__add:hover:not( :disabled ):not( .is-disabled ) {
	border-color: var( --bf-focus-color, #0f766e );
	color: var( --bf-focus-color, #0f766e );
}

.bf-repeater__add.is-disabled,
.bf-repeater__add:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}
