/* Royal Classic Light AI Theme */

:root {
	--mbcore-bg: #fdfdfd;
	/* Pure Paper White */
	--mbcore-card-bg: rgba(255, 255, 255, 0.85);
	/* Glass Base */
	--mbcore-primary: #2563eb;
	/* Royal Blue */
	--mbcore-primary-soft: #eff6ff;
	--mbcore-accent: #8b5cf6;
	/* Regal Violet */
	--mbcore-border: #e2e8f0;
	/* Soft Silver */
	--mbcore-text-head: #1e293b;
	/* Slate 800 */
	--mbcore-text-body: #475569;
	/* Slate 600 */

	--mbcore-radius-lg: 16px;
	--mbcore-radius-md: 10px;
	--mbcore-radius-sm: 6px;

	--mbcore-shadow-glass:
		0 4px 6px -1px rgba(0, 0, 0, 0.02),
		0 2px 4px -1px rgba(0, 0, 0, 0.02),
		inset 0 0 0 1px rgba(255, 255, 255, 0.9);

	--mbcore-shadow-hover:
		0 20px 25px -5px rgba(0, 0, 0, 0.05),
		0 10px 10px -5px rgba(0, 0, 0, 0.02);

	--mbcore-font-head: 'Outfit', 'Inter', sans-serif;
	/* Modern Aesthetic */
}

/* Glassmorphism Sections */
.mbcore-editor-section {
	background: var(--mbcore-card-bg);
	border: 1px solid rgba(255, 255, 255, 0.6);
	border-radius: var(--mbcore-radius-lg);
	box-shadow: var(--mbcore-shadow-glass);
	margin-bottom: 24px;
	overflow: hidden;
	backdrop-filter: blur(12px);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.mbcore-editor-section:hover {
	box-shadow: var(--mbcore-shadow-hover);
	transform: translateY(-2px);
}

.mbcore-editor-section h3 {
	margin: 0;
	padding: 18px 24px;
	background: linear-gradient(to bottom, #ffffff, #fafafa);
	border-bottom: 1px solid var(--mbcore-border);
	font-family: var(--mbcore-font-head);
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.5px;
	color: var(--mbcore-text-head);
	text-transform: uppercase;
	display: flex;
	align-items: center;
}

.mbcore-editor-section h3::before {
	content: '';
	display: inline-block;
	width: 6px;
	height: 6px;
	background: var(--mbcore-primary);
	border-radius: 50%;
	margin-right: 12px;
	box-shadow: 0 0 0 3px var(--mbcore-primary-soft);
}

/* Compact Forms */
.mbcore-form-row {
	padding: 16px 24px;
	/* Tighter padding */
	border-bottom: 1px solid #f1f5f9;
}

.mbcore-form-row:last-child {
	border-bottom: none;
}

.mbcore-form-row label {
	display: block;
	color: var(--mbcore-text-body);
	font-size: 12px;
	font-weight: 600;
	margin-bottom: 6px;
	letter-spacing: 0.02em;
}

.mbcore-form-row input[type="text"],
.mbcore-form-row select {
	width: 100%;
	background: #ffffff;
	border: 1px solid var(--mbcore-border);
	border-radius: var(--mbcore-radius-sm);
	padding: 8px 12px;
	font-size: 13px;
	color: #334155;
	transition: all 0.2s ease;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.mbcore-form-row input[type="text"]:focus,
.mbcore-form-row select:focus {
	border-color: var(--mbcore-primary);
	box-shadow: 0 0 0 3px var(--mbcore-primary-soft);
	outline: none;
}

/* Intelligent Code Editors */
.mbcore-editor-section textarea.mbcore-code-editor {
	font-family: 'Fira Code', 'Menlo', monospace;
	font-size: 13px;
	line-height: 1.6;
	padding: 20px 24px;
	border: none;
	width: 100%;
	min-height: 400px;
	background: #fafafa;
	color: #24292e;
}

/* CodeMirror Resizing */
.mbcore-tab-content .CodeMirror {
	height: 500px;
	min-height: 200px;
	border-radius: var(--mbcore-radius-md);
	font-family: 'Fira Code', 'Menlo', monospace;
	font-size: 14px;
	resize: vertical;
	overflow: hidden !important;
}

.mbcore-tab-content .CodeMirror-scroll {
	min-height: inherit;
}

/* Resize Handle Indicator */
.mbcore-tab-content .CodeMirror::after {
	content: "";
	position: absolute;
	bottom: 0;
	right: 0;
	width: 15px;
	height: 15px;
	background: linear-gradient(135deg, transparent 50%, #ccd0d4 50%, #ccd0d4 60%, transparent 60%, transparent 70%, #ccd0d4 70%);
	cursor: nwse-resize;
	pointer-events: none;
	z-index: 20;
	opacity: 0.6;
}

.mbcore-tab-content .CodeMirror:hover::after {
	opacity: 1;
}

/* Differentiate Editors visually via border strip */
.mbcore-tab-content#mbcore-code-css .CodeMirror {
	border-left: 4px solid #2965f1;
	background: linear-gradient(to right, #f8faff, #ffffff);
}

.mbcore-tab-content#mbcore-code-js .CodeMirror {
	border-left: 4px solid #f7df1e;
	background: linear-gradient(to right, #fffff0, #ffffff);
}

.mbcore-tab-content#mbcore-code-php .CodeMirror {
	border-left: 4px solid #8993be;
	background: linear-gradient(to right, #f9f9ff, #ffffff);
}

.CodeMirror-focused {
	box-shadow: 0 0 0 3px var(--mbcore-primary-soft);
	border-color: var(--mbcore-primary);
}

/* Full-width field */
.field.full-width {
	flex: 1 1 100%;
}

.field.full-width .description {
	font-size: 12px;
	color: #666;
	font-style: italic;
	margin-top: 4px;
}

/* Control Item - Lazy Blocks Style */
.mbcore-controls-wrapper {
	background: transparent;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.mbcore-control-item {
	background: #ffffff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 0;
	position: relative;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.mbcore-control-item.open {
	border-color: #8c8f94;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mbcore-control-header {
	display: flex;
	align-items: center;
	padding: 10px 15px;
	background: #f6f7f7;
	cursor: pointer;
	border-bottom: 1px solid transparent;
	user-select: none;
}

.mbcore-control-item.open .mbcore-control-header {
	background: #f0f0f1;
	border-bottom-color: #dcdcde;
}

.mbcore-control-handle {
	color: #a7aaad;
	margin-right: 10px;
	cursor: move;
}

.mbcore-control-handle:hover {
	color: #1d2327;
}

.mbcore-control-title {
	flex-grow: 1;
	font-weight: 600;
	font-size: 14px;
	color: #1d2327;
}

.mbcore-control-type-badge {
	background: #dcdcde;
	color: #50575e;
	font-size: 11px;
	padding: 2px 6px;
	border-radius: 3px;
	margin-right: 10px;
	text-transform: uppercase;
}

.mbcore-control-toggle-icon {
	color: #a7aaad;
}

.mbcore-control-item.open .mbcore-control-toggle-icon {
	transform: rotate(180deg);
}

.mbcore-control-body {
	display: none;
	padding: 15px;
	background: #fff;
	border-bottom-left-radius: 4px;
	border-bottom-right-radius: 4px;
}

.mbcore-control-item.open .mbcore-control-body {
	display: block;
}

.mbcore-control-row {
	display: flex;
	gap: 20px;
	margin-bottom: 15px;
}

.mbcore-control-row .field {
	flex: 1;
}

.mbcore-control-row:last-child {
	margin-bottom: 0;
}

.mbcore-control-actions {
	margin-top: 15px;
	padding-top: 15px;
	border-top: 1px solid #f0f0f1;
	display: flex;
	justify-content: flex-end;
}

.mbcore-control-item label {
	display: block;
	margin-bottom: 5px;
	font-weight: 600;
	font-size: 13px;
	color: #1d2327;
}

.mbcore-control-item input,
.mbcore-control-item select,
.mbcore-control-item textarea {
	width: 100%;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	padding: 6px 10px;
	font-size: 14px;
	color: #2c3338;
}

.mbcore-control-item .btn-remove {
	color: #b32d2e;
	text-decoration: none;
	font-size: 13px;
	background: transparent;
	border: none;
	padding: 0;
	cursor: pointer;
}

.mbcore-control-item .btn-remove:hover {
	color: #d63638;
	text-decoration: underline;
}

/* Hide legacy strip */
.mbcore-control-item::before {
	display: none;
}

.mbcore-control-card-body {
	margin-left: 0;
	padding: 0;
}

/* Import Page */
#mbcore-import-page {
	background: #fff;
	border: 1px solid var(--mbcore-border);
	border-radius: var(--mbcore-radius-lg);
	padding: 40px;
	margin-top: 30px;
	box-shadow: var(--mbcore-shadow-glass);
}

#mbcore-import-page h1 {
	font-family: var(--mbcore-font-head);
	color: var(--mbcore-text-head);
	font-weight: 800;
	letter-spacing: -0.5px;
}

/* Repeater Sub Controls */
.mbcore-sub-controls-wrapper {
	background: #f9f9f9;
	padding: 15px;
	border: 1px dashed #ccc;
	border-radius: 4px;
}

.mbcore-sub-controls-list {
	margin-bottom: 10px;
}

.mbcore-sub-control-item {
	background: #fff;
	border: 1px solid #ddd;
	padding: 8px;
	margin-bottom: 5px;
	border-radius: 4px;
}

.mbcore-sub-control-row {
	display: flex;
	gap: 10px;
	align-items: center;
}

.mbcore-sub-control-handle {
	cursor: move;
	color: #a7aaad;
	flex: 0 0 20px;
}

.mbcore-sub-control-handle:hover {
	color: #1d2327;
}

.mbcore-sub-control-row input,
.mbcore-sub-control-row select {
	flex: 1;
	font-size: 12px !important;
	padding: 4px 8px !important;
}

.mbcore-sub-control-row .btn-remove-sub {
	flex: 0 0 30px;
	height: 30px;
	padding: 0;
	line-height: 28px;
	text-align: center;
}

/* Code Editor Tabs */
.mbcore-code-tabs {
	display: flex;
	background: #f0f0f1;
	border: 1px solid #dcdcde;
	border-bottom: none;
	border-top-left-radius: 4px;
	border-top-right-radius: 4px;
}

.mbcore-tab-link {
	padding: 10px 20px;
	border: none;
	background: transparent;
	cursor: pointer;
	font-weight: 600;
	color: #50575e;
	border-right: 1px solid #dcdcde;
	transition: all 0.2s ease;
}

.mbcore-tab-link:hover {
	background: #fff;
	color: var(--mbcore-primary);
}

.mbcore-tab-link.active {
	background: #fff;
	color: var(--mbcore-primary);
	border-bottom: 2px solid var(--mbcore-primary);
}

.mbcore-tab-content {
	display: none;
	border: 1px solid #dcdcde;
	padding: 15px;
	background: #fff;
	border-bottom-left-radius: 4px;
	border-bottom-right-radius: 4px;
}

.mbcore-tab-content.active {
	display: block;
}