/* Dark Theme Variables */
:root {
	--dark-bg: #1a1a1a;
	--dark-secondary: #2d2d2d;
	--dark-border: #404040;
	--dark-text: #e0e0e0;
	--dark-text-secondary: #a0a0a0;
	--primary-color: #4a9eff;
	--primary-hover: #357abd;
	--success-color: #28a745;
	--danger-color: #dc3545;
	--panel-bg: #2d2d2d;
	--panel-border: #404040;
	--panel-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Fix for WordPress Media Modal */
.media-modal {
	z-index: 999999 !important;
}

.media-modal-backdrop {
	z-index: 999998 !important;
}

.media-frame {
	z-index: 999999 !important;
}

.media-frame-title,
.media-frame-router,
.media-frame-content,
.media-frame-toolbar {
	z-index: 999999 !important;
}

.media-frame-content {
	background: #fff !important;
}

.media-frame-title h1 {
	color: #1d2327 !important;
}

.media-frame-router .media-router {
	background: #f0f0f1 !important;
	border-bottom: 1px solid #dcdcde !important;
}

.media-frame-router .media-router a {
	color: #1d2327 !important;
}

.media-frame-router .media-router a.active {
	color: #2271b1 !important;
	border-bottom-color: #2271b1 !important;
}

.media-frame-toolbar {
	background: #f0f0f1 !important;
	border-top: 1px solid #dcdcde !important;
}

.media-frame-toolbar .button {
	color: #fff !important;
	background: #2271b1 !important;
	border-color: #2271b1 !important;
}

.media-frame-toolbar .button:hover {
	background: #135e96 !important;
	border-color: #135e96 !important;
}

.gjs-layer-title {
	margin: 0 !important;
	border-radius: 0 !important;
}

.gjs-plh-image{
	outline: 3px solid var(--primary-color) !important;
}

.gjs-category-title, .gjs-layer-title, .gjs-block-category .gjs-title, .gjs-sm-sector-title{
	background-color: var(--primary-color) !important;
	color: #fff !important;
	font-weight: 500 !important;
	border-radius: 20px;
	margin: 10px;
}

.gjs-one-bg {
	background-color: #2d2d2d;
}
.gjs-three-bg {
	background-color: transparent;
	border: 1px solid #4a9eff4f;
}

/* Full Screen Container */
.x4email-editor-wrapper {
	position: fixed;
	top: 0px;
	left: 0px;
	right: 0;
	bottom: 0;
	z-index: 999999;
	background: var(--dark-bg);
}

#toggle-fullscreen{
	background: var(--dark-secondary);
	color: var(--dark-text);
	border: 1px solid var(--dark-border);
	padding: 8px 12px;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

#toggle-fullscreen:hover{
	background: var(--primary-color);
	color: #fff;
	border: 1px solid var(--primary-color);
}

.gjs-four-color-h:hover {
	color: var(--primary-color);
}

.gjs-selected-parent {
	outline:2px solid var(--primary-color) !important;
	}

.gjs-placeholder.horizontal, .gjs-com-placeholder.horizontal, .gjs-placeholder.horizontal {
	border-color: transparent var(--primary-color) !important;
	}

.gjs-placeholder-int, .gjs-com-placeholder-int, .gjs-placeholder-int{
	background-color: var(--primary-color) !important;
	}
/* Full Screen Mode */
.x4email-fullscreen {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1;
	background: var(--dark-bg);
}

/* Fullscreen Mode Adjustments */
.x4email-fullscreen.x4email-editor-wrapper {
	top: 32px;
	left: 160px;
}

/* Hide WordPress Admin Bar in Fullscreen */
.x4email-fullscreen #wpadminbar {
	display: none;
}

/* Template Editor Container */
.x4email-editor-container {
	display: flex;
	height: 100vh;
	background: var(--dark-bg);
	color: var(--dark-text);
}

/* Sidebar Styles */
.x4email-sidebar {
	width: 300px;
	background: var(--dark-secondary);
	border-right: 1px solid var(--dark-border);
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow-y: auto;
	box-shadow: var(--panel-shadow);
}

/* Main Content Area */
.x4email-main {
	flex: 1;
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
}

/* Toolbar Styles */
.x4email-toolbar {
	padding: 15px 20px;
	background: var(--dark-secondary);
	border-bottom: 1px solid var(--dark-border);
	display: flex;
	gap: 12px;
	position: sticky;
	top: 0;
	z-index: 10;
	justify-content: space-between;
	align-items: center;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.x4email-toolbar button {
	padding: 8px 16px;
	background: var(--primary-color);
	color: #fff;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.3s ease;
	font-weight: 500;
	font-size: 14px;
	display: flex;
	align-items: center;
	gap: 8px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.x4email-toolbar button:hover {
	background: var(--primary-hover);
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* GrapesJS Panel Customization */
.gjs-pn-panel {
	background: var(--panel-bg) !important;
	border-color: var(--panel-border) !important;
	box-shadow: var(--panel-shadow) !important;
}

.gjs-pn-btn {
	color: var(--dark-text) !important;
	transition: all 0.3s ease !important;
}

.gjs-pn-btn:hover {
	background: var(--primary-color) !important;
	color: #fff !important;
}

.gjs-pn-btn.gjs-pn-active {
	background: var(--primary-color) !important;
	color: #fff !important;
}

.gjs-block {
	background: var(--panel-bg) !important;
	border: 1px solid var(--panel-border) !important;
	border-radius: 6px !important;
	transition: all 0.3s ease !important;
}

.gjs-block:hover {
	transform: translateY(-2px);
	box-shadow: var(--panel-shadow);
}

.gjs-block-label {
	color: var(--dark-text) !important;
}

/* Email Component Styles */
.email-header {
	padding: 20px;
	text-align: center;
	background: var(--dark-secondary);
	border: 1px solid var(--dark-border);
}

.email-section {
	padding: 20px;
	background: var(--dark-secondary);
	border: 1px solid var(--dark-border);
}

.email-cta {
	text-align: center;
	padding: 20px;
	background: var(--dark-secondary);
	border: 1px solid var(--dark-border);
}

.email-footer {
	padding: 20px;
	text-align: center;
	background: var(--dark-secondary);
	border: 1px solid var(--dark-border);
	font-size: 12px;
	color: var(--dark-text-secondary);
}

/* Social Links */
.social-links {
	margin-top: 10px;
}

.social-links a {
	margin: 0 5px;
	color: var(--dark-text-secondary);
	text-decoration: none;
	transition: color 0.3s ease;
}

.social-links a:hover {
	color: var(--primary-color);
}

/* Button Styles */
.button {
	padding: 10px 20px;
	background: var(--primary-color);
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	text-decoration: none;
	display: inline-block;
	transition: all 0.3s ease;
}

.button:hover {
	background: var(--primary-hover);
	transform: translateY(-1px);
}

/* Divider */
.divider {
	border: none;
	border-top: 1px solid var(--dark-border);
	margin: 20px 0;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

::-webkit-scrollbar-track {
	background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
	background: var(--dark-border);
	border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
	background: var(--primary-color);
}

/* GrapesJS Canvas Customization */
.gjs-cv-canvas {
	background: var(--dark-bg) !important;
}

.gjs-selected {
	outline: 2px solid var(--primary-color) !important;
}

/* Responsive Adjustments */
@media screen and (max-width: 782px) {
	.x4email-sidebar {
		width: 250px;
	}

	.x4email-toolbar {
		padding: 10px;
		flex-wrap: wrap;
	}

	.x4email-toolbar button {
		padding: 6px 12px;
		font-size: 12px;
	}

	.device-select {
		min-width: 120px;
	}
}

/* Device Selector Styles */
.device-selector {
	margin-left: auto;
	margin-right: 15px;
	position: relative;
}

.device-select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background: var(--panel-bg) !important;
	color: var(--dark-text) !important;
	border: 1px solid var(--panel-border);
	padding: 8px 35px 8px 12px;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.3s ease;
	min-width: 140px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.device-select:hover {
	border-color: var(--primary-color);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.device-select:focus {
	outline: none;
	border-color: var(--primary-color);
	box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.device-select option {
	background: var(--dark-bg);
	color: var(--dark-text);
	padding: 12px;
	font-size: 14px;
}

/* Custom dropdown arrow */
.device-selector::after {
	content: '';
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	width: 0;
	height: 0;
	border-left: 5px solid transparent;
	border-right: 5px solid transparent;
	border-top: 5px solid #fff;
	pointer-events: none;
	transition: transform 0.3s ease;
}

.device-selector:hover::after {
	border-top-color: #fff;
}

/* Dropdown open state */
.device-select:focus + .device-selector::after {
	transform: translateY(-50%) rotate(180deg);
}

/* Active state */
.device-select option:checked {
	background: var(--primary-color);
	color: #fff;
}

/* Hover state for options */
.device-select option:hover {
	background: var(--dark-secondary);
}

/* Custom scrollbar for dropdown */
.device-select::-webkit-scrollbar {
	width: 8px;
}

.device-select::-webkit-scrollbar-track {
	background: var(--dark-bg);
}

.device-select::-webkit-scrollbar-thumb {
	background: var(--dark-border);
	border-radius: 4px;
}

.device-select::-webkit-scrollbar-thumb:hover {
	background: var(--primary-color);
}

/* Sidebar Tabs */
.x4email-sidebar-tabs {
	display: flex;
	background: var(--dark-secondary);
	border-bottom: 1px solid var(--dark-border);
	padding: 10px;
	gap: 5px;
}

.tab-button {
	padding: 8px 15px;
	background: transparent;
	color: var(--dark-text);
	border: none;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.3s ease;
	font-size: 14px;
}

.tab-button:hover {
	background: var(--dark-bg);
}

.tab-button.active {
	background: var(--primary-color);
	color: #fff;
}

.tab-content {
	flex: 1;
	overflow-y: auto;
}

.tab-pane {
	display: none;
	height: 100%;
}

.tab-pane.active {
	display: block;
}

/* Template Selector Styles */
.template-selector {
	background: var(--panel-bg);
	border-radius: 6px;
	padding: 8px;
	box-shadow: var(--panel-shadow);
	min-width: 200px;
}

.template-selector label {
	display: block;
	color: var(--dark-text);
	margin-bottom: 8px;
	font-size: 14px;
}

.template-selector select {
	width: 100%;
	padding: 8px 12px;
	background: var(--dark-bg);
	border: 1px solid var(--panel-border);
	border-radius: 6px;
	color: var(--dark-text);
	font-size: 14px;
	cursor: pointer;
	transition: all 0.3s ease;
}

.template-selector select:hover {
	border-color: var(--primary-color);
}

.template-selector select:focus {
	outline: none;
	border-color: var(--primary-color);
	box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.template-selector select option {
	background: var(--dark-bg);
	color: var(--dark-text);
	padding: 8px;
}

/* Undo/Redo Button Styles */
[id="undo"],
[id="redo"] {
	position: relative;
	transition: all 0.3s ease;
}

[id="undo"]:hover,
[id="redo"]:hover {
	background: var(--primary-hover) !important;
	transform: translateY(-1px);
}

[id="undo"].active,
[id="redo"].active {
	background: var(--primary-hover) !important;
	box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.3);
}

[id="undo"]:disabled,
[id="redo"]:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	background: var(--dark-secondary) !important;
}

[id="undo"] i,
[id="redo"] i {
	transition: transform 0.3s ease;
}

[id="undo"]:hover i {
	transform: rotate(-30deg);
}

[id="redo"]:hover i {
	transform: rotate(30deg);
}

/* Save Button States */
#save-template {
	background: var(--dark-secondary);
	color: var(--dark-text-secondary);
	border: 1px solid var(--dark-border);
	padding: 8px 16px;
	border-radius: 6px;
	cursor: not-allowed;
	transition: all 0.3s ease;
	font-weight: 500;
	font-size: 14px;
	opacity: 0.7;
}

#save-template.has-changes {
	background: var(--primary-color);
	color: #fff;
	border-color: var(--primary-color);
	cursor: pointer;
	opacity: 1;
}

#save-template.has-changes:hover {
	background: var(--primary-hover);
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#save-template:disabled {
	cursor: not-allowed;
	pointer-events: none;
}


[id^="__wp-uploader-id-"] {
	z-index: 99999999 !important;
	}
