/**
 * PixelBorsch Core - Category Bar & Mobile Swiper Styles
 * Elegant horizontal categories navigation with touch swipe, edge gradients, and scroll hints.
 *
 * @package PixelBorsch_Core
 */

:root {
	--pb-catbar-gap: 20px;
	--pb-catbar-img-size: 72px;
	--pb-catbar-font-size: 13.5px;
	--pb-catbar-text-color: #0f172a;
	--pb-catbar-text-hover: #c5a059;
	--pb-catbar-accent: #c5a059;
	--pb-catbar-bg: transparent;
	--pb-catbar-item-bg: transparent;
	--pb-catbar-item-pad: 8px;
	--pb-catbar-radius: 12px;
	--pb-catbar-transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─────────────────────────────────────────────────────────────
   1. MAIN CONTAINER & TRACK
   ───────────────────────────────────────────────────────────── */
.pb-category-bar-wrapper {
	position: relative;
	width: 100%;
	margin: 0 auto;
	box-sizing: border-box;
	clear: both;
	contain: layout style;
}

/* Scroll Container */
.pb-category-bar-scroll {
	position: relative;
	width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-x: contain;
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* IE 10+ */
	scroll-behavior: smooth;
	padding: 5px;
	box-sizing: border-box;
	transform: translateZ(0);
}

.pb-category-bar-scroll::-webkit-scrollbar {
	display: none; /* Chrome, Safari */
}

/* Track list */
.pb-category-bar-track {
	display: flex;
	align-items: flex-start;
	justify-content: center;
	gap: var(--pb-catbar-gap);
	margin: 0;
	padding: 0;
	list-style: none;
	width: max-content;
	min-width: 100%;
}

/* Specific alignment modifier classes */
.pb-category-bar--align-center .pb-category-bar-track {
	justify-content: center;
}

.pb-category-bar--align-left .pb-category-bar-track {
	justify-content: flex-start;
}

.pb-category-bar--align-right .pb-category-bar-track {
	justify-content: flex-end;
}

/* ─────────────────────────────────────────────────────────────
   2. CATEGORY ITEM
   ───────────────────────────────────────────────────────────── */
.pb-category-bar-item {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	box-sizing: border-box;
	position: relative;
	scroll-snap-align: start;
	width: 96px;
	max-width: 110px;
}

.pb-category-bar-link {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-decoration: none;
	color: var(--pb-catbar-text-color);
	width: 100%;
	padding: var(--pb-catbar-item-pad);
	border-radius: var(--pb-catbar-radius);
	background-color: var(--pb-catbar-item-bg);
	transition: var(--pb-catbar-transition);
	position: relative;
	outline: none;
}

.pb-category-bar-link:hover {
	color: var(--pb-catbar-text-hover);
	transform: translateY(-3px);
}

.pb-category-bar-link:hover .pb-catbar-img-wrap {
	transform: scale(1.08);
}

/* Active Category State - Clean & Elegant, No Heavy Shadows or Glow */
.pb-category-bar-item.is-active .pb-category-bar-link,
.pb-category-bar-link.is-active {
	color: var(--pb-catbar-accent);
	font-weight: 700;
}

.pb-category-bar-item.is-active .pb-catbar-title,
.pb-category-bar-link.is-active .pb-catbar-title {
	color: var(--pb-catbar-accent);
	font-weight: 700;
}

.pb-category-bar-item.is-active .pb-catbar-img-wrap,
.pb-category-bar-link.is-active .pb-catbar-img-wrap {
	transform: none;
}

.pb-category-bar-item.is-active .pb-catbar-img,
.pb-category-bar-link.is-active .pb-catbar-img {
	filter: none;
}

/* Image / Icon Wrap */
.pb-catbar-img-wrap {
	width: var(--pb-catbar-img-size);
	height: var(--pb-catbar-img-size);
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 8px;
	position: relative;
	transition: var(--pb-catbar-transition);
	flex-shrink: 0;
}

/* Product Cutout / Icon Images */
.pb-catbar-img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
	filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.08));
	transition: var(--pb-catbar-transition);
}

.pb-category-bar-link:hover .pb-catbar-img {
	filter: drop-shadow(0 6px 10px rgba(197, 160, 89, 0.25));
}

/* Vector Icon fallback */
.pb-catbar-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	font-size: calc(var(--pb-catbar-img-size) * 0.55);
	color: var(--pb-catbar-accent);
	transition: var(--pb-catbar-transition);
}

.pb-catbar-icon svg {
	width: 60%;
	height: 60%;
	fill: currentColor;
}

/* Circle background styling option */
.pb-category-bar--style-circles .pb-catbar-img-wrap {
	background: #ffffff;
	border-radius: 50%;
	padding: 8px;
	border: 1.5px solid #e8e2d5;
	box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.pb-category-bar--style-circles .pb-category-bar-link:hover .pb-catbar-img-wrap {
	border-color: var(--pb-catbar-accent);
	box-shadow: 0 6px 18px rgba(197, 160, 89, 0.25);
	transform: scale(1.08) translateY(-2px);
}

.pb-category-bar--style-circles .pb-category-bar-item.is-active .pb-catbar-img-wrap,
.pb-category-bar--style-circles .pb-category-bar-link.is-active .pb-catbar-img-wrap {
	border-color: var(--pb-catbar-accent);
	border-width: 2px;
	box-shadow: none;
	transform: none;
}

/* Preset: Compact Glass / Pill Style */
.pb-category-bar--style-compact .pb-category-bar-item {
	width: auto;
	max-width: none;
}

.pb-category-bar--style-compact .pb-category-bar-link {
	flex-direction: row;
	align-items: center;
	gap: 10px;
	background: #ffffff;
	border: 1px solid #e8e2d5;
	padding: 6px 16px 6px 8px;
	border-radius: 999px;
	box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.pb-category-bar--style-compact .pb-catbar-img-wrap {
	width: 38px;
	height: 38px;
	margin-bottom: 0;
	background: #fdfbf7;
	border-radius: 50%;
	padding: 4px;
}

.pb-category-bar--style-compact .pb-catbar-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.pb-category-bar--style-compact .pb-catbar-title {
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	-webkit-line-clamp: 1;
}

.pb-category-bar--style-compact .pb-category-bar-link:hover {
	background: #ffffff;
	border-color: var(--pb-catbar-accent);
	box-shadow: 0 6px 18px rgba(197, 160, 89, 0.18);
	transform: translateY(-2px);
}

.pb-category-bar--style-compact .pb-category-bar-link:hover .pb-catbar-title {
	color: var(--pb-catbar-accent);
}

.pb-category-bar--style-compact .pb-category-bar-item.is-active .pb-category-bar-link,
.pb-category-bar--style-compact .pb-category-bar-link.is-active {
	background: #0f172a;
	border-color: #0f172a;
	color: #ffffff;
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.pb-category-bar--style-compact .pb-category-bar-item.is-active .pb-catbar-title,
.pb-category-bar--style-compact .pb-category-bar-link.is-active .pb-catbar-title {
	color: #ffffff;
}

.pb-category-bar--style-compact .pb-category-bar-item.is-active .pb-catbar-img-wrap {
	background: #ffffff;
}

/* Preset: Luxury Minimal Style */
.pb-category-bar--style-luxury .pb-category-bar-link {
	padding: 6px 8px;
	background: transparent;
}

.pb-category-bar--style-luxury .pb-catbar-img-wrap {
	border-radius: 16px;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, rgba(248, 245, 238, 0.6) 100%);
	border: 1px solid rgba(197, 160, 89, 0.25);
	padding: 8px;
	backdrop-filter: blur(4px);
}

.pb-category-bar--style-luxury .pb-category-bar-link:hover .pb-catbar-img-wrap {
	border-color: var(--pb-catbar-accent);
	box-shadow: 0 8px 24px rgba(197, 160, 89, 0.22);
	background: #ffffff;
}

.pb-category-bar--style-luxury .pb-category-bar-item.is-active .pb-catbar-img-wrap,
.pb-category-bar--style-luxury .pb-category-bar-link.is-active .pb-catbar-img-wrap {
	border-color: var(--pb-catbar-accent);
	border-width: 2px;
	box-shadow: none;
	background: #ffffff;
}

.pb-category-bar--style-luxury .pb-catbar-title {
	font-weight: 600;
	letter-spacing: 0.2px;
}

/* Title */
.pb-catbar-title {
	font-size: var(--pb-catbar-font-size);
	font-weight: 600;
	line-height: 1.25;
	color: inherit;
	margin: 0;
	padding: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
	word-break: break-word;
	max-width: 100%;
	transition: color 0.2s ease;
}

/* Badge (e.g. NEW, Хіт, -15%) */
.pb-catbar-badge {
	position: absolute;
	top: 0;
	right: 4px;
	background: linear-gradient(135deg, #c5a059 0%, #d4af37 100%);
	color: #ffffff;
	font-size: 9.5px;
	font-weight: 800;
	line-height: 1;
	padding: 3px 6px;
	border-radius: 20px;
	text-transform: uppercase;
	letter-spacing: 0.3px;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
	z-index: 2;
}

/* ─────────────────────────────────────────────────────────────
   3. VISUAL SWIPE INDICATORS & EDGE FADE MASKS
   ───────────────────────────────────────────────────────────── */

/* Edge Gradient Masks (Shows there's more content to scroll) */
.pb-category-bar-wrapper.has-edge-fade::before,
.pb-category-bar-wrapper.has-edge-fade::after {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	width: 32px;
	pointer-events: none;
	z-index: 3;
	opacity: 0;
	transition: opacity 0.25s ease;
}

/* Left edge mask */
.pb-category-bar-wrapper.has-edge-fade::before {
	left: 0;
	background: linear-gradient(to right, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 100%);
}

/* Right edge mask */
.pb-category-bar-wrapper.has-edge-fade::after {
	right: 0;
	background: linear-gradient(to left, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 100%);
}

/* Dark mode edge support */
.pb-category-bar--dark.has-edge-fade::before {
	background: linear-gradient(to right, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0) 100%);
}

.pb-category-bar--dark.has-edge-fade::after {
	background: linear-gradient(to left, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0) 100%);
}

.pb-category-bar-wrapper.is-scrollable-left::before {
	opacity: 1;
}

.pb-category-bar-wrapper.is-scrollable-right::after {
	opacity: 1;
}

/* Swipe Hint Indicator (Mobile pill saying '⇄ Свайпайте') */
.pb-catbar-swipe-hint {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 6px;
	font-size: 11.5px;
	font-weight: 600;
	color: #64748b;
	margin: 6px auto 0 auto;
	text-align: center;
	opacity: 0.85;
	animation: pbSwipePulse 2.5s ease infinite;
}

.pb-catbar-swipe-hint svg {
	width: 14px;
	height: 14px;
	stroke: var(--pb-catbar-accent);
}

@keyframes pbSwipePulse {
	0%, 100% { transform: translateX(0); opacity: 0.7; }
	50% { transform: translateX(4px); opacity: 1; }
}

/* Navigation Arrow Buttons */
.pb-catbar-arrow {
	position: absolute;
	top: calc(50% - 10px);
	transform: translateY(-50%);
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	color: #0f172a;
	display: none;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 10;
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
	transition: all 0.2s ease;
	outline: none;
	padding: 0;
}

.pb-catbar-arrow:hover {
	background: #0f172a;
	color: #ffffff;
	border-color: #0f172a;
	box-shadow: 0 6px 16px rgba(15, 23, 42, 0.2);
}

.pb-catbar-arrow--prev {
	left: -12px;
}

.pb-catbar-arrow--next {
	right: -12px;
}

.pb-catbar-arrow:disabled {
	opacity: 0;
	pointer-events: none;
}

/* Show arrows on desktop if enabled */
.pb-category-bar--show-arrows .pb-catbar-arrow {
	display: flex;
}

/* Scroll Progress Line */
.pb-catbar-progress-track {
	width: 120px;
	height: 3px;
	background: #e2e8f0;
	border-radius: 4px;
	margin: 8px auto 0 auto;
	position: relative;
	overflow: hidden;
	display: none;
}

.pb-catbar-progress-thumb {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 30%;
	background: var(--pb-catbar-accent);
	border-radius: 4px;
	transition: transform 0.1s linear;
}

.pb-category-bar--show-progress .pb-catbar-progress-track {
	display: block;
}

/* Minimalist Pagination Dots for Mobile */
.pb-catbar-dots {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 5px;
	margin: 10px auto 2px auto;
	padding: 0;
}

.pb-catbar-dot {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: #cbd5e1;
	border: none;
	padding: 0;
	cursor: pointer;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	outline: none;
}

.pb-catbar-dot.is-active {
	width: 16px;
	border-radius: 999px;
	background: var(--pb-catbar-accent, #c5a059);
}

/* ─────────────────────────────────────────────────────────────
   4. RESPONSIVE & MOBILE PEEK BEHAVIOR
   ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
	.pb-catbar-arrow {
		display: none;
	}

	/* Mobile Side Arrows: Minimalist, elegant floating glass buttons */
	.pb-catbar--mobile-nav-side_arrows .pb-catbar-arrow {
		display: flex !important;
		width: 28px;
		height: 28px;
		background: rgba(255, 255, 255, 0.92);
		backdrop-filter: blur(8px);
		-webkit-backdrop-filter: blur(8px);
		border: 1px solid rgba(232, 226, 213, 0.95);
		box-shadow: 0 3px 10px rgba(15, 23, 42, 0.12);
		color: #0f172a;
		z-index: 12;
		top: calc(50% - 8px);
	}

	.pb-catbar--mobile-nav-side_arrows .pb-catbar-arrow svg {
		width: 13px;
		height: 13px;
		stroke-width: 2.5;
	}

	.pb-catbar--mobile-nav-side_arrows .pb-catbar-arrow--prev {
		left: 4px;
	}

	.pb-catbar--mobile-nav-side_arrows .pb-catbar-arrow--next {
		right: 4px;
	}

	.pb-catbar--mobile-nav-side_arrows .pb-catbar-arrow:active {
		background: #0f172a;
		color: #ffffff;
		border-color: #0f172a;
		transform: translateY(-50%) scale(0.92);
	}

	/* Minimalist Dots on Mobile */
	.pb-catbar--mobile-nav-dots .pb-catbar-dots {
		display: flex;
	}
}

@media (max-width: 767px) {
	:root {
		--pb-catbar-gap: 14px;
		--pb-catbar-img-size: 60px;
		--pb-catbar-font-size: 12px;
	}

	.pb-category-bar-wrapper.has-edge-fade::before,
	.pb-category-bar-wrapper.has-edge-fade::after {
		width: 24px;
	}

	.pb-category-bar-scroll {
		padding: 5px;
		scroll-snap-type: x mandatory;
	}

	/* Peek effect: element size allows the next item to partially peek in */
	.pb-category-bar-item {
		width: 82px;
		max-width: 86px;
	}

	.pb-catbar-title {
		font-size: 11.5px;
	}

	.has-swipe-hint .pb-catbar-swipe-hint {
		display: flex;
	}

	/* Side gutters for comfortable swiping and ensuring no edge cutoffs */
	.pb-category-bar-track {
		padding: 0 16px 0 16px;
	}
}
