/* marker.css - Drawing / Marker tool modal */

/* Full-screen overlay */

.ii-marker-modal {
	position: fixed;
	inset: 0;
	z-index: 1200;
	background: rgba(0, 0, 0, 0.92);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.25s ease;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	padding: 16px;
	box-sizing: border-box;
}

.ii-marker-modal.is-open {
	opacity: 1;
}

/* Inner wrapper */

.ii-marker-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	max-height: 100%;
	width: 100%;
}

/* Canvas area */

.ii-marker-canvas-wrapper {
	position: relative;
	display: inline-block;
	max-width: 90vw;
	max-height: calc(100svh - 140px);
	overflow: hidden;
	border-radius: 10px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
	cursor: none; /* hide default cursor while drawing */
	flex-shrink: 1;
}

.ii-marker-source-img {
	display: block;
	max-width: 90vw;
	max-height: calc(100svh - 140px);
	object-fit: contain;
	user-select: none;
	pointer-events: none;
	border-radius: 10px;
}

.ii-marker-canvas {
	position: absolute;
	inset: 0;
	cursor: none;
	touch-action: none;
	border-radius: 10px;
}

/* Custom circular cursor */

.ii-marker-cursor {
	--cursor-color: rgba(239, 68, 68, 0.65);
	position: absolute;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--cursor-color);
	pointer-events: none;
	transform: translate(-50%, -50%);
	border: 2px solid rgba(255, 255, 255, 0.4);
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
	opacity: 1;
	transition: background 0.15s ease, opacity 0.1s ease;
	will-change: left, top;
	left: -100px; /* hidden initially */
	top: -100px;
}

.ii-marker-cursor.is-hidden {
	opacity: 0;
}

/* Toolbar */

.ii-marker-toolbar {
	display: flex;
	align-items: center;
	gap: 10px;
	background: rgba(20, 20, 26, 0.9);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 14px;
	padding: 10px 14px;
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	flex-wrap: nowrap;
	width: min(96vw, 620px);
	box-sizing: border-box;
	flex-shrink: 0;
}

/* Color swatches */

.ii-marker-colors {
	display: flex;
	align-items: center;
	gap: 8px;
}

.ii-marker-swatch {
	--swatch-color: rgba(239, 68, 68, 0.65);
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--swatch-color);
	border: 2px solid transparent;
	cursor: pointer;
	padding: 0;
	outline: none;
	flex-shrink: 0;
	position: relative;
	transition:
		transform 0.15s ease,
		border-color 0.15s ease;
	box-shadow:
		0 0 0 1px rgba(255, 255, 255, 0.15),
		inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.ii-marker-swatch:hover {
	transform: scale(1.15);
}

.ii-marker-swatch.is-active {
	border-color: #fff;
	transform: scale(1.2);
	box-shadow:
		0 0 0 1px rgba(255, 255, 255, 0.5),
		0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Brush-size control */

.ii-marker-brush-size {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 0 10px;
	border-left: 1px solid rgba(255, 255, 255, 0.12);
	border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.ii-marker-brush-icon {
	flex-shrink: 0;
	color: rgba(255, 255, 255, 0.55);
}

.ii-marker-brush-slider {
	-webkit-appearance: none;
	appearance: none;
	width: 72px;
	height: 4px;
	border-radius: 2px;
	background: rgba(255, 255, 255, 0.2);
	outline: none;
	cursor: pointer;
}

.ii-marker-brush-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
	cursor: pointer;
	transition: transform 0.1s;
}

.ii-marker-brush-slider::-moz-range-thumb {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #fff;
	border: none;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
	cursor: pointer;
}

.ii-marker-brush-slider::-webkit-slider-thumb:hover {
	transform: scale(1.2);
}

/* Tool buttons (undo / clear) */

.ii-marker-toolbar-actions {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0 4px;
	border-left: 1px solid rgba(255, 255, 255, 0.12);
	border-right: 1px solid rgba(255, 255, 255, 0.12);
	padding: 0 12px;
}

.ii-marker-tool-btn {
	width: 32px;
	height: 32px;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.1);
	color: rgba(255, 255, 255, 0.75);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition:
		background 0.15s,
		color 0.15s,
		transform 0.1s;
}

.ii-marker-tool-btn:hover:not(:disabled) {
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	transform: translateY(-1px);
}

.ii-marker-tool-btn:disabled {
	opacity: 0.35;
}

/* Action buttons */

.ii-marker-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
}

.ii-marker-btn {
	height: 36px;
	padding: 0 16px;
	border-radius: 9px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	border: 1px solid rgba(255, 255, 255, 0.15);
	background: rgba(255, 255, 255, 0.08);
	color: rgba(255, 255, 255, 0.8);
	transition:
		background 0.15s,
		color 0.15s,
		transform 0.1s;
	white-space: nowrap;
}

.ii-marker-btn:hover {
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	transform: translateY(-1px);
}

.ii-marker-btn--primary {
	background: var(--ii-accent, #2563eb);
	border-color: transparent;
	color: #fff;
}

.ii-marker-btn--primary:hover {
	background: var(--ii-accent-hover, #1d4ed8);
	transform: translateY(-1px);
}

.ii-marker-btn--primary:disabled {
	opacity: 0.5;
	transform: none;
}

/* Marker chip (amber / orange tint) */
/* Marker chip styling (accent ring + corner badge) lives with the other
   square asset-chip rules in chat.css (.ii-asset-chip--marker). */

/* Draw button in image-actions overlay */

.ii-marker-action-btn svg {
	width: 14px;
	height: 14px;
}

/* Edit toolbar Draw button */

.ii-marker-edit-btn {
	background: rgba(245, 158, 11, 0.1);
	border: 1px solid rgba(245, 158, 11, 0.25);
	color: rgba(245, 158, 11, 0.9);
}

.ii-marker-edit-btn:hover {
	background: rgba(245, 158, 11, 0.15);
	color: #f59e0b;
	border-color: rgba(245, 158, 11, 0.4);
}

/* Mobile responsive */

@media (max-width: 600px) {
	.ii-marker-toolbar {
		gap: 8px;
		padding: 8px 10px;
		flex-wrap: wrap;
	}

	.ii-marker-colors {
		gap: 6px;
	}

	.ii-marker-actions {
		margin-left: 0;
		width: 100%;
		justify-content: flex-end;
	}

	.ii-marker-btn {
		height: 32px;
		padding: 0 12px;
		font-size: 12px;
	}

	.ii-marker-toolbar-actions {
		padding: 0 8px;
	}

	.ii-marker-brush-size {
		padding: 0 8px;
	}

	.ii-marker-brush-slider {
		width: 56px;
	}
}
