/**
 * NexaShop Shop Toolbar Widget Styles
 */

.nexashop-toolbar-wrap {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 14px;
	padding: 12px 18px;
	background: var(--nexashop-shop-toolbar-bg, #ffffff);
	border: 1px solid #f0f0f1;
	border-radius: 12px;
	font-family: inherit;
	direction: rtl;
	box-sizing: border-box;
	margin-bottom: 20px;
}

.nexashop-toolbar-right {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 1 1 auto;
	min-width: 0;
}

.nexashop-toolbar-label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 700;
	color: #424750;
	white-space: nowrap;
	flex-shrink: 0;
}

.nexashop-toolbar-label svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

/* Tabs list */
.nexashop-sort-tabs {
	display: flex;
	align-items: center;
	gap: 6px;
	list-style: none;
	margin: 0;
	padding: 0;
	overflow-x: auto;
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* IE/Edge */
	white-space: nowrap;
	-webkit-overflow-scrolling: touch;
}

.nexashop-sort-tabs::-webkit-scrollbar {
	display: none; /* Chrome/Safari */
}

.nexashop-sort-tab-item {
	display: inline-block;
	margin: 0;
	padding: 0;
}

.nexashop-sort-tab-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 6px 14px;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 8px;
	color: #62666d;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	outline: none;
	white-space: nowrap;
	font-family: inherit;
	user-select: none;
	gap: 6px;
}

.nexashop-sort-tab-btn:hover {
	color: var(--nexashop-shop-toolbar-active-color, #ef394e);
	background: rgba(239, 57, 78, 0.04);
}

.nexashop-sort-tab-btn.is-active {
	color: var(--nexashop-shop-toolbar-active-color, #ef394e);
	background: rgba(239, 57, 78, 0.08);
	font-weight: 700;
	border-color: rgba(239, 57, 78, 0.15);
}

.nexashop-tab-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	line-height: 1;
}

.nexashop-tab-icon svg {
	width: 13px;
	height: 13px;
	fill: currentColor;
}

/* Left side elements: count & optional quick switch */
.nexashop-toolbar-left {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-shrink: 0;
}

.nexashop-toolbar-count {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 600;
	color: #81858b;
	background: #f7f7f8;
	padding: 6px 12px;
	border: 1px solid transparent;
	border-radius: 8px;
	white-space: nowrap;
	transition: all 0.2s ease;
}

.nexashop-count-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	line-height: 1;
}

.nexashop-count-icon svg {
	width: 13px;
	height: 13px;
	fill: currentColor;
}

.nexashop-toolbar-count .nexashop-count-number {
	color: var(--nexashop-shop-toolbar-count-color, #19bfd3);
	font-weight: 700;
}

/* Quick In-Stock Switch inside Toolbar */
.nexashop-toolbar-instock-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	user-select: none;
	font-size: 13px;
	font-weight: 600;
	color: #424750;
	margin: 0;
}

.nexashop-toolbar-instock-toggle input {
	display: none;
}

.nexashop-toolbar-instock-slider {
	width: 38px;
	height: 22px;
	background-color: #e0e0e2;
	border-radius: 20px;
	position: relative;
	transition: background-color 0.25s ease;
	display: inline-block;
}

.nexashop-toolbar-instock-slider::before {
	content: '';
	position: absolute;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background-color: #ffffff;
	top: 3px;
	right: 3px;
	transition: transform 0.25s ease;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.nexashop-toolbar-instock-toggle input:checked + .nexashop-toolbar-instock-slider {
	background-color: #029a59;
}

.nexashop-toolbar-instock-toggle input:checked + .nexashop-toolbar-instock-slider::before {
	transform: translateX(-16px);
}

/* ============================================================
   Mobile 2-Row Toolbar Card & Sort Bottom Sheet (<= 768px)
   Matches media_1790257225139.png & media_1790257271366.png
   ============================================================ */
/* Desktop Defaults */
.nexashop-toolbar-mobile-card,
.ns-mobile-sort-sheet-backdrop,
.ns-bottom-sheet-drag-bar {
	display: none;
}

body.ns-mobile-sheet-locked {
	overflow: hidden !important;
	touch-action: none;
}

@media (max-width: 768px) {
	.nexashop-toolbar-desktop-view {
		display: none !important;
	}

	.nexashop-toolbar-mobile-card {
		display: block;
		width: 100%;
		background: #ffffff;
		border: 1px solid #eef2f6;
		border-radius: 10px;
		box-shadow: 0 3px 14px rgba(15, 23, 42, 0.03);
		overflow: hidden;
		margin-bottom: 16px;
		direction: rtl;
		box-sizing: border-box;
	}

	/* Row 1: Right = Archive Title | Left = "نمایش 1 تا 20 از 28 کالا" */
	.ns-mtb-top-row {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
		padding: 14px 16px;
		border-bottom: 1px solid #f1f5f9;
	}

	.ns-mtb-archive-title {
		margin: 0 !important;
		font-size: 14px !important;
		font-weight: 800 !important;
		color: #0f172a !important;
		line-height: 1.4 !important;
	}

	.ns-mtb-result-range {
		font-size: 12.5px;
		font-weight: 500;
		color: #64748b;
		white-space: nowrap;
		flex-shrink: 0;
	}

	/* Row 2: 50/50 Split Buttons (Right = فیلتر کردن | Left = مرتب سازی) */
	.ns-mtb-actions-row {
		display: grid;
		grid-template-columns: 1fr 1fr;
		align-items: stretch;
		min-height: 50px;
	}

	.ns-mtb-action-btn {
		display: inline-flex !important;
		align-items: center !important;
		justify-content: center !important;
		gap: 10px !important;
		padding: 12px 10px !important;
		background: #ffffff !important;
		border: none !important;
		border-radius: 0 !important;
		box-shadow: none !important;
		color: #64748b !important;
		font-size: 13.5px !important;
		font-weight: 600 !important;
		font-family: inherit !important;
		cursor: pointer;
		transition: background-color 0.18s ease;
	}

	.ns-mtb-action-btn:active,
	.ns-mtb-action-btn:hover {
		background: #f8fafc !important;
	}

	.ns-mtb-btn-filter {
		border-left: 1px solid #f1f5f9 !important;
	}

	.ns-mtb-action-btn svg {
		width: 20px;
		height: 20px;
		stroke: #161e42;
		flex-shrink: 0;
	}

	/* Mobile Sort Bottom Sheet */
	.ns-mobile-sort-sheet-backdrop {
		position: fixed;
		inset: 0;
		background: rgba(15, 23, 42, 0.52);
		backdrop-filter: blur(2px);
		-webkit-backdrop-filter: blur(2px);
		z-index: 99999;
		display: block;
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.28s ease, visibility 0.28s ease;
	}

	.ns-mobile-sort-sheet-backdrop.is-open {
		opacity: 1;
		visibility: visible;
	}

	/* Draggable Drag Handle Bar */
	.ns-bottom-sheet-drag-bar {
		display: flex !important;
		align-items: center;
		justify-content: center;
		width: 100%;
		padding: 10px 0 6px 0;
		cursor: grab;
		touch-action: none;
		user-select: none;
		-webkit-user-select: none;
		-webkit-tap-highlight-color: transparent;
		flex-shrink: 0;
	}

	.ns-bottom-sheet-drag-handle {
		display: block;
		width: 38px;
		height: 4.5px;
		background-color: #cbd5e1;
		border-radius: 999px;
		transition: width 0.2s ease, background-color 0.2s ease;
	}

	.ns-bottom-sheet-drag-bar:active .ns-bottom-sheet-drag-handle,
	.ns-mobile-sort-sheet.is-sheet-dragging .ns-bottom-sheet-drag-handle {
		background-color: #94a3b8;
		width: 48px;
	}

	.ns-mobile-sort-sheet {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		max-height: 88vh;
		background: #f8fafc;
		border-radius: 28px 28px 0 0;
		padding: 2px 18px 28px;
		box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.2);
		transform: translate3d(0, 105%, 0);
		transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
		display: flex;
		flex-direction: column;
		overflow: hidden;
		will-change: transform;
		touch-action: pan-y;
	}

	/* Dragging State: Disable transition for immediate 60fps finger tracking */
	.ns-mobile-sort-sheet.is-sheet-dragging {
		transition: none !important;
	}

	/* Snap States */
	.ns-mobile-sort-sheet-backdrop.is-open .ns-mobile-sort-sheet.is-fully-open {
		transform: translate3d(0, 0, 0);
	}

	.ns-mobile-sort-sheet-backdrop.is-open .ns-mobile-sort-sheet.is-half-open {
		transform: translate3d(0, 42%, 0);
	}

	.ns-mobile-sort-sheet-backdrop.is-open .ns-mobile-sort-sheet:not(.is-half-open):not(.is-fully-open):not(.is-sheet-dragging) {
		transform: translate3d(0, 0, 0);
	}

	.ns-mss-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 16px;
		padding: 0 4px;
	}

	.ns-mss-title {
		font-size: 16.5px;
		font-weight: 800;
		color: #161e42;
	}

	.ns-mss-close {
		width: 34px !important;
		height: 34px !important;
		padding: 0 !important;
		border: none !important;
		border-radius: 10px !important;
		background: #ffffff !important;
		color: #161e42 !important;
		font-size: 20px !important;
		cursor: pointer;
		display: inline-flex !important;
		align-items: center !important;
		justify-content: center !important;
	}

	.ns-mss-options-list {
		display: flex;
		flex-direction: column;
		gap: 10px;
	}

	.ns-mss-option-card {
		width: 100%;
		display: flex !important;
		align-items: center !important;
		justify-content: space-between !important;
		padding: 15px 18px !important;
		background: #ffffff !important;
		border: 1px solid transparent !important;
		border-radius: 16px !important;
		box-shadow: 0 4px 16px rgba(15, 23, 42, 0.03) !important;
		color: #161e42 !important;
		font-size: 14px !important;
		font-weight: 700 !important;
		font-family: inherit !important;
		cursor: pointer;
		text-align: right;
		transition: all 0.2s ease;
	}

	.ns-mss-option-card .ns-mss-opt-check {
		opacity: 0;
		color: #161e42;
		display: inline-flex;
		align-items: center;
	}

	.ns-mss-option-card.is-active {
		border-color: #161e42 !important;
	}

	.ns-mss-option-card.is-active .ns-mss-opt-check {
		opacity: 1;
	}
}

