/**
 * شبکه تأمین — Design system و کاتالوگ (RTL).
 */

:root {
	--st-font: "Vazirmatn", "Tahoma", "Segoe UI", system-ui, -apple-system, sans-serif;
	--st-bg: #f4f6f8;
	--st-surface: #ffffff;
	--st-border: #e2e8f0;
	--st-border-strong: #cbd5e1;
	--st-text: #0f172a;
	--st-muted: #64748b;
	--st-accent: #c41e3a;
	--st-accent-hover: #a01830;
	--st-accent-soft: #fef2f4;
	--st-success: #0d9488;
	--st-error: #b91c1c;
	--st-info: #1d4ed8;
	--st-radius: 14px;
	--st-radius-sm: 8px;
	--st-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
	--st-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
	--st-shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.14);
	--st-transition: 0.2s ease;
	--st-columns-effective: var(--st-columns-config, 4);
}

@media (prefers-color-scheme: dark) {
	.st-catalog-root.st-theme-auto {
		--st-bg: #0f172a;
		--st-surface: #1e293b;
		--st-border: #334155;
		--st-border-strong: #475569;
		--st-text: #f1f5f9;
		--st-muted: #94a3b8;
		--st-accent-soft: #3f1d28;
		--st-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
		--st-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
	}
}

html.st-modal-open {
	overflow: hidden;
}

.st-catalog-root {
	--st-columns-effective: min(var(--st-columns-config, 4), 4);
	direction: rtl;
	text-align: right;
	font-family: var(--st-font);
	color: var(--st-text);
	background: var(--st-bg);
	padding: 1.25rem;
	border-radius: var(--st-radius);
	box-sizing: border-box;
}

@media (min-width: 1025px) {
	.st-catalog-root {
		--st-columns-effective: var(--st-columns-config, 4);
	}
}

@media (max-width: 1024px) {
	.st-catalog-root {
		--st-columns-effective: min(var(--st-columns-config, 4), 3);
	}
}

@media (max-width: 720px) {
	.st-catalog-root {
		--st-columns-effective: min(var(--st-columns-config, 4), 2);
	}
}

@media (max-width: 420px) {
	.st-catalog-root {
		--st-columns-effective: 1;
	}
}

.st-catalog-root *,
.st-catalog-root *::before,
.st-catalog-root *::after {
	box-sizing: border-box;
}

.st-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ——— Buttons ——— */
.st-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	padding: 0.55rem 1rem;
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.3;
	border-radius: var(--st-radius-sm);
	border: 1px solid transparent;
	cursor: pointer;
	transition: background var(--st-transition), color var(--st-transition), border-color var(--st-transition), box-shadow var(--st-transition);
}

.st-btn:focus-visible {
	outline: 2px solid var(--st-accent);
	outline-offset: 2px;
}

.st-btn--primary {
	background: var(--st-accent);
	color: #fff;
	border-color: var(--st-accent);
}

.st-btn--primary:hover {
	background: var(--st-accent-hover);
	border-color: var(--st-accent-hover);
}

.st-btn--secondary {
	background: var(--st-text);
	color: #fff;
	border-color: var(--st-text);
}

.st-btn--secondary:hover {
	opacity: 0.9;
}

.st-btn--ghost {
	background: var(--st-surface);
	color: var(--st-text);
	border-color: var(--st-border);
}

.st-btn--ghost:hover {
	background: var(--st-bg);
	border-color: var(--st-border-strong);
}

.st-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* ——— Toolbar ——— */
.st-toolbar-stack {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.st-toolbar {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
	align-items: center;
}

.st-toolbar--search {
	position: relative;
	background: var(--st-surface);
	border: 1px solid var(--st-border);
	border-radius: var(--st-radius-sm);
	padding: 0.35rem 0.35rem 0.35rem 0.5rem;
	box-shadow: var(--st-shadow-sm);
}

.st-search-icon {
	display: flex;
	align-items: center;
	color: var(--st-muted);
	padding: 0 0.25rem;
	flex-shrink: 0;
}

.st-search-input {
	flex: 1 1 180px;
	min-width: 0;
	padding: 0.55rem 0.5rem;
	border: none;
	background: transparent;
	font: inherit;
	font-size: 0.95rem;
	color: var(--st-text);
}

.st-search-input:focus {
	outline: none;
}

.st-toolbar-actions {
	display: flex;
	gap: 0.5rem;
}

.st-filters-panel {
	margin-top: -0.25rem;
}

.st-filters-panel__inner {
	flex-direction: column;
	align-items: stretch;
	gap: 0.75rem;
	padding: 1rem;
	background: var(--st-surface);
	border: 1px solid var(--st-border);
	border-radius: var(--st-radius-sm);
	box-shadow: var(--st-shadow-sm);
}

.st-filter-fields {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.st-filter-label {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	font-size: 0.8rem;
	font-weight: 600;
	flex: 1 1 140px;
	min-width: 0;
	color: var(--st-muted);
}

.st-filter-province,
.st-filter-city {
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--st-border);
	border-radius: var(--st-radius-sm);
	font: inherit;
	font-size: 0.95rem;
	background: var(--st-surface);
	color: var(--st-text);
}

.st-filter-province:focus,
.st-filter-city:focus {
	border-color: var(--st-accent);
	outline: none;
	box-shadow: 0 0 0 3px var(--st-accent-soft);
}

.st-filter-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.st-active-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-bottom: 0.75rem;
}

.st-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.3rem 0.65rem;
	font-size: 0.8rem;
	font-family: inherit;
	background: var(--st-accent-soft);
	color: var(--st-accent);
	border: 1px solid transparent;
	border-radius: 999px;
	cursor: pointer;
	transition: background var(--st-transition);
}

.st-chip:hover {
	background: var(--st-accent);
	color: #fff;
}

/* ——— Status & loading ——— */
.st-catalog-root.st-is-loading .st-grid .st-card:not(.st-card--skeleton) {
	opacity: 0.6;
	pointer-events: none;
}

.st-catalog-status {
	margin-bottom: 0.75rem;
	font-size: 0.9rem;
	color: var(--st-muted);
	padding: 0.5rem 0.75rem;
	border-radius: var(--st-radius-sm);
}

.st-catalog-status.st-is-error {
	color: var(--st-error);
	background: #fef2f2;
}

.st-catalog-status.st-is-info {
	color: var(--st-info);
	background: #eff6ff;
}

/* ——— Grid & cards ——— */
.st-grid {
	display: grid;
	grid-template-columns: repeat(var(--st-columns-effective, 4), minmax(0, 1fr));
	gap: 1rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.st-card {
	background: var(--st-surface);
	border: 1px solid var(--st-border);
	border-radius: var(--st-radius);
	box-shadow: var(--st-shadow-sm);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	min-height: 100%;
	transition: transform var(--st-transition), box-shadow var(--st-transition);
}

.st-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--st-shadow);
}

.st-card-img-wrap {
	aspect-ratio: 1;
	background: var(--st-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.st-card-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: transform 0.35s ease;
}

.st-card:hover .st-card-img {
	transform: scale(1.03);
}

.st-card-img--ph {
	width: 42%;
	height: 42%;
	background: linear-gradient(135deg, var(--st-border) 0%, var(--st-border-strong) 100%);
	border-radius: var(--st-radius-sm);
}

.st-card-body {
	padding: 0.9rem 1rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	flex: 1;
}

.st-card-title {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.st-card-title-link {
	color: inherit;
	text-decoration: none;
}

.st-card-title-link:hover {
	color: var(--st-accent);
	text-decoration: underline;
}

.st-card-meta {
	font-size: 0.78rem;
	color: var(--st-muted);
}

.st-card-price {
	font-size: 1.05rem;
	font-weight: 800;
	color: var(--st-accent);
	margin-top: 0.2rem;
}

.st-card-supplier {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.8rem;
	color: var(--st-muted);
}

.st-card-supplier__avatar {
	width: 1.5rem;
	height: 1.5rem;
	border-radius: 50%;
	background: var(--st-accent-soft);
	color: var(--st-accent);
	font-size: 0.7rem;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.st-card-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-top: auto;
	padding-top: 0.6rem;
}

.st-card-actions .st-btn {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 0.8rem;
	padding: 0.45rem 0.6rem;
}

/* ——— Skeleton ——— */
.st-card--skeleton {
	pointer-events: none;
}

.st-skeleton-block,
.st-skeleton-line {
	background: linear-gradient(90deg, var(--st-border) 25%, var(--st-bg) 50%, var(--st-border) 75%);
	background-size: 200% 100%;
	animation: st-shimmer 1.2s ease-in-out infinite;
	border-radius: var(--st-radius-sm);
}

.st-skeleton-line {
	height: 0.75rem;
	margin-bottom: 0.45rem;
}

.st-skeleton-line--title {
	width: 85%;
	height: 0.9rem;
}

.st-skeleton-line--short {
	width: 55%;
}

.st-skeleton-line--price {
	width: 40%;
	height: 1rem;
}

@keyframes st-shimmer {
	0% { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* ——— Empty state ——— */
.st-empty-state {
	text-align: center;
	padding: 2.5rem 1rem;
	color: var(--st-muted);
}

.st-empty-state__icon {
	margin: 0 auto 0.75rem;
	color: var(--st-border-strong);
}

.st-empty-state__title {
	margin: 0 0 0.35rem;
	font-size: 1rem;
	font-weight: 700;
	color: var(--st-text);
}

.st-empty-state__hint {
	margin: 0;
	font-size: 0.875rem;
}

/* ——— Load more ——— */
.st-loadmore-wrap {
	margin-top: 1.25rem;
	text-align: center;
}

/* ——— Modals ——— */
.st-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.55);
	backdrop-filter: blur(4px);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	direction: rtl;
}

.st-modal {
	background: var(--st-surface);
	border-radius: var(--st-radius);
	max-width: 440px;
	width: 100%;
	max-height: 90vh;
	overflow: auto;
	padding: 1.35rem;
	position: relative;
	box-shadow: var(--st-shadow-lg);
}

.st-detail-modal {
	max-width: 540px;
}

.st-detail-title {
	padding-left: 2.25rem;
}

.st-detail-loading {
	text-align: center;
	padding: 1.5rem 0;
	color: var(--st-muted);
}

.st-detail-img-wrap {
	text-align: center;
	margin: 0 0 0.85rem;
}

.st-detail-img {
	max-width: 100%;
	max-height: 240px;
	object-fit: contain;
	border-radius: var(--st-radius-sm);
}

.st-detail-meta,
.st-detail-price,
.st-detail-supplier,
.st-detail-address,
.st-detail-phone,
.st-detail-mobile,
.st-detail-unit,
.st-detail-updated {
	font-size: 0.9rem;
	margin-bottom: 0.45rem;
	line-height: 1.5;
}

.st-detail-price {
	font-weight: 800;
	font-size: 1.15rem;
	color: var(--st-accent);
}

.st-detail-desc-wrap {
	margin-top: 0.85rem;
}

.st-detail-desc-label {
	display: block;
	margin-bottom: 0.3rem;
	font-size: 0.85rem;
	font-weight: 600;
}

.st-detail-desc {
	max-height: 220px;
	overflow: auto;
	font-size: 0.9rem;
	line-height: 1.6;
	border: 1px solid var(--st-border);
	border-radius: var(--st-radius-sm);
	padding: 0.65rem 0.8rem;
	background: var(--st-bg);
}

.st-detail-error {
	color: var(--st-error);
	margin: 0;
	padding: 0.5rem 0;
}

.st-detail-actions {
	margin-top: 1rem;
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.st-detail-overlay {
	z-index: 100001;
}

.st-modal-close {
	position: absolute;
	left: 0.75rem;
	top: 0.65rem;
	width: 2rem;
	height: 2rem;
	border: none;
	background: var(--st-bg);
	border-radius: 50%;
	font-size: 1.35rem;
	line-height: 1;
	cursor: pointer;
	color: var(--st-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background var(--st-transition), color var(--st-transition);
}

.st-modal-close:hover {
	background: var(--st-border);
	color: var(--st-text);
}

.st-modal-close:focus-visible {
	outline: 2px solid var(--st-accent);
	outline-offset: 2px;
}

.st-modal-title {
	margin: 0 0 1rem;
	font-size: 1.15rem;
	font-weight: 700;
}

/* ——— فرم تماس ——— */
.st-contact-modal {
	display: flex;
	flex-direction: column;
	padding: 0;
	overflow: hidden;
}

.st-contact-modal__header {
	flex-shrink: 0;
	padding: 1.1rem 1.25rem 0.75rem;
	padding-left: 2.75rem;
	border-bottom: 1px solid var(--st-border);
	background: linear-gradient(180deg, var(--st-accent-soft) 0%, var(--st-surface) 100%);
}

.st-contact-modal__header .st-modal-title {
	margin: 0 0 0.35rem;
	font-size: 1.1rem;
	font-weight: 800;
	color: var(--st-text);
}

.st-contact-modal__intro {
	margin: 0;
	font-size: 0.82rem;
	line-height: 1.6;
	color: var(--st-muted);
}

.st-contact-form {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	margin: 0;
}

.st-contact-form__fields {
	flex: 1 1 auto;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	padding: 1rem 1.25rem 0.5rem;
	-webkit-overflow-scrolling: touch;
}

.st-contact-form__footer {
	flex-shrink: 0;
	padding: 0.75rem 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid var(--st-border);
	background: var(--st-surface);
	box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
}

.st-contact-form label,
.st-contact-form .st-field {
	display: block;
	margin-bottom: 0.85rem;
}

.st-field__label {
	display: block;
	margin-bottom: 0.35rem;
	font-size: 0.82rem;
	font-weight: 700;
	color: var(--st-text);
}

.st-contact-form input,
.st-contact-form textarea {
	display: block;
	width: 100%;
	margin-top: 0;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--st-border);
	border-radius: var(--st-radius-sm);
	font: inherit;
	background: var(--st-bg);
	color: var(--st-text);
	transition: border-color var(--st-transition), box-shadow var(--st-transition);
}

.st-contact-form input::placeholder,
.st-contact-form textarea::placeholder {
	color: var(--st-muted);
	opacity: 0.75;
}

.st-contact-form input:focus,
.st-contact-form textarea:focus {
	border-color: var(--st-accent);
	outline: none;
	box-shadow: 0 0 0 3px var(--st-accent-soft);
	background: var(--st-surface);
}

.st-contact-form textarea {
	min-height: 5.5rem;
	resize: vertical;
	line-height: 1.55;
}

.st-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
}

.st-captcha-block {
	margin-bottom: 0.5rem;
	padding: 0.75rem;
	border: 1px solid var(--st-border);
	border-radius: var(--st-radius-sm);
	background: var(--st-bg);
}

.st-captcha-block__label {
	display: block;
	margin-bottom: 0.5rem;
	font-size: 0.82rem;
	font-weight: 700;
	color: var(--st-text);
}

.st-captcha-row {
	display: flex;
	align-items: stretch;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.st-captcha-media {
	position: relative;
	flex: 1 1 10rem;
	min-height: 3rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px dashed var(--st-border);
	border-radius: var(--st-radius-sm);
	background: var(--st-surface);
	overflow: hidden;
}

.st-captcha-media.is-loading .st-captcha-img {
	display: none;
}

.st-captcha-media:not(.is-loading) .st-captcha-loader {
	display: none;
}

.st-captcha-loader {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.5rem;
	color: var(--st-muted);
	font-size: 0.78rem;
	font-weight: 600;
}

.st-captcha-loader__spinner {
	width: 1.15rem;
	height: 1.15rem;
	border: 2px solid var(--st-border);
	border-top-color: var(--st-accent);
	border-radius: 50%;
	animation: st-spin 0.75s linear infinite;
}

@keyframes st-spin {
	to {
		transform: rotate(360deg);
	}
}

.st-captcha-img {
	display: block;
	width: 100%;
	max-height: 3.25rem;
	height: auto;
	object-fit: contain;
	border: none;
	border-radius: 0;
	background: #fff;
}

.st-captcha-row .st-captcha-refresh {
	align-self: center;
	flex-shrink: 0;
	white-space: nowrap;
}

.st-captcha-row .st-captcha-refresh:disabled {
	opacity: 0.55;
	cursor: wait;
}

.st-captcha-code-input {
	display: block;
	width: 100%;
	margin-top: 0.55rem;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--st-border);
	border-radius: var(--st-radius-sm);
	font: inherit;
	font-size: 1rem;
	letter-spacing: 0.12em;
	text-align: center;
	background: var(--st-surface);
	color: var(--st-text);
}

.st-captcha-code-input:focus {
	border-color: var(--st-accent);
	outline: none;
	box-shadow: 0 0 0 3px var(--st-accent-soft);
}

.st-form-status {
	margin: 0.65rem 0 0;
	padding: 0.55rem 0.7rem;
	font-size: 0.85rem;
	line-height: 1.5;
	border-radius: var(--st-radius-sm);
	background: var(--st-bg);
}

.st-form-status.st-is-error {
	color: #b91c1c;
	background: #fef2f2;
	border: 1px solid #fecaca;
}

.st-form-status.st-is-success {
	color: #047857;
	background: #ecfdf5;
	border: 1px solid #a7f3d0;
}

.st-submit {
	width: 100%;
	margin: 0;
	min-height: 2.75rem;
	font-size: 0.95rem;
	font-weight: 800;
	background: var(--st-accent) !important;
	color: #fff !important;
	border-color: var(--st-accent) !important;
	box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

.st-submit:hover:not(:disabled) {
	background: var(--st-accent-hover) !important;
	border-color: var(--st-accent-hover) !important;
	color: #fff !important;
}

.st-submit:disabled,
.st-submit.is-loading {
	opacity: 0.88;
	cursor: wait;
}

.st-submit.is-loading::before {
	content: "";
	display: inline-block;
	width: 1rem;
	height: 1rem;
	margin-left: 0.4rem;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: st-spin 0.75s linear infinite;
	vertical-align: middle;
}

@media (max-width: 768px) {
	.st-modal-overlay {
		align-items: flex-end;
		padding: 0;
	}

	.st-modal,
	.st-detail-modal {
		max-width: none;
		width: 100%;
		max-height: 92vh;
		border-radius: var(--st-radius) var(--st-radius) 0 0;
	}
}

/* صفحه محصول تکی؛ کلاس‌ها در قالب افزونه و override قالب استفاده می‌شوند. */
.st-product-seo-supplier-card {
	display: grid;
	gap: 0.35rem;
	margin: 1rem 0;
	padding: 1rem;
	border: 1px solid var(--st-border);
	border-radius: var(--st-radius);
	background: var(--st-surface);
}

.st-product-seo-supplier-kicker {
	color: var(--st-muted);
	font-size: 0.8rem;
	font-weight: 700;
}

.st-product-seo-supplier-name {
	color: var(--st-text);
	font-size: 1rem;
}

.st-product-seo-supplier-location,
.st-product-seo-supplier-address {
	color: var(--st-muted);
	font-size: 0.9rem;
	line-height: 1.6;
}

.st-product-seo-actions {
	margin-top: 1rem;
}
