/* Surgemint Category Slider widget — base styles.
 *
 * Elementor Style-tab controls override these via higher-specificity
 * {{WRAPPER}} rules, compiled into real per-breakpoint media queries.
 * Several controls write CSS custom properties on the widget wrapper
 * (--surgemint-cat-*); the var() fallbacks below are the defaults used until
 * a control sets them. The media queries at the bottom are sensible mobile /
 * tablet defaults for font-size, padding and spacing — they apply until the
 * matching responsive control is customized.
 *
 * All classes are prefixed surgemint-cat-* so this file never clashes with
 * the Product List widget's styles when both are on the same page.
 */

.surgemint-cat-slider-widget {
	width: 100%;
	box-sizing: border-box;
}

.surgemint-cat-slider-widget *,
.surgemint-cat-slider-widget *::before,
.surgemint-cat-slider-widget *::after {
	box-sizing: border-box;
}

/* ---------------------------------------------------------------
 * Header row: heading top-left, View All button top-right
 * ------------------------------------------------------------- */

.surgemint-cat-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 16px;
	margin-bottom: 20px;
}

.surgemint-cat-heading {
	margin: 0;
	font-size: 24px;
	font-weight: 600;
	line-height: 1.3;
}

.surgemint-cat-view-all {
	display: inline-block;
	flex-shrink: 0;
	padding: 8px 18px;
	border-radius: 4px;
	background: var(--pbd-brand, #222222);
	color: var(--pbd-on-brand, #ffffff);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	text-decoration: none;
	transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.surgemint-cat-view-all:hover,
.surgemint-cat-view-all:focus-visible {
	background: var(--pbd-brand-dark, #000000);
	color: var(--pbd-on-brand, #ffffff);
	text-decoration: none;
}

/* ---------------------------------------------------------------
 * Slider shell
 * ------------------------------------------------------------- */

.surgemint-cat-slider-stage {
	position: relative;
}

.surgemint-cat-slider {
	position: relative;
	overflow: hidden;
	/* Vertical breathing room so card shadows aren't clipped by overflow. */
	padding: 6px 0 10px;
}

.surgemint-cat-slider .swiper-wrapper {
	display: flex;
}

.surgemint-cat-slider .swiper-slide {
	height: auto;
	flex-shrink: 0;
}

/* Pre-init sizing: until Swiper boots (or if JS fails), lay slides out
 * exactly as Swiper will, using the per-instance, per-breakpoint custom
 * properties the widget prints inline (--surgemint-cat-spv = slides per
 * view, --surgemint-cat-gap = space between). Once the JS adds
 * .surgemint-cat-slider--ready, Swiper's own inline sizes take over. */
.surgemint-cat-slider:not(.surgemint-cat-slider--ready) .swiper-slide {
	width: calc((100% - (var(--surgemint-cat-spv, 5) - 1) * var(--surgemint-cat-gap, 20px)) / var(--surgemint-cat-spv, 5));
	margin-inline-end: var(--surgemint-cat-gap, 20px);
}

/* ---------------------------------------------------------------
 * Category card
 * ------------------------------------------------------------- */

.surgemint-cat-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	color: inherit;
	text-decoration: none;
	transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

a.surgemint-cat-card:hover,
a.surgemint-cat-card:focus {
	color: inherit;
	text-decoration: none;
}

a.surgemint-cat-card:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* The shape lives on the CONTAINER (Aspect Ratio / Fixed Height controls);
 * the img just fills it. */
.surgemint-cat-thumb {
	position: relative;
	width: 100%;
	margin: 0 auto 12px;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	border-radius: 12px;
	background-color: var(--pbd-tint, #f5f5f5);
	/* Keeps overflow:hidden + border-radius clipping during transforms in Safari. */
	isolation: isolate;
}

.surgemint-cat-thumb img,
.surgemint-cat-thumb .surgemint-cat-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border: 0;
	border-radius: 0;
	object-fit: cover;
	transition:
		transform var(--surgemint-cat-transition, 400ms) ease,
		filter var(--surgemint-cat-transition, 400ms) ease;
}

.surgemint-cat-content {
	text-align: center;
}

.surgemint-cat-title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	transition: color 0.3s ease;
	overflow-wrap: anywhere;
}

.surgemint-cat-count {
	display: block;
	margin-top: 4px;
	font-size: 13px;
	line-height: 1.4;
	color: var(--pbd-muted, #8a8a8a);
	transition: color 0.3s ease;
}

/* ---------------------------------------------------------------
 * Image hover effects (class added by the Hover Effect control's
 * prefix_class on the Elementor widget wrapper)
 * ------------------------------------------------------------- */

/* Zoom */
.surgemint-cat-hover-zoom .surgemint-cat-card:hover .surgemint-cat-thumb img,
.surgemint-cat-hover-zoom .surgemint-cat-card:focus-visible .surgemint-cat-thumb img {
	transform: scale(var(--surgemint-cat-zoom, 1.08));
}

/* Darken overlay */
.surgemint-cat-hover-darken .surgemint-cat-thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.35);
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--surgemint-cat-transition, 400ms) ease;
}

.surgemint-cat-hover-darken .surgemint-cat-card:hover .surgemint-cat-thumb::after,
.surgemint-cat-hover-darken .surgemint-cat-card:focus-visible .surgemint-cat-thumb::after {
	opacity: 1;
}

/* Grayscale → color */
.surgemint-cat-hover-grayscale .surgemint-cat-thumb img {
	filter: grayscale(100%);
}

.surgemint-cat-hover-grayscale .surgemint-cat-card:hover .surgemint-cat-thumb img,
.surgemint-cat-hover-grayscale .surgemint-cat-card:focus-visible .surgemint-cat-thumb img {
	filter: grayscale(0);
}

@media (prefers-reduced-motion: reduce) {
	.surgemint-cat-thumb img,
	.surgemint-cat-thumb::after {
		transition: none !important;
	}
}

/* ---------------------------------------------------------------
 * Navigation arrows
 *
 * Positioned with logical properties (inset-inline-start/end), so in
 * Right-to-Left mode — dir="rtl" on .surgemint-cat-slider-body — "prev"
 * automatically moves to the right side and "next" to the left, matching
 * Swiper's RTL slide order.
 * ------------------------------------------------------------- */

/* <button> carries theme/browser styles that <a>/<div> don't — neutralize
 * them so the arrow renders identically under any theme. */
.surgemint-cat-slider-widget .surgemint-cat-arrow {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	position: absolute;
	top: var(--surgemint-cat-arrow-top, 40%);
	z-index: 3;
	display: var(--surgemint-cat-arrow-display, flex);
	align-items: center;
	justify-content: center;
	width: var(--surgemint-cat-arrow-size, 40px);
	height: var(--surgemint-cat-arrow-size, 40px);
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	transform: translateY(-50%);
	border: 0;
	border-radius: 50%;
	background-color: #ffffff;
	color: var(--pbd-ink, #111111);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
	font-size: 0;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}

.surgemint-cat-slider-widget .surgemint-cat-arrow:hover,
.surgemint-cat-slider-widget .surgemint-cat-arrow:focus-visible {
	background-color: var(--pbd-brand, #111111);
	color: var(--pbd-on-brand, #ffffff);
}

.surgemint-cat-slider-widget .surgemint-cat-arrow:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.surgemint-cat-arrow svg {
	display: block;
	width: var(--surgemint-cat-arrow-icon, 18px);
	height: var(--surgemint-cat-arrow-icon, 18px);
	pointer-events: none;
}

/* Chevrons point the right way in RTL too. */
[dir="rtl"] .surgemint-cat-arrow svg {
	transform: scaleX(-1);
}

/* Inside: arrows float over the slides, offset from the edge. */
.surgemint-cat-arrow--prev {
	inset-inline-start: var(--surgemint-cat-arrow-offset, 10px);
}

.surgemint-cat-arrow--next {
	inset-inline-end: var(--surgemint-cat-arrow-offset, 10px);
}

/* Outside: the stage reserves side room for the arrows so they sit beside
 * the slides without overlapping them or overflowing the page. The room
 * collapses to 0 on devices where arrows are hidden via "Visibility". */
.surgemint-cat-arrows-outside .surgemint-cat-slider-stage.has-arrows {
	padding-inline: calc((var(--surgemint-cat-arrow-size, 40px) + var(--surgemint-cat-arrow-offset, 10px)) * var(--surgemint-cat-arrow-space, 1));
}

.surgemint-cat-arrows-outside .surgemint-cat-arrow--prev {
	inset-inline-start: 0;
}

.surgemint-cat-arrows-outside .surgemint-cat-arrow--next {
	inset-inline-end: 0;
}

/* Swiper state classes: at the start/end of a non-looping slider, and when
 * all slides already fit (watchOverflow). The lock rule needs !important to
 * beat the display value the responsive "Visibility" controls emit. */
.surgemint-cat-slider-widget .surgemint-cat-arrow.swiper-button-disabled {
	opacity: 0.35;
	cursor: default;
	pointer-events: none;
}

.surgemint-cat-slider-widget .surgemint-cat-arrow.swiper-button-lock,
.surgemint-cat-slider-widget .surgemint-cat-pagination.swiper-pagination-lock {
	display: none !important;
}

/* ---------------------------------------------------------------
 * Pagination dots (rendered below the stage, in normal flow — not
 * absolutely positioned over the slides)
 * ------------------------------------------------------------- */

.surgemint-cat-slider-widget .surgemint-cat-pagination {
	position: static;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	margin-top: 16px;
	transform: none;
}

/* Spacing comes from the flex gap above, so zero Swiper's own margins
 * (specificity high enough to beat swiper-bundle.css in any load order). */
.surgemint-cat-slider-widget .surgemint-cat-pagination.swiper-pagination-bullets .swiper-pagination-bullet {
	margin: 0;
}

.surgemint-cat-pagination .swiper-pagination-bullet {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 999px;
	background-color: #d0d0d0;
	opacity: 1;
	cursor: pointer;
	transition: background-color 0.25s ease, width 0.25s ease;
}

.surgemint-cat-pagination .swiper-pagination-bullet-active {
	background-color: var(--pbd-brand, #111111);
}

/* ---------------------------------------------------------------
 * Empty state
 * ------------------------------------------------------------- */

.surgemint-cat-empty {
	color: var(--pbd-muted, #777777);
	font-style: italic;
}

/* ---------------------------------------------------------------
 * Responsive defaults (Elementor's default tablet/mobile breakpoints).
 * Style-tab controls override every one of these per device.
 * ------------------------------------------------------------- */

@media (max-width: 1024px) {
	.surgemint-cat-header {
		margin-bottom: 16px;
	}

	.surgemint-cat-heading {
		font-size: 21px;
	}

	.surgemint-cat-thumb {
		margin-bottom: 10px;
	}

	.surgemint-cat-title {
		font-size: 15px;
	}

	.surgemint-cat-count {
		font-size: 12px;
	}
}

@media (max-width: 767px) {
	.surgemint-cat-header {
		margin-bottom: 12px;
		gap: 8px 12px;
	}

	.surgemint-cat-heading {
		font-size: 18px;
	}

	.surgemint-cat-view-all {
		padding: 6px 14px;
		font-size: 13px;
	}

	.surgemint-cat-slider {
		padding: 4px 0 8px;
	}

	.surgemint-cat-thumb {
		margin-bottom: 8px;
		border-radius: 10px;
	}

	.surgemint-cat-title {
		font-size: 14px;
	}

	.surgemint-cat-count {
		margin-top: 2px;
		font-size: 12px;
	}

	.surgemint-cat-slider-widget .surgemint-cat-pagination {
		margin-top: 12px;
		gap: 6px;
	}
}
