:root {
	/* Light theme colors */
	--bg-primary: #ffffff;
	--bg-secondary: #f0f0f0;
	--bg-tertiary: #e0e0e0;
	--bg-accent: #cccccc;

	--text-primary: #000000;
	--text-secondary: #222222;
	--text-muted: #555555;

	--border-primary: rgba(0, 0, 0, 0.2);
	--border-secondary: rgba(0, 0, 0, 0.3);
	--border-active: var(--accent-primary);


	--panel-border-color:rgba(0, 0, 0, 0.1);

	--shadow-color: rgba(0, 0, 0, 0.15);

	--canvas-bg: #f0f0f0;
	--menu-hover: rgba(0, 0, 0, 0.05);
	--menu-active: rgba(0, 0, 0, 0.08);
	--button-hover: rgba(0, 0, 0, 0.05);
	--button-active: rgba(0, 0, 0, 0.08);
	--accent-primary: #025dee;
	--accent-hover: #003ea2;
	--accent-border: #0062ff;
	--error-color: #dc3545;
	--radius-medium: 8px;
	--radius-large: 10px;
	--radius-xl: 20px;
	--radius-xxl: 24px;

	--tool-button-width: 32px;
	--tool-button-height: 32px;
}

[data-theme="dark"] {
	/* Dark theme colors */
	--bg-primary: #121212;
	--bg-secondary: #1a1a1a;
	--bg-tertiary: #222222;
	--bg-accent: #2a2a2a;

	--text-primary: #ffffff;
	--text-secondary: #d0d0d0;
	--text-muted: #999999;

	--border-primary: rgba(255, 255, 255, 0.2);
	--border-secondary: rgba(255, 255, 255, 0.3);
	--border-active: var(--accent-primary);
	--panel-border-color:rgba(255,255,255, 0.1);
	--shadow-color: rgba(0, 0, 0, 0.6);

	--canvas-bg: #1a1a1a;
	--menu-hover: rgba(255, 255, 255, 0.08);
	--menu-active: rgba(255, 255, 255, 0.12);
	--button-hover: rgba(255, 255, 255, 0.08);
	--button-active: rgba(255, 255, 255, 0.12);
	--accent-primary: #025dee;
	--accent-hover: #003ea2;
	--accent-border: #0062ff;
	--error-color: #dc3545;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

/* Allow text selection in input fields */
input,
textarea,
[contenteditable] {
	-webkit-user-select: text;
	-moz-user-select: text;
	-ms-user-select: text;
	user-select: text;
}

body {
	font-family: "Arial", "Helvetica", sans-serif;
	font-size: 12px;
	background-color: var(--bg-primary);
	color: var(--text-primary);
	overflow: hidden;
	image-rendering: pixelated;
	image-rendering: -moz-crisp-edges;
	image-rendering: crisp-edges;
	transition: background-color 0.2s ease, color 0.2s ease;
	min-width: 1200px;
	min-height: 800px;
}

/* Minimum window size constraints */
html {
	min-width: 1200px;
	min-height: 800px;
	overflow: hidden;
}

/* Handle small screens gracefully */
@media screen and (max-width: 1199px), screen and (max-height: 799px) {
	html, body {
		overflow: hidden;
		min-width: unset;
		min-height: unset;
	}
	
	/* Hide scroll bars completely on small screens */
	::-webkit-scrollbar {
		display: none;
	}
	
	body {
		-ms-overflow-style: none;
		scrollbar-width: none;
	}
}

/* Menu Bar */
.menu-bar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 32px;
	background: var(--bg-secondary);
	border-bottom: 1px solid var(--border-primary);
	display: flex;
	align-items: center;
	z-index: 1000;
	font-size: 12px;
	font-weight: 500;
	transition: all 0.2s ease;
	backdrop-filter: blur(10px);
}

.menu-coordinates {
	margin-left: auto;
	padding-right: 12px;
	font-size: 12px;
	font-weight: 500;
	color: var(--text-secondary);
	font-family: monospace;
	white-space: nowrap;
	user-select: none;
}

.sub-top-bar{
		position: fixed;
	top: 32px;
	left: 0;
	right: 0;
	/* height: 48px; */

	margin: 8px;


	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;

	font-size: 14px;
	z-index: 999;
	transition: all 0.2s ease;
overflow: hidden;
}



/* Tool Options Bar - Bootstrap-like Modern Design */
.tool-options-bar {
	display: flex;
	align-items: center;
	gap: 4px;
	min-height: 40px;
	height: 40px;
	padding: 2px 4px 2px 8px;
	background: var(--bg-tertiary);
	border: var(--panel-border-color) 1px solid;
	border-radius: var(--radius-medium);
	flex: 1;
}

/* Active Tool Indicator */
.active-tool-indicator {
	display: flex;
	align-items: center;
	gap: 8px;



	border-radius: 6px;
	font-weight: 500;
	font-size: 13px;
	min-width: 60px;
}

.active-tool-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
}

.active-tool-name {
	white-space: nowrap;
}

.tool-options-separator {
	width: 1px;
	height: 24px;
	background: var(--border-secondary);
	margin: 0 8px;
}

.tool-options-bar .option-group {
	display: flex;
	align-items: center;
	gap: 4px;

	padding-left: 2px;
}

.tool-options-bar .option-group:first-child {
	border-left: none;
	padding-left: 0;
}

/* Toggle Button Component */
.btn-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	height: 32px;
	padding: 0 8px;
	border: none;
	border-radius: 4px;
	color: var(--text-secondary);
	cursor: pointer;
	transition: all 0.15s ease;	
	background: var(--bg-secondary);
	font-size: 14px;
	white-space: nowrap;
}

.btn-toggle:hover {
	background: var(--button-hover);
	color: var(--text-primary);
}

.btn-toggle.active {
	background: var(--accent-primary);
	color: #ffffff;
}

.btn-toggle i {
	font-size: 16px;
}

/* Shape Toggle Group */
.btn-group {
	display: inline-flex;
	border-radius: 4px;
	/* background: var(--bg-tertiary); */
	padding: 2px;
	gap: 2px;
}

.btn-group .btn-toggle {
	border-radius: 3px;
	margin: 0;

}

.btn-group .btn-toggle:hover {
	background: var(--button-hover);
}

.btn-group .btn-toggle.active {
	background: var(--accent-primary);
	color: #ffffff;
}

/* Number Input with +/- Buttons */
.number-input {
	display: inline-flex;
	align-items: center;
	border-radius: 4px;
	background: var(--bg-tertiary);
	overflow: hidden;
}

.number-input button {
	width: 28px;
	height: 32px;
	border: none;
	background: transparent;
	color: var(--text-secondary);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.15s ease;
	font-size: 14px;
	font-weight: 600;
}

.number-input button:hover {
	background: var(--button-hover);
	color: var(--text-primary);
}

.number-input input {
	width: 40px;
	height: 32px;
	border: none;
	background: transparent;
	color: var(--text-primary);
	text-align: center;
	font-size: 13px;
	font-weight: 500;
	outline: none;
}

.number-input input::-webkit-outer-spin-button,
.number-input input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.number-input input[type="number"] {
	-moz-appearance: textfield;
}

/* Flat minimal design - no extra decorative elements needed */
.tool-option-btn {
	font-size: 11px;
	padding: 8px 16px;
	border: none;
	background: var(--bg-tertiary);
	color: var(--text-primary);
	cursor: pointer;
	border-radius: var(--radius-large);
	transition: all 0.2s ease;
	font-weight: 500;
}

.tool-option-btn:hover {
	background: var(--button-hover);
}

.tool-option-btn:active {
	background: var(--button-active);
}

/* Text Tool Styles */
.text-tool-info {
	font-size: 11px;
	font-weight: 500;
	color: var(--text-secondary);
	background: var(--bg-secondary);
	padding: 4px 8px;
	border-radius: 4px;
	border: 1px solid var(--border-tertiary);
}

/* Control Labels */
.control-label {
	font-size: 11px;
	font-weight: 500;
	color: var(--text-primary);
	margin-bottom: 4px;
	display: block;
}

/* iOS-style Button Labels */
.button-label {
	font-size: 12px;
	display: inline-block;
	margin: 0;
	color: var(--text-primary);
	font-weight: 400;
	line-height: 1.2;
}

/* Display Mode Name */
#display-mode-name {
	font-size: 11px;
	color: var(--text-primary);
	min-width: 80px;
	text-align: left;
}

/* Icon-first layout for all control block buttons */
.control-block button {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: flex-start;
	gap: 8px;
	padding: 10px 12px;
	border: none;
	border-radius: 8px;
	background: transparent;
	color: var(--text-primary);
	font-size: 12px;
	font-weight: 400;
	transition: all 0.15s ease-out;
	cursor: pointer;
	min-height: 44px;
	position: relative;
	overflow: hidden;
}

.control-block button:hover {
	background: rgba(0, 122, 255, 0.1);
	transform: scale(1.02);
}

.control-block button:active {
	background: rgba(0, 122, 255, 0.2);
	transform: scale(0.98);
	transition: all 0.1s ease-out;
}

.control-block button i {
	font-size: 16px;
	color: rgba(0, 122, 255, 0.8);
	flex-shrink: 0;
	width: 18px;
	text-align: center;
}

.control-block button .button-label {
	font-size: 12px;
	color: var(--text-primary);
	margin: 0;
	flex: 1;
	text-align: left;
}

.menu-item {
	padding: 6px 12px;
	cursor: pointer;
	user-select: none;
	transition: background-color 0.2s, color 0.2s;
	color: var(--text-primary);
}

.menu-item:hover {
	background: var(--accent-primary);
	color: #ffffff;
}

.menu-item.active {
	background: var(--accent-primary);
	color: #ffffff;
}

.apple-logo {
	font-size: 14px;
}

.menu-dropdown {
	position: fixed;
	background: var(--bg-secondary);
	border: 1px solid var(--border-primary);
	min-width: 220px;
	z-index: 1001;
	display: none;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.menu-dropdown.show {
	display: block;
}

.menu-dropdown-item {
	padding: 8px 16px;
	font-size: 12px;
	cursor: pointer;
	user-select: none;
	position: relative;
	color: var(--text-primary);
	transition: background-color 0.2s, color 0.2s;
	display: flex;
	justify-content: flex-start;
	align-items: center;
	min-width: 220px;
	gap: 8px;
}

.menu-dropdown-item:hover:not(.disabled) {
	background: var(--accent-primary);
	color: #ffffff;
}

/* Menu item content wrapper for proper layout */
.menu-dropdown-item > span {
	flex: 1;
}

/* Menu icons */
.menu-dropdown-item > i {
	width: 16px;
	height: 16px;
	font-size: 14px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--text-secondary);
	transition: color 0.2s;
}

.menu-dropdown-item:hover > i {
	color: #ffffff;
}

/* Menu shortcuts positioning */
.menu-dropdown-item .menu-shortcut {
	margin-left: auto;
	padding-left: 16px;
}

.menu-dropdown-item.disabled {
	color: var(--text-muted);
	cursor: default;
}

.menu-divider {
	height: 1px;
	background: #e0e0e0;
	margin: 4px 0;
}

.menu-shortcut {
	font-size: 11px;
	color: #999999;
	font-family: "Consolas", "Monaco", "Courier New", monospace;
	margin-left: 16px;
}

.menu-dropdown-item:hover .menu-shortcut {
	color: #cccccc;
}

/* Submenu styles */
.menu-dropdown-item.has-submenu {
	position: relative;
}

.menu-arrow {
	font-size: 10px;
	color: #999999;
	margin-left: 8px;
}

.menu-dropdown-item:hover .menu-arrow {
	color: #cccccc;
}

.menu-submenu {
	position: fixed;
	background: var(--bg-secondary);
	border: 1px solid var(--border-primary);
	min-width: 150px;
	z-index: 1002;
	display: none;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Improve submenu item padding */
.menu-submenu .menu-dropdown-item {
	padding: 8px 16px;
	transition: background-color 0.2s, color 0.2s;
	border: none;
}

.menu-submenu.show {
	display: block;
}

/* Desktop */
.desktop {
	position: fixed;
	top: 80px; /* Menu bar (32px) + Tool options bar (36px) */
	left: 0;
	right: 0;
	bottom: 0;
	overflow: hidden;
}

/* Windows */
.window {
	position: absolute;
	/* background: var(--bg-secondary); */
	border: 1px solid var(--border-secondary);
	min-width: 200px;
	min-height: 100px;
	resize: both;
	overflow: hidden;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.window-title-bar {
	height: 32px;
	background: var(--bg-tertiary);
	border-bottom: 1px solid var(--border-primary);
	display: flex;
	align-items: center;
	padding: 0 8px;
	cursor: move;
	user-select: none;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Make canvas window completely flat */
#canvas-window {
	resize: none;
	border: none;

}

#canvas-window .window-title-bar {
	display: none;
}

#canvas-window .window-content {
	height: 100%;
	padding-bottom: 48px;
}

.window-title {
	font-size: 12px;
	font-weight: 600;
	flex: 1;
	text-align: center;
	margin: 0 8px;
	margin-right: 64px;
	color: var(--text-primary);
	transition: color 0.2s ease;
}

/* Windows-style window controls (right-aligned) */
.platform-windows .window-title-bar {
	flex-direction: row-reverse;
}

.platform-windows .window-title {
	margin-right: 8px;
	margin-left: 64px;
}

.platform-windows .window-controls {
	margin-right: 0;
	margin-left: 8px;
	order: 1;
	flex-direction: row-reverse;
}

.platform-windows .window-control {
	border-radius: 0;
}

.platform-windows .window-control.close {
	background: #e81123;
	color: #ffffff;
}

.platform-windows .window-control.close:hover {
	background: #f1707a;
}

.platform-windows .window-control.minimize {
	background: var(--bg-accent);
	color: var(--text-secondary);
}

.platform-windows .window-control.minimize:hover {
	background: #cccccc;
	color: var(--text-primary);
}

.platform-windows .window-control.zoom {
	background: var(--bg-accent);
	color: var(--text-secondary);
}

.platform-windows .window-control.zoom:hover {
	background: #cccccc;
	color: var(--text-primary);
}

.window-controls {
	display: flex;
	gap: 8px;
	margin-right: 8px;
}

.window-control {
	width: 20px;
	height: 20px;
	border: none;
	cursor: pointer;
	font-size: 12px;
	font-weight: bold;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--border-radius-sm);
	user-select: none;
	transition: background-color 0.2s, color 0.2s;
	background: var(--bg-secondary);
	color: var(--text-primary);
	border: 1px solid var(--border-color);
}

.window-control:hover {
	opacity: 0.8;
}

.window-control.close {
	background: var(--bg-accent);
	color: var(--text-secondary);
}

.window-control.close:hover {
	background: #ff5f57;
	color: #ffffff;
}

.window-control.minimize {
	background: var(--bg-accent);
	color: var(--text-secondary);
}

.window-control.minimize:hover {
	background: #ffbd2e;
	color: #ffffff;
}

.window-control.zoom {
	background: var(--bg-accent);
	color: var(--text-secondary);
}

.window-control.zoom:hover {
	background: #28ca42;
	color: #ffffff;
}

.window-content {
	min-height: 20px;
	overflow: auto;
	position: relative;

	color: var(--text-primary);
	transition: background-color 0.2s ease, color 0.2s ease;
}

/* For windows with fixed height */
.window[style*="height:"][style*="px"] .window-content {
	height: calc(100% - 33px);
}

/* Canvas window specific adjustments */
#canvas-window .window-content {
	padding: 0;
	padding-bottom: 48px;
	display: flex;
	flex-direction: column;
	position: relative;
	height: calc(100% - 48px);
}

/* Small Title Bar - Photoshop Style */
.window.small-titlebar {
	height: auto !important;
}

.window.small-titlebar .window-title-bar {
	height: 16px;
	min-height: 16px;
	padding: 0 4px;
	font-size: 10px;
}

.window.small-titlebar .window-title {
	font-size: 10px;
	font-weight: 600;
	margin: 0 4px;
}

.window.small-titlebar .window-controls {
	gap: 4px;
	margin-right: 4px;
}

.window.small-titlebar .window-control {
	width: 12px;
	height: 12px;
	font-size: 10px;
}

.window.small-titlebar .window-content {
	height: auto;
}

.window.small-titlebar.minimized {
	height: 17px !important;
	min-height: 17px !important;
}

/* Tool Palette */
.tool-palette {
	background: var(--bg-tertiary);
	padding: 2px;
	transition: background-color 0.2s ease, border-color 0.2s ease;
	display: grid;
	grid-template-columns: repeat(4, auto);
	grid-auto-flow: row;
	grid-auto-rows: auto;
	gap: 2px;
}

.tool-row {
	display: contents;
}

.tool-icon {
	width: var(--tool-button-width);
	height: var(--tool-button-height);
	border: none;
	background: var(--bg-secondary);
	cursor: pointer;
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: all 0.2s ease;
	border-radius: var(--radius-medium);
	color: var(--text-primary);
	aspect-ratio: 1/1;
}

.tool-icon:hover {
	background: var(--button-hover);
}

.tool-icon.active {
	background: var(--accent-primary);
	color: #ffffff;
}

.tool-spacer {
	width: var(--tool-button-width);
	height: var(--tool-button-height);
	/* Invisible spacer - takes up grid space but is not visible */
}

/* Color Palette */
.color-palette {
	background: var(--bg-tertiary);
	padding: 4px;
	transition: background-color 0.2s ease, border-color 0.2s ease;
	display: flex;
	flex-direction: column;
	gap: 4px;
	max-height: 300px;
	overflow-y: auto;
}

.pattern-row {
	display: flex;
	gap: 4px;
}

.color-swatch {
	width: var(--tool-button-width);
	height: var(--tool-button-height);
	border: none;
	cursor: pointer;
	position: relative;
	transition: all 0.2s ease;
	border-radius: var(--radius-medium);
}

.color-swatch:hover {
	transform: translateY(-1px);
}

.color-swatch.selected {
	transform: translateY(-1px);
	border: 2px solid #007aff;
	box-shadow: 0 0 0 1px rgba(0, 122, 255, 0.3);
}

/* Pattern visualization is now done via dynamic canvas previews */

.new-pattern-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--bg-secondary);
	border: 1px dashed var(--border-secondary);
	transition: all 0.2s ease;
}

.new-pattern-btn:hover {
	background: var(--button-hover);
	border-color: var(--accent-primary);
	transform: translateY(-1px);
}

.new-pattern-btn i {
	color: var(--text-muted);
}

/* Option Groups */
.option-group {
	/* Removed margin-bottom for cleaner alignment */
}

.option-group:last-child {
}

.option-group h4 {
	color: #333333;
	margin-bottom: 8px;
	font-size: 12px;
	font-weight: 600;
	/* border-bottom: 1px solid #e0e0e0; */
	padding-bottom: 2px;
}

.option-group label {
	display: block;
	margin-bottom: 6px;
	font-size: 12px;
}

.option-group input[type="text"],
.option-group input[type="number"],
.option-group select,
.option-group textarea {
	padding: 4px 8px;
	border: 1px solid var(--border-secondary);
	background: var(--bg-secondary);
	color: var(--text-primary);
	font-size: 12px;
	font-family: inherit;
	border-radius: var(--radius-medium);
	transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.option-group input[type="number"] {
	width: 60px;
}

.option-group input[type="text"] {
	width: 140px;
}

/* .option-group button {
	width: var(--tool-button-width);
	height: var(--tool-button-height);
	border: none;
	background: var(--bg-secondary);
	cursor: pointer;
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: all 0.2s ease;
	border-radius: var(--radius-medium);
	color: var(--text-primary);
	margin: 2px;
}
.option-group button:hover {
	background: var(--button-hover);
}

.option-group button:active {
	background: var(--button-active);
} */

#export-btn {
	background: #28a745;
	color: #ffffff;
	border-color: #1e7e34;
}

#export-btn:hover {
	background: #218838;
}

#clear-btn {
	background: #dc3545;
	color: #ffffff;
	border-color: #c82333;
}

#clear-btn:hover {
	background: #c82333;
}

/* Canvas Area */
.canvas-area {


	padding: 8px;
	display: flex;
	justify-content: center;
	align-items: center;
	flex: 1;
	overflow: auto;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

#bitmap-canvas {
	border: 1px solid #cccccc;
	cursor: crosshair;
	image-rendering: pixelated;
	image-rendering: -moz-crisp-edges;
	image-rendering: crisp-edges;
	background-color: #ffffff;
}

#bitmap-canvas.bucket-cursor {
	cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill="black" d="M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"/><path fill="black" d="M1.5 2A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2h-13zm13 1a.5.5 0 0 1 .5.5v6l-3.775-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12v.54A1.5 1.5 0 0 1 1.5 3h13z"/></svg>')
			8 8,
		auto;
}

/* Preview Window */
.preview-area {
	background: var(--bg-secondary);
	border: 1px solid var(--border-primary);
	padding: 4px;
	display: flex;
	justify-content: center;
	align-items: center;
	overflow: hidden;
	position: relative;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

#preview-canvas {
	border: 1px solid #cccccc;
	image-rendering: pixelated;
	image-rendering: -moz-crisp-edges;
	image-rendering: crisp-edges;
	background-color: #ffffff;
	max-width: 100%;
	max-height: 100%;
}

/* Viewport Overlay for Preview Navigation */
.viewport-overlay {
	position: absolute;
	top: 4px;
	left: 4px;
	right: 4px;
	bottom: 4px;
	pointer-events: none;
	z-index: 10;
}

.viewport-frame {
	position: absolute;
	border: 2px solid #ff0000;
	pointer-events: auto;
	cursor: move;
	box-sizing: border-box;
	background: rgba(255, 0, 0, 0.1);
	transition: border-color 0.2s ease;
}

.viewport-frame:hover {
	border-color: #cc0000;
	background: rgba(255, 0, 0, 0.15);
}

/* Output Area */
.output-area {
	display: flex;
	flex-direction: column;
	height: calc(100% - 140px);
}

#output-code {
	flex: 1;
	font-family: "Consolas", "Monaco", "Courier New", monospace;
	font-size: 11px;
	padding: 8px;
	border: 1px solid #cccccc;
	resize: none;
	background: #ffffff;
	min-height: 200px;
}

/* Drop Zone */
.drop-zone {
	border: 1px dashed #cccccc;
	padding: 16px;
	text-align: center;
	color: #666666;
	font-size: 12px;
	margin-bottom: 8px;
	background: #f8f8f8;
	cursor: pointer;
	transition: all 0.3s;
}

.drop-zone:hover {
	background: #f0f0f0;
	border-color: #999999;
}

.drop-zone.dragover {
	background: #e3f2fd;
	border-color: #2196f3;
	color: #1976d2;
}

.drop-zone button {
	background: #ffffff;
	border: 1px solid #cccccc;
	padding: 4px 8px;
	font-size: 12px;
	cursor: pointer;
}

.drop-zone button:hover {
	background: #f0f0f0;
}

/* Responsive behavior for smaller screens */

/* PNG Icon styles */
.icon {
	image-rendering: pixelated;
	image-rendering: -moz-crisp-edges;
	image-rendering: crisp-edges;
}

.tool-icon .icon {
	width: 20px;
	height: 20px;
}

.window-control-icon {
	width: 12px;
	height: 12px;
}

.menu-icon {
	width: 16px;
	height: 16px;
}

.png-icon-loaded {
	/* Successfully loaded PNG icon */
}

.fallback-icon {
	/* Using SVG fallback */
	opacity: 0.8;
}

.placeholder-icon {
	/* Using generated placeholder */
	opacity: 0.6;
	filter: contrast(0.8);
}

/* Hidden elements */
.window.hidden {
	display: none;
}

/* Minimized windows */
.window.minimized {
	height: 33px !important;
	min-height: 33px !important;
	overflow: hidden;
	resize: none;
}

.window.minimized .window-content {
	display: none;
}

.window.minimized .window-title-bar {
	cursor: move;
	background: #f0f0f0;
	border-bottom: none;
}

.window.minimized .window-title-bar:hover {
	background: #e8e8e8;
}

.window-menu-item {
	font-family: inherit !important;
}

/* Selection animation */
@keyframes dashMove {
	0% {
		stroke-dashoffset: 0;
	}
	100% {
		stroke-dashoffset: 8;
	}
}

.selection-overlay {
	animation: dashMove 0.5s linear infinite;
}

/* Notification animations */
@keyframes slideIn {
	from {
		transform: translateX(100%);
		opacity: 0;
	}
	to {
		transform: translateX(0);
		opacity: 1;
	}
}

@keyframes slideOut {
	from {
		transform: translateX(0);
		opacity: 1;
	}
	to {
		transform: translateX(100%);
		opacity: 0;
	}
}

.notification {
	position: fixed;
	top: 40px;
	right: 20px;
	padding: 12px 16px;
	border: 1px solid #cccccc;
	background: #ffffff;
	color: #333333;
	font-size: 12px;
	font-weight: 400;
	z-index: 2000;
	animation: slideIn 0.3s ease;
}

.notification-success {
	background: #d4edda;
	border-color: #c3e6cb;
	color: #155724;
}

.notification-error {
	background: #f8d7da;
	border-color: #f5c6cb;
	color: #721c24;
}

/* About Window Styles */
.about-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

.about-icon {
	margin-bottom: 16px;
}

.app-icon {
	font-size: 48px;
	width: 64px;
	height: 64px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--bg-tertiary);
	border-radius: 8px;
	margin: 0 auto;
	transition: background-color 0.2s ease;
}

.app-icon-image {
	width: 64px;
	height: 64px;
	object-fit: contain;
	border-radius: 8px;
}

.about-info h2 {
	font-size: 24px;
	font-weight: 600;
	margin-bottom: 4px;
	color: var(--text-primary);
	transition: color 0.2s ease;
}

.about-info .version {
	font-size: 14px;
	color: var(--text-secondary);
	margin-bottom: 8px;
	transition: color 0.2s ease;
}

.about-info .description {
	font-size: 14px;
	color: var(--text-secondary);
	margin-bottom: 16px;
	transition: color 0.2s ease;
}

.about-section {
	margin-bottom: 16px;
	text-align: left;
	width: 100%;
}

.about-section h3 {
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 8px;
	color: var(--text-primary);
	border-bottom: 1px solid var(--border-primary);
	padding-bottom: 4px;
	transition: color 0.2s ease, border-color 0.2s ease;
}

.about-section p {
	font-size: 12px;
	color: var(--text-secondary);
	line-height: 1.4;
	margin-bottom: 4px;
	transition: color 0.2s ease;
}

.coffee-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 24px;
	background: #FF813F;
	color: white;
	text-decoration: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.2s ease;
	margin-top: 8px;
	box-shadow: 0 2px 8px rgba(255, 129, 63, 0.3);
}

.coffee-link:hover {
	background: #FF6B1A;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(255, 129, 63, 0.4);
	text-decoration: none;
	color: white;
}

.coffee-link i {
	font-size: 16px;
}

.about-section ul {
	font-size: 12px;
	color: #666666;
	line-height: 1.4;
	margin-left: 16px;
}

.about-section li {
	margin-bottom: 2px;
}

.about-section a {
	color: #0078d4;
	text-decoration: none;
}

.about-section a:hover {
	text-decoration: underline;
}

/* Shortcuts Window Styles */
.shortcuts-content {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.shortcuts-section {
	margin-bottom: 16px;
}

.shortcuts-section h3 {
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 8px;
	color: #333333;
	border-bottom: 1px solid #e0e0e0;
	padding-bottom: 4px;
}

.shortcut-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 4px 0;
	font-size: 12px;
}

.shortcut-key {
	background: #f0f0f0;
	padding: 2px 6px;
	border-radius: 3px;
	font-family: "Consolas", "Monaco", "Courier New", monospace;
	font-size: 11px;
	color: #333333;
	border: 1px solid #cccccc;
	min-width: 60px;
	text-align: center;
}

.shortcut-desc {
	color: #666666;
	flex: 1;
	margin-left: 12px;
}

/* Canvas Controls */
.canvas-controls-bar {
 overflow: hidden;
	display: flex;
	align-items: center;height: 40px;
	gap: 4px;
border: var(--panel-border-color) 1px solid;
		padding: 4px 4px 4px 4px;
	background: var(--bg-tertiary);
border-radius: var(--radius-medium);
}

/* Canvas controls in window have different styling */
#canvas-controls-window .canvas-controls {

}

/* Vertical canvas controls layout */
.canvas-controls-vertical {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 8px;
}

.control-block {
	display: flex;
	flex-direction: column;
	width: 100%;
}

.control-block .dropdown-button {
	width: 100%;
	height: auto;
	min-height: 36px;
	padding: 6px 12px;
	justify-content: space-between;
	gap: 6px;
	font-size: 12px;
	white-space: nowrap;
}


.control-group {
	display: flex;
	align-items: center;
	/* gap: 6px; */
	/* padding: 0 8px; */

	transition: border-color 0.2s ease;
	min-height: 24px;
}

.control-group:first-child {
	padding-left: 0;
}

.control-group:last-child {
	border-right: none;
	padding-right: 0;
}

/* Control groups in window don't have borders */
#canvas-controls-window .control-group {
	border-right: none;
	padding: 4px 0;
	background: var(--bg-accent);
	border-radius: 4px;
	padding: 4px 8px;
}

.control-group label {
	color: var(--text-secondary);
	font-size: 12px;
	margin-right: 6px;
	display: flex;
	align-items: center;
	transition: color 0.2s ease;
	white-space: nowrap;
}


/* Dropdown buttons for canvas controls */
/* Display mode preview icon */
.display-preview {
	width: 16px;
	height: 16px;
	border: 1px solid var(--border-secondary);
	border-radius: 2px;
	margin-right: 6px;
	background: var(--canvas-bg);
}

.dropdown-button {
	width: var(--tool-button-width);
	height: var(--tool-button-height);
	border: none;
	background: var(--bg-secondary);
	cursor: pointer;
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: all 0.2s ease;
	border-radius: var(--radius-medium);
	color: var(--text-primary);
	aspect-ratio: 1/1;
	min-width: 0;
	flex-shrink: 0;
	white-space: nowrap;
}

.dropdown-button:hover {
	background: var(--button-hover);
}

.dropdown-button:active {
	background: var(--button-active);
}

.dropdown-button i:first-child {
	font-size: 14px;
	flex-shrink: 0;
}

.dropdown-button i:last-child {
	font-size: 12px;
	opacity: 0.6;
	flex-shrink: 0;
}

.dropdown-button span {
	flex-shrink: 0;
	min-width: 0;
}

/* Hidden selects */
#zoom-select,
#display-mode-select {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

/* Canvas controls dropdowns - Drop-down style */
.canvas-controls-bar select {
	position: absolute;
	top: 100%;
	left: 0;
	margin-top: 4px;
	min-width: 100%;
	z-index: 1000;
}

/* Custom dropdown */
.custom-dropdown {
	background: var(--bg-secondary);
	border: 1px solid var(--border-primary);
	border-radius: 4px;
	z-index: 9999;
	max-height: 200px;
	overflow-y: auto;
	transition: background-color 0.2s ease, border-color 0.2s ease;
	min-width: 120px;
}

/* Minimal scrollbar for all dropdowns */
.custom-dropdown::-webkit-scrollbar {
	width: 6px;
}

.custom-dropdown::-webkit-scrollbar-track {
	background: transparent;
}

.custom-dropdown::-webkit-scrollbar-thumb {
	background: var(--text-muted);
	border-radius: 3px;
	opacity: 0.5;
}

.custom-dropdown::-webkit-scrollbar-thumb:hover {
	background: var(--text-secondary);
	opacity: 0.8;
}

.dropdown-item {
	padding: 6px 12px;
	font-size: 11px;
	cursor: pointer;
	border-bottom: 1px solid var(--border-primary);
	transition: background-color 0.2s, color 0.2s;
	color: var(--text-primary);
}

.dropdown-item:last-child {
	border-bottom: none;
}

.dropdown-item:hover {
	background-color: var(--accent-primary);
	color: #ffffff;
}

.dropdown-item.selected {
	background-color: var(--accent-primary);
	color: #ffffff;
}

.dropdown-item.selected:hover {
	background-color: var(--accent-hover);
}

/* View controls in tool options */
.view-controls {
	display: flex;
	gap: 8px;
	align-items: center;
}

.view-controls button {
	width: var(--tool-button-width);
	height: var(--tool-button-height);
	border: none;
	background: var(--bg-secondary);
	cursor: pointer;
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: all 0.2s ease;
	border-radius: var(--radius-medium);
	color: var(--text-primary);
	aspect-ratio: 1/1;
}

.view-controls button:hover {
	background: var(--button-hover);
}

.view-controls button:active {
	background: var(--button-active);
}

/* Override text color for dropdown options */
#zoom-select option {
	color: #333333;
	text-indent: 0;
}

/* Zoom level display */
.zoom-level {
	color: #666666;
	font-size: 11px;
	font-weight: 600;
	min-width: 30px;
	text-align: center;
}

/* Layer Panel Styles */
.layer-controls {
	display: flex;
	gap: 6px;
	margin-bottom: 8px;

	background: var(--bg-tertiary);

	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.layer-controls button {
	width: var(--tool-button-width);
	height: var(--tool-button-height);
	border: none;
	background: var(--bg-secondary);
	cursor: pointer;
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: all 0.2s ease;
	border-radius: var(--radius-medium);
	color: var(--text-primary);
	aspect-ratio: 1/1;
	font-family: inherit;
}

.layer-controls button:hover {
	background: var(--button-hover);
}

.layer-controls button:active {
	background: var(--button-active);
}

.layer-list {
	background: var(--bg-secondary);
	border: 1px solid var(--border-primary);

	max-height: 300px;
	overflow-y: auto;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.layer-item {
	display: flex;
	align-items: center;
	padding: 8px;
	border-bottom: 1px solid var(--border-primary);
	cursor: pointer;
	user-select: none;
	transition: background-color 0.2s;
	font-size: 12px;
	color: var(--text-primary);
}

.layer-item:last-child {
	border-bottom: none;
}

.layer-item:hover {
	background: var(--bg-tertiary);
}

.layer-item.active {
	background: var(--accent-primary);
	border-color: var(--accent-border);
	color: #ffffff;
}

.layer-item.active:hover {
	background: var(--accent-hover);
}

.layer-visibility {
	width: 20px;
	height: 20px;
	border: 1px solid var(--border-secondary);
	background: var(--bg-secondary);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-right: 8px;
	font-size: 14px;
	color: var(--text-primary);
	transition: background-color 0.2s, color 0.2s, border-color 0.2s;
	border-radius: 2px;
}

.layer-visibility:hover {
	background: var(--button-hover);
}

.layer-visibility.hidden {
	background: var(--button-hover);
	color: var(--text-muted);
}

.layer-name {
	flex: 1;
	font-weight: 600;
	color: var(--text-primary);
	margin-right: 8px;
	transition: color 0.2s ease;
}

.layer-item.active .layer-name {
	color: #ffffff;
}

/* Layer Drag and Drop */
.layer-item.dragging {
	opacity: 0.5;
	transform: scale(0.95);
}

.layer-item.drag-over {
	background-color: var(--accent-primary);
	border-color: var(--accent-border);
}

.layer-item.drag-over .layer-name {
	color: white;
}

.layer-item {
	cursor: grab;
}

.layer-item:active {
	cursor: grabbing;
}

/* Layer Batch Controls */
.layer-batch-controls {
	display: flex;
	gap: 4px;
	margin-bottom: 8px;
	padding: 4px;
	background: var(--bg-tertiary);
	border: 1px solid var(--accent-primary);
	border-radius: var(--radius-medium);
	flex-wrap: wrap;
}

.layer-batch-controls button {
	height: 24px;
	padding: 4px 8px;
	border: none;
	background: var(--bg-secondary);
	cursor: pointer;
	font-size: 11px;
	display: flex;
	align-items: center;
	gap: 4px;
	transition: all 0.2s ease;
	border-radius: var(--radius-medium);
	color: var(--text-primary);
	font-family: inherit;
	white-space: nowrap;
}

.layer-batch-controls button:hover {
	background: var(--button-hover);
}

.layer-batch-controls button:active {
	background: var(--button-active);
}

#batch-delete-btn {
	background: #dc3545;
	color: white;
}

#batch-delete-btn:hover {
	background: #c82333;
}

#combine-layers-btn {
	background: var(--accent-primary);
	color: white;
}

#combine-layers-btn:hover {
	background: var(--accent-hover);
}

/* Layer Multi-Selection */
.layer-item.selected {
	background: #e3f2fd;
	border-color: var(--accent-primary);
}

.layer-item.selected:hover {
	background: #bbdefb;
}

.layer-item.selected.active {
	background: var(--accent-primary);
}

.layer-checkbox {
	width: 16px;
	height: 16px;
	margin-right: 8px;
	cursor: pointer;
}

.layer-item .layer-checkbox {
	opacity: 0;
	transition: opacity 0.2s ease;
}

.layer-item:hover .layer-checkbox,
.layer-item.selected .layer-checkbox {
	opacity: 1;
}



/* Tool Options in Window */


.option-section {
	margin-bottom: 12px;
	padding: 8px;
	background: var(--bg-secondary);
	border: 1px solid var(--border-primary);
	border-radius: 4px;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.option-section:last-child {
	margin-bottom: 0;
}

.option-section label {
	display: block;
	margin-bottom: 6px;
	font-size: 12px;
	font-weight: 600;
	color: var(--text-primary);
	transition: color 0.2s ease;
}

.option-section input[type="range"] {
	width: 120px;
	margin-right: 8px;
}

.option-section input[type="number"],
.option-section input[type="text"],
.option-section select {
	padding: 4px 8px;
	border: 1px solid var(--border-secondary);
	background: var(--bg-secondary);
	color: var(--text-primary);
	font-size: 12px;
	font-family: inherit;
	border-radius: 3px;
}

.option-section input[type="number"] {
	width: 60px;
}

.option-section input[type="text"] {
	width: 140px;
}

.option-section input[type="number"]:focus,
.option-section input[type="text"]:focus,
.option-section select:focus {
	outline: none;
	border-color: #0078d4;
}

.option-section input[type="checkbox"] {
	margin-right: 6px;
}

.option-section button {
	width: var(--tool-button-width);
	height: var(--tool-button-height);
	margin: 4px 4px 4px 0;
	border: none;
	background: var(--bg-secondary);
	cursor: pointer;
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: all 0.2s ease;
	border-radius: var(--radius-medium);
	color: var(--text-primary);
	aspect-ratio: 1/1;
	font-family: inherit;
}

.option-section button:hover {
	background: var(--button-hover);
}

.option-section button:active {
	background: var(--button-active);
}

.option-label {
	color: var(--text-secondary);
	font-style: italic;
	font-size: 11px;
	transition: color 0.2s ease;
}

/* CPP Export/Import Dialog Styles */
.input-section,
.code-section,
.import-section {
	margin-bottom: 16px;
}

.input-section label,
.code-section label,
.import-section label {
	display: block;
	margin-bottom: 6px;
	font-size: 12px;
	font-weight: 600;
	color: #333;
}

.input-section input[type="text"] {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 12px;
	font-family: "Consolas", "Monaco", "Courier New", monospace;
}

.code-section textarea,
.import-section textarea {
	width: 100%;
	min-height: 300px;
	padding: 8px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 11px;
	font-family: "Consolas", "Monaco", "Courier New", monospace;
	background: #f8f9fa;
	resize: vertical;
}

.import-section input[type="file"] {
	width: 100%;
	padding: 8px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 12px;
	margin-bottom: 12px;
}

.help-text {
	font-size: 11px;
	color: #666;
	margin: 8px 0 4px 0;
	font-style: italic;
}

/* Dithering Dialog Styles */
.input-section select {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 12px;
	background: #ffffff;
	cursor: pointer;
}

.input-section input[type="range"] {
	width: 70%;
	margin-right: 8px;
}

.input-section span {
	display: inline-block;
	min-width: 20px;
	font-weight: 600;
	color: #333;
}

/* Text Tool Preview Area */
.text-preview-area {
	background: var(--bg-primary);
	border: 1px solid var(--border-secondary);
	border-radius: 4px;
	padding: 12px;
	margin-top: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 60px;
}

#text-preview-canvas {
	background: var(--bg-secondary);
	border: 1px solid var(--border-tertiary);
	border-radius: 2px;
	image-rendering: pixelated;
	image-rendering: -moz-crisp-edges;
	image-rendering: crisp-edges;
}

/* Dialog Overlay */
.dialog-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2000;
	backdrop-filter: blur(4px);
}

.dialog {
	background: var(--bg-primary);
	border-radius: 12px;
	width: 480px;
	max-width: 800px;
	max-height: 600px;
	overflow: hidden;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.1);
	border: 1px solid var(--border-primary);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	transform: scale(1);
}

.dialog-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 8px;
	color: var(--text-primary);
	border-bottom: 1px solid var(--border-primary);
	background: var(--bg-primary);
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.dialog-header h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: var(--text-primary);
	transition: color 0.2s ease;
	letter-spacing: -0.02em;
}

.dialog-close {
	background: none;
	border: none;
	font-size: 18px;
	cursor: pointer;
	padding: 8px;
	border-radius: 8px;
	color: var(--text-muted);
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.dialog-close:hover {
	background: var(--bg-tertiary);
	color: var(--text-primary);
	transform: scale(1.05);
}

.dialog-content {
	padding: 24px;
	max-height: 400px;
	overflow-y: auto;
	background: var(--bg-primary);
	color: var(--text-primary);
	transition: background-color 0.2s ease, color 0.2s ease;
}

.dialog-footer {
	display: flex;
	justify-content: flex-end;
	gap: 12px;
	padding: 20px 24px;
	border-top: 1px solid var(--border-primary);
	background: var(--bg-primary);
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.dialog-btn {
	padding: 10px 20px;
	border: 1px solid var(--border-secondary);
	border-radius: 8px;
	cursor: pointer;
	font-size: 13px;
	font-weight: 500;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	min-width: 80px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.dialog-btn-cancel {
	background: var(--bg-secondary);
	color: var(--text-secondary);
	border: 1px solid var(--border-primary);
}

.dialog-btn-cancel:hover {
	background: var(--bg-tertiary);
	color: var(--text-primary);
	border-color: var(--border-secondary);
	transform: translateY(-1px);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dialog-btn-primary {
	background: var(--accent-primary);
	color: #ffffff;
	border-color: var(--accent-primary);
	box-shadow: 0 2px 4px rgba(2, 93, 238, 0.2);
}

.dialog-btn-primary:hover {
	background: var(--accent-hover);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(2, 93, 238, 0.3);
}

/* New Canvas Dialog */
.preset-section,
.custom-section {
	margin-bottom: 24px;
}

.preset-section:last-child,
.custom-section:last-child {
	margin-bottom: 0;
}

.preset-section h4,
.custom-section h4 {
	margin: 0 0 12px 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--text-primary);
	transition: color 0.2s ease;
}

#preset-select {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid var(--border-secondary);
	border-radius: 4px;
	font-size: 12px;
	background: var(--bg-secondary);
	color: var(--text-primary);
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease,
		border-color 0.2s ease;
}

.size-inputs {
	display: flex;
	gap: 12px;
	align-items: center;
}

.size-inputs label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	font-weight: 500;
	color: var(--text-primary);
	transition: color 0.2s ease;
}

.size-inputs input {
	width: 80px;
	padding: 6px 8px;
	border: 1px solid var(--border-secondary);
	border-radius: 4px;
	font-size: 12px;
	background: var(--bg-secondary);
	color: var(--text-primary);
	transition: background-color 0.2s ease, color 0.2s ease,
		border-color 0.2s ease;
}

.project-inputs {
	display: flex;
	gap: 12px;
	align-items: center;
}

.project-inputs label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	font-weight: 500;
	color: var(--text-primary);
	transition: color 0.2s ease;
}

.project-inputs input {
	width: 200px;
	padding: 6px 8px;
	border: 1px solid var(--border-secondary);
	border-radius: 4px;
	font-size: 12px;
	background: var(--bg-secondary);
	color: var(--text-primary);
	transition: background-color 0.2s ease, color 0.2s ease,
		border-color 0.2s ease;
}

.background-inputs {
	display: flex;
	gap: 12px;
	align-items: center;
}

.background-inputs label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	font-weight: 500;
	color: var(--text-primary);
	transition: color 0.2s ease;
}

.background-inputs select {
	width: 200px;
	padding: 6px 8px;
	border: 1px solid var(--border-secondary);
	border-radius: 4px;
	font-size: 12px;
	background: var(--bg-secondary);
	color: var(--text-primary);
	transition: background-color 0.2s ease, color 0.2s ease,
		border-color 0.2s ease;
	cursor: pointer;
}

/* Progress Manager Styles */
.progress-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.7);
	backdrop-filter: blur(4px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10000;
	animation: progressFadeIn 0.3s ease-out;
}

.progress-container {
	background: var(--bg-primary);
	border: 1px solid var(--border-primary);
	border-radius: 12px;
	padding: 32px;
	min-width: 400px;
	max-width: 500px;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
	animation: progressSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.progress-content {
	text-align: center;
}

.progress-icon {
	margin-bottom: 16px;
}

.progress-icon i {
	font-size: 48px;
	color: var(--accent-primary);
	animation: progressSpin 1s linear infinite;
}

.progress-text {
	margin-bottom: 24px;
}

.progress-title {
	font-size: 18px;
	font-weight: 600;
	color: var(--text-primary);
	margin-bottom: 4px;
}

.progress-subtitle {
	font-size: 14px;
	color: var(--text-secondary);
	line-height: 1.4;
}

.progress-bar-container {
	margin-bottom: 16px;
	display: flex;
	align-items: center;
	gap: 12px;
}

.progress-bar {
	flex: 1;
	height: 8px;
	background: var(--bg-tertiary);
	border-radius: 4px;
	overflow: hidden;
	position: relative;
}

.progress-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
	border-radius: 4px;
	transition: width 0.3s ease;
	position: relative;
}

.progress-fill.indeterminate {
	width: 100% !important;
	background: linear-gradient(90deg, 
		transparent, 
		var(--accent-primary), 
		transparent
	);
	background-size: 200% 100%;
	animation: progressIndeterminate 1.5s ease-in-out infinite;
}

.progress-percentage {
	font-size: 14px;
	font-weight: 600;
	color: var(--text-primary);
	min-width: 40px;
	text-align: right;
}

.progress-details {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	font-size: 12px;
	color: var(--text-muted);
}

.progress-stats {
	font-family: monospace;
}

.progress-eta {
	font-style: italic;
}

.progress-actions {
	display: flex;
	justify-content: center;
}

.progress-cancel-btn {
	padding: 8px 24px;
	background: var(--bg-secondary);
	color: var(--text-primary);
	border: 1px solid var(--border-secondary);
	border-radius: 6px;
	cursor: pointer;
	font-size: 14px;
	transition: all 0.2s ease;
}

.progress-cancel-btn:hover {
	background: var(--bg-tertiary);
	border-color: var(--border-primary);
}

.progress-cancel-btn:active {
	transform: translateY(1px);
}

/* Progress Animations */
@keyframes progressFadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes progressSlideIn {
	from {
		opacity: 0;
		transform: translateY(-20px) scale(0.95);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@keyframes progressSpin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

@keyframes progressIndeterminate {
	0% {
		background-position: -200% 0;
	}
	100% {
		background-position: 200% 0;
	}
}

/* Responsive Progress Styles */
@media (max-width: 480px) {
	.progress-container {
		min-width: 320px;
		margin: 20px;
		padding: 24px;
	}
	
	.progress-icon i {
		font-size: 36px;
	}
	
	.progress-title {
		font-size: 16px;
	}
	
	.progress-details {
		flex-direction: column;
		gap: 8px;
		text-align: center;
	}
}

#swap-dimensions-btn {
	width: var(--tool-button-width);
	height: var(--tool-button-height);
	border: 1px solid var(--border-secondary);
	border-radius: 4px;
	background: var(--bg-secondary);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--text-secondary);
	transition: all 0.2s;
}

#swap-dimensions-btn:hover {
	background: var(--button-hover);
	border-color: var(--accent-primary);
	color: var(--accent-primary);
}

/* Image Placement Dialog Styles */
.image-placement-dialog {
	width: 800px;
	max-width: 900px;
	height: 600px;
	max-height: 650px;
}

.image-placement-content {
	display: flex;
	height: 100%;
	gap: 16px;
	padding: 0;
}

.placement-preview {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--bg-tertiary);
	border: 1px solid var(--border-primary);
	border-radius: 4px;
	position: relative;
	overflow: hidden;
	min-height: 400px;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.preview-container {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

.placement-canvas {
	border: 1px solid var(--border-secondary);
	background: #ffffff;
	image-rendering: pixelated;
	image-rendering: -moz-crisp-edges;
	image-rendering: crisp-edges;
	max-width: 100%;
	max-height: 100%;
	transition: border-color 0.2s ease;
}

.resize-handles {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	pointer-events: none;
}

.resize-handle {
	position: absolute;
	pointer-events: all;
	background: var(--accent-primary);
	border: 1px solid #ffffff;
	transition: background-color 0.2s ease;
}

.resize-handle:hover {
	background: var(--accent-hover);
}

.resize-handle.nw,
.resize-handle.ne,
.resize-handle.sw,
.resize-handle.se {
	width: 8px;
	height: 8px;
	border-radius: 50%;
}

.resize-handle.n,
.resize-handle.s {
	width: 8px;
	height: 6px;
	border-radius: 3px;
	left: 50%;
	transform: translateX(-50%);
}

.resize-handle.e,
.resize-handle.w {
	width: 6px;
	height: 8px;
	border-radius: 3px;
	top: 50%;
	transform: translateY(-50%);
}

.resize-handle.nw {
	top: -4px;
	left: -4px;
	cursor: nw-resize;
}

.resize-handle.ne {
	top: -4px;
	right: -4px;
	cursor: ne-resize;
}

.resize-handle.sw {
	bottom: -4px;
	left: -4px;
	cursor: sw-resize;
}

.resize-handle.se {
	bottom: -4px;
	right: -4px;
	cursor: se-resize;
}

.resize-handle.n {
	top: -3px;
	cursor: n-resize;
}

.resize-handle.s {
	bottom: -3px;
	cursor: s-resize;
}

.resize-handle.e {
	right: -3px;
	cursor: e-resize;
}

.resize-handle.w {
	left: -3px;
	cursor: w-resize;
}

.placement-controls {
	width: 250px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 16px;
	background: var(--bg-secondary);
	border-left: 1px solid var(--border-primary);
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.control-section {
	margin-bottom: 16px;
}

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

.control-section h4 {
	margin: 0 0 12px 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--text-primary);
	border-bottom: 1px solid var(--border-primary);
	padding-bottom: 4px;
	transition: color 0.2s ease, border-color 0.2s ease;
}

.size-buttons {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 16px;
}

.size-btn {
	padding: 8px 12px;
	border: 1px solid var(--border-secondary);
	background: var(--bg-secondary);
	color: var(--text-primary);
	font-size: 12px;
	font-weight: 500;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.2s;
	text-align: center;
}

.size-btn:hover {
	background: var(--button-hover);
	border-color: var(--border-active);
}

.size-btn.active {
	background: var(--accent-primary);
	color: #ffffff;
	border-color: var(--accent-border);
}

.size-btn.active:hover {
	background: var(--accent-hover);
}

.dimension-info {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 11px;
	color: var(--text-secondary);
	background: var(--bg-tertiary);
	padding: 8px;
	border-radius: 4px;
	border: 1px solid var(--border-primary);
	transition: background-color 0.2s ease, color 0.2s ease,
		border-color 0.2s ease;
}

.dimension-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.dimension-label {
	font-weight: 600;
	color: var(--text-primary);
	transition: color 0.2s ease;
}

.threshold-control {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.threshold-control label {
	font-size: 12px;
	font-weight: 500;
	color: var(--text-primary);
	display: flex;
	justify-content: space-between;
	align-items: center;
	transition: color 0.2s ease;
}

.threshold-control input[type="range"] {
	width: 100%;
	height: 6px;
	border-radius: 3px;
	background: var(--bg-accent);
	outline: none;
	-webkit-appearance: none;
	transition: background-color 0.2s ease;
}

.threshold-control input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--accent-primary);
	cursor: pointer;
	border: 2px solid #ffffff;
	transition: background-color 0.2s ease;
}

.threshold-control input[type="range"]::-webkit-slider-thumb:hover {
	background: var(--accent-hover);
}

.threshold-control input[type="range"]::-moz-range-thumb {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--accent-primary);
	cursor: pointer;
	border: 2px solid #ffffff;
	transition: background-color 0.2s ease;
}

.threshold-control input[type="range"]::-moz-range-thumb:hover {
	background: var(--accent-hover);
}

/* Brush Cursor Overlay */
.brush-cursor-overlay {
	position: fixed;
	pointer-events: none;
	z-index: 9999;
	border: 1px solid #000000;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.3);
	transform: translate(-50%, -50%);
	display: none;
}

.brush-cursor-overlay.square {
	border-radius: 0;
}

.brush-cursor-overlay.eraser {
	border: 2px dashed rgba(255, 0, 0, 0.8);
	background: rgba(255, 0, 0, 0.1);
}

.brush-cursor-overlay.pixelated {
	border: none;
	border-radius: 0;
	background: transparent;
	position: fixed;
	transform: none;
	z-index: 10000;
}

.brush-cursor-pixel {
	position: absolute;
	border: none;
	background: rgba(255, 0, 0, 0.6);
	box-sizing: border-box;
	image-rendering: pixelated;
	image-rendering: -moz-crisp-edges;
	image-rendering: crisp-edges;
	pointer-events: none;
}

/* Image Placement Dialog Styles */
.image-placement-dialog {
	width: 900px;
	max-width: 900px;
	height: 700px;
	max-height: 700px;
}

.image-placement-content {
	display: flex;
	gap: 20px;
	height: 100%;
	padding: 0;
}

.placement-preview {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: var(--bg-tertiary);
	border-radius: 6px;
	padding: 12px;
}

.preview-container {
	position: relative;
	flex: 1;
	border: 2px solid var(--border-primary);
	border-radius: 6px;
	overflow: hidden;
	background: var(--canvas-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 300px;
}

.placement-canvas {
	max-width: 800px;
	max-height: 600px;
	border: 1px solid var(--border-secondary);
	image-rendering: pixelated;
	image-rendering: -moz-crisp-edges;
	image-rendering: crisp-edges;
	cursor: move;
}

.placement-controls {
	width: 280px;
	display: flex;
	flex-direction: column;
	gap: 20px;
	background: var(--bg-secondary);
	border-radius: 6px;
	padding: 16px;
	border: 1px solid var(--border-primary);
	overflow-y: auto;
}

.placement-controls .control-group {
	background: var(--bg-tertiary);
	padding: 12px;
	border-radius: 6px;
	border: 1px solid var(--border-primary);
}

.placement-controls .control-group label {
	font-weight: 600;
	font-size: 12px;
	color: var(--text-primary);
	margin-bottom: 8px;
	display: block;
}

.placement-controls .control-group select {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid var(--border-secondary);
	border-radius: 4px;
	font-size: 12px;
	background: var(--bg-secondary);
	color: var(--text-primary);
	cursor: pointer;
	transition: all 0.2s ease;
}

.placement-controls .control-group select:focus {
	outline: none;
	border-color: var(--accent-primary);
}

.size-buttons {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.size-buttons .dialog-btn {
	padding: 12px 16px;
	background: var(--bg-tertiary);
	border: 1px solid var(--border-secondary);
	border-radius: 4px;
	cursor: pointer;
	font-size: 12px;
	font-weight: 500;
	transition: all 0.2s ease;
	text-align: center;
}

.size-buttons .dialog-btn:hover {
	background: var(--button-hover);
	border-color: var(--border-active);
	transform: translateY(-1px);
}

.size-buttons .dialog-btn.active {
	background: var(--accent-primary);
	color: white;
	border-color: var(--accent-border);
}

.image-info {
	background: var(--bg-tertiary);
	padding: 12px;
	border-radius: 4px;
	border: 1px solid var(--border-primary);
}

.image-info span {
	display: block;
	font-size: 11px;
	color: var(--text-secondary);
	margin-bottom: 4px;
	padding: 2px 0;
}

.image-info span:last-child {
	margin-bottom: 0;
}

.threshold-control {
	background: var(--bg-tertiary);
	padding: 12px;
	border-radius: 6px;
	border: 1px solid var(--border-primary);
}

.threshold-control label {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 8px;
	font-weight: 600;
	font-size: 12px;
	color: var(--text-primary);
}

.threshold-control .threshold-slider-container {
	display: flex;
	align-items: center;
	gap: 12px;
}

.threshold-control input[type="range"] {
	flex: 1;
	height: 6px;
	background: var(--bg-accent);
	border-radius: 3px;
	outline: none;
	appearance: none;
	cursor: pointer;
}

.threshold-control input[type="range"]::-webkit-slider-thumb {
	appearance: none;
	width: 18px;
	height: 18px;
	background: var(--accent-primary);
	border-radius: 50%;
	cursor: pointer;
	border: 3px solid white;
	transition: all 0.2s ease;
}

.threshold-control input[type="range"]::-webkit-slider-thumb:hover {
	transform: scale(1.1);
}

.threshold-control input[type="range"]::-moz-range-thumb {
	width: 18px;
	height: 18px;
	background: var(--accent-primary);
	border-radius: 50%;
	cursor: pointer;
	border: 3px solid white;
	transition: all 0.2s ease;
}

.threshold-control #threshold-value {
	font-size: 12px;
	font-weight: 600;
	color: var(--accent-primary);
	min-width: 32px;
	text-align: center;
	background: var(--bg-secondary);
	padding: 4px 8px;
	border-radius: 4px;
	border: 1px solid var(--border-secondary);
}

/* Resize Handles */
.resize-handles {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	pointer-events: none;
}

.resize-handle {
	position: absolute;
	background: var(--accent-primary);
	border: 2px solid white;
	border-radius: 50%;
	width: 12px;
	height: 12px;
	pointer-events: all;
	cursor: pointer;
}

.resize-handle.nw {
	top: -6px;
	left: -6px;
	cursor: nw-resize;
}

.resize-handle.ne {
	top: -6px;
	right: -6px;
	cursor: ne-resize;
}

.resize-handle.sw {
	bottom: -6px;
	left: -6px;
	cursor: sw-resize;
}

.resize-handle.se {
	bottom: -6px;
	right: -6px;
	cursor: se-resize;
}

.resize-handle.n {
	top: -6px;
	left: 50%;
	transform: translateX(-50%);
	cursor: n-resize;
}

.resize-handle.s {
	bottom: -6px;
	left: 50%;
	transform: translateX(-50%);
	cursor: s-resize;
}

.resize-handle.w {
	top: 50%;
	left: -6px;
	transform: translateY(-50%);
	cursor: w-resize;
}

.resize-handle.e {
	top: 50%;
	right: -6px;
	transform: translateY(-50%);
	cursor: e-resize;
}

/* Guides Panel Styles */
.guides-controls {
	display: flex;
	gap: 6px;
	margin-bottom: 8px;

	background: var(--bg-tertiary);

	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.guides-controls button {
	width: var(--tool-button-width);
	height: var(--tool-button-height);
	border: none;
	background: var(--bg-secondary);
	cursor: pointer;
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: all 0.2s ease;
	border-radius: var(--radius-medium);
	color: var(--text-primary);
	aspect-ratio: 1/1;
	font-family: inherit;
	gap: 4px;
}

.guides-controls button:hover {
	background: var(--button-hover);
}

.guides-controls button:active {
	background: var(--button-active);
}

.guides-list {
	background: var(--bg-secondary);
	border: 1px solid var(--border-primary);
	min-height: 100px;
	max-height: 250px;
	overflow-y: auto;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.guide-item {
	display: flex;
	align-items: center;
	padding: 8px;
	border-bottom: 1px solid var(--border-primary);
	cursor: pointer;
	user-select: none;
	transition: background-color 0.2s;
	font-size: 11px;
	color: var(--text-primary);
}

.guide-item:last-child {
	border-bottom: none;
}

.guide-item:hover {
	background: var(--bg-tertiary);
}

.guide-item.active {
	background: var(--accent-primary);
	border-color: var(--accent-border);
	color: #ffffff;
}

.guide-item.active:hover {
	background: var(--accent-hover);
}

.guide-color {
	width: 16px;
	height: 16px;
	border-radius: 2px;
	border: 1px solid var(--border-secondary);
	margin-right: 8px;
	flex-shrink: 0;
}

.guide-info {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.guide-name {
	font-weight: 600;
	font-size: 12px;
}

.guide-coords {
	font-size: 10px;
	color: var(--text-secondary);
	font-family: "Consolas", "Monaco", "Courier New", monospace;
}

.guide-item.active .guide-coords {
	color: rgba(255, 255, 255, 0.8);
}

.guide-actions {
	display: flex;
	gap: 4px;
	opacity: 0;
	transition: opacity 0.2s;
}

.guide-item:hover .guide-actions,
.guide-item.active .guide-actions {
	opacity: 1;
}

.guide-action {
	width: 20px;
	height: 20px;
	border: none;
	background: var(--bg-accent);
	color: var(--text-secondary);
	cursor: pointer;
	border-radius: 2px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	transition: all 0.2s;
}

.guide-action:hover {
	background: var(--button-hover);
	color: var(--text-primary);
}

.guide-item.active .guide-action {
	background: rgba(255, 255, 255, 0.2);
	color: rgba(255, 255, 255, 0.8);
}

.guide-item.active .guide-action:hover {
	background: rgba(255, 255, 255, 0.3);
	color: #ffffff;
}

/* Guide overlay on canvas */
.guide-overlay {
	position: absolute;
	pointer-events: none;
	border: 2px solid;
	box-sizing: border-box;
	z-index: 100;
}

.guide-overlay.active {
	opacity: 0.5;
}

.guide-overlay.inactive {
	opacity: 0.25;
}

/* Guide Color Picker */
.guide-color-picker {
	position: fixed;
	background: var(--bg-primary);
	border: 1px solid var(--border-primary);
	border-radius: var(--radius-medium);
	box-shadow: 0 4px 20px var(--shadow-color);
	padding: 12px;
	z-index: 1000;
	min-width: 200px;
}

.guide-color-picker-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 10px;
	font-weight: 600;
	font-size: 12px;
	color: var(--text-primary);
}

.guide-color-picker-close {
	background: none;
	border: none;
	color: var(--text-secondary);
	font-size: 16px;
	cursor: pointer;
	padding: 2px;
	width: 20px;
	height: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 2px;
}

.guide-color-picker-close:hover {
	background: var(--button-hover);
	color: var(--text-primary);
}

.guide-color-picker-colors {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 6px;
	margin-bottom: 12px;
}

.guide-color-option {
	width: 28px;
	height: 28px;
	border: 2px solid var(--border-primary);
	border-radius: 4px;
	cursor: pointer;
	transition: transform 0.2s, border-color 0.2s;
	position: relative;
}

.guide-color-option:hover {
	transform: scale(1.1);
}

.guide-color-option.selected {
	border-color: var(--accent-primary);
	border-width: 3px;
}

.guide-color-option.selected::after {
	content: '✓';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: #ffffff;
	font-weight: bold;
	font-size: 12px;
	text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8);
}

.guide-color-picker-custom {
	border-top: 1px solid var(--border-primary);
	padding-top: 10px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.guide-color-picker-custom input[type="color"] {
	width: 30px;
	height: 30px;
	border: 1px solid var(--border-primary);
	border-radius: 4px;
	cursor: pointer;
	background: none;
}

.guide-color-picker-custom label {
	font-size: 11px;
	color: var(--text-secondary);
	cursor: pointer;
}

/* Export Guides Dropdown */
.export-guides-dropdown {
	min-width: 160px;
}

.export-guides-dropdown .dropdown-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	font-size: 12px;
	cursor: pointer;
	border-bottom: 1px solid var(--border-primary);
	transition: background-color 0.2s, color 0.2s;
	color: var(--text-primary);
}

.export-guides-dropdown .dropdown-item:last-child {
	border-bottom: none;
}

.export-guides-dropdown .dropdown-item:hover {
	background-color: var(--accent-primary);
	color: #ffffff;
}

.export-guides-dropdown .dropdown-item i {
	font-size: 14px;
	flex-shrink: 0;
}

/* Dithering Dialog Styles */
.dithering-dialog-simple {
	width: 400px;
	max-width: 90vw;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.dithering-preview-simple {
	margin-bottom: 16px;
	text-align: center;
}

#dithering-preview-canvas {
	border: 1px solid var(--border-primary);
	image-rendering: pixelated;
	image-rendering: -moz-crisp-edges;
	image-rendering: crisp-edges;
	background: var(--bg-primary);
	border-radius: 4px;
	max-width: 320px;
	max-height: 240px;
}

.dithering-controls-simple {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.control-row {
	display: flex;
	align-items: center;
	gap: 12px;
}

.control-row label {
	font-size: 13px;
	font-weight: 500;
	min-width: 80px;
	color: var(--text-primary);
}

.control-row select {
	flex: 1;
	padding: 8px 12px;
	border: 1px solid var(--border-primary);
	border-radius: 4px;
	background: var(--bg-primary);
	color: var(--text-primary);
	font-size: 13px;
}

.control-row input[type="range"] {
	flex: 1;
	height: 6px;
	background: var(--bg-tertiary);
	border-radius: 3px;
	outline: none;
	appearance: none;
	cursor: pointer;
}

.control-row input[type="range"]::-webkit-slider-thumb {
	appearance: none;
	width: 16px;
	height: 16px;
	background: var(--accent-primary);
	border-radius: 50%;
	cursor: pointer;
}

.control-row input[type="range"]::-moz-range-thumb {
	width: 16px;
	height: 16px;
	background: var(--accent-primary);
	border-radius: 50%;
	cursor: pointer;
	border: none;
}

.control-row input[type="checkbox"] {
	margin-right: 8px;
}

/* Modern Dialog Control Groups */
.dialog-content .control-group {
	background: var(--bg-secondary);
	padding: 16px;
	border-radius: 10px;
	border: 1px solid var(--border-primary);
	margin-bottom: 16px;
	transition: all 0.2s ease;
}

.dialog-content .control-group:last-child {
	margin-bottom: 0;
}

.dialog-content .control-group label {
	font-weight: 600;
	font-size: 13px;
	color: var(--text-primary);
	margin-bottom: 8px;
	display: block;
	letter-spacing: -0.01em;
}

.dialog-content .control-group select {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--border-primary);
	border-radius: 8px;
	font-size: 13px;
	background: var(--bg-primary);
	color: var(--text-primary);
	cursor: pointer;
	height: 40px;
	transition: all 0.2s ease;
}

.dialog-content .control-group select:focus {
	outline: none;
	border-color: var(--accent-primary);
	box-shadow: 0 0 0 3px rgba(2, 93, 238, 0.1);
}

.dialog-content .control-group input[type="range"] {
	width: 100%;
	height: 8px;
	background: var(--bg-tertiary);
	border-radius: 4px;
	outline: none;
	appearance: none;
	cursor: pointer;
	margin: 8px 0;
	transition: all 0.2s ease;
}

.dialog-content .control-group input[type="range"]::-webkit-slider-thumb {
	appearance: none;
	width: 20px;
	height: 20px;
	background: var(--accent-primary);
	border-radius: 50%;
	cursor: pointer;
	border: 2px solid white;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
	transition: all 0.2s ease;
}

.dialog-content .control-group input[type="range"]::-webkit-slider-thumb:hover {
	transform: scale(1.15);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dialog-content .control-group input[type="range"]::-moz-range-thumb {
	width: 20px;
	height: 20px;
	background: var(--accent-primary);
	border-radius: 50%;
	cursor: pointer;
	border: 2px solid white;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
	transition: all 0.2s ease;
}

/* Checkbox groups for dialogs */
.dialog-content .checkbox-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 8px;
}

.dialog-content .checkbox-group label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	font-weight: 500;
	color: var(--text-primary);
	cursor: pointer;
	margin-bottom: 0;
}

.dialog-content .checkbox-group input[type="checkbox"] {
	width: 16px;
	height: 16px;
	accent-color: var(--accent-primary);
	cursor: pointer;
}

/* Info text styling */
.dialog-content .info-text {
	background: var(--bg-tertiary);
	padding: 12px 16px;
	border-radius: 8px;
	font-size: 12px;
	color: var(--text-muted);
	border-left: 3px solid var(--accent-primary);
	margin-top: 16px;
}

/* Canvas styling in dialogs */
.dialog-content canvas {
	border: 1px solid var(--border-primary);
	border-radius: 6px;
	background: var(--bg-primary);
	margin: 8px 0;
	image-rendering: pixelated;
	image-rendering: -moz-crisp-edges;
	image-rendering: crisp-edges;
}

/* ========================================
   Animation Export Dialog - Minimal Design
   ======================================== */

.animation-export-dialog {
	width: 420px !important;
	max-width: 90vw;
}

/* Format Selection Buttons */
.export-formats {
	display: flex;
	gap: 8px;
	margin-bottom: 24px;
}

.format-btn {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 16px 12px;
	background: var(--bg-secondary);
	border: 2px solid var(--border-primary);
	border-radius: 10px;
	cursor: pointer;
	transition: all 0.2s ease;
	font-size: 13px;
	color: var(--text-secondary);
}

.format-btn:hover {
	background: var(--bg-tertiary);
	border-color: var(--accent-primary);
	color: var(--text-primary);
}

.format-btn.active {
	background: var(--accent-primary);
	border-color: var(--accent-primary);
	color: white;
}

.format-btn i {
	font-size: 20px;
}

.format-btn span {
	font-weight: 500;
}

/* Settings */
.export-settings {
	margin-bottom: 20px;
}

.setting-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
}

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

.setting-row label {
	min-width: 60px;
	font-size: 13px;
	color: var(--text-secondary);
	font-weight: 500;
}

.setting-row input[type="range"] {
	flex: 1;
	height: 4px;
	background: var(--bg-tertiary);
	border-radius: 2px;
	outline: none;
	appearance: none;
	cursor: pointer;
}

.setting-row input[type="range"]::-webkit-slider-thumb {
	appearance: none;
	width: 16px;
	height: 16px;
	background: var(--accent-primary);
	border-radius: 50%;
	cursor: pointer;
	border: 2px solid white;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.setting-row input[type="text"] {
	flex: 1;
	padding: 8px 12px;
	border: 1px solid var(--border-primary);
	border-radius: 6px;
	font-size: 13px;
	background: var(--bg-primary);
	color: var(--text-primary);
}

.setting-row input[type="text"]:focus {
	outline: none;
	border-color: var(--accent-primary);
	box-shadow: 0 0 0 2px rgba(2, 93, 238, 0.1);
}

#fps-display {
	color: var(--accent-primary);
	font-weight: 600;
	font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
}

/* Quality Buttons */
.quality-section {
	margin-bottom: 20px;
}

.quality-buttons {
	display: flex;
	gap: 6px;
}

.quality-btn {
	flex: 1;
	padding: 10px 8px;
	background: var(--bg-secondary);
	border: 1px solid var(--border-primary);
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.2s ease;
	font-size: 12px;
	color: var(--text-secondary);
	font-weight: 500;
}

.quality-btn:hover {
	background: var(--bg-tertiary);
	border-color: var(--accent-primary);
	color: var(--text-primary);
}

.quality-btn.active {
	background: var(--accent-primary);
	border-color: var(--accent-primary);
	color: white;
}

/* Export Info */
.export-info {
	display: flex;
	justify-content: space-between;
	padding: 12px 16px;
	background: var(--bg-secondary);
	border-radius: 8px;
	border: 1px solid var(--border-primary);
	margin-bottom: 20px;
}

.export-info span {
	font-size: 12px;
	color: var(--text-muted);
	font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
}

/* Responsive Design */
@media (max-width: 480px) {
	.animation-export-dialog {
		width: 95vw !important;
	}
	
	.export-formats {
		flex-direction: column;
		gap: 6px;
	}
	
	.format-btn {
		flex-direction: row;
		padding: 12px 16px;
		gap: 10px;
	}
	
	.quality-buttons {
		flex-direction: column;
		gap: 6px;
	}
	
	.export-info {
		flex-direction: column;
		gap: 6px;
		text-align: center;
	}
}

.format-info {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.format-info strong {
	color: var(--text-primary);
	font-size: 14px;
}

.format-info span {
	color: var(--text-secondary);
	font-size: 12px;
}

.export-settings-section {
	margin-bottom: 20px;
}

.export-settings-section h4 {
	margin-bottom: 12px;
	color: var(--text-primary);
	font-size: 14px;
	font-weight: 600;
}

.settings-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.setting-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.setting-group label {
	color: var(--text-primary);
	font-size: 12px;
	font-weight: 500;
}

.frame-range-inputs {
	display: flex;
	align-items: center;
	gap: 8px;
}

.frame-range-inputs input {
	flex: 1;
	padding: 6px 8px;
	border: 1px solid var(--border-primary);
	border-radius: 4px;
	background: var(--bg-secondary);
	color: var(--text-primary);
	font-size: 12px;
}

.frame-range-inputs span {
	color: var(--text-secondary);
	font-size: 12px;
}

.fps-control {
	display: flex;
	align-items: center;
	gap: 8px;
}

.fps-control input[type="range"] {
	flex: 1;
}

.fps-control span {
	color: var(--text-primary);
	font-size: 12px;
	font-weight: 500;
	min-width: 40px;
}

.animation-options {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.animation-options label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--text-primary);
	cursor: pointer;
}

.animation-options input[type="checkbox"] {
	accent-color: var(--accent-primary);
}

.setting-group select,
.setting-group input[type="number"] {
	padding: 6px 8px;
	border: 1px solid var(--border-primary);
	border-radius: 4px;
	background: var(--bg-secondary);
	color: var(--text-primary);
	font-size: 12px;
}

.export-preview-section {
	margin-bottom: 20px;
}

.export-preview-section h4 {
	margin-bottom: 12px;
	color: var(--text-primary);
	font-size: 14px;
	font-weight: 600;
}

.preview-info {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 12px;
	background: var(--bg-tertiary);
	border-radius: 6px;
	border: 1px solid var(--border-primary);
}

.preview-info span {
	color: var(--text-secondary);
	font-size: 12px;
}

#frame-count-info {
	font-weight: 500;
	color: var(--text-primary);
}

/* ========================================
   Project Dialog Styles (Phase 6)
   ======================================== */

.large-dialog {
	width: 700px;
	max-width: 800px;
	max-height: 700px;
}

.project-tabs {
	display: flex;
	border-bottom: 1px solid var(--border-primary);
	margin-bottom: 20px;
}

.project-tab {
	background: none;
	border: none;
	padding: 12px 20px;
	cursor: pointer;
	color: var(--text-secondary);
	font-size: 14px;
	border-bottom: 2px solid transparent;
	transition: all 0.2s ease;
}

.project-tab:hover {
	color: var(--text-primary);
	background: var(--bg-tertiary);
}

.project-tab.active {
	color: var(--accent-primary);
	border-bottom-color: var(--accent-primary);
}

.project-tab-content {
	min-height: 400px;
}

.project-tab-content.hidden {
	display: none;
}

.form-section {
	margin-bottom: 24px;
}

.form-section h4 {
	margin-bottom: 12px;
	color: var(--text-primary);
	font-size: 14px;
	font-weight: 600;
}

.form-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.form-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.form-group label {
	color: var(--text-primary);
	font-size: 12px;
	font-weight: 500;
}

.form-group input,
.form-group textarea {
	padding: 8px 12px;
	border: 1px solid var(--border-primary);
	border-radius: 4px;
	background: var(--bg-secondary);
	color: var(--text-primary);
	font-size: 14px;
	resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
	outline: none;
	border-color: var(--accent-primary);
}

.template-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
}

.template-card {
	padding: 16px;
	border: 1px solid var(--border-primary);
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s ease;
	background: var(--bg-secondary);
}

.template-card:hover {
	border-color: var(--accent-primary);
	background: var(--bg-tertiary);
}

.template-card.selected {
	border-color: var(--accent-primary);
	background: var(--accent-primary);
	color: white;
}

.template-card.selected .template-info h5,
.template-card.selected .template-size,
.template-card.selected .template-description {
	color: white;
}

.template-icon {
	text-align: center;
	margin-bottom: 8px;
}

.template-icon i {
	font-size: 24px;
	color: var(--accent-primary);
}

.template-card.selected .template-icon i {
	color: white;
}

.template-info h5 {
	margin-bottom: 4px;
	color: var(--text-primary);
	font-size: 14px;
	font-weight: 600;
}

.template-size {
	color: var(--text-secondary);
	font-size: 12px;
	font-weight: 500;
}

.template-description {
	color: var(--text-secondary);
	font-size: 11px;
	margin-top: 4px;
	line-height: 1.3;
}

.size-controls {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.size-preset {
	display: flex;
	align-items: center;
	gap: 12px;
}

.size-preset label {
	color: var(--text-primary);
	font-size: 12px;
	font-weight: 500;
	min-width: 50px;
}

.size-preset select {
	flex: 1;
	padding: 6px 8px;
	border: 1px solid var(--border-primary);
	border-radius: 4px;
	background: var(--bg-secondary);
	color: var(--text-primary);
	font-size: 12px;
}

.size-inputs {
	display: flex;
	align-items: center;
	gap: 12px;
}

.size-input-group {
	display: flex;
	align-items: center;
	gap: 6px;
}

.size-input-group label {
	color: var(--text-primary);
	font-size: 12px;
	font-weight: 500;
	min-width: 40px;
}

.size-input-group input {
	width: 80px;
	padding: 6px 8px;
	border: 1px solid var(--border-primary);
	border-radius: 4px;
	background: var(--bg-secondary);
	color: var(--text-primary);
	font-size: 12px;
}

#swap-size-btn {
	padding: 6px;
	border: 1px solid var(--border-primary);
	border-radius: 4px;
	background: var(--bg-secondary);
	color: var(--text-secondary);
	cursor: pointer;
	transition: all 0.2s ease;
}

#swap-size-btn:hover {
	background: var(--bg-tertiary);
	color: var(--text-primary);
}

.recent-projects-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 16px;
}

.recent-projects-header h4 {
	color: var(--text-primary);
	font-size: 14px;
	font-weight: 600;
	margin: 0;
}

.text-button {
	background: none;
	border: none;
	color: var(--accent-primary);
	font-size: 12px;
	cursor: pointer;
	text-decoration: underline;
}

.text-button:hover {
	color: var(--accent-hover);
}

.recent-projects-list {
	max-height: 200px;
	overflow-y: auto;
	border: 1px solid var(--border-primary);
	border-radius: 4px;
	margin-bottom: 20px;
}

.recent-project-item {
	display: flex;
	align-items: center;
	padding: 12px;
	border-bottom: 1px solid var(--border-primary);
	cursor: pointer;
	transition: background 0.2s ease;
}

.recent-project-item:last-child {
	border-bottom: none;
}

.recent-project-item:hover {
	background: var(--bg-tertiary);
}

.recent-project-item.selected {
	background: var(--accent-primary);
	color: white;
}

.recent-project-item.selected .recent-project-info h5,
.recent-project-item.selected .recent-project-date {
	color: white;
}

.recent-project-icon {
	margin-right: 12px;
	color: var(--accent-primary);
}

.recent-project-item.selected .recent-project-icon {
	color: white;
}

.recent-project-info {
	flex: 1;
}

.recent-project-info h5 {
	margin-bottom: 2px;
	color: var(--text-primary);
	font-size: 14px;
	font-weight: 500;
}

.recent-project-date {
	color: var(--text-secondary);
	font-size: 11px;
}

.recent-project-actions {
	margin-left: 8px;
}

.icon-button {
	background: none;
	border: none;
	padding: 4px;
	cursor: pointer;
	color: var(--text-secondary);
	border-radius: 3px;
	transition: all 0.2s ease;
}

.icon-button:hover {
	background: var(--bg-accent);
	color: var(--text-primary);
}

.no-recent,
.no-auto-save {
	text-align: center;
	padding: 20px;
	color: var(--text-secondary);
	font-style: italic;
}

.auto-save-section {
	margin-top: 20px;
}

.auto-save-section h4 {
	color: var(--text-primary);
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 12px;
}

.auto-save-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px;
	border: 1px solid var(--border-primary);
	border-radius: 4px;
	background: var(--bg-tertiary);
}

.auto-save-info {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--text-primary);
	font-size: 13px;
}

.auto-save-info i {
	color: var(--accent-primary);
}

.file-drop-area {
	border: 2px dashed var(--border-primary);
	border-radius: 8px;
	padding: 40px 20px;
	text-align: center;
	cursor: pointer;
	transition: all 0.2s ease;
	margin-bottom: 20px;
}

.file-drop-area:hover,
.file-drop-area.drag-over {
	border-color: var(--accent-primary);
	background: var(--bg-tertiary);
}

.file-drop-content i {
	font-size: 48px;
	color: var(--accent-primary);
	margin-bottom: 12px;
}

.file-drop-content p {
	color: var(--text-secondary);
	margin-bottom: 16px;
	font-size: 14px;
}

.file-drop-content button {
	padding: 8px 16px;
	border: 1px solid var(--accent-primary);
	border-radius: 4px;
	background: var(--accent-primary);
	color: white;
	cursor: pointer;
	font-size: 12px;
	transition: background 0.2s ease;
}

.file-drop-content button:hover {
	background: var(--accent-hover);
}

.import-info {
	padding: 16px;
	border: 1px solid var(--border-primary);
	border-radius: 4px;
	background: var(--bg-tertiary);
}

.import-info h5 {
	margin-bottom: 8px;
	color: var(--text-primary);
	font-size: 13px;
	font-weight: 600;
}

.import-details {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.import-details span {
	color: var(--text-secondary);
	font-size: 12px;
}

/* Pattern Editor Styles */
.pattern-editor-content {
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding: 10px;
	min-width: 400px;
}

.pattern-info {
	display: flex;
	align-items: center;
	gap: 10px;
}

.pattern-info input {
	flex: 1;
	padding: 6px 10px;
	border: 1px solid var(--border-secondary);
	border-radius: 4px;
	background: var(--bg-secondary);
	color: var(--text-primary);
}

.pattern-grid-container {
	display: flex;
	justify-content: center;
}

.pattern-grid {
	display: grid;
	grid-template-columns: repeat(8, 1fr);
	grid-template-rows: repeat(8, 1fr);
	gap: 1px;
	background: var(--border-secondary);
	padding: 1px;
	border: 1px solid var(--border-primary);
	width: 200px;
	height: 200px;
}

.pattern-cell {
	background: var(--bg-secondary);
	cursor: pointer;
	transition: background-color 0.1s;
}

.pattern-cell:hover {
	opacity: 0.8;
}

.pattern-cell.filled {
	background: #000000;
}

.pattern-cell.empty {
	background: var(--bg-secondary);
}

.pattern-controls {
	display: flex;
	gap: 10px;
	justify-content: center;
}

.pattern-controls .dialog-btn {
	padding: 6px 12px;
	font-size: 12px;
}

.pattern-preview {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
}

.pattern-preview label {
	font-weight: 600;
	color: var(--text-primary);
}

#pattern-preview-canvas {
	border: 1px solid var(--border-secondary);
	background: var(--bg-secondary);
	image-rendering: pixelated;
	image-rendering: -moz-crisp-edges;
	image-rendering: crisp-edges;
}

/* New Pattern Button */
.new-pattern-btn {
	background: var(--bg-secondary);
	border: 2px dashed var(--border-secondary);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.2s;
}

.new-pattern-btn:hover {
	border-color: var(--border-active);
	background: var(--button-hover);
}

.new-pattern-btn:hover i {
	color: var(--accent-primary) !important;
}

/* Draw Edge Dialog */
#edge-preview-canvas {
	border: 1px solid var(--border-secondary);
	background: var(--bg-secondary);
	image-rendering: pixelated;
	image-rendering: -moz-crisp-edges;
	image-rendering: crisp-edges;
	margin: 10px 0;
}

#edge-preview-update-btn {
	padding: 6px 12px;
	font-size: 12px;
}

/* Adobe-Style Panel System */
.panel-column {
	position: fixed;
	top: 80px; /* Below menu bar and tool options bar */
	bottom: 214px; /* Leave space for sheets panel (200px height) */
	width: 240px;
	display: flex;
	flex-direction: column;

	border: 0;
	z-index: 100;
	overflow: hidden;
	padding: 8px;
}

.left-column {
	left: 0;
	width: 140px; /* Fixed width for clean 3-column layout */
	min-width: 140px;
}

.right-column {
	right: 0;
	width: 280px; /* Double width for Preview, Layers, etc. */
	min-width: 280px;
}

.panel {
	display: flex;
	flex-direction: column;
	border-bottom: none;

	background: var(--bg-secondary);

	margin-bottom: 12px;
	overflow: hidden;

border: var(--panel-border-color) 1px solid;

	border-radius: var(--radius-large);

	 box-sizing: border-box;
}

.panel:last-child {
	border-bottom: none;
	/* flex: 1; */
	margin-bottom: 0;
}

.panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 8px 8px 8px;
	background: var(--bg-tertiary);
	border-bottom: none;
	/* cursor: pointer; */
	user-select: none;
	min-height: 36px;
	font-weight: 500;
	border-radius: var(--radius-medium) var(--radius-medium) 0 0;
}

.panel-title {

	color: var(--text-muted);

}

.panel-header-buttons {
	display: flex;
	gap: 4px;
}

.panel-header-btn {
	width: 20px;
	height: 20px;
	border: 1px solid var(--border-secondary);
	background: var(--bg-secondary);
	border-radius: 3px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.2s ease;
	padding: 0;
}

.panel-header-btn:hover {
	background: var(--button-hover);
	border-color: var(--border-primary);
}

.panel-header-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	background: var(--bg-secondary);
	border-color: var(--border-secondary);
}

.panel-header-btn i {
	font-size: 12px;
	color: var(--text-primary);
}

.panel-controls {
	display: flex;
	gap: 4px;
}

.panel-control {
	width: 16px;
	height: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	border-radius: 2px;
	transition: background-color 0.2s;
}

.panel-control:hover {
	background: var(--button-hover);
}

.panel-control i {
	font-size: 10px;
	color: var(--text-secondary);
}

.panel-content {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 0 8px 8px 8px;
	background: var(--bg-tertiary);
}

/* Panel States */
.panel.minimized .panel-content {
	display: none;
}

.panel.minimized {
	min-height: auto;
	flex: 0;
}

/* Sticky Magnet Behavior */
.panel-column.docking {
 */
}

.panel-column.floating {
	position: absolute;
	z-index: 200;
}

/* Adjust canvas area for panel columns */
.desktop {
	margin-left: 140px; /* Fixed left margin for clean layout */
	margin-right: 240px;
}

/* Responsive behavior */



/* Sheets Panel */
#sheets-panel {
	position: fixed;
	bottom: 4px;
	left: 8px;
	right: 8px;
	width: calc(100% - 16px);
	height: 200px;
	z-index: 20;
	display: flex;
	flex-direction: row;
	gap: 0;
	background: var(--bg-secondary);
	border: none !important;
	border-top: 1px solid var(--border-primary) !important;
	border-radius: 0 !important;
	padding: 8px;
}


.panel-options-buttons {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.panel-options-buttons.compact {
	flex-direction: row;
	gap: 6px;
	justify-content: center;
}

.panel-option-btn {
	width: 100%;
	height: var(--tool-button-height);
	border: none;
	background: var(--bg-secondary);
	cursor: pointer;
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	padding: 0 8px;
	transition: all 0.2s ease;
	border-radius: var(--radius-medium);
	color: var(--text-primary);
	gap: 8px;
	aspect-ratio: 1/1;
	font-family: inherit;
}

.panel-option-btn.compact {
	width: var(--tool-button-width);
	height: var(--tool-button-height);
	justify-content: center;
	padding: 0;
	border-radius: var(--radius-medium);
	gap: 0;
	aspect-ratio: 1/1;
}

.panel-option-btn:hover {
	background: var(--button-hover);
}

.panel-option-btn:active {
	background: var(--button-active);
}

.panel-option-btn i {
	font-size: 18px;
	width: 18px;
	text-align: center;
}

.sheets-container {
	flex: 1;
	background: var(--bg-secondary);
	border: 1px solid var(--border-primary);
	border-radius: var(--radius-medium);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	gap: 0;
}

.sheets-list {
	flex: 1;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
	gap: 8px;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 8px;
	align-content: start;
}

.sheet-item {
	display: flex;
	flex-direction: column;
	aspect-ratio: 2/1;
	background: var(--bg-secondary);
	border: 1px solid var(--border-primary);
	cursor: pointer;
	transition: all 0.2s ease;
	padding: 2px;
}

.sheet-item:hover {
	background: var(--bg-tertiary);
	border-color: var(--border-secondary);
}

.sheet-item.active {
	background: var(--accent-primary);
	border-color: var(--accent-border);
	color: white;
}

.sheet-preview {
	display: flex;
	justify-content: center;
	align-items: center;
	background: var(--bg-primary);
	padding: 2px;
	flex: 1;
}

.sheet-item.active .sheet-preview {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.2);
}

.sheet-thumbnail {
	max-width: 100%;
	max-height: 100%;
	image-rendering: pixelated;
	image-rendering: -moz-crisp-edges;
	image-rendering: crisp-edges;
}

.sheet-info {
	display: none;
}

/* Animation Footer */
.animation-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px;
	background: var(--bg-primary);
	border-top: 1px solid var(--border-primary);
	border-radius: 0 0 var(--radius-medium) var(--radius-medium);
}

.animation-controls-left {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.animation-controls-right {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.sheet-options {
	display: flex;
	align-items: center;
	gap: 6px;
}

/* Animation Footer Controls */
.animation-footer .btn-toggle {
	width: var(--tool-button-width);
	height: var(--tool-button-height);
	min-width: var(--tool-button-width);
	border-radius: var(--radius-medium);
	font-size: 18px;
}

.animation-footer .btn-toggle i {
	font-size: 18px;
}

.animation-footer .number-input {
	height: var(--tool-button-height);
	border-radius: var(--radius-medium);
	border: 1px solid var(--border-primary);
}

.animation-footer .number-input button {
	width: 24px;
	height: 100%;
	background: var(--bg-secondary);
	border-radius: 0;
	font-size: 16px;
	font-weight: bold;
}

.animation-footer .number-input button:hover {
	background: var(--button-hover);
}

.animation-footer .number-input button:first-child {
	border-radius: var(--radius-medium) 0 0 var(--radius-medium);
}

.animation-footer .number-input button:last-child {
	border-radius: 0 var(--radius-medium) var(--radius-medium) 0;
}

.animation-footer .number-input input {
	width: 40px;
	height: 100%;
	font-size: 12px;
	font-weight: bold;
	color: var(--text-primary);
}

.playback-buttons,
.frame-buttons {
	display: flex;
	gap: 6px;
}

.control-btn {
	width: var(--tool-button-width);
	height: var(--tool-button-height);
	border: none;
	background: var(--bg-secondary);
	cursor: pointer;
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: all 0.2s ease;
	border-radius: var(--radius-medium);
	color: var(--text-primary);
	flex-shrink: 0;
	aspect-ratio: 1/1;
	font-family: inherit;
}

.control-btn:hover {
	background: var(--button-hover);
}

.control-btn:active {
	background: var(--button-active);
}

.control-btn.playing {
	background: var(--accent-primary);
	color: white;
}

.frame-info {
	font-family: monospace;
	font-size: 12px;
	font-weight: bold;
	text-align: center;
	padding: 4px 8px;
	background: var(--bg-tertiary);
	border-radius: var(--radius-medium);
	min-width: 50px;
	color: var(--text-primary);
	border: 1px solid var(--border-primary);
}

.speed-control {
	display: flex;
	align-items: center;
	gap: 4px;
	min-width: 100px;
}

.speed-control input[type="range"] {
	flex: 1;
	height: 3px;
	background: var(--bg-tertiary);
	border: none;
	border-radius: 2px;
	outline: none;
	appearance: none;
}

.speed-control input[type="range"]::-webkit-slider-thumb {
	appearance: none;
	width: 12px;
	height: 12px;
	background: var(--accent-primary);
	border-radius: 50%;
	cursor: pointer;
}

.speed-control input[type="range"]::-moz-range-thumb {
	width: 12px;
	height: 12px;
	background: var(--accent-primary);
	border-radius: 50%;
	border: none;
	cursor: pointer;
}

#speed-value {
	font-family: monospace;
	font-weight: bold;
	min-width: 20px;
	text-align: center;
	font-size: 10px;
}

/* Timeline Panel */
.timeline-panel {
	background: var(--bg-primary);
	border: 1px solid var(--border-primary);
	border-radius: 6px;
	padding: 8px;
	flex: 1;
}

.timeline-header {
	font-size: 12px;
	font-weight: bold;
	color: var(--text-secondary);
	margin-bottom: 8px;
	display: flex;
	align-items: center;
	gap: 4px;
}

.timeline-header i {
	font-size: 14px;
}

.timeline-controls {
	display: flex;
	flex-direction: column;
}

.timeline-track {
	display: flex;
	gap: 2px;
	padding: 4px;
	overflow-x: auto;
	min-height: 30px;
	background: var(--bg-tertiary);
	border-radius: 4px;
	border-radius: 4px;
	padding: 4px;
}

.timeline-frame {
	width: 20px;
	height: 20px;
	background: var(--bg-secondary);
	border: 1px solid var(--border-primary);
	border-radius: 2px;
	cursor: pointer;
	transition: all 0.2s ease;
	flex-shrink: 0;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 10px;
	font-weight: bold;
}

.timeline-frame:hover {
	background: var(--bg-primary);
	border-color: var(--border-secondary);
}

.timeline-frame.active {
	background: var(--accent-primary);
	border-color: var(--accent-border);
}

.timeline-frame.current {
	outline: 2px solid var(--accent-primary);
	outline-offset: 1px;
}

.controls-content {
	display: flex;
	align-items: center;
	gap: 16px;
	width: 100%;
	justify-content: center;
	flex-wrap: nowrap;
}

.canvas-controls-bar .control-group {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
	min-width: fit-content;
}

.canvas-controls-bar .control-label {
	font-size: 11px;
	color: var(--text-secondary);
	font-weight: 500;
	white-space: nowrap;
}

.canvas-controls-bar .dropdown-button {
	min-width: 80px;
	height: 32px;
	padding: 0 12px;
	background: var(--bg-secondary);
	border: 1px solid var(--border-secondary);
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	font-size: 12px;
	cursor: pointer;
	color: var(--text-primary);
	transition: all 0.15s ease;
	overflow: hidden;
	box-sizing: border-box;
	line-height: 1;
	white-space: nowrap;
}

.canvas-controls-bar .dropdown-button:hover {
	background: var(--button-hover);
	border-color: var(--border-active);
}

.canvas-controls-bar .dropdown-button i {
	font-size: 12px;
	opacity: 1;
	flex-shrink: 0;
	color: var(--text-secondary);
}

.canvas-controls-bar .dropdown-button span {
	flex: 1;
	text-align: left;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.canvas-controls-bar .zoom-buttons {
	display: flex;
	gap: 2px;
}

.canvas-controls-bar .zoom-buttons button,
.canvas-controls-bar .grid-buttons button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	height: 32px;
	padding: 0 8px;
	border: none;
	border-radius: 4px;
	color: var(--text-secondary);
	cursor: pointer;
	transition: all 0.15s ease;	
	background: var(--bg-secondary);
	font-size: 14px;
	white-space: nowrap;
}

.canvas-controls-bar .zoom-buttons button:hover,
.canvas-controls-bar .grid-buttons button:hover {
	background: var(--button-hover);
	color: var(--text-primary);
}

.canvas-controls-bar .zoom-buttons button.active,
.canvas-controls-bar .grid-buttons button.active {
	background: var(--accent-primary);
	color: #ffffff;
}


/* Drop-down dropdowns for bottom controls */
.canvas-controls-bar .custom-dropdown {
	position: fixed;
	background: var(--bg-primary);
	border: 1px solid var(--border-color);
	border-radius: var(--border-radius-md);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	z-index: 1000;
	max-height: 200px;
	overflow-y: auto;
	min-width: 120px;
	/* Position below the button instead of above */
	transform: translateY(0);
	margin-top: -8px;
}

/* Minimal scrollbar for dropdown */
.canvas-controls-bar .custom-dropdown::-webkit-scrollbar {
	width: 6px;
}

.canvas-controls-bar .custom-dropdown::-webkit-scrollbar-track {
	background: transparent;
}

.canvas-controls-bar .custom-dropdown::-webkit-scrollbar-thumb {
	background: var(--text-muted);
	border-radius: 3px;
	opacity: 0.5;
}

.canvas-controls-bar .custom-dropdown::-webkit-scrollbar-thumb:hover {
	background: var(--text-secondary);
	opacity: 0.8;
}

/* Dropdown item styling for color previews */
.custom-dropdown .dropdown-item {
	padding: 8px 12px;
	font-size: 14px;
	cursor: pointer;
	border-bottom: 1px solid var(--border-color);
	transition: background-color 0.2s;
	color: var(--text-primary);
	display: flex;
	align-items: center;
}

.custom-dropdown .dropdown-item:last-child {
	border-bottom: none;
}

.custom-dropdown .dropdown-item:hover {
	background-color: var(--accent-primary);
	color: white;
}

.custom-dropdown .dropdown-item.selected {
	background-color: var(--accent-primary);
	color: white;
}

/* Colour Panel */
.color-selector {
	/* padding: 12px; */
  padding-left: 8px;
  padding-right: 8px;
padding-bottom: 8px;
padding-top: 8px;
}

.color-blocks {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	align-items: center;
}

.color-block {
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	/* padding: 4px; */
	border-radius: var(--radius-medium);
	transition: all 0.2s ease;
}

.color-block:hover {
	background-color: var(--bg-tertiary);
	transform: scale(1.02);
}

.color-display {
	width:var(--tool-button-width);
  width: 100%;
	height: var(--tool-button-height);

	border-radius: var(--radius-medium);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	transition: all 0.2s ease;
}

.color-block.primary .color-display {
	border-color: var(--text-primary);
}

.color-block.secondary .color-display {
	border-color: var(--border-secondary);
}

.color-label {
	font-size: 11px;
	font-weight: 500;
	color: var(--text-secondary);
	text-align: center;
	margin-top: 4px;
}

/* Panel Collapse Functionality */
.panel-header.collapsible {
	cursor: pointer;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.panel-header.collapsible:hover {
	background-color: var(--bg-tertiary);
}

.panel-caret {
	font-size: 14px;
	color: var(--text-secondary);
	transition: transform 0.2s ease;
}

.panel.collapsed .panel-caret {
	transform: rotate(-90deg);
}

.panel.collapsed .panel-content {
	display: none;
}

/* Pattern Controls */
.pattern-controls {
	display: flex;
	gap: 6px;
	margin-bottom: 8px;
	background: var(--bg-tertiary);
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.pattern-controls button {
	width: var(--tool-button-width);
	height: var(--tool-button-height);
	border: none;
	background: var(--bg-secondary);
	cursor: pointer;
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: all 0.2s ease;
	border-radius: var(--radius-medium);
	color: var(--text-primary);
	aspect-ratio: 1/1;
	font-family: inherit;
}

.pattern-controls button:hover {
	background: var(--button-hover);
}

.pattern-controls button:active {
	background: var(--button-active);
}

/* ========================================
   Canvas Resize Dialog Styles
   ======================================== */

#canvas-resize-dialog .dialog {
	max-width: 600px;
	width: 90vw;
}

.current-size-section {
	margin-bottom: 24px;
	padding: 16px;
	background: var(--bg-secondary);
	border-radius: var(--border-radius-md);
	border: 1px solid var(--border-color);
}

.current-size-section h4 {
	margin: 0 0 8px 0;
	color: var(--text-secondary);
	font-size: 14px;
	font-weight: 500;
}

.size-display {
	font-size: 18px;
	font-weight: 600;
	color: var(--accent-primary);
	font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
}

.resize-section {
	margin-bottom: 24px;
}

.size-inputs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-bottom: 16px;
}

.input-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.input-group label {
	font-size: 14px;
	font-weight: 500;
	color: var(--text-secondary);
}

.input-group input[type="number"] {
	padding: 10px 12px;
	border: 2px solid var(--border-color);
	border-radius: var(--border-radius-md);
	background: var(--bg-primary);
	color: var(--text-primary);
	font-size: 16px;
	font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
	transition: border-color 0.2s ease;
}

.input-group input[type="number"]:focus {
	outline: none;
	border-color: var(--accent-primary);
	box-shadow: 0 0 0 3px var(--accent-primary-alpha);
}

.input-group .unit {
	font-size: 14px;
	color: var(--text-muted);
	margin-left: 8px;
	align-self: flex-end;
	padding-bottom: 12px;
}

.constraint-controls {
	margin-top: 16px;
}

.checkbox-label {
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	font-size: 14px;
	color: var(--text-secondary);
	user-select: none;
}

.checkbox-label input[type="checkbox"] {
	display: none;
}

.checkbox-label .checkmark {
	width: 18px;
	height: 18px;
	border: 2px solid var(--border-color);
	border-radius: 4px;
	background: var(--bg-primary);
	position: relative;
	transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
	background: var(--accent-primary);
	border-color: var(--accent-primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
	content: '';
	position: absolute;
	left: 5px;
	top: 2px;
	width: 4px;
	height: 8px;
	border: solid white;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.preset-section {
	margin-bottom: 24px;
}

.preset-buttons {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 8px;
	margin-top: 12px;
}

.preset-btn {
	padding: 10px 12px;
	border: 2px solid var(--border-color);
	border-radius: var(--border-radius-md);
	background: var(--bg-primary);
	color: var(--text-primary);
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
}

.preset-btn:hover {
	border-color: var(--accent-primary);
	background: var(--accent-primary-alpha);
}

.preset-btn.active {
	background: var(--accent-primary);
	border-color: var(--accent-primary);
	color: white;
}

.resize-options-section {
	margin-bottom: 24px;
}

.resize-options {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 16px;
}

.radio-label {
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	font-size: 14px;
	color: var(--text-secondary);
	user-select: none;
}

.radio-label input[type="radio"] {
	display: none;
}

.radio-label .radio-mark {
	width: 18px;
	height: 18px;
	border: 2px solid var(--border-color);
	border-radius: 50%;
	background: var(--bg-primary);
	position: relative;
	transition: all 0.2s ease;
}

.radio-label input[type="radio"]:checked + .radio-mark {
	border-color: var(--accent-primary);
}

.radio-label input[type="radio"]:checked + .radio-mark::after {
	content: '';
	position: absolute;
	left: 50%;
	top: 50%;
	width: 8px;
	height: 8px;
	background: var(--accent-primary);
	border-radius: 50%;
	transform: translate(-50%, -50%);
}

.fill-options {
	margin-top: 16px;
	display: flex;
	align-items: center;
	gap: 12px;
}

.fill-options label {
	font-size: 14px;
	color: var(--text-secondary);
	font-weight: 500;
}

.fill-options select {
	padding: 8px 12px;
	border: 2px solid var(--border-color);
	border-radius: var(--border-radius-md);
	background: var(--bg-primary);
	color: var(--text-primary);
	font-size: 14px;
	cursor: pointer;
	transition: border-color 0.2s ease;
}

.fill-options select:focus {
	outline: none;
	border-color: var(--accent-primary);
}

.warning-section {
	margin-bottom: 16px;
	padding: 12px 16px;
	background: rgba(220, 53, 69, 0.1);
	border: 1px solid rgba(220, 53, 69, 0.3);
	border-radius: var(--border-radius-md);
}

.warning-content {
	display: flex;
	align-items: center;
	gap: 10px;
	color: #dc3545;
	font-size: 14px;
	font-weight: 500;
}

.warning-content i {
	font-size: 18px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.size-inputs {
		grid-template-columns: 1fr;
	}
	
	.preset-buttons {
		grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	}
	
	.resize-options {
		gap: 8px;
	}
	
	.radio-label,
	.checkbox-label {
		font-size: 13px;
	}
}

/* ===============================================
   Enhanced Error Dialog System
   =============================================== */

.error-dialog {
	max-width: 600px;
	width: 90vw;
}

.error-content {
	display: flex;
	gap: 16px;
	align-items: flex-start;
}

.error-icon {
	flex-shrink: 0;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(239, 68, 68, 0.1);
	border-radius: var(--border-radius-lg);
	border: 2px solid rgba(239, 68, 68, 0.2);
}

.error-icon i {
	font-size: 24px;
	color: #ef4444;
}

.error-details {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.error-message {
	font-size: 15px;
	line-height: 1.5;
	color: var(--text-primary);
	margin: 0;
}

.error-suggestions {
	background: var(--bg-secondary);
	padding: 16px;
	border-radius: var(--border-radius-md);
	border: 1px solid var(--border-color);
}

.error-suggestions h4 {
	margin: 0 0 12px 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--text-primary);
}

.error-suggestions ul {
	margin: 0;
	padding-left: 20px;
	list-style-type: disc;
}

.error-suggestions li {
	margin-bottom: 8px;
	font-size: 14px;
	line-height: 1.4;
	color: var(--text-secondary);
}

.error-suggestions li:last-child {
	margin-bottom: 0;
}

.error-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 4px;
}

.error-action-btn {
	padding: 8px 16px;
	border: 2px solid var(--accent-primary);
	background: transparent;
	color: var(--accent-primary);
	border-radius: var(--border-radius-md);
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
}

.error-action-btn:hover {
	background: var(--accent-primary);
	color: white;
}

.error-action-btn:active {
	transform: translateY(1px);
}

.technical-details {
	margin-top: 16px;
	border: 1px solid var(--border-color);
	border-radius: var(--border-radius-md);
	overflow: hidden;
}

.technical-details summary {
	padding: 12px 16px;
	background: var(--bg-secondary);
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	color: var(--text-secondary);
	user-select: none;
	transition: background-color 0.2s ease;
}

.technical-details summary:hover {
	background: var(--bg-tertiary);
}

.technical-details[open] summary {
	border-bottom: 1px solid var(--border-color);
}

.technical-details pre {
	margin: 0;
	padding: 16px;
	background: var(--bg-primary);
	font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
	font-size: 12px;
	line-height: 1.4;
	color: var(--text-secondary);
	white-space: pre-wrap;
	word-break: break-word;
	max-height: 200px;
	overflow-y: auto;
}

/* Enhanced Notification Improvements */
#app-notification {
	backdrop-filter: blur(8px);
	border: 1px solid rgba(255, 255, 255, 0.1);
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 48px;
}

#app-notification::before {
	content: '';
	width: 4px;
	height: 100%;
	background: currentColor;
	border-radius: 2px;
	opacity: 0.7;
}

/* Notification with icon support */
.notification-with-icon {
	display: flex;
	align-items: center;
	gap: 12px;
}

.notification-icon {
	font-size: 18px;
	opacity: 0.9;
}

/* Validation feedback styles */
.validation-feedback {
	margin-top: 4px;
	font-size: 12px;
	line-height: 1.3;
}

.validation-error {
	color: #ef4444;
}

.validation-warning {
	color: #f59e0b;
}

.validation-success {
	color: #22c55e;
}

.input-error {
	border-color: #ef4444 !important;
	background: rgba(239, 68, 68, 0.05);
}

.input-warning {
	border-color: #f59e0b !important;
	background: rgba(245, 158, 11, 0.05);
}

.input-success {
	border-color: #22c55e !important;
	background: rgba(34, 197, 94, 0.05);
}

/* Loading and progress indicators for error recovery */
.error-loading {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: var(--text-secondary);
}

.error-loading::before {
	content: '';
	width: 16px;
	height: 16px;
	border: 2px solid var(--border-color);
	border-top-color: var(--accent-primary);
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

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

/* Error dialog responsive adjustments */
@media (max-width: 640px) {
	.error-dialog {
		margin: 20px;
		max-width: calc(100vw - 40px);
	}
	
	.error-content {
		flex-direction: column;
		gap: 12px;
	}
	
	.error-icon {
		align-self: flex-start;
	}
	
	.error-actions {
		flex-direction: column;
	}
	
	.error-action-btn {
		width: 100%;
		text-align: center;
	}
	
	.technical-details pre {
		font-size: 11px;
		max-height: 150px;
	}
}


/* ===========================================
   TEXT OBJECT MANAGEMENT STYLES
   =========================================== */

.text-objects-section {
    border-top: 1px solid var(--border-primary);
    padding: 12px 0;
    margin-top: 12px;
}

.text-objects-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.text-objects-section h3 {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.text-objects-section .section-controls {
    display: flex;
    gap: 4px;
}

.text-objects-section .section-controls button {
    width: 24px;
    height: 24px;
    padding: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.text-objects-section .section-controls button:hover {
    background: var(--accent-primary);
    color: white;
}

.text-objects-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-primary);
}

.text-objects-list .empty-state {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 12px;
}

.text-object-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-secondary);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.text-object-item:last-child {
    border-bottom: none;
}

.text-object-item:hover {
    background: var(--bg-secondary);
}

.text-object-item.selected {
    background: var(--accent-primary);
    color: white;
}

.text-object-item.selected .text-object-info {
    color: rgba(255, 255, 255, 0.8);
}

.text-object-content {
    flex: 1;
    min-width: 0;
}

.text-object-text {
    font-weight: 500;
    font-size: 12px;
    margin-bottom: 2px;
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-object-info {
    font-size: 10px;
    color: var(--text-secondary);
    line-height: 1.2;
}

.text-object-controls {
    display: flex;
    gap: 2px;
    margin-left: 8px;
}

.text-object-btn {
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 3px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 11px;
}

.text-object-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.text-object-btn.active {
    background: var(--accent-primary);
    color: white;
}

.text-object-btn.inactive {
    opacity: 0.5;
}

.text-object-btn.delete-btn:hover {
    background: var(--error-color);
    color: white;
}

.text-object-item.selected .text-object-btn {
    color: rgba(255, 255, 255, 0.8);
}

.text-object-item.selected .text-object-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

/* Text Objects Stats */
.text-objects-stats {
    margin-bottom: 8px;
    padding: 4px 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    box-shadow: 0 8px 20px var(--shadow-color);
    z-index: 10000;
    padding: 4px 0;
    min-width: 160px;
    animation: contextMenuSlideIn 0.15s ease;
}

@keyframes contextMenuSlideIn {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.15s ease;
    white-space: nowrap;
}

.context-menu-item:hover {
    background: var(--button-hover);
}

.context-menu-item.delete {
    color: var(--error-color);
}

.context-menu-item.delete:hover {
    background: var(--error-color);
    color: white;
}

.context-menu-item.checked {
    background: var(--bg-secondary);
}

.context-menu-item.checked::after {
    content: '✓';
    margin-left: auto;
    font-size: 10px;
    color: var(--accent-primary);
}

.context-menu-separator {
    height: 1px;
    background: var(--border-primary);
    margin: 4px 0;
}

/* Font Upload Dialog Styles */
#font-upload-dialog .modal-content {
    width: 600px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}

.font-upload-section {
    margin-bottom: 24px;
}

.upload-area {
    border: 2px dashed var(--border-primary);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

.upload-area:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.upload-area.drag-over {
    border-color: var(--accent-primary);
    background: rgba(var(--accent-primary-rgb, 2, 93, 238), 0.1);
}

.upload-icon {
    font-size: 48px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.upload-text h4 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.upload-text p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.font-info-section {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
}

.font-info-section h4 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.font-preview {
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
}

#font-preview-canvas {
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.font-details {
    margin-bottom: 16px;
}

.font-detail-item {
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.font-detail-item strong {
    color: var(--text-primary);
    min-width: 120px;
    display: inline-block;
}

.format-help-section {
    margin-bottom: 16px;
}

.format-help-section h4 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.format-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.format-item {
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
}

.format-item strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
    font-size: 14px;
}

.format-item p {
    margin: 0 0 8px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
    padding: 0;
}

.btn-link:hover {
    color: var(--accent-hover);
}

/* Custom Font Manager Panel */
.custom-fonts-section {
    border-top: 1px solid var(--border-primary);
    padding: 16px 0;
    margin-top: 16px;
}

.custom-fonts-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.custom-fonts-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.custom-fonts-controls {
    display: flex;
    gap: 6px;
}

.custom-fonts-controls button {
    width: 28px;
    height: 28px;
    padding: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.custom-fonts-controls button:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-border);
}

.custom-fonts-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-primary);
}

.custom-fonts-list .empty-state {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 12px;
}

.custom-font-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-secondary);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.custom-font-item:last-child {
    border-bottom: none;
}

.custom-font-item:hover {
    background: var(--bg-secondary);
}

.custom-font-item.selected {
    background: var(--accent-primary);
    color: white;
}

.custom-font-content {
    flex: 1;
    min-width: 0;
}

.custom-font-name {
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-font-info {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.2;
}

.custom-font-item.selected .custom-font-info {
    color: rgba(255, 255, 255, 0.8);
}

.custom-font-controls {
    display: flex;
    gap: 2px;
    margin-left: 8px;
}

.custom-font-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 3px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 11px;
}

.custom-font-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.custom-font-btn.delete-btn:hover {
    background: var(--error-color);
    color: white;
}

.custom-font-item.selected .custom-font-btn {
    color: rgba(255, 255, 255, 0.8);
}

.custom-font-item.selected .custom-font-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    #font-upload-dialog .modal-content {
        width: 95vw;
        height: 90vh;
    }
    
    .format-list {
        flex-direction: column;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
    
    .upload-icon {
        font-size: 36px;
    }
}

/* Text Edit Dialog */
#text-edit-dialog .modal-content {
    width: 400px;
    max-width: 90vw;
}

#text-edit-dialog .input-section {
    margin-bottom: 16px;
}

#text-edit-dialog label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 12px;
    color: var(--text-primary);
}

#text-edit-dialog input,
#text-edit-dialog select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    transition: border-color 0.2s ease;
}

#text-edit-dialog input:focus,
#text-edit-dialog select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.1);
}

#text-edit-input {
    font-family: monospace;
}

/* Responsive text objects panel */
@media (max-width: 768px) {
    .text-object-item {
        padding: 6px 8px;
    }
    
    .text-object-controls {
        margin-left: 4px;
    }
    
    .text-object-btn {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
    
    .text-objects-list {
        max-height: 150px;
    }
}


/* Text Tool Option Bar Styles */
.text-tool-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 12px;
}

.text-info-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.text-info-value {
    color: var(--text-primary);
    font-weight: 600;
    font-family: monospace;
}

.text-tool-instruction {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 11px;
    font-style: italic;
}

.text-tool-instruction i {
    font-size: 12px;
    color: var(--accent-primary);
}

.text-tool-instruction span {
    line-height: 1.3;
}


/* Modal Dialog Base Styles */
.modal-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid var(--border-primary);
    background: var(--bg-secondary);
}

.input-section {
    margin-bottom: 16px;
}

.input-section label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 12px;
    color: var(--text-primary);
}

.input-section input,
.input-section select,
.input-section textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.input-section input:focus,
.input-section select:focus,
.input-section textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.1);
}

/* Modal Dialog Button Styles */
.btn-primary {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-secondary:hover {
    background: var(--bg-accent);
    border-color: var(--border-secondary);
}

/* Text Creation Dialog Styles */
#text-creation-dialog .modal-content {
    width: 380px;
    max-width: 95vw;
}

#text-creation-dialog .input-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

#text-creation-dialog .input-row .input-section {
    flex: 1;
    margin-bottom: 0;
}

/* Compact modal for live preview */
#text-creation-dialog .modal-body {
    padding: 16px;
}

#text-creation-dialog .modal-footer {
    padding: 12px 16px;
}

#text-creation-dialog .input-section {
    margin-bottom: 12px;
}

#text-creation-input {
    font-family: monospace;
    min-height: 60px;
    resize: vertical;
    line-height: 1.4;
}

/* Input help text */
.input-help {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.input-help i {
    font-size: 12px;
    opacity: 0.7;
}

/* Number input controls */
.number-input {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-primary);
    overflow: hidden;
    height: 34px;
}

.number-input button {
    background: var(--bg-secondary);
    border: none;
    color: var(--text-primary);
    padding: 0;
    width: 28px;
    height: 100%;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-input button:hover {
    background: var(--bg-tertiary);
}

.number-input button:active {
    background: var(--bg-accent);
}

.number-input input {
    border: none;
    background: transparent;
    padding: 6px 8px;
    text-align: center;
    min-width: 50px;
    flex: 1;
    color: var(--text-primary);
    font-size: 13px;
}

.number-input input:focus {
    outline: none;
    background: var(--bg-secondary);
}

/* Enhanced input focus states */
#text-creation-dialog input:focus,
#text-creation-dialog select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.1);
}
