/* =====================================================================
   Custom Product Page — scoped so it only touches the single-product
   template pieces this plugin actually replaces (the gallery wrapper it
   adds, .cpp-buybox, and its own popup/toast elements). Title, price,
   and the description/reviews tabs keep whatever the theme already did.
   ===================================================================== */

:root {
	--cpp-ink: #111111;
	--cpp-muted: #6b6b6b;
	--cpp-border: #e2e2e2;
	--cpp-bg-soft: #f5f5f5;
	--cpp-danger: #c0392b;
	--cpp-radius-pill: 999px;
	--cpp-radius: 8px;
}

/* ---------------------------------------------------------------- Gallery + badges */
.cpp-gallery-wrap { position: relative; }

.cpp-badges {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 5;
	display: flex;
	flex-direction: column;
	gap: 6px;
	pointer-events: none;
}
.cpp-badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 4px;
	background: var(--cpp-danger);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .03em;
	line-height: 1.6;
}
.cpp-badge--stock { background: #333333; }

/* Fully self-contained gallery — no dependency on WooCommerce's default gallery or any
   third-party variation-gallery plugin. Thumbnails are a vertical slider on the left (bottom
   items slide up into view); the main image sits to the right with prev/next arrows
   overlaid on it, and zooms on hover. */
.cpp-gallery {
	position: relative;
	display: flex;
	gap: 24px;
	--cpp-thumb-width: 84px;
	--cpp-thumb-gap: 16px;
	--cpp-thumb-visible: 4; /* how many thumbnails show before the slider scrolls */
}

/* ---------------------------------------------------------------- Thumbnail slider */
.cpp-gallery__thumbs-col {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	width: var(--cpp-thumb-width);
	flex: none;
}
.cpp-gallery__thumb-nav {
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 100%;
	border: 0 !important;
	background: none !important;
	box-shadow: none !important;
	padding: 4px !important;
	color: var(--cpp-ink) !important;
	cursor: pointer;
}
.cpp-gallery__thumb-nav:disabled { opacity: .25; cursor: not-allowed; }
.cpp-gallery__thumb-nav:not(:disabled):hover { opacity: .6; }

.cpp-gallery__thumbs-viewport {
	width: 100%;
	/* Assumes roughly square thumbnails (height ≈ width) — true for typical product photos.
	   Change --cpp-thumb-visible (via the Elementor widget's Style tab, or the
	   cpp_gallery_visible_thumbnails filter) rather than a fixed pixel height so it always
	   matches however many thumbnails should show. */
	height: calc( ( var(--cpp-thumb-visible) * ( var(--cpp-thumb-width) + var(--cpp-thumb-gap) ) ) - var(--cpp-thumb-gap) );
	overflow: hidden;
}
.cpp-gallery__thumbs {
	display: flex;
	flex-direction: column;
	gap: var(--cpp-thumb-gap);
	transition: transform .3s ease;
}
.cpp-gallery__thumb {
	display: block;
	width: 100%;
	flex: none;
	padding: 0 !important;
	margin: 0;
	border: 0 !important;
	background: none !important;
	box-shadow: none !important;
	cursor: pointer;
	opacity: .55;
	transition: opacity .15s ease;
}
.cpp-gallery__thumb:hover,
.cpp-gallery__thumb.is-active { opacity: 1; }
.cpp-gallery__thumb img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var(--cpp-radius);
}

/* ---------------------------------------------------------------- Main image + zoom */
.cpp-gallery__main {
	flex: 1;
	min-width: 0;
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

/* Prev/next arrows overlaid on the image itself, vertically centered at the edges. */
.cpp-gallery__nav .cpp-gallery__arrow {
	position: absolute;
	top: 50%;
	left: 10px;
	z-index: 99;
	transform: translateY(-50%);
}
.cpp-gallery__nav .cpp-gallery__arrow.cpp-gallery__arrow--next {
	left: unset !important;
	right: 10px;
}
.cpp-gallery__arrow {
	display: inline-flex !important;
	align-items: center;
	border: 0 !important;
	background: none !important;
	box-shadow: none !important;
	padding: 6px !important;
	color: var(--cpp-ink) !important;
	cursor: pointer;
}
.cpp-gallery__arrow svg { display: block; width: 22px; height: auto; }
.cpp-gallery__arrow:hover { opacity: .6; }

.cpp-gallery__stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: 100%;
	overflow: hidden;
	border-radius: var(--cpp-radius);
	cursor: zoom-in;
}
.cpp-gallery__image {
	max-width: 100%;
	max-height: 640px;
	width: auto;
	height: auto;
	object-fit: contain;
	transition: transform .1s ease-out;
	transform-origin: center center;
}
/* JS toggles this class and sets transform-origin/scale inline while the cursor is over the
   image — no separate zoomed-in state needed beyond the transform itself. */
.cpp-gallery__stage.is-zoomed .cpp-gallery__image { cursor: zoom-out; }

@media (max-width: 781px) {
	.cpp-gallery { flex-direction: column-reverse; gap: 14px; }
	.cpp-gallery__thumbs-col { flex-direction: row; width: 100%; }
	.cpp-gallery__thumb-nav { width: auto; padding: 4px 8px !important; }
	.cpp-gallery__thumb-nav svg { transform: rotate(-90deg); display: block; }
	.cpp-gallery__thumbs-viewport {
		height: auto !important;
		width: 100%;
		overflow: hidden;
	}
	.cpp-gallery__thumbs { flex-direction: row; }
	.cpp-gallery__thumb { width: 64px; flex: none; }
	.cpp-gallery__image { max-height: 420px; }
	/* Hover-zoom doesn't apply on touch; keep the cursor default and skip the transform. */
	.cpp-gallery__stage { cursor: default; }
}

/* ---------------------------------------------------------------- Buy box
   Selectors are prefixed with .cpp-buybox (raising specificity to two classes) and the
   properties themes/Elementor's Global Kit most commonly set site-wide on bare `button`/`a`
   tags (color, background, border, radius, font, spacing) carry !important, so this can't
   be silently overridden by a `body.elementor-kit-… button` style rule (which, despite
   looking specific, is actually LOWER specificity than two classes — but themes vary, so
   !important is the belt-and-suspenders here, per your request). */

.cpp-buybox .cpp-attribute { margin-bottom: 20px; }
.cpp-buybox .cpp-attribute__label {
	margin-bottom: 10px !important;
	font-size: 14px !important;
	font-weight: 500 !important;
	letter-spacing: 0 !important;
	color: var(--cpp-ink) !important;
	text-transform: uppercase !important;
}
.cpp-buybox .cpp-attribute__options { display: flex !important; flex-wrap: wrap; align-items: center; gap: 13px; }

/* Size (and any other non-color attribute) as small round pill buttons — selected state
   flips to a solid black circle. */
.cpp-buybox .cpp-pill-option {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0 !important;
	border: 0 !important;
	box-shadow: none !important;
	color: var(--cpp-ink) !important;
	font-size: 12px !important;
	font-weight: 400 !important;
	font-family: inherit !important;
	letter-spacing: 0 !important;
	text-transform: uppercase !important;
	line-height: 1.3 !important;
	cursor: pointer;
	width: 32px;
	height: 32px;
	background: #fff;
	border-radius: 50%;
}
.cpp-buybox .cpp-pill-option.is-selected {
	font-weight: 600 !important;
	background-color: #000 !important;
	color: #fff !important;
}
.cpp-buybox .cpp-pill-option:disabled,
.cpp-buybox .cpp-pill-option.is-unavailable {
	opacity: .35 !important;
	cursor: not-allowed;
	text-decoration: line-through !important;
}
button.cpp-pill-option:hover {
	background-color: #000 !important;
	color: #fff !important;
	border-color: #000 !important;
}
button.cpp-pill-option:hover * { color: #fff !important; }

.cpp-buybox .cpp-swatch {
	width: 20px !important;
	height: 20px !important;
	min-width: 0 !important;
	border-radius: 50% !important;
	border: 3px solid #fff !important;
	outline: 1px solid var(--cpp-border);
	box-shadow: none !important;
	cursor: pointer;
	padding: 0 !important;
	margin: 0;
	transition: outline-color .15s ease, outline-width .15s ease;
}
.cpp-buybox .cpp-swatch:hover { outline-color: var(--cpp-ink); }
.cpp-buybox .cpp-swatch.is-selected { outline: 2px solid var(--cpp-ink); }
.cpp-buybox .cpp-swatch.is-unavailable { opacity: .3; cursor: not-allowed; }

/* Quantity + wishlist row */
.cpp-buybox .cpp-quantity-block { margin-bottom: 25px; }
.cpp-buybox .cpp-quantity-row {
	display: flex !important;
	align-items: center;
	flex-wrap: wrap;
	gap: 20px;
}

/* The +/- are plain glyphs with no box; only the number sits in a soft rounded field. */
.cpp-buybox .cpp-quantity {
	display: inline-flex !important;
	align-items: center;
	gap: 22px;
	padding: 1px 12px;
	background: #fff;
	border-radius: 50px;
}
.cpp-buybox .cpp-qty-btn {
	width: 24px;
	height: 24px;
	min-width: 0 !important;
	border: 0 !important;
	background: none !important;
	box-shadow: none !important;
	padding: 0 !important;
	margin: 0;
	font-size: 24px !important;
	font-weight: 400 !important;
	font-family: inherit !important;
	line-height: 1 !important;
	color: var(--cpp-ink) !important;
	cursor: pointer;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
}
.cpp-buybox .cpp-qty-btn:disabled { opacity: .3; cursor: not-allowed; }
.cpp-buybox .cpp-qty-input {
	width: 64px !important;
	height: 52px !important;
	border: 0 !important;
	background: var(--cpp-bg-soft) !important;
	box-shadow: none !important;
	text-align: center !important;
	font-size: 16px !important;
	font-weight: 500 !important;
	font-family: inherit !important;
	color: var(--cpp-ink) !important;
	-moz-appearance: textfield;
}
.cpp-buybox .cpp-qty-input::-webkit-outer-spin-button,
.cpp-buybox .cpp-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.cpp-buybox .cpp-wishlist {
	display: inline-flex !important;
	align-items: center;
	gap: 12px;
	border: 0 !important;
	box-shadow: none !important;
	margin: 0;
	color: var(--cpp-muted) !important;
	font-size: 16px !important;
	font-weight: 500 !important;
	font-family: inherit !important;
	letter-spacing: 0 !important;
	text-transform: uppercase !important;
	cursor: pointer;
	height: 45px;
	background: #fff;
	padding: 0 20px;
	border-radius: 50px;
}
.cpp-buybox .cpp-wishlist__icon { width: 24px; height: 24px; flex: none; transition: fill .15s ease, color .15s ease; }
.cpp-buybox .cpp-wishlist:hover { color: var(--cpp-ink) !important; }
.cpp-buybox .cpp-wishlist.is-active {
	background-color: #000 !important;
	color: #fff !important;
}
.cpp-buybox .cpp-wishlist.is-active svg path { fill: #fff !important; }
.cpp-buybox .cpp-wishlist.is-active .cpp-wishlist__icon { fill: var(--cpp-danger); stroke: var(--cpp-danger); }

/* Wishlist hover — dark pill, white icon/label */
.cpp-wishlist:hover { background-color: #000 !important; }
.cpp-wishlist:hover svg,
.cpp-wishlist:hover svg path,
.cpp-wishlist:hover .cpp-wishlist__label {
	fill: #fff !important;
	color: #fff !important;
}

/* Elementor/theme native variation-swatch hover fix (Size L/S example markup). */
.variable-item.button-variable-item-l:hover,
.variable-item.button-variable-item-s:hover,
.variable-item.button-variable-item-l:hover .variable-item-contents,
.variable-item.button-variable-item-l:hover .variable-item-span,
.variable-item.button-variable-item-s:hover .variable-item-contents,
.variable-item.button-variable-item-s:hover .variable-item-span {
	background-color: #000 !important;
	color: #fff !important;
}

/* Add to Cart / Checkout — same pill shape and size; Add to Cart is white with a black
   hover, Checkout is solid black. */
.cpp-buybox .cpp-actions { display: flex !important; align-items: center; justify-content: space-between; gap: 24px; }

.cpp-buybox .cpp-btn {
	position: relative;
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	border: 0 !important;
	box-shadow: none !important;
	color: var(--cpp-ink) !important;
	font-size: 17px !important;
	font-weight: 500 !important;
	font-family: inherit !important;
	text-transform: uppercase !important;
	letter-spacing: .02em !important;
	cursor: pointer;
	background-color: #fff;
	transition: opacity .15s ease;
	flex: 1;
	border-radius: var(--cpp-radius-pill) !important;
	padding: 15px 32px !important;
}
.cpp-btn.cpp-add-to-cart:hover {
	background-color: #000000 !important;
	color: #fff !important;
}
.cpp-buybox .cpp-btn--dark {
	justify-content: space-between;
	background: #000000 !important;
	color: #fff !important;
	font-weight: 500 !important;
}
.cpp-buybox .cpp-btn--dark:hover:not(:disabled) { opacity: .85; background: var(--cpp-ink) !important; color: #fff !important; }
.cpp-buybox .cpp-btn:disabled { opacity: .4; cursor: not-allowed; }
.cpp-buybox .cpp-btn.is-loading .cpp-btn__label,
.cpp-buybox .cpp-btn.is-loading .cpp-btn__arrow { visibility: hidden; }
.cpp-buybox .cpp-btn__arrow { font-weight: 300; transition: transform .15s ease; }
.cpp-buybox .cpp-btn:hover:not(:disabled) .cpp-btn__arrow { transform: translateX(3px); }

.cpp-buybox .cpp-spinner {
	display: none;
	position: absolute;
	width: 16px;
	height: 16px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: cpp-spin .6s linear infinite;
}
.cpp-buybox .cpp-btn.is-loading .cpp-spinner { display: inline-block; }
@keyframes cpp-spin { to { transform: rotate(360deg); } }

.cpp-buybox .cpp-form-message {
	margin: 14px 0 0;
	padding: 10px 14px;
	border-radius: 6px;
	font-size: 13px;
	display: none;
}
.cpp-form-message.is-visible { display: block; }
.cpp-form-message.is-error { background: #fdeceb; color: var(--cpp-danger); }
.cpp-form-message.is-success { background: #eaf7ef; color: #1F6F4F; }

/* ---------------------------------------------------------------- Toasts */
.cpp-toasts {
	position: fixed;
	top: 20px;
	right: 20px;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	gap: 10px;
	pointer-events: none;
}
.cpp-toast {
	min-width: 240px;
	max-width: 320px;
	padding: 12px 16px;
	border-radius: 8px;
	background: var(--cpp-ink);
	color: #fff;
	font-size: 13px;
	box-shadow: 0 10px 30px rgba(0,0,0,.18);
	opacity: 0;
	transform: translateY(-8px);
	transition: opacity .2s ease, transform .2s ease;
}
.cpp-toast.is-visible { opacity: 1; transform: translateY(0); }
.cpp-toast.is-error { background: var(--cpp-danger); }

/* ---------------------------------------------------------------- Viewer popup */
.cpp-viewer-popup {
	position: fixed;
	left: 20px;
	bottom: 20px;
	z-index: 9999;
	display: flex;
	align-items: center;
	gap: 12px;
	max-width: 320px;
	padding: 12px 34px 12px 12px;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 12px 32px rgba(0,0,0,.16);
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px);
	transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
.cpp-viewer-popup.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.cpp-viewer-popup__thumb {
	width: 44px;
	height: 44px;
	flex: none;
	border-radius: 6px;
	overflow: hidden;
	background: var(--cpp-bg-soft);
}
.cpp-viewer-popup__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cpp-viewer-popup__text { font-size: 13px; line-height: 1.4; color: var(--cpp-ink); }
.cpp-viewer-popup__count { font-weight: 700; }
.cpp-viewer-popup__close {
	position: absolute;
	top: 6px;
	right: 8px;
	width: 22px;
	height: 22px;
	border: 0;
	background: none;
	color: var(--cpp-muted);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}
.cpp-viewer-popup__close:hover { color: var(--cpp-ink); }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 781px) {
	.cpp-buybox { max-width: 100%; }
	.cpp-buybox .cpp-actions { flex-direction: column; align-items: stretch; gap: 15px; }
	.cpp-buybox .cpp-btn--dark { width: 100% !important; }

	.cpp-viewer-popup {
		left: 12px;
		right: 12px;
		bottom: 12px;
		max-width: none;
	}
}
