/**
 * CJ's Brew & BBQ - Image Upload Styles v2.1
 * Side-by-side layout with scrollable image section
 * UPDATED: Jan 8, 2026 - Consolidated with brand-colors.css
 */

@import url('brand-colors.css');

/* =======================================
   STEP 5 CONTAINER - TWO COLUMN LAYOUT
   ======================================= */

.step5-container {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 30px;
	margin-bottom: 30px;
}

.preview-column {
	flex: 1;
	min-width: 0;
}

.image-column {
	flex: 1;
	min-width: 0;
}

/* =======================================
   IMAGE UPLOAD SECTION
   ======================================= */

.image-upload-section {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.image-upload-section h3 {
	color: var(--cjbb-primary);
	margin-bottom: 8px;
	margin-top: 0;
	font-weight: 700;
	font-size: 18px;
}

.image-upload-section p {
	color: #666;
	font-size: 13px;
	margin-bottom: 15px;
	margin-top: 0;
	line-height: 1.4;
}

/* =======================================
   DRAG & DROP DROPZONE
   ======================================= */

.dropzone {
	border: 2px dashed #ccc;
	border-radius: 8px;
	padding: 20px;
	text-align: center;
	background-color: #f9f9f9;
	cursor: pointer;
	transition: all 0.3s ease;
	margin-bottom: 15px;
	position: relative;
	overflow: hidden;
	flex-shrink: 0;
}

.dropzone::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(135deg, rgba(230, 57, 70, 0.02), rgba(212, 165, 116, 0.02));
	z-index: 0;
}

.dropzone.dragover {
	border-color: var(--cjbb-primary);
	background-color: rgba(230, 57, 70, 0.05);
	box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
	transform: scale(1.01);
}

.dropzone-content {
	position: relative;
	z-index: 1;
	pointer-events: none;
}

.dropzone-icon {
	font-size: 32px;
	margin-bottom: 8px;
	opacity: 0.6;
}

.dropzone-text {
	font-weight: 600;
	color: #333;
	margin-bottom: 3px;
	font-size: 14px;
}

.dropzone-subtext {
	font-size: 12px;
	color: #999;
}

.dropzone-input {
	display: none;
}

/* =======================================
   IMAGE GALLERY - SCROLLABLE CONTAINER
   ======================================= */

.image-gallery-wrapper {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overflow-x: hidden;
	padding-right: 5px;
	margin-right: -5px;
}

.image-gallery {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
	margin-bottom: 10px;
}

.image-item {
	position: relative;
	border-radius: 8px;
	overflow: hidden;
	background: var(--cjbb-bg-light);
	border: 2px solid #e0e0e0;
	transition: all 0.3s ease;
	cursor: grab;
	aspect-ratio: 1;
}

.image-item:hover {
	border-color: var(--cjbb-primary);
	box-shadow: 0 4px 12px rgba(230, 57, 70, 0.15);
}

.image-item.dragging {
	opacity: 0.6;
	cursor: grabbing;
	transform: scale(0.95);
}

.image-item.primary {
	border: 3px solid var(--cjbb-primary);
	box-shadow: 0 0 0 2px white, 0 0 0 4px var(--cjbb-primary);
}

.image-item.primary::after {
	content: '★ Primary';
	position: absolute;
	top: 5px;
	right: 5px;
	background: var(--cjbb-primary);
	color: white;
	padding: 3px 6px;
	border-radius: 3px;
	font-size: 10px;
	font-weight: 700;
	z-index: 5;
}

.image-preview {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Image Item Toolbar */
.image-toolbar {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: rgba(0, 0, 0, 0.8);
	padding: 6px 0;
	display: flex;
	justify-content: space-around;
	gap: 3px;
	opacity: 0;
	transition: opacity 0.3s ease;
	z-index: 3;
}

.image-item:hover .image-toolbar {
	opacity: 1;
}

.image-toolbar button {
	background: none;
	border: none;
	color: white;
	font-size: 14px;
	cursor: pointer;
	padding: 4px 6px;
	transition: all 0.2s ease;
	flex: 1;
	text-align: center;
}

.image-toolbar button:hover {
	background: rgba(230, 57, 70, 0.8);
	transform: scale(1.1);
}

/* =======================================
   IMAGE REMOVE BUTTON
   ======================================= */

.image-remove-btn {
	position: absolute;
	top: 5px;
	right: 5px;
	background: rgba(231, 76, 60, 0.9);
	color: white;
	border: none;
	border-radius: 50%;
	width: 24px;
	height: 24px;
	font-size: 14px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: all 0.2s ease;
	z-index: 4;
}

.image-item:hover .image-remove-btn {
	opacity: 1;
}

.image-remove-btn:hover {
	background: rgba(192, 57, 43, 1);
	transform: scale(1.1);
}

/* =======================================
   EMPTY STATE
   ======================================= */

.gallery-empty-state {
	text-align: center;
	padding: 20px;
	color: #999;
	font-size: 13px;
}

.gallery-empty-state.hidden {
	display: none;
}

.gallery-empty-state p {
	margin: 0;
}

/* =======================================
   UPLOAD PROGRESS
   ======================================= */

.upload-progress {
	margin-bottom: 15px;
	display: none;
	flex-shrink: 0;
}

.upload-progress.active {
	display: block;
}

.progress-bar-container {
	width: 100%;
	height: 6px;
	background: #e0e0e0;
	border-radius: 3px;
	overflow: hidden;
	margin-bottom: 8px;
}

.progress-bar-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--cjbb-primary), var(--cjbb-accent));
	transition: width 0.3s ease;
	border-radius: 3px;
}

.progress-text {
	font-size: 12px;
	color: #666;
}

/* =======================================
   IMAGE EDIT MODAL
   ======================================= */

.image-edit-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.7);
	z-index: 1000;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.image-edit-modal.active {
	display: flex;
}

.modal-content {
	background: white;
	border-radius: 8px;
	padding: 20px;
	max-width: 600px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	border-bottom: 1px solid #e0e0e0;
	padding-bottom: 15px;
}

.modal-header h3 {
	margin: 0;
	color: var(--cjbb-primary);
	font-size: 18px;
}

.modal-close {
	background: none;
	border: none;
	font-size: 24px;
	cursor: pointer;
	color: #666;
}

.modal-close:hover {
	color: var(--cjbb-primary);
}

/* =======================================
   CROP/ROTATE CONTROLS
   ======================================= */

.crop-container {
	margin-bottom: 20px;
	text-align: center;
}

.crop-image {
	max-width: 100%;
	max-height: 400px;
	border-radius: 4px;
	margin-bottom: 15px;
}

.crop-controls {
	display: flex;
	gap: 10px;
	justify-content: center;
	flex-wrap: wrap;
	margin-bottom: 15px;
}

.crop-btn {
	background: var(--cjbb-bg-light);
	border: 1px solid #ddd;
	padding: 8px 15px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 13px;
	transition: all 0.2s ease;
}

.crop-btn:hover {
	background: var(--cjbb-primary);
	color: white;
	border-color: var(--cjbb-primary);
}

.crop-btn.active {
	background: var(--cjbb-primary);
	color: white;
	border-color: var(--cjbb-primary);
}

/* =======================================
   ALT TEXT INPUT
   ======================================= */

.alt-text-group {
	margin-bottom: 15px;
}

.alt-text-label {
	display: block;
	font-weight: 600;
	color: #333;
	margin-bottom: 8px;
	font-size: 14px;
}

.alt-text-input {
	width: 100%;
	padding: 10px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
	transition: all 0.2s ease;
	box-sizing: border-box;
	font-family: inherit;
	resize: vertical;
}

.alt-text-input:focus {
	outline: none;
	border-color: var(--cjbb-primary);
	box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}

.alt-text-hint {
	font-size: 12px;
	color: #999;
	margin-top: 5px;
}

/* =======================================
   MODAL BUTTONS
   ======================================= */

.modal-buttons {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid #e0e0e0;
}

.modal-buttons button {
	padding: 10px 20px;
	border: 1px solid #ddd;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	transition: all 0.2s ease;
}

.modal-buttons button.cancel {
	background: var(--cjbb-bg-light);
	color: #333;
}

.modal-buttons button.cancel:hover {
	background: #e0e0e0;
}

.modal-buttons button.save {
	background: var(--cjbb-primary);
	color: white;
	border-color: var(--cjbb-primary);
}

.modal-buttons button.save:hover {
	background: var(--cjbb-accent);
}

/* =======================================
   RESPONSIVE DESIGN - TABLET
   ======================================= */

@media (max-width: 1024px) {
	.step5-container {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.image-gallery {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 768px) {
	.step5-container {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.image-gallery {
		grid-template-columns: repeat(3, 1fr);
		gap: 8px;
	}

	.dropzone {
		padding: 15px;
	}

	.dropzone-icon {
		font-size: 28px;
		margin-bottom: 6px;
	}

	.dropzone-text {
		font-size: 13px;
	}

	.dropzone-subtext {
		font-size: 11px;
	}

	.image-upload-section h3 {
		font-size: 16px;
	}

	.image-upload-section p {
		font-size: 12px;
	}

	.modal-content {
		padding: 15px;
	}

	.crop-image {
		max-height: 300px;
	}
}

@media (max-width: 480px) {
	.step5-container {
		grid-template-columns: 1fr;
		gap: 15px;
	}

	.image-gallery {
		grid-template-columns: repeat(2, 1fr);
		gap: 8px;
	}

	.dropzone {
		padding: 12px;
	}

	.dropzone-icon {
		font-size: 24px;
		margin-bottom: 5px;
	}

	.dropzone-text {
		font-size: 12px;
		margin-bottom: 2px;
	}

	.dropzone-subtext {
		font-size: 10px;
	}

	.image-upload-section h3 {
		font-size: 15px;
		margin-bottom: 6px;
	}

	.image-upload-section p {
		font-size: 11px;
		margin-bottom: 10px;
	}

	.image-item.primary::after {
		font-size: 8px;
		padding: 2px 4px;
	}

	.crop-controls {
		gap: 8px;
	}

	.crop-btn {
		padding: 6px 10px;
		font-size: 12px;
	}

	.modal-buttons {
		flex-direction: column;
	}

	.modal-buttons button {
		width: 100%;
	}

	.image-toolbar button {
		font-size: 12px;
		padding: 3px 4px;
	}

	.image-remove-btn {
		width: 20px;
		height: 20px;
		font-size: 12px;
	}
}

/* =======================================
   SCROLLBAR STYLING (Webkit browsers)
   ======================================= */

.image-gallery-wrapper::-webkit-scrollbar {
	width: 6px;
}

.image-gallery-wrapper::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 3px;
}

.image-gallery-wrapper::-webkit-scrollbar-thumb {
	background: #ddd;
	border-radius: 3px;
}

.image-gallery-wrapper::-webkit-scrollbar-thumb:hover {
	background: var(--cjbb-primary);
}