/**
 * Form Builder CSS
 * 
 * Styling for interactive form builder interface
 */

/* ============================================
   Form Builder Container
   ============================================ */

#affcf-form-builder {
	max-width: 1200px;
}

.affcf-form-section {
	background: #fff;
	border: 1px solid #ccd0d4;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
	margin-bottom: 20px;
}

.affcf-form-section-header {
	background: #f7f7f7;
	border-bottom: 1px solid #ccd0d4;
	padding: 15px 20px;
}

.affcf-form-section-header h3 {
	margin: 0;
	font-size: 16px;
	color: #23282d;
}

.affcf-form-section-body {
	padding: 20px;
}

/* ============================================
   Loading States
   ============================================ */

.affcf-loading {
	text-align: center;
	padding: 40px 20px;
	color: #50575e;
}

.affcf-loading .spinner {
	float: none;
	margin: 0 auto 10px;
}

/* ============================================
   Field Groups List
   ============================================ */

.affcf-field-groups-list {
	margin: 0;
}

.affcf-field-group {
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	margin-bottom: 15px;
	background: #fff;
	transition: all 0.2s ease;
}

.affcf-field-group.active {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

.affcf-field-group-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 15px;
	background: #f9f9f9;
	border-bottom: 1px solid #e0e0e0;
	cursor: pointer;
	transition: background 0.2s ease;
}

.affcf-field-group-header:hover {
	background: #f0f0f0;
}

.affcf-field-group.active .affcf-field-group-header {
	background: #e7f3ff;
}

.affcf-field-group-label {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1;
	cursor: pointer;
	margin: 0;
}

.affcf-field-group-label input[type="checkbox"] {
	margin: 0;
	cursor: pointer;
}

.affcf-field-group-title {
	font-size: 14px;
	font-weight: 600;
	color: #1d2327;
}

.affcf-field-count {
	color: #646970;
	font-size: 13px;
	font-weight: normal;
	margin-left: 5px;
}

.affcf-field-group-actions {
	display: flex;
	gap: 8px;
}

.affcf-field-group-actions .button {
	padding: 4px 12px;
	height: auto;
	line-height: 1.4;
	font-size: 12px;
}

/* ============================================
   Field List
   ============================================ */

.affcf-field-list {
	padding: 10px;
	background: #fafafa;
	border-top: 1px solid #e0e0e0;
	min-height: 50px;
}

.affcf-no-fields {
	text-align: center;
	padding: 20px;
	color: #646970;
	font-style: italic;
	margin: 0;
}

/* ============================================
   Field Item
   ============================================ */

.affcf-field-item {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 3px;
	margin-bottom: 8px;
	transition: all 0.2s ease;
}

.affcf-field-item:hover {
	border-color: #8c8f94;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.affcf-field-item:last-child {
	margin-bottom: 0;
}

.affcf-field-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	cursor: move;
}

.affcf-field-drag-handle {
	color: #8c8f94;
	cursor: move;
	transition: color 0.2s ease;
}

.affcf-field-drag-handle:hover {
	color: #2271b1;
}

.affcf-field-label {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	margin: 0;
	cursor: pointer;
}

.affcf-field-label input[type="checkbox"] {
	margin: 0;
	cursor: pointer;
}

.affcf-field-label .dashicons {
	width: 18px;
	height: 18px;
	font-size: 18px;
	color: #646970;
}

.affcf-field-name {
	font-weight: 500;
	color: #1d2327;
	font-size: 13px;
}

.affcf-field-type {
	color: #646970;
	font-size: 12px;
	font-weight: normal;
}

.affcf-required-badge {
	background: #dc3232;
	color: #fff;
	padding: 2px 6px;
	border-radius: 2px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
}

.affcf-field-settings-toggle {
	background: transparent;
	border: 1px solid #dcdcde;
	border-radius: 3px;
	padding: 4px 8px;
	cursor: pointer;
	transition: all 0.2s ease;
	height: auto;
	line-height: 1;
}

.affcf-field-settings-toggle:hover {
	background: #f0f0f0;
	border-color: #8c8f94;
}

.affcf-field-settings-toggle .dashicons {
	width: 16px;
	height: 16px;
	font-size: 16px;
	color: #646970;
}

/* ============================================
   Field Settings Panel
   ============================================ */

.affcf-field-settings-panel {
	border-top: 1px solid #e0e0e0;
	background: #f9f9f9;
	padding: 15px;
}

.affcf-field-settings {
	max-width: 600px;
}

.affcf-setting-row {
	margin-bottom: 15px;
}

.affcf-setting-row:last-child {
	margin-bottom: 0;
}

.affcf-setting-row > label {
	display: block;
	margin-bottom: 5px;
	font-weight: 600;
	color: #1d2327;
	font-size: 13px;
}

.affcf-setting-row input[type="text"],
.affcf-setting-row textarea {
	width: 100%;
	max-width: 500px;
}

.affcf-setting-row textarea {
	resize: vertical;
}

.affcf-setting-row .description {
	margin-top: 5px;
	margin-bottom: 0;
	color: #646970;
	font-size: 12px;
}

.affcf-setting-row label input[type="checkbox"] {
	margin-right: 5px;
}

/* ============================================
   Drag & Drop States
   ============================================ */

.affcf-field-placeholder {
	background: #e7f3ff;
	border: 2px dashed #2271b1;
	height: 50px;
	margin-bottom: 8px;
	border-radius: 3px;
}

.ui-sortable-helper {
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
	opacity: 0.8;
}

/* ============================================
   Default WordPress Fields
   ============================================ */

.affcf-default-fields-list {
	display: grid;
	gap: 15px;
}

.affcf-default-field {
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	background: #fff;
	transition: all 0.2s ease;
}

.affcf-default-field:hover {
	border-color: #8c8f94;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.affcf-default-field-header {
	padding: 12px 15px;
	background: #f9f9f9;
	border-bottom: 1px solid #e0e0e0;
}

.affcf-default-field-header label {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	cursor: pointer;
	font-weight: 600;
	color: #1d2327;
}

.affcf-default-field-header input[type="checkbox"] {
	margin: 0;
}

.affcf-default-field-header .dashicons {
	color: #646970;
}

/* ============================================
   Taxonomies
   ============================================ */

.affcf-taxonomies-list {
	display: grid;
	gap: 15px;
}

.affcf-taxonomy-item {
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	background: #fff;
	transition: all 0.2s ease;
}

.affcf-taxonomy-item:hover {
	border-color: #8c8f94;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.affcf-taxonomy-header {
	padding: 12px 15px;
	background: #f9f9f9;
	border-bottom: 1px solid #e0e0e0;
}

.affcf-taxonomy-header label {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	cursor: pointer;
	font-weight: 600;
	color: #1d2327;
}

.affcf-taxonomy-header input[type="checkbox"] {
	margin: 0;
}

.affcf-taxonomy-header .dashicons {
	color: #646970;
}

.affcf-taxonomy-type {
	color: #646970;
	font-size: 12px;
	font-weight: normal;
	margin-left: 5px;
}

.affcf-taxonomy-settings-panel {
	padding: 15px;
	background: #f9f9f9;
}

.affcf-taxonomy-settings {
	max-width: 600px;
}

/* ============================================
   Empty States
   ============================================ */

.affcf-empty-state {
	text-align: center;
	padding: 60px 20px;
	color: #646970;
}

.affcf-empty-state .dashicons {
	font-size: 80px;
	width: 80px;
	height: 80px;
	color: #dcdcde;
	margin-bottom: 15px;
}

.affcf-empty-state h4 {
	font-size: 16px;
	color: #1d2327;
	margin: 0 0 10px;
}

.affcf-empty-state p {
	font-size: 14px;
	margin: 0;
}

/* ============================================
   Notices within Form Builder
   ============================================ */

.affcf-form-section-body .notice {
	margin: 0 0 15px;
}

.affcf-form-section-body .notice:last-child {
	margin-bottom: 0;
}

/* ============================================
   Hidden Inputs
   ============================================ */

.affcf-hidden-inputs {
	display: none;
}

/* ============================================
   Responsive Design
   ============================================ */

@media screen and (max-width: 782px) {
	.affcf-field-group-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
	}
	
	.affcf-field-group-actions {
		width: 100%;
	}
	
	.affcf-field-group-actions .button {
		flex: 1;
	}
	
	.affcf-field-header {
		flex-wrap: wrap;
	}
	
	.affcf-field-settings-toggle {
		margin-left: auto;
	}
}

@media screen and (max-width: 600px) {
	.affcf-field-label {
		flex-wrap: wrap;
	}
	
	.affcf-field-type {
		width: 100%;
		margin-left: 26px;
	}
}

/* ============================================
   Animations
   ============================================ */

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.affcf-field-list,
.affcf-field-settings-panel,
.affcf-taxonomy-settings-panel {
	animation: slideDown 0.3s ease;
}

/* ============================================
   Sub-fields (Group & Repeater)
   ============================================ */

.affcf-has-subfields {
	border-left: 3px solid #2271b1;
}

.affcf-subfield-count {
	display: inline-block;
	background: #2271b1;
	color: #fff;
	padding: 2px 8px;
	border-radius: 3px;
	font-size: 11px;
	margin-left: 8px;
	font-weight: 600;
}

.affcf-subfields-container {
	margin-left: 20px;
	margin-top: 10px;
	padding: 15px;
	background: #f6f7f7;
	border: 1px solid #dcdcde;
	border-radius: 4px;
}

.affcf-subfields-label {
	display: flex;
	align-items: center;
	margin-bottom: 10px;
	padding-bottom: 8px;
	border-bottom: 1px solid #dcdcde;
	color: #2271b1;
	font-size: 13px;
}

.affcf-subfields-label .dashicons {
	margin-right: 5px;
}

.affcf-subfields-label strong {
	margin-right: 8px;
}

.affcf-subfields-label small {
	color: #646970;
	font-style: italic;
}

.affcf-subfields-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.affcf-subfield-item {
	padding: 8px 12px;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 3px;
	transition: all 0.2s ease;
}

.affcf-subfield-item:hover {
	border-color: #2271b1;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.affcf-subfield-label {
	display: flex;
	align-items: center;
	cursor: pointer;
	margin: 0;
	font-size: 13px;
}

.affcf-subfield-label input[type="checkbox"] {
	margin: 0 8px 0 0;
}

.affcf-subfield-label .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	margin-right: 6px;
	color: #50575e;
}

.affcf-subfield-name {
	font-weight: 500;
	margin-right: 6px;
}

.affcf-subfield-type {
	color: #646970;
	font-size: 11px;
}

.affcf-subfield-item .affcf-required-badge {
	margin-left: 8px;
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
	.affcf-field-drag-handle,
	.affcf-field-settings-toggle,
	.affcf-field-group-actions {
		display: none;
	}
	
	.affcf-field-settings-panel {
		display: block !important;
	}
}
