/* ---------------------------------------------------------------
   Selene Loop Plus
   Slider + quick add for every WooCommerce product loop
--------------------------------------------------------------- */

:root {
	/* Height of every slide, as a % of its width. 100% = square. */
	--slp-ratio: 100%;
}

/* Media / slider ---------------------------------------------- */

.slp-media {
	position: relative;
	overflow: hidden;
	direction: ltr; /* keeps translateX maths sane inside RTL pages */
	touch-action: pan-y;
	user-select: none;
	-webkit-user-select: none;
	-webkit-touch-callout: none;
	-webkit-tap-highlight-color: transparent;
	background: transparent;
	border-radius: inherit;
}

.slp-media--multi {
	cursor: grab;
}

.slp-media--multi.is-dragging {
	cursor: grabbing;
}

.slp-track {
	display: flex;
	align-items: stretch;
	width: 100%;
	transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Every slide is the same box, so mixed image ratios can't leave a
   strip of empty background under the picture. */
.slp-slide {
	position: relative;
	flex: 0 0 100%;
	width: 100%;
	padding-top: var(--slp-ratio);
	overflow: hidden;
}

.slp-slide img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	pointer-events: none;
	-webkit-user-drag: none;
	user-drag: none;
}

/* Dots -------------------------------------------------------- */

.slp-dots {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 10px;
	z-index: 3;
	display: flex;
	justify-content: center;
	gap: 6px;
	background: none;
}

.slp-dot {
	display: block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.22);
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
}

.slp-dot.is-active {
	background: #1a1a1a;
	transform: scale(1.2);
}

/* Quick add "+" ------------------------------------------------ */

ul.products li.product,
.products .product {
	position: relative;
}

/* Neutralise theme button/link styling on our controls. */
.slp-media .slp-add,
li.product .slp-add,
.slp-modal .slp-opt,
.slp-modal .slp-cta,
.slp-modal .slp-modal__close {
	box-sizing: border-box;
	margin: 0;
	text-transform: none;
	letter-spacing: normal;
	text-decoration: none;
	box-shadow: none;
	min-width: 0;
	min-height: 0;
	width: auto;
	height: auto;
}

.slp-add {
	position: absolute;
	right: 14px;
	bottom: 14px;
	z-index: 4;
	padding: 0;
	border: 0;
	appearance: none;
	-webkit-appearance: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.94);
	color: #1a1a1a;
	box-shadow: 0 1px 5px rgba(0, 0, 0, 0.18);
	cursor: pointer;
	transition: transform 0.18s ease, background 0.18s ease;
}

li.product .slp-add,
.products .product .slp-add {
	width: 34px;
	height: 34px;
	background: rgba(255, 255, 255, 0.94);
	color: #1a1a1a;
	border: 0;
	border-radius: 50%;
	box-shadow: 0 1px 5px rgba(0, 0, 0, 0.18);
}

.slp-add:hover,
.slp-add:focus-visible {
	background: #fff;
	transform: scale(1.08);
	outline: none;
}

.slp-add:focus-visible {
	box-shadow: 0 0 0 2px #1a1a1a;
}

.slp-add svg {
	display: block;
	width: 16px;
	height: 16px;
}

.slp-add.is-loading {
	pointer-events: none;
}

.slp-add.is-loading svg,
.slp-add.is-added svg {
	opacity: 0;
}

.slp-add.is-loading::after {
	content: "";
	position: absolute;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(0, 0, 0, 0.18);
	border-top-color: #1a1a1a;
	border-radius: 50%;
	animation: slp-spin 0.7s linear infinite;
}

.slp-add.is-added {
	background: #1a1a1a;
	color: #fff;
}

.slp-add.is-added::after {
	content: "✓";
	position: absolute;
	font-size: 15px;
	line-height: 1;
}

@keyframes slp-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Hide the default loop buttons. They stay in the DOM on purpose —
   themes and add-ons look them up and break on a missing element. */

ul.products li.product .woocommerce-loop-product__buttons,
ul.products li.product .add_to_cart_button,
ul.products li.product .added_to_cart,
ul.products li.product .product_type_simple,
ul.products li.product .product_type_variable,
ul.products li.product .product_type_grouped,
ul.products li.product .product_type_external,
.products .product .woocommerce-loop-product__buttons {
	display: none !important;
}

/* Popup -------------------------------------------------------- */

.slp-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.slp-modal.is-open {
	opacity: 1;
	visibility: visible;
}

.slp-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
}

.slp-modal__box {
	position: relative;
	display: flex;
	gap: 18px;
	width: 100%;
	max-width: 560px;
	max-height: 86vh;
	overflow: auto;
	padding: 20px;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
	transform: translateY(14px);
	transition: transform 0.25s ease;
}

.slp-modal.is-open .slp-modal__box {
	transform: none;
}

.slp-modal__body {
	display: flex;
	gap: 18px;
	width: 100%;
}

.slp-modal__img {
	flex: 0 0 150px;
	width: 150px;
	height: 150px;
	object-fit: cover;
	border-radius: 8px;
	background: #f4f4f4;
}

.slp-modal__info {
	flex: 1;
	min-width: 0;
}

.slp-modal__title {
	margin: 0 0 6px;
	font-size: 16px;
	line-height: 1.35;
}

.slp-modal__price {
	margin: 0 0 16px;
	font-size: 15px;
}

.slp-modal__price del {
	opacity: 0.5;
	margin-inline-end: 6px;
}

.slp-attr {
	margin-bottom: 14px;
}

.slp-attr__label {
	display: block;
	margin-bottom: 7px;
	font-size: 13px;
	opacity: 0.65;
}

.slp-opts {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.slp-modal .slp-opt {
	display: inline-block;
	padding: 7px 14px;
	border: 1px solid #d9d9d9;
	border-radius: 999px;
	background: #fff;
	color: inherit;
	font: inherit;
	font-size: 13px;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.slp-modal .slp-opt:hover {
	border-color: #1a1a1a;
}

.slp-modal .slp-opt.is-active {
	background: #1a1a1a;
	border-color: #1a1a1a;
	color: #fff;
}

.slp-modal .slp-opt.is-disabled {
	opacity: 0.35;
	cursor: not-allowed;
	text-decoration: line-through;
}

.slp-modal .slp-cta {
	display: block;
	width: 100%;
	margin-top: 4px;
	padding: 12px 18px;
	border: 0;
	border-radius: 999px;
	background: #1a1a1a;
	color: #fff;
	font: inherit;
	font-size: 14px;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.slp-modal .slp-cta.is-disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.slp-modal .slp-cta.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

.slp-modal__msg {
	min-height: 20px;
	margin-bottom: 10px;
	font-size: 13px;
}

.slp-modal__msg.is-ok {
	color: #1a7f37;
}

.slp-modal__msg.is-err {
	color: #b42318;
}

.slp-modal__link {
	display: inline-block;
	margin-top: 10px;
	font-size: 13px;
	opacity: 0.6;
}

.slp-modal .slp-modal__close {
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	top: 8px;
	inset-inline-end: 10px;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	z-index: 2;
}

.slp-modal .slp-modal__close:hover {
	background: rgba(0, 0, 0, 0.06);
}

.slp-modal__spinner {
	margin: 30px auto;
	width: 22px;
	height: 22px;
	border: 2px solid rgba(0, 0, 0, 0.15);
	border-top-color: #1a1a1a;
	border-radius: 50%;
	animation: slp-spin 0.7s linear infinite;
}

/* Toast -------------------------------------------------------- */

.slp-toast {
	position: fixed;
	left: 50%;
	bottom: 26px;
	z-index: 1000000;
	transform: translate(-50%, 12px);
	padding: 10px 18px;
	border-radius: 999px;
	background: #1a1a1a;
	color: #fff;
	font-size: 13px;
	opacity: 0;
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
}

.slp-toast.is-open {
	opacity: 1;
	transform: translate(-50%, 0);
}

@media (max-width: 520px) {
	.slp-modal__body {
		flex-direction: column;
		gap: 14px;
	}

	.slp-modal__img {
		flex: none;
		width: 100%;
		height: 190px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.slp-track,
	.slp-modal,
	.slp-modal__box,
	.slp-add,
	.slp-toast {
		transition: none !important;
	}
}
