/* ============================================================
   Dynamic Form Builder – Frontend Styles
   ============================================================ */

.df-form-wrap {
	max-width: 680px;
}

/* ── Section ──────────────────────────────────────────────── */
.df-section {
	margin-bottom: 32px;
}

/* ── Row (flex container for grouped fields) ──────────────── */
.df-row {
	display: flex;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 4px;
}

.df-row .df-field-wrap {
	flex: 1;
	min-width: 180px;
	margin-bottom: 14px;
}

.df-section-title {
	font-size: 18px;
	font-weight: 600;
	margin: 0 0 16px;
	padding-bottom: 8px;
	border-bottom: 2px solid #e2e8f0;
	color: #1a202c;
}

/* ── Field wrapper ────────────────────────────────────────── */
.df-field-wrap {
	margin-bottom: 18px;
	transition: opacity .2s;
}

.df-field-wrap[style*="display: none"] {
	opacity: 0;
}

/* ── Label ────────────────────────────────────────────────── */
.df-label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 5px;
	color: #2d3748;
}

.df-required {
	color: #e53e3e;
	margin-left: 2px;
}

/* ── Inputs ───────────────────────────────────────────────── */
.df-field {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 9px 12px;
	font-size: 15px;
	line-height: 1.5;
	color: #2d3748;
	background: #fff;
	border: 1px solid #cbd5e0;
	border-radius: 5px;
	outline: none;
	transition: border-color .15s, box-shadow .15s;
	appearance: auto;
}

.df-field:focus {
	border-color: #4299e1;
	box-shadow: 0 0 0 3px rgba( 66, 153, 225, .25 );
}

.df-field:disabled {
	background: #f7fafc;
	color: #a0aec0;
	cursor: not-allowed;
}

textarea.df-field {
	min-height: 100px;
	resize: vertical;
}

/* ── Radio & Checkbox groups ──────────────────────────────── */
.df-radio-group,
.df-checkbox-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 4px;
}

.df-radio-item,
.df-checkbox-item {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: #2d3748;
	cursor: pointer;
}

.df-radio-item input,
.df-checkbox-item input {
	width: 16px;
	height: 16px;
	cursor: pointer;
	flex-shrink: 0;
}

/* ── Field error ──────────────────────────────────────────── */
.df-field-error {
	display: block;
	color: #e53e3e;
	font-size: 13px;
	margin-top: 4px;
	min-height: 1em;
}

/* ── Submit row ───────────────────────────────────────────── */
.df-submit-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 24px;
}

.df-submit-btn {
	padding: 10px 28px;
	font-size: 15px;
	font-weight: 600;
	color: #fff;
	background: #3182ce;
	border: none;
	border-radius: 5px;
	cursor: pointer;
	transition: background .15s;
}

.df-submit-btn:hover {
	background: #2b6cb0;
}

.df-submit-btn:disabled {
	background: #a0aec0;
	cursor: not-allowed;
}

/* ── Spinner ──────────────────────────────────────────────── */
.df-spinner {
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2px solid #bee3f8;
	border-top-color: #3182ce;
	border-radius: 50%;
	animation: df-spin .7s linear infinite;
}

@keyframes df-spin {
	to { transform: rotate( 360deg ); }
}

/* ── Messages ─────────────────────────────────────────────── */
.df-messages {
	margin-top: 16px;
}

.df-message {
	padding: 12px 16px;
	border-radius: 5px;
	font-size: 14px;
	line-height: 1.5;
}

.df-message--success {
	background: #f0fff4;
	border: 1px solid #9ae6b4;
	color: #276749;
}

.df-message--error {
	background: #fff5f5;
	border: 1px solid #fc8181;
	color: #c53030;
}

/* ── Field description (hint) ─────────────────────────────── */
.df-field-desc {
	display: block;
	font-size: 12px;
	color: #718096;
	margin-top: 4px;
	line-height: 1.5;
	font-style: italic;
}

/* ── Readonly field ───────────────────────────────────────── */
.df-field[readonly] {
	background: #f7fafc;
	color: #4a5568;
	cursor: default;
}

/* ── File input ───────────────────────────────────────────── */
.df-file-input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	font-size: 14px;
	color: #2d3748;
	padding: 6px 0;
}

/* ── Optional section ─────────────────────────────────────── */
.df-section--optional .df-section-title::after {
	content: ' (optional)';
	font-size: 12px;
	font-weight: 400;
	color: #718096;
}

/* ── Accordion rows ───────────────────────────────────────── */
.df-accordion-panel {
	border: 1px solid #e2e8f0;
	border-radius: 5px;
	margin-bottom: 8px;
	overflow: hidden;
}

.df-accordion-toggle {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	background: #f7fafc;
	border: none;
	font-size: 14px;
	font-weight: 600;
	color: #2d3748;
	cursor: pointer;
	text-align: left;
	transition: background .12s;
}

.df-accordion-toggle:hover { background: #edf2f7; }

.df-accordion-panel--open .df-accordion-toggle { background: #ebf8ff; }

.df-accordion-arrow {
	font-size: 11px;
	color: #a0aec0;
	transition: transform .18s;
	flex-shrink: 0;
}

.df-accordion-panel--open .df-accordion-arrow { transform: rotate( 180deg ); }

.df-accordion-content {
	padding: 14px;
	display: none;
}

.df-accordion-panel--open .df-accordion-content { display: block; }

/* ── Repeatable groups ────────────────────────────────────── */
.df-repeatable-wrap {
	border: 1px solid #e2e8f0;
	border-radius: 5px;
	margin-bottom: 18px;
	overflow: hidden;
}

.df-repeatable-title {
	font-size: 14px;
	font-weight: 600;
	padding: 8px 14px;
	background: #f7fafc;
	border-bottom: 1px solid #e2e8f0;
	color: #2d3748;
}

.df-repeatable-row {
	border-bottom: 1px solid #e2e8f0;
	padding: 14px;
}

.df-repeatable-row:last-child { border-bottom: none; }

.df-repeatable-row-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
}

.df-repeatable-row-num {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .5px;
	color: #718096;
}

.df-remove-rep-row {
	background: none;
	border: 1px solid #fc8181;
	border-radius: 3px;
	color: #e53e3e;
	font-size: 12px;
	padding: 3px 8px;
	cursor: pointer;
	transition: background .1s;
}

.df-remove-rep-row:hover { background: #fff5f5; }

.df-add-rep-row {
	display: block;
	width: 100%;
	padding: 8px;
	background: #f7fafc;
	border: none;
	border-top: 1px dashed #cbd5e0;
	color: #3182ce;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background .1s;
	box-sizing: border-box;
}

.df-add-rep-row:hover { background: #ebf8ff; }

/* ── Tabbed navigation ────────────────────────────────────── */
.df-tab-nav {
	display: flex;
	gap: 2px;
	border-bottom: 2px solid #e2e8f0;
	margin-bottom: 24px;
	flex-wrap: wrap;
}

.df-tab-btn {
	padding: 8px 18px;
	font-size: 14px;
	font-weight: 600;
	color: #718096;
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	margin-bottom: -2px;
	cursor: pointer;
	transition: color .15s, border-color .15s;
	white-space: nowrap;
}

.df-tab-btn:hover { color: #2d3748; }

.df-tab-btn--active {
	color: #3182ce;
	border-bottom-color: #3182ce;
}

.df-tab-panel { display: none; }
.df-tab-panel--active { display: block; }

.df-tab-nav-row {
	display: flex;
	align-items: center;
	margin-top: 24px;
	padding-top: 16px;
	border-top: 1px solid #e2e8f0;
	gap: 8px;
}

.df-tab-prev-btn {
	padding: 8px 20px;
	font-size: 14px;
	font-weight: 600;
	border-radius: 5px;
	cursor: pointer;
	border: 1px solid #cbd5e0;
	background: #fff;
	color: #2d3748;
	transition: background .12s;
}

.df-tab-prev-btn:hover { background: #f7fafc; }

.df-tab-next-btn {
	margin-left: auto;
	padding: 8px 20px;
	font-size: 14px;
	font-weight: 600;
	border-radius: 5px;
	cursor: pointer;
	border: 1px solid #3182ce;
	background: #3182ce;
	color: #fff;
	transition: background .12s;
}

.df-tab-next-btn:hover { background: #2b6cb0; }

/* ── Sub-section ─────────────────────────────────────────── */
.df-subsection {
	padding-left: 1.25rem;
	border-left: 3px solid #3182ce;
	margin: .75rem 0;
}

.df-subsection-title {
	font-size: 1rem;
	font-weight: 600;
	color: #2d3748;
	margin: 0 0 .6rem 0;
}
