/* ========== Image Editor Section ========== */

.container {
	max-width: 1200px;
	margin: 0 auto;
}

.editor-wrapper {
	display: flex;
	flex-wrap: nowrap;
	gap: 1.5rem;
	margin: 1.5rem 0;
	min-height: 600px;
	scroll-margin-top: 70px;
}

@media (max-width: 1024px) {
	.editor-wrapper {
		flex-wrap: wrap;
	}
}

/* Preview Container */
.preview-container {
	flex: 1.2;
	position: relative;
	border-radius: var(--radius-lg);
	padding: 0.5rem;
	text-align: center;
	transition: var(--transition);
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 0;
	height: auto;
	min-height: 350px;
	max-height: 500px;
	/* Supporting larger preview canvas */
	border: 1px solid rgba(124, 58, 237, 0.06);
	box-shadow: var(--shadow-lg);
	overflow: hidden;
}

.preview-container:hover {
	border-color: rgba(124, 58, 237, 0.15);
}

.preview-title {
	font-size: 1.8rem;
	font-weight: 700;
	margin-bottom: 1.5rem;
	background: var(--gradient-text);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

/* Old internal drop zone — permanently hidden (replaced by .tool-upload-area) */
#dropZone {
	display: none !important;
}

/* Editor workspace reveal animation */
.editor-wrapper.revealed {
	display: flex !important;
	animation: editorReveal 0.5s ease forwards;
}

@keyframes editorReveal {
	from {
		opacity: 0;
		transform: translateY(12px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

#previewCanvas,
#previewImage {
	display: none;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	animation: fadeIn 0.3s ease-in-out forwards;
}

#previewImage.fade-in {
	animation: fadeIn 0.3s ease-in-out forwards;
}

.image-preview {
	width: 100%;
	flex: 1;
	overflow: hidden;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0.5rem;
}

.image-preview.crop-mode #previewCanvas {
	display: none !important;
	width: 0 !important;
	height: 0 !important;
}

/* Spinner */
.spinner {
	position: absolute;
	top: 45%;
	left: 50%;
	width: 30px;
	height: 30px;
	border: 3px solid var(--border);
	border-top: 3px solid var(--primary);
	border-radius: 50%;
	animation: spin 1s linear infinite;
	z-index: 1001;
	transform: translate(-50%, -50%);
	display: none;
}

@keyframes spin {
	0% {
		transform: translate(-50%, -50%) rotate(0deg);
	}

	100% {
		transform: translate(-50%, -50%) rotate(360deg);
	}
}

/* Editing Controller */
.editingController {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	width: 100%;
	height: 20%;
	margin: 0.75rem;
	gap: 1rem;
}

#btnController,
#cropController {
	display: none;
	/* Managed by JS */
	justify-content: center;
	align-items: center;
	gap: 0.75rem;
	width: 100%;
	flex-wrap: wrap;
	/* Standard wrap for responsiveness */
}

#btnController button,
#cropController button {
	padding: 0.4rem 0.75rem;
	/* Tighter padding to fit 3 in a row */
	font-size: 0.8rem;
	/* Slightly smaller text */
	border-radius: 8px;
	white-space: nowrap;
	/* Prevent text wrapping inside button */
	flex-shrink: 0;
	/* Prevent buttons from squashing */

}

/* Undo/Redo Controls */
.undo-redo-controls {
	display: none;
	/* JS will set to flex */
	justify-content: space-around;
	align-items: center;
	/* Restored to a sensible default */
	width: 100%;
}

.undo-btn,
.redo-btn {
	border: none;
	background: none;
}

.undo-btn img,
.redo-btn img {
	height: 20px;
	width: 20px;
	cursor: pointer;
	opacity: 0.8;
}

.undo-btn:disabled,
.redo-btn:disabled {
	opacity: 0.3;
}

/* Zoom Controls */
.zoom-slider-control {
	display: none;
	/* JS will set to inline-block/flex */
	justify-content: center;
	align-items: center;
	gap: 0.75rem;
	width: 100%;
	margin: 0.25rem 0;
	color: var(--text-secondary);
}

#zoomSlider {
	width: 150px;
	vertical-align: middle;
	cursor: pointer;
}

.zoom-label {
	display: inline-block;
	font-size: 14px;
	vertical-align: middle;
	min-width: 35px;
}

/* Crop Controls */
#applyCropBtn {
	margin-right: 1rem;
}

.cropper-container {
	background: none !important;
}

.cropper-modal {
	background: none !important;
}

/* Controls Section (Right Side) */
.controls-section {
	flex: 1;
	/* min-width: 280px; */
	padding: 1.25rem;
	border-radius: var(--radius-lg);
	margin-bottom: 5rem;
	box-shadow: var(--shadow);
	background: var(--bg-card);
	height: fit-content;
	border: 1px solid rgba(124, 58, 237, 0.06);
}

.controls-section h2 {
	text-align: center;
	font-weight: 700;
	margin-bottom: 1rem;
	font-size: 1.2rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	background: var(--gradient-text);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

#editingTools .tools-grid {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	flex-grow: 1;
	max-height: calc(100% - 3rem);
}

.control-group {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem;
}

.control-label {
	font-weight: 500;
	color: var(--text-primary);
	white-space: nowrap;
	font-size: 0.95rem;
}

.control-input {
	padding: 0.35rem 0.5rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	width: inherit;
	flex-grow: 1;
	font-size: 0.85rem;
	cursor: pointer;
	transition: var(--transition);
	background: var(--bg-card);
}

.control-input:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

#widthInput,
#heightInput {
	cursor: auto;
}

.control-group span {
	min-width: 32px;
}

.lock-aspect {
	cursor: pointer;
}

.lock-aspect i {
	font-size: 1rem;
	color: var(--text-secondary);
}

input[type="range"] {
	width: 100%;
	padding: unset;
	accent-color: var(--primary);
	cursor: pointer;
}

input[type="number"]:focus,
select:focus,
input[type="range"]:focus {
	outline: none;
	border-color: var(--primary);
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	margin: 0;
}

input[type="number"] {
	-moz-appearance: textfield;
	appearance: textfield;
}

#downloadBtn {
	width: 100%;
	/* margin-top: 1rem; */
	padding: 0.75rem;
	border-radius: var(--radius);
	background: var(--gradient-primary);
	box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

#downloadBtn:hover {
	transform: translateY(-1px);
	box-shadow: 0 6px 16px rgba(124, 58, 237, 0.35);
}

@keyframes fadeIn {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

/* Icon base - Scoped to avoid affecting navbar icons */
#editingTools i {
	display: inline-block;
	min-width: 20px;
	height: 16px;
}