/* Sadattoys AddCart Widget - Frontend Styles */

.sac-box {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 14px;
	font-family: inherit;
	direction: rtl;
	text-align: right;
	box-sizing: border-box;
}

.sac-box * {
	box-sizing: border-box;
}

.sac-title {
	margin: 0;
	line-height: 1.4;
}

.sac-price {
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
	font-size: 20px;
	font-weight: 700;
	color: #1a1a1a;
	line-height: 1.3;
}

.sac-price-prefix {
	font-size: 13px;
	font-weight: 400;
	color: #8a8a8a;
}

.sac-price-html {
	display: inline-flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 2px;
	/* Keeps a price range ("520,000 - 550,000") in the correct visual
	   order inside an RTL context instead of the numbers/dash reordering. */
	unicode-bidi: isolate;
}

.sac-price del {
	opacity: 0.55;
	text-decoration: line-through;
	font-size: 0.75em;
	font-weight: 400;
	margin-inline-end: 2px;
}

.sac-price ins {
	text-decoration: none;
	font-weight: 700;
}

@media (max-width: 480px) {
	.sac-price {
		font-size: 17px;
		gap: 6px;
	}
}

.sac-desc {
	line-height: 1.8;
	margin: 0;
}

/* Variation swatches (color / size / ...) */
.sac-variations {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.sac-variation-attr {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.sac-variation-label {
	font-weight: 600;
}

.sac-variation-options {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.sac-variation-swatch {
	appearance: none;
	cursor: pointer;
	font-family: inherit;
	background: #fff;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.sac-variation-swatch.has-color {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 2px solid #e2e2e2;
	padding: 0;
	position: relative;
}

.sac-variation-swatch.has-color.is-selected {
	border-color: #1a1a1a;
	box-shadow: 0 0 0 1px #1a1a1a;
}

.sac-variation-swatch:not(.has-color) {
	padding: 8px 14px;
	border: 1px solid #d9d9d9;
	border-radius: 8px;
	font-size: 14px;
	color: #333;
}

.sac-variation-swatch:not(.has-color):hover {
	border-color: #b9b9b9;
}

.sac-variation-swatch.is-selected:not(.has-color) {
	background: #1a1a1a;
	color: #fff;
	border-color: #1a1a1a;
}

.sac-variation-swatch.disabled,
.sac-variation-swatch:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

/* Add-on */
.sac-addon {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Add-on layout mode: inline (title + options on the same row) */
.sac-addon.sac-addon-mode-inline {
	flex-direction: row;
	align-items: center;
	flex-wrap: wrap;
}

.sac-addon.sac-addon-mode-inline .sac-addon-title {
	flex-shrink: 0;
}

/* Add-on layout mode: accordion (collapsed by default) */
.sac-addon-accordion-toggle {
	appearance: none;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	border: 1px solid #d9d9d9;
	border-radius: 8px;
	padding: 10px 14px;
	cursor: pointer;
	font-family: inherit;
	color: inherit;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.sac-addon-accordion-toggle .sac-addon-title {
	font-weight: 600;
	margin-inline-end: auto;
}

.sac-addon-accordion-current {
	font-size: 12px;
	opacity: 0.7;
	white-space: nowrap;
}

.sac-addon-accordion-chevron {
	display: inline-flex;
	transition: transform 0.2s ease;
	flex-shrink: 0;
}

.sac-addon-accordion-toggle[aria-expanded="true"] .sac-addon-accordion-chevron {
	transform: rotate(180deg);
}

.sac-addon-panel {
	overflow: hidden;
	max-height: 0;
	border-radius: 0 0 8px 8px;
	transition: max-height 0.25s ease, background-color 0.2s ease;
}

.sac-addon-mode-accordion.is-open .sac-addon-panel {
	max-height: 600px;
}

.sac-addon-mode-accordion .sac-addon-panel > .sac-addon-options,
.sac-addon-mode-accordion .sac-addon-panel > .sac-addon-select {
	margin-top: 8px;
}

.sac-addon-title {
	font-weight: 600;
}

.sac-addon-options {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.sac-addon-option {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border: 1px solid #d9d9d9;
	border-radius: 8px;
	cursor: pointer;
	background: #fff;
	transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
	font-size: 14px;
	user-select: none;
}

.sac-addon-option input[type="radio"] {
	accent-color: currentColor;
	margin: 0;
}

.sac-addon-option:hover {
	border-color: #b9b9b9;
}

.sac-addon-option.is-selected {
	border-color: #d63638;
}

.sac-addon-price {
	font-size: 12px;
	opacity: 0.75;
	white-space: nowrap;
}

.sac-addon-select {
	width: 100%;
	max-width: 320px;
	padding: 10px 12px;
	border: 1px solid #d9d9d9;
	border-radius: 8px;
	background: #fff;
	font-family: inherit;
	direction: rtl;
}

/* Action row: stepper + cart button + wishlist */
.sac-action-row {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	flex-wrap: wrap;
}

.sac-action-row.sac-layout-column {
	flex-direction: column;
	align-items: stretch;
}

/* Stacked: stepper + wishlist together on one row, cart button full-width below */
.sac-action-row.sac-layout-stacked {
	flex-wrap: wrap;
	row-gap: 12px;
}

.sac-action-row.sac-layout-stacked .sac-stepper {
	order: 1;
}

.sac-action-row.sac-layout-stacked .sac-wishlist-btn {
	order: 2;
	margin-inline-start: auto;
}

.sac-action-row.sac-layout-stacked .sac-cart-btn {
	order: 3;
	flex: 1 1 100%;
	width: 100%;
}

/* Stepper */
.sac-stepper {
	display: inline-flex;
	align-items: stretch;
	height: 42px;
	border: 1px solid #d9d9d9;
	border-radius: 8px;
	overflow: hidden;
	flex-shrink: 0;
	width: fit-content;
}

.sac-stepper-btn {
	appearance: none;
	border: none;
	background: transparent;
	width: 38px;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #333;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.sac-stepper-btn:hover {
	background: #f2f2f2;
}

.sac-stepper-input {
	flex: 1 1 auto;
	min-width: 40px;
	width: 48px;
	border: none;
	border-inline: 1px solid #e5e5e5;
	text-align: center;
	font-size: 15px;
	background: #fff;
	-moz-appearance: textfield;
	direction: ltr;
}

.sac-stepper-input::-webkit-outer-spin-button,
.sac-stepper-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* Add to cart button */
.sac-cart-btn {
	appearance: none;
	border: none;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: #1a1a1a;
	color: #fff;
	padding: 12px 22px;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 600;
	font-family: inherit;
	transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
	flex: 1 1 auto;
	white-space: nowrap;
}

.sac-cart-btn-icon {
	display: inline-flex;
	align-items: center;
}

.sac-cart-btn svg,
.sac-cart-btn i {
	font-size: 16px;
	width: 16px;
	height: 16px;
	fill: currentColor;
}

.sac-cart-btn:disabled {
	opacity: 0.65;
	cursor: progress;
}

.sac-cart-btn.is-success {
	background: #2fa84f;
}

/* Wishlist button */
.sac-wishlist-btn {
	appearance: none;
	border: 1px solid transparent;
	background: rgba(17, 17, 17, 0.05);
	color: #666;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.sac-wishlist-btn:hover {
	background: rgba(17, 17, 17, 0.09);
}

.sac-wishlist-btn .sac-wishlist-icon-active {
	display: none;
}

.sac-wishlist-btn.is-active .sac-wishlist-icon-normal {
	display: none;
}

.sac-wishlist-btn.is-active .sac-wishlist-icon-active {
	display: inline-flex;
}

.sac-wishlist-btn.is-active {
	color: #d63638;
}

.sac-wishlist-btn svg,
.sac-wishlist-btn i {
	font-size: 18px;
	width: 18px;
	height: 18px;
	fill: currentColor;
}

/* Inline notice */
.sac-notice {
	font-size: 13px;
	min-height: 1em;
}

.sac-notice.sac-notice-success {
	color: #2fa84f;
}

.sac-notice.sac-notice-error {
	color: #d63638;
}

/* Persian / RTL font fallback stack - applies only within this widget so it
   doesn't override the site's existing typography choices elsewhere. */
.sac-box {
	font-family: 'Vazirmatn', 'IRANSans', 'Estedad', Tahoma, sans-serif;
}

/* LTR sites: allow easy override by adding this class on the widget wrapper via Elementor's advanced CSS classes */
.sac-box.sac-ltr {
	direction: ltr;
	text-align: left;
}

@media (max-width: 480px) {
	.sac-box {
		gap: 12px;
	}

	/* Keep stepper + add-to-cart + wishlist on a single row on mobile too,
	   regardless of the chosen layout (row / column / stacked) — just make
	   each element more compact so everything fits. */
	.sac-action-row,
	.sac-action-row.sac-layout-column,
	.sac-action-row.sac-layout-stacked {
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: center;
		gap: 8px;
	}

	.sac-action-row.sac-layout-stacked .sac-stepper,
	.sac-action-row.sac-layout-stacked .sac-wishlist-btn,
	.sac-action-row.sac-layout-stacked .sac-cart-btn {
		order: initial;
		margin-inline-start: 0;
	}

	.sac-stepper {
		height: 44px;
		flex: 0 0 auto;
	}

	.sac-stepper-input {
		width: 30px;
		min-width: 26px;
		padding: 0 2px;
	}

	.sac-stepper-btn {
		width: 30px;
	}

	.sac-cart-btn {
		flex: 1 1 auto;
		min-width: 0;
		min-height: 44px;
		padding: 10px 12px;
		white-space: normal;
		text-align: center;
		font-size: 14px;
	}

	.sac-wishlist-btn {
		width: 44px;
		height: 44px;
		flex: 0 0 auto;
	}

	.sac-addon-select {
		max-width: 100%;
	}

	.sac-variation-swatch.has-color {
		width: 36px;
		height: 36px;
	}

	.sac-variation-swatch:not(.has-color) {
		padding: 9px 12px;
	}

	.sac-addon-option {
		padding: 9px 12px;
		flex: 1 1 auto;
		justify-content: center;
	}
}

/* Up-sell / Cross-sell related products gallery */
.sac-related {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.sac-related-title {
	font-weight: 600;
}

.sac-related-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}

.sac-related-item {
	appearance: none;
	background: none;
	border: none;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
	cursor: pointer;
	font-family: inherit;
	text-align: inherit;
	color: inherit;
}

.sac-related-thumb {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: 8px;
	background: #f2f2f2;
}

.sac-related-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 8px;
	transition: transform 0.2s ease;
}

.sac-related-item:hover .sac-related-thumb img {
	transform: scale(1.04);
}

.sac-related-name {
	font-size: 13px;
	color: #333;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.sac-related-price {
	font-size: 12px;
	color: #8a8a8a;
}

/* Related products popup */
.sac-related-popup {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.sac-related-popup.is-open {
	display: flex;
}

.sac-related-popup-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	cursor: pointer;
}

.sac-related-popup-modal {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 12px;
	max-width: 480px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	direction: rtl;
	text-align: right;
	font-family: 'Vazirmatn', 'IRANSans', 'Estedad', Tahoma, sans-serif;
	box-sizing: border-box;
}

.sac-related-popup-modal * {
	box-sizing: border-box;
}

.sac-related-popup-close {
	position: absolute;
	top: 10px;
	inset-inline-start: 10px;
	appearance: none;
	border: none;
	background: #f2f2f2;
	color: #333;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.sac-related-popup-image {
	width: 100%;
	border-radius: 8px;
	overflow: hidden;
	background: #f2f2f2;
}

.sac-related-popup-image img {
	width: 100%;
	max-height: 320px;
	object-fit: contain;
	display: block;
}

.sac-related-popup-name {
	margin: 0;
	font-size: 17px;
	line-height: 1.5;
}

.sac-related-popup-price {
	font-size: 15px;
	color: #2c2c2c;
}

.sac-related-popup-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.sac-related-popup-stepper {
	display: inline-flex;
	align-items: stretch;
	height: 42px;
	border: 1px solid #d9d9d9;
	border-radius: 8px;
	overflow: hidden;
	flex-shrink: 0;
	width: fit-content;
}

.sac-related-popup-notice {
	font-size: 13px;
	min-height: 1em;
}

.sac-related-popup-notice.sac-notice-success {
	color: #2fa84f;
}

.sac-related-popup-notice.sac-notice-error {
	color: #d63638;
}

@media (max-width: 480px) {
	.sac-related-grid {
		grid-template-columns: repeat(2, 1fr) !important;
	}

	.sac-related-popup {
		padding: 10px;
	}

	.sac-related-popup-modal {
		padding: 14px;
		gap: 10px;
		max-height: 94vh;
	}

	.sac-related-popup-image img {
		max-height: 220px;
	}

	.sac-related-popup-name {
		font-size: 15px;
	}

	.sac-related-popup-actions {
		flex-direction: column;
		align-items: stretch;
	}

	.sac-related-popup-stepper,
	.sac-related-popup-addtocart,
	.sac-related-popup-viewproduct {
		width: 100%;
	}
}

/* ---------------- Sticky add-to-cart bar (mobile only) ---------------- */
.sac-sticky-bar {
	display: none;
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9999;
	background: #fff;
	box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1);
	direction: rtl;
}

.sac-sticky-bar.is-visible {
	display: block;
}

.sac-sticky-bar-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 16px;
	padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

.sac-sticky-bar .sac-price {
	flex: 0 0 auto;
	font-size: 16px;
}

.sac-sticky-bar .sac-cart-btn {
	flex: 1 1 auto;
	max-width: 220px;
	min-height: 44px;
}

/* The sticky bar is a mobile pattern only — never show it on tablet/desktop
   even if it was toggled visible before the viewport was resized. */
@media (min-width: 769px) {
	.sac-sticky-bar {
		display: none !important;
	}
}
