/*
 * Spare Parts Manager — Popup / Lightbox Styles
 * Version: 1.0.0
 *
 * Table of contents:
 *   1.  Body scroll lock
 *   2.  Overlay backdrop
 *   3.  Modal container
 *   4.  Close button
 *   5.  Gallery — main image + arrows
 *   6.  Gallery — thumbnail strip
 *   7.  Product info (title + description)
 *   8.  Entrance animation
 *   9.  Responsive
 */

/* ── 1. Scroll lock ────────────────────────────────────────────────────────── */
body.spm-no-scroll {
	overflow: hidden;
}

/* ── 2. Overlay backdrop ───────────────────────────────────────────────────── */
#spm-popup-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: rgba(10, 10, 20, 0.75);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
}

#spm-popup-overlay.spm-active {
	display: flex;
	animation: spmFadeIn 0.22s ease;
}

/* ── 3. Modal container ────────────────────────────────────────────────────── */
#spm-popup-modal {
	position: relative;
	background: #ffffff;
	border-radius: 16px;
	width: 100%;
	max-width: 900px;
	max-height: 90vh;
	overflow-y: auto;
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-template-rows: auto;
	box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
	animation: spmSlideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── 4. Close button ───────────────────────────────────────────────────────── */
#spm-popup-close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 10;
	width: 36px;
	height: 36px;
	border: none;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.08);
	color: #374151;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

#spm-popup-close:hover,
#spm-popup-close:focus-visible {
	background: #ef4444;
	color: #fff;
	transform: rotate(90deg);
	outline: none;
}

/* ── 5. Gallery — main image + arrows ─────────────────────────────────────── */
#spm-popup-gallery {
	background: #0f0f1a;
	border-radius: 16px 0 0 16px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

#spm-popup-main-wrap {
	position: relative;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 300px;
	background: #0f0f1a;
}

#spm-popup-main-img-wrap {
	width: 100%;
	height: 380px;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

#spm-popup-main-img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	display: block;
	transition: opacity 0.2s ease;
}

/* Prev / Next arrows */
#spm-popup-prev,
#spm-popup-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 38px;
	height: 38px;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.18s ease;
	z-index: 5;
}

#spm-popup-prev { left: 10px; }
#spm-popup-next { right: 10px; }

#spm-popup-prev:hover,
#spm-popup-next:hover {
	background: rgba(240, 0, 0, 0.85);
}

/* ── 6. Gallery — thumbnail strip ─────────────────────────────────────────── */
#spm-popup-thumbs {
	display: flex;
	gap: 8px;
	padding: 12px 14px;
	background: #18182a;
	overflow-x: auto;
	flex-shrink: 0;
	scrollbar-width: thin;
	scrollbar-color: #444 transparent;
}

#spm-popup-thumbs::-webkit-scrollbar { height: 4px; }
#spm-popup-thumbs::-webkit-scrollbar-thumb { background: #555; border-radius: 2px; }

.spm-popup-thumb {
	flex-shrink: 0;
	width: 60px;
	height: 60px;
	border: 2px solid transparent;
	border-radius: 8px;
	overflow: hidden;
	padding: 0;
	cursor: pointer;
	background: none;
	transition: border-color 0.18s ease, transform 0.18s ease;
}

.spm-popup-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.spm-popup-thumb--active,
.spm-popup-thumb:hover {
	border-color: #F00000;
	transform: scale(1.06);
}

/* ── 7. Product info ───────────────────────────────────────────────────────── */
#spm-popup-info {
	padding: 36px 32px 32px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	overflow-y: auto;
}

#spm-popup-title {
	margin: 0;
	font-size: 1.45rem;
	font-weight: 800;
	line-height: 1.25;
	color: #111827;
}

#spm-popup-desc {
	font-size: 0.95rem;
	line-height: 1.75;
	color: #4b5563;
}

#spm-popup-desc p { margin: 0 0 12px; }
#spm-popup-desc p:last-child { margin-bottom: 0; }

/* ── 8. Entrance animations ────────────────────────────────────────────────── */
@keyframes spmFadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes spmSlideUp {
	from { transform: translateY(28px) scale(0.97); opacity: 0; }
	to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* ── 9. Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
	#spm-popup-modal {
		grid-template-columns: 1fr;
		max-height: 95vh;
	}

	#spm-popup-gallery {
		border-radius: 16px 16px 0 0;
	}

	#spm-popup-main-img-wrap {
		height: 250px;
	}

	#spm-popup-info {
		padding: 24px 20px 28px;
	}

	#spm-popup-title {
		font-size: 1.2rem;
	}
}

@media (max-width: 480px) {
	#spm-popup-overlay {
		padding: 0;
		align-items: flex-end;
	}

	#spm-popup-modal {
		border-radius: 20px 20px 0 0;
		max-height: 92vh;
	}
}
