/* LillyShop — mobile category sticky bar + filter/category/sort drawers */

:root {
	--lilly-cat-bar-h: 52px;
	--lilly-cat-z-bar: 1035;
	--lilly-cat-z-overlay: 1080;
	--lilly-cat-z-drawer: 1090;
}

.lilly-cat-mobile {
	display: none;
}

@media (max-width: 767px) {
	/* —— Sticky bar (top) —— */
	.lilly-cat-mobile {
		display: block;
		margin: 0 -15px 12px;
	}

	body.lilly-cat-scroll-lock {
		overflow: hidden;
		touch-action: none;
	}

	/* Products first: subcategory chips live in Категорії drawer */
	#product-category .category-list,
	#product-category .category-list + .visible-xs {
		display: none !important;
	}

	/* Hide legacy mobile filter chip & duplicate sort select */
	.filter-default__icon,
	body.lilly-cat-mobile-ready .filter-default__icon {
		display: none !important;
	}

	body.lilly-cat-mobile-ready #product-category .sorts-block__select.visible-xs,
	body.lilly-cat-mobile-ready #product-category #input-sort {
		display: none !important;
	}

	.lilly-cat-bar-sentinel {
		display: block;
		height: 0;
		width: 100%;
		margin: 0;
		padding: 0;
		pointer-events: none;
	}

	.lilly-cat-bar-spacer {
		display: none;
		height: var(--lilly-cat-bar-h);
		pointer-events: none;
	}

	.lilly-cat-bar-spacer.is-active {
		display: block;
	}

	.lilly-cat-bar {
		position: relative;
		z-index: var(--lilly-cat-z-bar);
		display: flex;
		align-items: stretch;
		gap: 0;
		min-height: var(--lilly-cat-bar-h);
		padding: 0;
		background: #fff;
		border-bottom: 1px solid var(--lilly-border, #e6e6e6);
		box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
	}

	/* Pinned to viewport top while scrolling products */
	.lilly-cat-bar.is-pinned {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		width: 100%;
		margin: 0;
	}

	.lilly-cat-bar__btn {
		flex: 1 1 0;
		display: inline-flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
		gap: 6px;
		margin: 0;
		padding: 10px 8px;
		border: 0;
		border-right: 1px solid var(--lilly-border, #e6e6e6);
		background: transparent;
		color: var(--lilly-text, #2a2a2a);
		font-size: 13px;
		font-weight: 600;
		line-height: 1.2;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}

	.lilly-cat-bar__btn:last-child {
		border-right: 0;
	}

	.lilly-cat-bar__btn--filters {
		color: #fff;
		background: var(--lilly-accent, var(--add-to-cart-btn-bg, #f44272));
	}

	.lilly-cat-bar__btn--filters .lilly-cat-bar__icon {
		stroke: #fff;
	}

	.lilly-cat-bar__btn[hidden] {
		display: none !important;
	}

	.lilly-cat-bar__icon {
		display: block;
		flex-shrink: 0;
	}

	.lilly-cat-bar__sort-label {
		max-width: 100%;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		padding: 0 2px;
	}

	/* —— Overlay —— */
	.lilly-cat-overlay {
		position: fixed;
		inset: 0;
		z-index: var(--lilly-cat-z-overlay);
		background: rgba(0, 0, 0, 0.45);
		opacity: 0;
		transition: opacity 0.2s ease;
		pointer-events: none;
	}

	.lilly-cat-overlay.is-open {
		opacity: 1;
		pointer-events: auto;
	}

	.lilly-cat-overlay[hidden] {
		display: none !important;
	}

	/* —— Drawer (left panel) —— */
	.lilly-cat-drawer {
		position: fixed;
		inset: 0;
		z-index: var(--lilly-cat-z-drawer);
		pointer-events: none;
	}

	.lilly-cat-drawer[hidden] {
		display: none !important;
	}

	.lilly-cat-drawer.is-open {
		pointer-events: auto;
	}

	.lilly-cat-drawer__panel {
		position: absolute;
		top: 0;
		left: 0;
		display: flex;
		flex-direction: column;
		width: min(86vw, 360px);
		height: 100%;
		background: #fff;
		box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
		transform: translateX(-105%);
		transition: transform 0.22s ease;
		overflow: hidden;
	}

	.lilly-cat-drawer.is-open .lilly-cat-drawer__panel {
		transform: translateX(0);
	}

	/* Sort as bottom sheet */
	.lilly-cat-drawer--sheet .lilly-cat-drawer__panel {
		top: auto;
		bottom: 0;
		left: 0;
		right: 0;
		width: 100%;
		max-height: min(70vh, 480px);
		height: auto;
		border-radius: 16px 16px 0 0;
		transform: translateY(105%);
		box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.15);
	}

	.lilly-cat-drawer--sheet.is-open .lilly-cat-drawer__panel {
		transform: translateY(0);
	}

	.lilly-cat-screen {
		display: none;
		flex-direction: column;
		flex: 1 1 auto;
		min-height: 0;
		height: 100%;
	}

	.lilly-cat-screen.is-active {
		display: flex;
	}

	.lilly-cat-drawer__head {
		flex: 0 0 auto;
		display: flex;
		align-items: flex-start;
		gap: 8px;
		padding: 16px 16px 12px;
		border-bottom: 1px solid var(--lilly-border, #e6e6e6);
	}

	.lilly-cat-drawer__back,
	.lilly-cat-drawer__x {
		flex: 0 0 auto;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 36px;
		height: 36px;
		margin: -4px 0 0 -8px;
		padding: 0;
		border: 0;
		background: transparent;
		color: var(--lilly-text, #2a2a2a);
		font-size: 28px;
		line-height: 1;
		cursor: pointer;
	}

	.lilly-cat-drawer__x {
		margin-left: auto;
		margin-right: -4px;
		font-weight: 300;
	}

	.lilly-cat-drawer__titles {
		flex: 1 1 auto;
		min-width: 0;
	}

	.lilly-cat-drawer__title {
		margin: 0;
		font-size: 18px;
		font-weight: 700;
		line-height: 1.25;
		color: var(--lilly-text, #2a2a2a);
	}

	.lilly-cat-drawer__found {
		margin: 4px 0 0;
		font-size: 13px;
		color: var(--lilly-text-muted, #6b6b6b);
	}

	.lilly-cat-drawer__body {
		flex: 1 1 auto;
		min-height: 0;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	.lilly-cat-drawer__foot {
		flex: 0 0 auto;
		padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
		border-top: 1px solid var(--lilly-border, #e6e6e6);
		background: #fff;
	}

	.lilly-cat-drawer__foot--split {
		display: flex;
		gap: 10px;
	}

	.lilly-cat-drawer__foot--split .lilly-cat-btn {
		flex: 1 1 0;
	}

	/* Open path: ancestors → current → children */
	.lilly-cat-branch {
		list-style: none;
		margin: 0;
		padding: 8px 0 0;
	}

	.lilly-cat-branch__node {
		margin: 0;
		padding: 0;
	}

	.lilly-cat-branch__label {
		display: block;
		padding: 10px 16px;
		color: var(--lilly-text-muted, #6b6b6b);
		font-size: 13px;
		font-weight: 600;
		line-height: 1.3;
		text-decoration: none;
	}

	a.lilly-cat-branch__label:active {
		background: #f7f7f7;
	}

	.lilly-cat-branch__label.is-current {
		padding-top: 12px;
		padding-bottom: 6px;
		color: var(--lilly-text, #2a2a2a);
		font-size: 15px;
		font-weight: 700;
	}

	.lilly-cat-branch__node:not(.is-current) .lilly-cat-branch__label {
		position: relative;
		padding-left: 28px;
	}

	.lilly-cat-branch__node:not(.is-current) .lilly-cat-branch__label::before {
		content: '';
		position: absolute;
		left: 16px;
		top: 50%;
		width: 6px;
		height: 6px;
		margin-top: -4px;
		border-left: 1.5px solid #999;
		border-bottom: 1.5px solid #999;
		transform: rotate(45deg);
	}

	.lilly-cat-branch__children {
		border-top: 1px solid #f0f0f0;
	}

	/* Nav rows (filter groups / categories) */
	.lilly-cat-nav {
		list-style: none;
		margin: 0;
		padding: 0;
	}

	.lilly-cat-nav__item {
		border-bottom: 1px solid #f0f0f0;
	}

	.lilly-cat-nav__link,
	.lilly-cat-nav__btn {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		width: 100%;
		padding: 14px 16px;
		border: 0;
		background: transparent;
		color: var(--lilly-text, #2a2a2a);
		font-size: 15px;
		font-weight: 500;
		text-align: left;
		text-decoration: none;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}

	.lilly-cat-nav__link:active,
	.lilly-cat-nav__btn:active {
		background: #f7f7f7;
	}

	.lilly-cat-nav__link.is-active {
		color: var(--lilly-accent, #f44272);
		font-weight: 700;
	}

	.lilly-cat-nav__label {
		flex: 1 1 auto;
		min-width: 0;
	}

	.lilly-cat-nav__chev {
		flex: 0 0 auto;
		color: #b0b0b0;
		font-size: 22px;
		line-height: 1;
		font-weight: 300;
	}

	.lilly-cat-nav__badge {
		flex: 0 0 auto;
		min-width: 18px;
		height: 18px;
		padding: 0 5px;
		border-radius: 9px;
		background: var(--lilly-accent, #f44272);
		color: #fff;
		font-size: 11px;
		font-weight: 700;
		line-height: 18px;
		text-align: center;
	}

	/* Filter value checkboxes */
	.lilly-cat-filter-values {
		padding: 4px 0 8px;
	}

	.lilly-cat-check {
		display: flex;
		align-items: center;
		gap: 12px;
		margin: 0;
		padding: 12px 16px;
		font-size: 15px;
		font-weight: 400;
		color: var(--lilly-text, #2a2a2a);
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}

	.lilly-cat-check + .lilly-cat-check {
		border-top: 1px solid #f0f0f0;
	}

	.lilly-cat-check input {
		position: absolute;
		opacity: 0;
		pointer-events: none;
	}

	.lilly-cat-check__box {
		flex: 0 0 auto;
		width: 22px;
		height: 22px;
		border: 2px solid #c8c8c8;
		border-radius: 4px;
		background: #fff;
		position: relative;
	}

	.lilly-cat-check input:checked + .lilly-cat-check__box {
		border-color: var(--lilly-accent, #f44272);
		background: var(--lilly-accent, #f44272);
	}

	.lilly-cat-check input:checked + .lilly-cat-check__box::after {
		content: '';
		position: absolute;
		left: 6px;
		top: 2px;
		width: 6px;
		height: 11px;
		border: solid #fff;
		border-width: 0 2px 2px 0;
		transform: rotate(45deg);
	}

	.lilly-cat-check__text {
		flex: 1 1 auto;
		min-width: 0;
		line-height: 1.35;
	}

	/* Buttons */
	.lilly-cat-btn {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-height: 44px;
		padding: 10px 16px;
		border-radius: 8px;
		border: 1px solid transparent;
		font-size: 15px;
		font-weight: 600;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}

	.lilly-cat-btn--block {
		width: 100%;
	}

	.lilly-cat-btn--ghost {
		background: #fff;
		border-color: #d0d0d0;
		color: #3a7bd5;
	}

	.lilly-cat-btn--primary {
		background: var(--lilly-accent, #f44272);
		border-color: var(--lilly-accent, #f44272);
		color: #fff;
	}

	/* Sort list */
	.lilly-cat-sort-list {
		list-style: none;
		margin: 0;
		padding: 0 0 12px;
	}

	.lilly-cat-sort-list__item {
		display: block;
		padding: 14px 16px;
		border-bottom: 1px solid #f0f0f0;
		color: var(--lilly-text, #2a2a2a);
		font-size: 15px;
		font-weight: 500;
		text-decoration: none;
	}

	.lilly-cat-sort-list__item.is-active {
		color: var(--lilly-accent, #f44272);
		font-weight: 700;
	}
}

@media (min-width: 768px) {
	.lilly-cat-mobile {
		display: none !important;
	}
}
