/**
 * منوی چسبان پایین — موبایل
 */

.nextshop-mobile-bottom-nav {
	display: none;
}

@media (max-width: 768px) {
	body.has-mobile-bottom-nav {
		padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
	}

	.nextshop-mobile-bottom-nav {
		display: block;
		position: fixed;
		inset-inline: 0;
		bottom: 0;
		z-index: 120;
		background: #fff;
		border-top: 1px solid var(--ns-border, #e5e7eb);
		box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.06);
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}

	.nextshop-mobile-bottom-nav__list {
		display: flex;
		align-items: stretch;
		justify-content: space-around;
		margin: 0;
		padding: 0;
		list-style: none;
		min-height: 56px;
	}

	.nextshop-mobile-bottom-nav__item {
		flex: 1 1 0;
		min-width: 0;
	}

	.nextshop-mobile-bottom-nav__link {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 2px;
		min-height: 56px;
		padding: 6px 4px 4px;
		text-decoration: none;
		color: #81858b;
		transition: color 0.2s ease;
	}

	.nextshop-mobile-bottom-nav__icon {
		position: relative;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 28px;
		height: 28px;
	}

	.nextshop-mobile-bottom-nav__icon svg {
		display: block;
	}

	.nextshop-mobile-bottom-nav__logo {
		display: block;
		width: 24px;
		height: 24px;
		object-fit: contain;
	}

	.nextshop-mobile-bottom-nav__label {
		font-size: 0.68rem;
		font-weight: 500;
		line-height: 1.2;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		max-width: 100%;
	}

	.nextshop-mobile-bottom-nav__badge {
		position: absolute;
		top: -2px;
		inset-inline-start: 16px;
		min-width: 16px;
		height: 16px;
		padding: 0 4px;
		border-radius: 999px;
		background: #ef394e;
		color: #fff;
		font-size: 0.6rem;
		font-weight: 700;
		line-height: 16px;
		text-align: center;
	}

	.nextshop-mobile-bottom-nav__item.is-active .nextshop-mobile-bottom-nav__link {
		color: var(--ns-primary, #00a049);
	}

	.nextshop-mobile-bottom-nav__link--modal {
		width: 100%;
		border: none;
		background: transparent;
		font: inherit;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}
}

/* =========================================
 * مودال دسته‌بندی‌ها — تمام‌صفحه
 * ========================================= */

.nextshop-cat-modal {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	flex-direction: column;
	pointer-events: none;
}

.nextshop-cat-modal[hidden] {
	display: none !important;
}

.nextshop-cat-modal:not([hidden]) {
	pointer-events: auto;
}

.nextshop-cat-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.nextshop-cat-modal:not([hidden]) .nextshop-cat-modal__backdrop {
	opacity: 1;
}

.nextshop-cat-modal__sheet {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100dvh;
	max-height: 100dvh;
	background: #f8fafc;
	border-radius: 0;
	box-shadow: none;
	transform: translateY(100%);
	transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
	overflow: hidden;
}

.nextshop-cat-modal:not([hidden]) .nextshop-cat-modal__sheet {
	transform: translateY(0);
}

.nextshop-cat-modal__header {
	display: grid;
	grid-template-columns: 44px 1fr 44px;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1rem;
	padding-top: max(0.75rem, env(safe-area-inset-top, 0px));
	background: var(--cat-modal-header-bg, linear-gradient(135deg, #ef394e 0%, #d32f2f 100%));
	color: #fff;
	flex-shrink: 0;
}

.nextshop-cat-modal__title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 800;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nextshop-cat-modal__back,
.nextshop-cat-modal__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: -6px 0;
	border: none;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	cursor: pointer;
	transition: background 0.2s;
}

.nextshop-cat-modal__back[hidden] {
	display: none;
}

.nextshop-cat-modal__back:active,
.nextshop-cat-modal__close:active {
	background: rgba(255, 255, 255, 0.28);
}

.nextshop-cat-modal__back svg {
	transform: scaleX(-1);
}

.nextshop-cat-modal__body {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	padding: 1rem 1rem 0.5rem;
	overscroll-behavior: contain;
}

.nextshop-cat-modal__lead {
	margin: 0 0 1rem;
	font-size: 0.85rem;
	color: #64748b;
	text-align: center;
}

.nextshop-cat-modal__view {
	display: none;
}

.nextshop-cat-modal__view.is-active {
	display: block;
	animation: nextshop-cat-modal-fade 0.25s ease;
}

@keyframes nextshop-cat-modal-fade {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.nextshop-cat-modal__view-all {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	margin-bottom: 1rem;
	padding: 0.85rem 1rem;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 14px;
	box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.nextshop-cat-modal__view-all-back {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin: -0.35rem;
	padding: 0;
	border: none;
	border-radius: 10px;
	background: transparent;
	color: var(--cat-modal-accent, #ef394e);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.nextshop-cat-modal__view-all-back:active {
	background: color-mix(in srgb, var(--cat-modal-accent, #ef394e) 12%, #fff);
}

.nextshop-cat-modal__view-all-back svg {
	display: block;
	transform: scaleX(-1);
}

.nextshop-cat-modal__view-all-link {
	flex: 1;
	min-width: 0;
	color: var(--cat-modal-accent, #ef394e);
	font-weight: 700;
	font-size: 0.88rem;
	text-decoration: none;
	text-align: start;
}

.nextshop-cat-modal__view-all-link:active {
	opacity: 0.85;
}

.nextshop-cat-modal__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.65rem;
}

.nextshop-cat-modal--cols-2 .nextshop-cat-modal__grid,
.nextshop-cat-modal--cols-2 .nextshop-cat-modal__grid--sub {
	grid-template-columns: repeat(2, 1fr);
}

.nextshop-cat-modal--cols-3 .nextshop-cat-modal__grid,
.nextshop-cat-modal--cols-3 .nextshop-cat-modal__grid--sub {
	grid-template-columns: repeat(3, 1fr);
}

.nextshop-cat-modal--cols-4 .nextshop-cat-modal__grid,
.nextshop-cat-modal--cols-4 .nextshop-cat-modal__grid--sub {
	grid-template-columns: repeat(4, 1fr);
}

.nextshop-cat-modal--cols-4 .nextshop-cat-modal__card-icon {
	width: 52px;
	height: 52px;
}

.nextshop-cat-modal--cols-4 .nextshop-cat-modal__card-name {
	font-size: 0.65rem;
}

.nextshop-cat-modal__grid--sub {
	grid-template-columns: repeat(3, 1fr);
}

.nextshop-cat-modal__card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.4rem;
	padding: 0.85rem 0.5rem 0.65rem;
	background: #fff;
	border: 1px solid #e8ecf1;
	border-radius: 16px;
	text-decoration: none;
	color: #1e293b;
	cursor: pointer;
	font: inherit;
	text-align: center;
	transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
	box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
	-webkit-tap-highlight-color: transparent;
}

.nextshop-cat-modal__card:active {
	transform: scale(0.97);
	border-color: color-mix(in srgb, var(--cat-modal-accent, #ef394e) 35%, #fff);
	box-shadow: 0 4px 16px color-mix(in srgb, var(--cat-modal-accent, #ef394e) 18%, transparent);
}

.nextshop-cat-modal__card--has-children {
	padding-bottom: 1.5rem;
}

.nextshop-cat-modal__card-icon {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border: 2px solid #fff;
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.nextshop-cat-modal__card--sub .nextshop-cat-modal__card-icon {
	width: 52px;
	height: 52px;
}

.nextshop-cat-modal__card-icon img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.nextshop-cat-modal__card-name {
	font-size: 0.72rem;
	font-weight: 700;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	max-width: 100%;
}

.nextshop-cat-modal__card-count {
	font-size: 0.65rem;
	font-weight: 600;
	color: #94a3b8;
}

.nextshop-cat-modal__card-chevron {
	position: absolute;
	bottom: 6px;
	left: 50%;
	transform: translateX(-50%);
	color: #cbd5e1;
	display: flex;
}

.nextshop-cat-modal__card-chevron svg {
	transform: scaleX(-1);
}

.nextshop-cat-modal__footer {
	flex-shrink: 0;
	padding: 0.75rem 1rem;
	padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
	background: #fff;
	border-top: 1px solid #e8ecf1;
}

.nextshop-cat-modal__shop-link {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0.75rem 1rem;
	background: var(--cat-modal-footer, #1e293b);
	color: #fff !important;
	font-weight: 700;
	font-size: 0.9rem;
	text-decoration: none;
	border-radius: 12px;
	transition: background 0.2s;
}

.nextshop-cat-modal__shop-link:active {
	background: #0f172a;
}

body.nextshop-categories-modal-open {
	overflow: hidden;
}

@media (min-width: 769px) {
	.nextshop-cat-modal {
		display: none !important;
	}
}

@media (max-width: 380px) {
	.nextshop-cat-modal--cols-3 .nextshop-cat-modal__grid,
	.nextshop-cat-modal--cols-3 .nextshop-cat-modal__grid--sub,
	.nextshop-cat-modal--cols-4 .nextshop-cat-modal__grid,
	.nextshop-cat-modal--cols-4 .nextshop-cat-modal__grid--sub {
		grid-template-columns: repeat(2, 1fr);
		gap: 0.5rem;
	}

	.nextshop-cat-modal--cols-3 .nextshop-cat-modal__card-icon,
	.nextshop-cat-modal--cols-4 .nextshop-cat-modal__card-icon {
		width: 56px;
		height: 56px;
	}
}
