/* Widget Builder Admin Styles */
#wpr-widget-builder-app {
	max-width: 900px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Hide default post editor elements */
#post-body-content > #titlediv,
#postbox-container-1,
#minor-publishing-actions,
#misc-publishing-actions,
#post-body-content > #postdivrich {
	display: none !important;
}

/* Sections */
.wpr-wb-section {
	background: #fff;
	border: 1px solid #ccd0d4;
	margin-bottom: 16px;
	border-radius: 4px;
}

.wpr-wb-section-title {
	margin: 0;
	padding: 12px 16px;
	background: #f8f9fa;
	border-bottom: 1px solid #ccd0d4;
	font-size: 14px;
	font-weight: 600;
	color: #1d2327;
	border-radius: 4px 4px 0 0;
}

.wpr-wb-section-content {
	padding: 16px;
}

/* Fields */
.wpr-wb-field {
	margin-bottom: 14px;
}

.wpr-wb-field:last-child {
	margin-bottom: 0;
}

.wpr-wb-field label {
	display: block;
	font-weight: 600;
	margin-bottom: 4px;
	font-size: 13px;
	color: #1d2327;
}

.wpr-wb-field input[type="text"],
.wpr-wb-field input[type="number"],
.wpr-wb-field select,
.wpr-wb-field textarea {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.wpr-wb-field-desc {
	display: block;
	margin-top: 4px;
	font-size: 12px;
	color: #757575;
	font-style: italic;
}

/* Tabs */
.wpr-wb-tabs {
	display: flex;
	gap: 0;
	border-bottom: 2px solid #ccd0d4;
	margin-bottom: 16px;
}

.wpr-wb-tab {
	padding: 8px 20px;
	border: none;
	background: transparent;
	cursor: pointer;
	font-size: 13px;
	font-weight: 500;
	color: #50575e;
	border-bottom: 2px solid transparent;
	margin-bottom: -2px;
	transition: color 0.2s, border-color 0.2s;
}

.wpr-wb-tab:hover {
	color: #2271b1;
}

.wpr-wb-tab.active {
	color: #2271b1;
	border-bottom-color: #2271b1;
	font-weight: 600;
}

.wpr-wb-tab-count {
	display: inline-block;
	background: #2271b1;
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	min-width: 18px;
	height: 18px;
	line-height: 18px;
	text-align: center;
	border-radius: 9px;
	padding: 0 5px;
	margin-left: 4px;
	vertical-align: middle;
}

.wpr-wb-tab-panel {
	display: none;
}

.wpr-wb-tab-panel.active {
	display: block;
}

/* Tab Panel Toolbar */
.wpr-wb-tab-toolbar {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 8px;
}

.wpr-wb-collapse-all {
	background: none;
	border: 1px solid #dcdcde;
	border-radius: 3px;
	padding: 2px 10px;
	font-size: 12px;
	color: #50575e;
	cursor: pointer;
}

.wpr-wb-collapse-all:hover {
	background: #f0f0f1;
	color: #1d2327;
}

/* Controls List */
.wpr-wb-controls-list {
	margin-bottom: 12px;
	min-height: 10px;
}

.wpr-wb-control-item {
	border: 1px solid #dcdcde;
	border-radius: 4px;
	margin-bottom: 8px;
	background: #fff;
	transition: box-shadow 0.15s;
}

.wpr-wb-control-item:hover {
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.wpr-wb-control-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 12px;
	background: #f0f0f1;
	cursor: grab;
	border-radius: 4px 4px 0 0;
	user-select: none;
}

.wpr-wb-control-header:active {
	cursor: grabbing;
}

.wpr-wb-control-item.collapsed .wpr-wb-control-header {
	border-radius: 4px;
}

.wpr-wb-control-header-left {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.wpr-wb-control-drag-handle {
	color: #a7aaad;
	font-size: 16px;
	cursor: grab;
	flex-shrink: 0;
}

.wpr-wb-control-drag-handle:active {
	cursor: grabbing;
}

.wpr-wb-control-title {
	font-weight: 500;
	font-size: 13px;
	color: #1d2327;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.wpr-wb-control-type-badge {
	font-size: 11px;
	color: #757575;
	background: #e0e0e0;
	padding: 1px 6px;
	border-radius: 3px;
	flex-shrink: 0;
}

.wpr-wb-control-actions {
	display: flex;
	gap: 2px;
	flex-shrink: 0;
}

.wpr-wb-control-actions button {
	border: none;
	background: transparent;
	cursor: pointer;
	font-size: 14px;
	color: #757575;
	padding: 2px 6px;
	line-height: 1;
	border-radius: 2px;
	transition: background 0.15s, color 0.15s;
}

.wpr-wb-control-actions button:hover {
	background: #dcdcde;
}

.wpr-wb-control-remove:hover {
	color: #d63638 !important;
}

.wpr-wb-control-duplicate:hover {
	color: #2271b1 !important;
}

.wpr-wb-control-toggle {
	transition: transform 0.2s;
}

.wpr-wb-control-item.collapsed .wpr-wb-control-toggle {
	transform: rotate(-90deg);
}

.wpr-wb-control-body {
	padding: 12px;
	border-top: 1px solid #dcdcde;
}

.wpr-wb-control-item.collapsed .wpr-wb-control-body {
	display: none;
}

.wpr-wb-add-control {
	width: 100%;
	text-align: center;
	padding: 8px !important;
}

/* Sortable Placeholder */
.wpr-wb-sortable-placeholder {
	border: 2px dashed #2271b1;
	border-radius: 4px;
	background: #f0f6fc;
	margin-bottom: 8px;
	height: 40px;
}

/* Code Editors */
#wpr-wb-markup,
#wpr-wb-css,
#wpr-wb-js {
	width: 100%;
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
	font-size: 13px;
	line-height: 1.5;
	padding: 10px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	background: #f6f7f7;
	tab-size: 4;
	resize: vertical;
	box-sizing: border-box;
}

#wpr-wb-markup:focus,
#wpr-wb-css:focus,
#wpr-wb-js:focus {
	background: #fff;
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
	outline: none;
}

/* Tag Insert Helpers */
.wpr-wb-tag-helpers {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 8px;
}

.wpr-wb-insert-tag {
	background: #f0f0f1;
	border: 1px solid #dcdcde;
	border-radius: 3px;
	padding: 3px 8px;
	font-size: 12px;
	font-family: monospace;
	color: #50575e;
	cursor: pointer;
	transition: background 0.15s;
}

.wpr-wb-insert-tag:hover {
	background: #e0e0e0;
	color: #1d2327;
}

/* Save Bar */
.wpr-wb-save-bar {
	position: sticky;
	bottom: 0;
	background: #fff;
	border: 1px solid #ccd0d4;
	padding: 12px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	border-radius: 4px;
	box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05);
	z-index: 10;
}

#wpr-wb-save {
	min-width: 120px;
}

#wpr-wb-preview {
	text-decoration: none;
}

#wpr-wb-status {
	font-size: 13px;
	color: #00a32a;
}

#wpr-wb-status.error {
	color: #d63638;
}

#wpr-wb-status.saving {
	color: #dba617;
}

/* Empty state */
.wpr-wb-controls-list:empty::before {
	content: 'No controls added yet. Click "+ Add Control" below.';
	display: block;
	text-align: center;
	padding: 20px;
	color: #a7aaad;
	font-size: 13px;
	font-style: italic;
}
