/**
 * Product Gallery — common widget CSS.
 *
 * Structural layout for the main image, thumbnails (bottom / left), grid, sale
 * badge, navigation arrows and the shared lightbox. Colours / borders come from
 * Elementor controls and the per-style sheets.
 *
 * @package captain-widgets-kit
 * @since   1.3.0
 */

.captwiki-pg {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

/* ----------------------------------------------------------- Main image */
.captwiki-pg__main {
	position: relative;
	overflow: hidden;
}

.captwiki-pg__main-btn {
	display: block;
	width: 100%;
	padding: 0;
	margin: 0;
	border: none;
	background: none;
	cursor: zoom-in;
}

.captwiki-pg__main img,
.captwiki-pg__grid img {
	display: block;
	width: 100%;
	height: auto;
}

.captwiki-pg__main-img {
	transition: opacity 0.15s ease;
}

.captwiki-pg__main-img.is-swapping {
	opacity: 0;
}

/* ----------------------------------------------------------- Thumbnails */
.captwiki-pg__thumbs {
	display: grid;
	grid-template-columns: repeat( 5, 1fr );
	gap: 10px;
}

.captwiki-pg__thumb {
	display: block;
	padding: 0;
	margin: 0;
	border: none;
	background: none;
	cursor: pointer;
	opacity: 0.6;
	transition: opacity 0.2s ease;
}

.captwiki-pg__thumb.is-active,
.captwiki-pg__thumb:hover {
	opacity: 1;
}

.captwiki-pg__thumb img {
	display: block;
	width: 100%;
	height: auto;
	border: 2px solid transparent;
	transition: border-color 0.2s ease;
}

.captwiki-pg__thumb.is-active img {
	border-color: #2563eb;
}

/* ----------------------------------------------- Thumbnails-left layout */
.captwiki-pg[data-layout="thumbs-left"] {
	flex-direction: row-reverse;
	align-items: flex-start;
}

.captwiki-pg[data-layout="thumbs-left"] .captwiki-pg__main {
	flex: 1;
}

.captwiki-pg[data-layout="thumbs-left"] .captwiki-pg__thumbs {
	display: flex;
	flex-direction: column;
	width: 84px;
	flex-shrink: 0;
}

/* ----------------------------------------------------------- Grid layout */
.captwiki-pg__grid {
	display: grid;
	grid-template-columns: repeat( 3, 1fr );
	gap: 10px;
}

.captwiki-pg__grid-item {
	position: relative;
	display: block;
	padding: 0;
	margin: 0;
	border: none;
	background: none;
	cursor: zoom-in;
	overflow: hidden;
}

/* ----------------------------------------------------------- Sale badge */
.captwiki-pg__sale {
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	padding: 5px 12px;
	border-radius: 4px;
	background: #e02b2b;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.2;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

/* ----------------------------------------------------------- Nav arrows */
.captwiki-pg__nav {
	position: absolute;
	top: 50%;
	transform: translateY( -50% );
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.9 );
	color: #1f2937;
	cursor: pointer;
	opacity: 0;
	box-shadow: 0 2px 10px rgba( 0, 0, 0, 0.15 );
	transition: opacity 0.2s ease, background-color 0.2s ease;
}

.captwiki-pg__main:hover .captwiki-pg__nav {
	opacity: 1;
}

.captwiki-pg__nav--prev {
	left: 12px;
}

.captwiki-pg__nav--next {
	right: 12px;
}

/* ----------------------------------------------------------- Lightbox */
.captwiki-pg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba( 0, 0, 0, 0.88 );
}

.captwiki-pg-lightbox.is-open {
	display: flex;
}

.captwiki-pg-lightbox__img {
	max-width: 86vw;
	max-height: 86vh;
	border-radius: 4px;
	box-shadow: 0 20px 60px rgba( 0, 0, 0, 0.5 );
}

.captwiki-pg-lightbox__close {
	position: absolute;
	top: 22px;
	right: 26px;
	width: 44px;
	height: 44px;
	border: none;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.12 );
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.captwiki-pg-lightbox__close:hover {
	background: rgba( 255, 255, 255, 0.25 );
}

.captwiki-pg-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY( -50% );
	width: 52px;
	height: 52px;
	border: none;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.12 );
	color: #fff;
	font-size: 22px;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.captwiki-pg-lightbox__nav:hover {
	background: rgba( 255, 255, 255, 0.25 );
}

.captwiki-pg-lightbox__nav--prev {
	left: 24px;
}

.captwiki-pg-lightbox__nav--next {
	right: 24px;
}

body.captwiki-pg-lightbox-open {
	overflow: hidden;
}

/* ----------------------------------------------------------- Editor notice */
.captwiki-pg--notice {
	display: block;
	padding: 16px 18px;
	border: 1px dashed #c3c4c7;
	border-radius: 6px;
	background: #f6f7f7;
	color: #50575e;
	text-align: center;
	font-size: 13px;
}

.captwiki-pg--notice p {
	margin: 0;
}

@media ( max-width: 767px ) {
	.captwiki-pg[data-layout="thumbs-left"] {
		flex-direction: column;
	}

	.captwiki-pg[data-layout="thumbs-left"] .captwiki-pg__thumbs {
		flex-direction: row;
		width: 100%;
		overflow-x: auto;
	}

	.captwiki-pg[data-layout="thumbs-left"] .captwiki-pg__thumb {
		flex: 0 0 72px;
	}
}
