/* ============================================================
   Widget: Product image w. left gallery (stil ELHO)
   ============================================================ */

.pilg-gallery {
	display: flex;
	flex-direction: row;
	gap: 16px;
	align-items: flex-start;
	width: 100%;
	--pilg-accent: #76A73A;
	--pilg-thumb-w: 84px;
	--pilg-thumb-visible: 5;
}

/* ---------- Coloana thumbnails (stanga) ---------- */
.pilg-gallery__thumbs-col {
	flex: 0 0 var(--pilg-thumb-w);
	width: var(--pilg-thumb-w);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

.pilg-gallery__thumbs {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 100%;
	overflow: hidden;
	max-height: calc((var(--pilg-thumb-w) + 10px) * var(--pilg-thumb-visible));
	scroll-behavior: smooth;
}

.pilg-gallery__thumb {
	margin: 0;
	padding: 0;
	width: 100%;
	height: var(--pilg-thumb-w);   /* inaltime = latimea coloanei => patrat */
	flex: 0 0 var(--pilg-thumb-w);
	border: 1px solid transparent;
	border-radius: 8px;
	overflow: hidden;
	cursor: pointer;
	opacity: 0.55;
	transition: opacity 0.2s ease, border-color 0.2s ease;
	background: #fff;
	box-sizing: border-box;
}

.pilg-gallery__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.pilg-gallery__thumb:hover { opacity: 0.85; }

.pilg-gallery__thumb.is-active {
	opacity: 1;
	border-color: var(--pilg-accent);
}

/* sagetile de navigare thumbs */
.pilg-gallery__nav {
	border: none;
	background: transparent;
	color: #333;
	cursor: pointer;
	padding: 4px;
	display: none;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: background 0.15s ease;
}
.pilg-gallery__nav:hover { background: #f0f0f0; }
.pilg-gallery__nav.is-visible { display: flex; }

/* ---------- Imaginea principala (dreapta) ---------- */
.pilg-gallery__main {
	flex: 1 1 auto;
	min-width: 0;               /* CRUCIAL pentru flexbox */
	position: relative;
}

.pilg-gallery__stage {
	position: relative;
	width: 100%;
	background: #fff;
	border-radius: 8px;
	overflow: hidden;
	cursor: pointer;
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pilg-gallery__main-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	transition: opacity 0.2s ease;
}

/* Sageti next/prev pe imaginea mare (stil ELHO) */
.pilg-gallery__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	border: none;
	border-radius: 50%;
	background: rgba(255,255,255,0.85);
	color: #333;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 8px rgba(0,0,0,0.12);
	opacity: 0;
	transition: opacity 0.2s ease, background 0.15s ease;
	z-index: 4;
}
.pilg-gallery__stage:hover .pilg-gallery__arrow { opacity: 1; }
.pilg-gallery__arrow:hover { background: #fff; }
.pilg-gallery__arrow--prev { left: 12px; }
.pilg-gallery__arrow--next { right: 12px; }

/* pe touch (mobil) sagetile raman mereu vizibile */
@media (hover: none) {
	.pilg-gallery__arrow { opacity: 1; }
}

/* ---------- Empty state ---------- */
.pilg-gallery--empty {
	padding: 20px;
	text-align: center;
	color: #999;
}

/* ---------- Responsive (mobil: thumbs jos, orizontal) ---------- */
@media (max-width: 768px) {
	.pilg-gallery { flex-direction: column-reverse; }
	.pilg-gallery__thumbs-col { flex: 1 1 auto; width: 100%; }
	.pilg-gallery__thumbs {
		flex-direction: row;
		max-height: none;
		max-width: 100%;
		overflow-x: auto;
		overflow-y: hidden;
	}
	.pilg-gallery__thumb { flex: 0 0 var(--pilg-thumb-w); }
	.pilg-gallery__nav { display: none !important; }
}

/* ---------- Lightbox fallback ---------- */
.pilg-lightbox {
	position: fixed; inset: 0;
	background: rgba(0,0,0,0.9);
	z-index: 999999;
	display: flex; align-items: center; justify-content: center;
}
.pilg-lightbox__inner {
	position: relative;
	max-width: 90vw; max-height: 90vh;
	display: flex; align-items: center; justify-content: center;
}
.pilg-lightbox__img {
	max-width: 90vw; max-height: 90vh;
	object-fit: contain; border-radius: 4px;
}
.pilg-lightbox__close,
.pilg-lightbox__prev,
.pilg-lightbox__next {
	position: absolute;
	background: rgba(255,255,255,0.15);
	color: #fff; border: none; cursor: pointer;
	width: 48px; height: 48px; border-radius: 50%;
	font-size: 28px; line-height: 1;
	display: flex; align-items: center; justify-content: center;
	transition: background 0.15s ease;
}
.pilg-lightbox__close:hover,
.pilg-lightbox__prev:hover,
.pilg-lightbox__next:hover { background: rgba(255,255,255,0.3); }
.pilg-lightbox__close { top: -60px; right: 0; }
.pilg-lightbox__prev  { left: -70px; top: 50%; transform: translateY(-50%); }
.pilg-lightbox__next  { right: -70px; top: 50%; transform: translateY(-50%); }

@media (max-width: 768px) {
	.pilg-lightbox__prev { left: 5px; }
	.pilg-lightbox__next { right: 5px; }
	.pilg-lightbox__close { top: 5px; right: 5px; }
}
