.toolbar {
	position: fixed;
	padding: var(--spacing-lg) var(--spacing-md);
	top: 48px;
	left: 0;
	bottom: 0;
	width: 96px;
	height: calc(100vh - 48px);
	background-color: var(--bg-primary);
	border-right: 1px solid var(--border-light);
	box-shadow: var(--shadow-sm);
	z-index: 20;
	overflow-y: auto;
	overflow-x: hidden;
	transition: background-color 0.2s ease;
}

.toolbar::-webkit-scrollbar {
	width: 6px;
}

.toolbar::-webkit-scrollbar-track {
	background: transparent;
}

.toolbar::-webkit-scrollbar-thumb {
	background: var(--border-medium);
	border-radius: 3px;
}

.toolbar::-webkit-scrollbar-thumb:hover {
	background: var(--border-dark);
}

.toolbarSection {
	position: relative;
	margin-bottom: var(--spacing-xl);
}

.toolbarSection.extraSpace {
	margin-bottom: 32px;
}

.toolbarSection:last-child {
	margin-bottom: 0;
}

/* Tools container - 2 column grid */
.toolsContainer {
	display: grid;
	grid-template-columns: repeat(2, 36px);
	gap: var(--spacing-xs);
	justify-content: center;
}

/* Tool Group Wrapper */
.tool-group {
	position: relative;
	width: 36px;
	height: 36px;
}

/* Expand Arrow - Bottom Right Corner */
.tool-expand-arrow {
	position: absolute;
	bottom: 1px;
	right: 1px;
	width: 12px;
	height: 12px;
	background-color: var(--bg-primary);
	border: none;
	border-radius: var(--radius-md);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 5;
	transition: all 0.15s ease;
	color: var(--text-secondary);
	outline: none;
}

.tool-expand-arrow:hover {
	background-color: var(--accent-primary);
	border: none;
	color: white;
	transform: scale(1.1);
}

/* When tool is active, chevron has blue background with white icon */
.tool-group .tool.active~.tool-expand-arrow {
	background-color: var(--accent-primary);
	color: white;
}

/* On hover when tool is active, flip to default state */
.tool-group .tool.active~.tool-expand-arrow:hover {
	background-color: var(--bg-primary);
	color: var(--text-secondary);
	transform: scale(1.1);
}

.tool-expand-arrow svg {
	width: 7px;
	height: 7px;
	transform: rotate(-45deg);
}

/* Tool Dropdown Menu */
.tool-dropdown {
	position: fixed;
	background-color: var(--bg-primary);
	border: 1px solid var(--border-light);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
	min-width: 160px;
	max-height: 400px;
	padding: var(--spacing-xs);
	z-index: 1000;
	opacity: 0;
	visibility: hidden;
	transform: translateX(-8px);
	transition: all 0.2s ease;
	pointer-events: none;
	overflow-y: auto;
	overflow-x: hidden;
}

.tool-dropdown::-webkit-scrollbar {
	width: 6px;
}

.tool-dropdown::-webkit-scrollbar-track {
	background: transparent;
	border-radius: var(--radius-md);
}

.tool-dropdown::-webkit-scrollbar-thumb {
	background: var(--border-medium);
	border-radius: 3px;
}

.tool-dropdown::-webkit-scrollbar-thumb:hover {
	background: var(--border-dark);
}

.tool-dropdown.visible {
	opacity: 1;
	visibility: visible;
	transform: translateX(0);
	pointer-events: auto;
}

.tool-dropdown-item {
	padding: var(--spacing-sm) var(--spacing-md);
	cursor: pointer;
	border-radius: var(--radius-sm);
	font-size: 13px;
	color: var(--text-primary);
	transition: all 0.15s ease;
	white-space: nowrap;
	display: flex;
	align-items: center;
	gap: var(--spacing-sm);
}

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

.tool-dropdown-icon {
	width: 24px;
	height: 24px;
	background-repeat: no-repeat;
	background-size: 20px;
	background-position: center;
	flex-shrink: 0;
	opacity: 0.7;
	transition: opacity 0.15s ease;
}

body.dark-theme .tool-dropdown-icon {
	filter: brightness(0) invert(1);
}

.tool-dropdown-item:hover .tool-dropdown-icon {
	opacity: 1;
}

body.dark-theme .tool-dropdown-item:hover .tool-dropdown-icon {
	filter: brightness(0) invert(1);
	opacity: 1;
}

.tool-dropdown-text {
	flex: 1;
}

/* Undo/Redo container - 2 column grid */
.undoRedoContainer {
	display: grid;
	grid-template-columns: repeat(2, 36px);
	gap: var(--spacing-xs);
	justify-content: center;
}

.undoButton,
.redoButton {
	position: relative;
	display: block;
	background-color: transparent;
	line-height: 0;
	text-align: center;
	font-size: 0;
	padding: 0;
	width: 36px;
	height: 36px;
	margin: 0;
	cursor: pointer;
	border-radius: var(--radius-md);
	overflow: hidden;
	background-repeat: no-repeat;
	background-size: 24px;
	background-position: center;
	transition: all 0.15s ease;
	border: 1px solid transparent;
	opacity: 0.7;
}

.undoButton {
	background-image: url('../assets/tools/tool_undo.svg');
}

.redoButton {
	background-image: url('../assets/tools/tool_redo.svg');
}

body.dark-theme .undoButton,
body.dark-theme .redoButton {
	filter: brightness(0) invert(1);
	opacity: 0.7;
}

.undoButton:hover,
.redoButton:hover {
	background-color: var(--bg-hover);
	border-color: var(--border-light);
	opacity: 1;
}

body.dark-theme .undoButton:hover,
body.dark-theme .redoButton:hover {
	filter: none;
	background-color: #e9ecef;
	border-color: #dee2e6;
}

.undoButton.disabled,
.redoButton.disabled {
	opacity: 0.3;
	cursor: not-allowed;
	pointer-events: none;
}

body.dark-theme .undoButton.disabled,
body.dark-theme .redoButton.disabled {
	filter: brightness(0) invert(1);
	opacity: 0.3;
}

.undoButton:active:not(.disabled),
.redoButton:active:not(.disabled) {
	background-color: var(--accent-primary);
	border-color: var(--accent-primary);
	box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.15);
}

.undoButton:active:not(.disabled)::before,
.redoButton:active:not(.disabled)::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-image: inherit;
	background-size: inherit;
	background-position: inherit;
	background-repeat: inherit;
	filter: brightness(0) invert(1);
	opacity: 1;
}

body.dark-theme .undoButton:active:not(.disabled),
body.dark-theme .redoButton:active:not(.disabled) {
	filter: none;
	background-color: var(--accent-primary);
	border-color: var(--accent-primary);
}

.undoButton.active-click:not(.disabled),
.redoButton.active-click:not(.disabled) {
	background-color: var(--accent-primary);
	border-color: var(--accent-primary);
	box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.15);
	opacity: 1;
	transition: all 0.15s ease;
}

.undoButton.active-click:not(.disabled)::before,
.redoButton.active-click:not(.disabled)::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-image: inherit;
	background-size: inherit;
	background-position: inherit;
	background-repeat: inherit;
	filter: brightness(0) invert(1);
	opacity: 1;
	z-index: 1;
}

body.dark-theme .undoButton.active-click:not(.disabled),
body.dark-theme .redoButton.active-click:not(.disabled) {
	filter: none;
	background-color: var(--accent-primary);
	border-color: var(--accent-primary);
	opacity: 1;
}

/* Color container - aligned to bottom of toolbar */
.colorContainer {
	position: absolute;
	bottom: var(--spacing-lg);
	left: 0;
	right: 0;
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 0 var(--spacing-md);
}


.tool {
	position: relative;
	display: block;
	background-color: transparent;
	line-height: 0;
	text-align: center;
	font-size: 0;
	padding: 0;
	width: 36px;
	height: 36px;
	margin: 0;
	cursor: pointer;
	border-radius: var(--radius-md);
	overflow: hidden;
	background-repeat: no-repeat;
	background-size: 24px;
	background-position: center;
	transition: all 0.15s ease;
	border: 1px solid transparent;
}

/* Make tool icons visible with gray tint */
.tool {
	opacity: 0.7;
}

/* Make tool icons visible in dark mode */
body.dark-theme .tool {
	filter: brightness(0) invert(1);
	opacity: 0.7;
}

.tool:hover {
	background-color: var(--bg-hover);
	border-color: var(--border-light);
	opacity: 1;
}

body.dark-theme .tool:hover {
	filter: none;
	background-color: #e9ecef;
	border-color: #dee2e6;
}

.tool.active {
	background-color: var(--accent-primary);
	border-color: var(--accent-primary);
	box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.15);
	opacity: 1;
}

.tool.active:hover {
	background-color: var(--accent-primary);
	border-color: var(--accent-primary);
}

/* Reset filter for active tool in dark mode, then apply white icon via ::before */
body.dark-theme .tool.active {
	filter: none;
	opacity: 1;
}

body.dark-theme .tool.active:hover {
	filter: none;
	background-color: var(--accent-primary);
	border-color: var(--accent-primary);
	opacity: 1;
}

.tool.active::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-image: inherit;
	background-size: inherit;
	background-position: inherit;
	background-repeat: inherit;
	filter: brightness(0) invert(1);
	opacity: 1;
}

/* ===== COLOR PICKER - MODERN OVERLAPPING DESIGN ===== 
 * 
 * Visual Layout (Horizontal):
 * 
 *    ●  ○  [⇄]
 *   Fill Stroke Swap
 * 
 * ================================================== */

.colorContainer input {
	display: none;
}

.colorPickerWrapper {
	position: relative;
	width: 68px;
	height: 68px;
	display: block;
	flex-shrink: 0;
}

/* Switch Button - Positioned below swatches, center aligned */
.colorSwitchButton {
	position: absolute !important;
	bottom: -4px !important;
	left: 50% !important;
	transform: translateX(-50%) !important;
	width: 20px !important;
	height: 20px !important;
	padding: 0 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	background-color: transparent !important;
	border: none !important;
	border-radius: 4px !important;
	cursor: pointer !important;
	color: var(--text-secondary) !important;
	transition: all 0.2s ease !important;
	z-index: 10 !important;
}

.colorSwitchButton svg {
	width: 16px;
	height: 8px;
	display: block;
	transition: all 0.2s ease;
}

.colorSwitchButton.is-reset svg {
	width: 16px;
	height: 12px;
}

.colorSwitchButton:hover {
	background-color: var(--bg-hover);
	color: var(--accent-primary);
	transform: translateX(-50%) scale(1.15);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.colorSwitchButton:hover svg {
	transform: scale(1.1);
}

.colorSwitchButton:active {
	transform: translateX(-50%) scale(0.95);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Color Swatches Positioning - Horizontal Overlapping */
.fillColorSpec {
	position: absolute !important;
	left: 0 !important;
	top: 0 !important;
	z-index: 10 !important;
	transition: z-index 0s !important;
	cursor: pointer !important;
}

.strokeColorSpec {
	position: absolute !important;
	left: 24px !important;
	top: 0 !important;
	z-index: 1 !important;
	transition: z-index 0s !important;
	cursor: pointer !important;
}

/* Active swatch on top - managed by JavaScript */
.fillColorSpec:active,
.fillColorSpec.sp-active {
	z-index: 10 !important;
}

.strokeColorSpec:active,
.strokeColorSpec.sp-active {
	z-index: 10 !important;
}


.toolbarLabel {
	top: -20px;
	position: absolute;
	color: var(--text-tertiary);
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	display: block;
	margin-bottom: var(--spacing-xs);
}

.opacityInput {
	width: 100%;
	font-size: 12px;
}

.blendModeSelect {
	width: 100%;
	padding: 0 var(--spacing-sm);
	font-size: 12px;
}

.strokeInput {
	width: 100%;
	font-size: 12px;
}

.strokeButtons {
	position: absolute;
	top: 0;
	right: 0;
	display: inline-block;
	height: 28px;
	margin: 0;
	padding: 0;
	vertical-align: bottom;
	line-height: 0;
}

.inputHelper {
	border: 0;
	background-color: var(--bg-hover);
	margin: 0;
	width: 28px;
	height: 14px;
	text-align: center;
	padding: 0;
	display: block;
	line-height: 0;
	outline: none;
	color: var(--text-secondary);
	font-size: 10px;
	transition: all 0.15s ease;
	border-radius: var(--radius-sm);
}

.inputHelper:hover {
	background-color: var(--bg-active);
	color: var(--text-primary);
}

.inputHelper.increase {
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
}

.inputHelper.decrease {
	border-top-left-radius: 0;
	border-top-right-radius: 0;
}


/* Floating Zoom Controls (similar to reference app) */
.zoom-controls {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 12px;
	background: var(--bg-secondary);
	border: 1px solid var(--border-light);
	border-radius: 12px;
	padding: 10px 14px;
	box-shadow: var(--shadow-lg);
	z-index: 100;
	user-select: none;
	backdrop-filter: blur(10px);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.zoom-controls.visible {
	opacity: 1;
	pointer-events: auto;
	animation: slideUpFade 0.4s ease;
}

@keyframes slideUpFade {
	from {
		opacity: 0;
		transform: translateX(-50%) translateY(20px);
	}

	to {
		opacity: 1;
		transform: translateX(-50%) translateY(0);
	}
}

.zoom-button {
	width: 36px;
	height: 36px;
	border-radius: 8px;
	background: var(--bg-tertiary);
	border: 1px solid var(--border-light);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	padding: 0;
	flex-shrink: 0;
}

.zoom-button:hover:not(.disabled) {
	background: var(--bg-hover);
	border-color: var(--accent-primary);
	transform: translateY(-1px);
}

.zoom-button:active:not(.disabled) {
	transform: translateY(0);
}

.zoom-button.disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.zoom-button svg {
	width: 20px;
	height: 20px;
	color: var(--text-secondary);
	transition: color 0.2s ease;
}

.zoom-button:hover:not(.disabled) svg {
	color: var(--accent-primary);
}

.zoom-display-container {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

.zoom-input {
	width: 70px;
	height: 36px;
	padding: 0 8px;
	background-color: var(--bg-tertiary);
	border: 1px solid var(--border-light);
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	color: var(--text-primary);
	text-align: center;
	cursor: text;
	transition: all 0.2s ease;
	outline: none;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Roboto", "Helvetica Neue", sans-serif;
}

.zoom-input:hover {
	background-color: var(--bg-hover);
	border-color: var(--accent-primary);
}

.zoom-input:focus {
	background-color: var(--bg-hover);
	border-color: var(--accent-primary);
	box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.1);
}

.zoom-select-dropdown {
	width: 36px;
	height: 36px;
	padding: 0;
	background-color: var(--bg-tertiary);
	border: 1px solid var(--border-light);
	border-radius: 8px;
	font-size: 0;
	color: transparent;
	cursor: pointer;
	transition: all 0.2s ease;
	outline: none;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 12 12" fill="none" stroke="%23868e96" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><polyline points="2,4 6,8 10,4"></polyline></svg>');
	background-repeat: no-repeat;
	background-position: center;
	background-size: 12px;
	text-indent: -9999px;
	overflow: hidden;
}

.zoom-select-dropdown:hover {
	background-color: var(--bg-hover);
	border-color: var(--accent-primary);
	background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 12 12" fill="none" stroke="%234c6ef5" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><polyline points="2,4 6,8 10,4"></polyline></svg>');
}

.zoom-select-dropdown:focus {
	background-color: var(--bg-hover);
	border-color: var(--accent-primary);
	box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.1);
}

/* Ensure dropdown menu items are visible */
.zoom-select-dropdown option {
	font-size: 14px;
	color: var(--text-primary);
	text-indent: 0;
}


/* No Color Buttons - Positioned to left and right of swap button */
.noColorButton {
	position: absolute !important;
	bottom: -4px !important;
	width: 20px !important;
	height: 20px !important;
	padding: 0 !important;
	display: block !important;
	background-color: white !important;
	border: 1px solid var(--border-medium) !important;
	border-radius: 50% !important;
	cursor: pointer !important;
	transition: all 0.2s ease !important;
	z-index: 10 !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

body.dark-theme .noColorButton {
	background-color: var(--bg-secondary) !important;
	border-color: var(--border-light) !important;
}

.noFillButton {
	left: 0 !important;
}

.noStrokeButton {
	right: 0 !important;
}

/* Subtle gray circle indicator */
.noColorButton::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 8px;
	height: 8px;
	background: rgba(0, 0, 0, 0.15);
	border-radius: 50%;
	transform: translate(-50%, -50%);
}

body.dark-theme .noColorButton::before {
	background: rgba(255, 255, 255, 0.2);
}

/* Stroke button gets a stroke outline instead of fill */
.noStrokeButton::before {
	background: transparent !important;
	border: 1.5px solid rgba(0, 0, 0, 0.2);
}

body.dark-theme .noStrokeButton::before {
	border-color: rgba(255, 255, 255, 0.25);
}

/* Red diagonal line */
.noColorButton::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 70%;
	height: 2px;
	background: #ff3b30;
	transform: translate(-50%, -50%) rotate(-45deg);
	border-radius: 2px;
}

.noColorButton:hover {
	transform: scale(1.15);
	border-color: var(--accent-primary) !important;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
}

.noColorButton:active {
	transform: scale(0.95);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}
