/**
 * WooCommerce Dynamic Attribute Add-ons - Frontend Styles (RTL Friendly)
 */

/* Remove bottom margin on theme's variation attribute rows */
table.variations tr,
table.variations tbody tr,
.box-price-info-single table.variations tr,
.box-price-info-single form.variations_form table.variations tbody tr,
form.variations_form table.variations tr,
form.variations_form table.variations tbody tr,
.variations_form table.variations tr {
	margin-bottom: 0 !important;
}

/* Table Row inside table.variations for Add-ons */
.variations_form .variations tr.wdaa-table-row,
.variations_form table.variations tr.wdaa-table-row,
.box-price-info-single .variations tr.wdaa-table-row,
tr.wdaa-table-row,
table.variations tr.wdaa-table-row {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	background: transparent !important;
	border: none !important;
	margin: 0 !important;
	padding: 0 !important;
	min-height: 0 !important;
	height: auto !important;
	box-shadow: none !important;
	box-sizing: border-box !important;
}

.variations_form .variations tr.wdaa-table-row td,
.variations_form table.variations tr.wdaa-table-row td,
.box-price-info-single .variations tr.wdaa-table-row td,
tr.wdaa-table-row td,
table.variations tr.wdaa-table-row td,
td.wdaa-table-cell {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
	background: transparent !important;
	box-sizing: border-box !important;
	flex: 1 1 100% !important;
}

/* Master Single Box for all Add-ons */
.wdaa-master-box {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	box-sizing: border-box !important;
	margin: 12px 0 16px 0 !important;
	padding: 16px 20px !important;
	background: #ffffff !important;
	border: 1px solid #e9edf2 !important;
	border-radius: 9px !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
	font-family: inherit !important;
	direction: rtl !important;
	text-align: right !important;
	color: rgb(40, 49, 59) !important;
}

@media (max-width: 1200px) {
	.wdaa-master-box {
		width: 100% !important;
		margin-top: 12px !important;
		margin-bottom: 16px !important;
		padding: 14px 18px !important;
		border-radius: 9px !important;
	}
}

/* Individual Add-on Row */
.wdaa-addon-row {
	margin: 0;
}

/* Divider between sections (e.g. between Base and Color) */
.wdaa-addon-divider {
	height: 1px;
	margin: 12px 0;
	border: none;
	border-top: 1px dashed #e9edf2;
}

.wdaa-attribute-header {
	margin-bottom: 8px;
}

.wdaa-attribute-title {
	font-size: 13.5px;
	font-weight: 700;
	color: rgb(40, 49, 59) !important;
	display: inline-block;
}

.wdaa-pills-container {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

/* Individual Pill Option */
.wdaa-pill-item {
	position: relative;
	cursor: pointer;
	user-select: none;
	margin: 0;
	display: inline-block;
}

/* Hide native radio input but keep it accessible */
.wdaa-pill-item input[type="radio"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	margin: 0;
	pointer-events: none;
}

/* Pill Box Label (Default State - rgb(40, 49, 59)) */
.wdaa-pill-label {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 7px 14px;
	background-color: #ffffff;
	border: 2px solid #cbd5e1;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 500;
	color: rgb(40, 49, 59) !important;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
	white-space: nowrap;
	box-sizing: border-box;
}

.wdaa-pill-name {
	display: inline-block;
	white-space: nowrap;
	color: rgb(40, 49, 59) !important;
}

.wdaa-pill-item:hover .wdaa-pill-label {
	border-color: #94a3b8;
	background-color: #f8fafc;
	color: rgb(40, 49, 59) !important;
	transform: translateY(-1px);
}

/* Selected Active State with Brand Color #00a27e */
.wdaa-pill-item.is-selected .wdaa-pill-label,
.wdaa-pill-item input[type="radio"]:checked + .wdaa-pill-label {
	border-color: #00a27e !important;
	background-color: #f0fdf9 !important;
	color: #00a27e !important;
	font-weight: 600;
	box-shadow: 0 2px 6px rgba(0, 162, 126, 0.15);
}

.wdaa-pill-item.is-selected .wdaa-pill-name {
	color: #00a27e !important;
}

/* Extra Price Badge (Currency on Left Side) */
.wdaa-pill-price {
	display: inline-flex !important;
	align-items: center !important;
	gap: 2px !important;
	white-space: nowrap;
	padding: 2px 8px;
	background-color: #e6f6f2;
	color: #00a27e;
	border-radius: 20px;
	font-size: 14px !important;
	font-weight: 700;
	line-height: 1.2;
	direction: ltr !important;
}

.wdaa-pill-amount {
	display: inline-block;
	font-size: 14px !important;
	font-weight: 700;
	line-height: 1;
}

.wdaa-price-display {
	display: inline-flex !important;
	align-items: center !important;
	gap: 2px !important;
	direction: ltr !important;
}

.wdaa-pill-item.is-selected .wdaa-pill-price {
	background-color: #00a27e;
	color: #ffffff;
}

/* Currency Symbol & Toman Icon Styling */
.wdaa-currency,
.wdaa-pill-price .woocommerce-Price-currencySymbol,
.wdaa-pill-price svg,
.wdaa-live-price-notice .woocommerce-Price-currencySymbol,
.wdaa-live-price-notice svg,
.woocommerce-Price-currencySymbol {
	--tw-text-opacity: 1;
	color: rgb(150 159 174 / var(--tw-text-opacity, 1)) !important;
	fill: rgb(150 159 174 / var(--tw-text-opacity, 1)) !important;
}

/* Smaller SVG currency icon inside pill buttons */
.wdaa-toman-icon {
	width: 16px !important;
	height: 16px !important;
	max-width: 16px !important;
	max-height: 16px !important;
	display: inline-block !important;
	vertical-align: middle !important;
	flex-shrink: 0;
}

.wdaa-pill-price svg,
.wdaa-pill-price .wdaa-toman-icon,
.wdaa-pill-price .woocommerce-Price-currencySymbol svg,
.wdaa-pill-price .wdaa-currency svg {
	width: 12px !important;
	height: 12px !important;
	max-width: 12px !important;
	max-height: 12px !important;
	display: inline-block !important;
	vertical-align: middle !important;
}

/* Text currency symbol size inside pill buttons */
.wdaa-pill-price .woocommerce-Price-currencySymbol,
.wdaa-pill-price .wdaa-currency {
	font-size: 11px !important;
	line-height: 1 !important;
	display: inline-flex !important;
	align-items: center !important;
}

.wdaa-pill-item.is-selected .wdaa-pill-price .woocommerce-Price-currencySymbol,
.wdaa-pill-item.is-selected .wdaa-pill-price svg,
.wdaa-pill-item.is-selected .wdaa-pill-price .wdaa-currency {
	color: #e6f6f2 !important;
	fill: #e6f6f2 !important;
}

/* Live Total Notice at bottom of the master box */
.wdaa-live-price-notice {
	margin-top: 14px;
	font-size: 13px;
	color: rgb(40, 49, 59) !important;
	border-top: 1px dashed #e9edf2;
	padding-top: 12px;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	line-height: 1.4;
}

.wdaa-live-price-notice > span {
	color: rgb(40, 49, 59) !important;
	font-size: 13.5px;
	font-weight: 600;
}

.wdaa-live-price-notice strong,
.wdaa-live-price-notice .wdaa-price-display {
	color: rgb(40, 49, 59) !important;
	font-size: 30px !important;
	font-weight: 800 !important;
	line-height: 1 !important;
	display: inline-flex !important;
	align-items: baseline !important;
	gap: 6px !important;
	white-space: nowrap;
}

.wdaa-live-price-notice .wdaa-amount,
.wdaa-live-price-notice .wdaa-price-amount {
	font-size: 30px !important;
	font-weight: 800 !important;
	color: rgb(40, 49, 59) !important;
	line-height: 1 !important;
}

.wdaa-live-price-notice .wdaa-currency,
.wdaa-live-price-notice .woocommerce-Price-currencySymbol {
	font-size: 16px !important;
	font-weight: 600 !important;
	line-height: 1 !important;
	display: inline-flex !important;
	align-items: center !important;
	color: rgb(150 159 174 / var(--tw-text-opacity, 1)) !important;
}

.wdaa-live-price-notice svg,
.wdaa-live-price-notice .wdaa-toman-icon,
.wdaa-price-display svg {
	width: 18px !important;
	height: 18px !important;
	max-width: 18px !important;
	max-height: 18px !important;
	display: inline-block !important;
	vertical-align: middle !important;
}

/* Backwards compatibility for single wrappers if any */
.wdaa-attribute-wrapper {
	margin: 14px 0;
	padding: 12px 14px;
	background: #ffffff;
	border: 1px solid #e9edf2;
	border-radius: 10px;
	box-sizing: border-box;
}

/* Responsive adjustments */
@media (max-width: 480px) {
	.wdaa-pills-container {
		flex-direction: row;
		align-items: center;
	}
}

/* ==========================================================================
   RESET / CLEAR VARIATIONS BUTTON ("صاف") STYLING & ZERO-SPACE COLLAPSE
   ========================================================================== */

/* 1. When hidden (not needed), collapse completely to 0px */
tr.woocommerce_reset_variations_link_tr.wdaa-hidden,
.woocommerce_reset_variations_link_tr.wdaa-hidden,
.variations_form .reset_variations.wdaa-hidden {
	display: none !important;
	visibility: hidden !important;
	height: 0 !important;
	min-height: 0 !important;
	max-height: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
	line-height: 0 !important;
	font-size: 0 !important;
	opacity: 0 !important;
	pointer-events: none !important;
	overflow: hidden !important;
}

/* 2. When active and visible (not wdaa-hidden), render with exact border and box style */
.variations_form .reset_variations:not(.wdaa-hidden) {
	border: 2px solid #f2bec0 !important;
	border-radius: 6px !important;
	width: 100% !important;
	height: 42px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	font-size: 15px !important;
	color: #ea6a6f !important;
	font-weight: 700 !important;
	margin: 10px auto 16px !important;
	text-decoration: none !important;
	box-sizing: border-box !important;
	background-color: #ffffff !important;
	transition: border-color 0.2s ease, background-color 0.2s ease !important;
}

.variations_form .reset_variations:not(.wdaa-hidden):hover {
	border-color: #ea6a6f !important;
	background-color: #fff5f5 !important;
	color: #ea6a6f !important;
}

.wdaa-table-cell {
	padding: 0 !important;
	border: none !important;
}

tr.wdaa-prev-row-no-margin {
	margin-bottom: 0 !important;
}

.wdaa-live-price-notice.wdaa-hidden {
	display: none !important;
}

/* Validation error highlighting and shake effect */
.wdaa-addon-row.wdaa-row-error {
	padding: 10px;
	border: 1.5px dashed #f87171 !important;
	border-radius: 10px;
	background-color: #fef2f2 !important;
	animation: wdaa-shake 0.4s ease-in-out;
}

@keyframes wdaa-shake {
	0%, 100% { transform: translateX(0); }
	20%, 60% { transform: translateX(-5px); }
	40%, 80% { transform: translateX(5px); }
}

.wdaa-validation-notice {
	margin-bottom: 18px !important;
	animation: fadeIn 0.3s ease;
}

/* ==========================================================================
   SUPPRESS REDUNDANT VARIATION PRICE (Keep ONLY #wdaa-master-box live notice)
   ========================================================================== */
body.wdaa-has-addons div.woocommerce-variation-price,
body.wdaa-has-addons .woocommerce-variation-price,
body.wdaa-has-addons .single_variation .woocommerce-variation-price,
body.wdaa-has-addons .single_variation .price,
body.wdaa-has-addons .single_variation_wrap .woocommerce-variation-price,
body.wdaa-has-addons .single_variation_wrap .price,
.wdaa-has-addons div.woocommerce-variation-price,
.wdaa-has-addons .woocommerce-variation-price,
.variations_form.wdaa-has-addons div.woocommerce-variation-price,
.variations_form.wdaa-has-addons .woocommerce-variation-price,
.variations_form.wdaa-has-addons .single_variation .price,
.variations_form:has(#wdaa-master-box) div.woocommerce-variation-price,
.variations_form:has(#wdaa-master-box) .woocommerce-variation-price,
.variations_form:has(#wdaa-master-box) .single_variation .price,
form.cart:has(#wdaa-master-box) div.woocommerce-variation-price,
form.cart:has(#wdaa-master-box) .woocommerce-variation-price,
form.cart:has(#wdaa-master-box) .single_variation .price,
div.woocommerce-variation-price.wdaa-hidden,
.woocommerce-variation-price.wdaa-hidden {
	display: none !important;
	visibility: hidden !important;
	height: 0 !important;
	min-height: 0 !important;
	max-height: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
	line-height: 0 !important;
	font-size: 0 !important;
	opacity: 0 !important;
	pointer-events: none !important;
	overflow: hidden !important;
}

/* ==========================================================================
   SMOOTH & SLOWER ENTER & EXIT ANIMATIONS: RESET BUTTON & LIVE PRICE NOTICE
   ========================================================================== */

/* 1. Reset variations row ("صاف") */
@keyframes wdaaRowFadeIn {
	0% {
		opacity: 0;
	}
	100% {
		opacity: 1;
	}
}

@keyframes wdaaRowFadeOut {
	0% {
		opacity: 1;
	}
	100% {
		opacity: 0;
	}
}

tr.woocommerce_reset_variations_link_tr.wdaa-animate-in,
.woocommerce_reset_variations_link_tr.wdaa-animate-in {
	animation: wdaaRowFadeIn 0.55s ease-out forwards;
}

tr.woocommerce_reset_variations_link_tr.wdaa-animating-out,
.woocommerce_reset_variations_link_tr.wdaa-animating-out {
	animation: wdaaRowFadeOut 0.5s ease-in forwards;
	pointer-events: none !important;
}

/* 2. Reset variations button ("صاف") */
@keyframes wdaaResetEnter {
	0% {
		opacity: 0;
		max-height: 0;
		transform: translateY(-10px) scale(0.96);
		margin-top: 0 !important;
		margin-bottom: 0 !important;
		padding-top: 0 !important;
		padding-bottom: 0 !important;
		border-width: 0 !important;
		overflow: hidden;
	}
	30% {
		opacity: 0.25;
		border-width: 2px !important;
	}
	60% {
		opacity: 0.75;
		max-height: 48px;
	}
	100% {
		opacity: 1;
		max-height: 48px;
		transform: translateY(0) scale(1);
		margin-top: 10px !important;
		margin-bottom: 16px !important;
		border-width: 2px !important;
		overflow: visible;
	}
}

@keyframes wdaaResetExit {
	0% {
		opacity: 1;
		max-height: 48px;
		transform: translateY(0) scale(1);
		margin-top: 10px !important;
		margin-bottom: 16px !important;
		border-width: 2px !important;
		overflow: hidden;
	}
	35% {
		opacity: 0.45;
		transform: translateY(-5px) scale(0.97);
	}
	70% {
		opacity: 0;
		max-height: 18px;
		border-width: 2px !important;
	}
	100% {
		opacity: 0;
		max-height: 0;
		height: 0 !important;
		min-height: 0 !important;
		margin-top: 0 !important;
		margin-bottom: 0 !important;
		padding-top: 0 !important;
		padding-bottom: 0 !important;
		border-width: 0 !important;
		overflow: hidden;
	}
}

.variations_form .reset_variations.wdaa-animate-in {
	animation: wdaaResetEnter 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
}

.variations_form .reset_variations.wdaa-animating-out {
	animation: wdaaResetExit 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
	pointer-events: none !important;
}

/* 3. WDAA Master Box live price notice */
@keyframes wdaaPriceNoticeEnter {
	0% {
		opacity: 0;
		max-height: 0;
		padding-top: 0 !important;
		margin-top: 0 !important;
		border-top-color: transparent !important;
		transform: translateY(10px);
		overflow: hidden;
	}
	30% {
		opacity: 0.25;
		border-top-color: rgba(233, 237, 242, 0.4) !important;
	}
	60% {
		opacity: 0.75;
		max-height: 80px;
	}
	100% {
		opacity: 1;
		max-height: 80px;
		padding-top: 12px !important;
		margin-top: 14px !important;
		border-top-color: #e9edf2 !important;
		transform: translateY(0);
		overflow: visible;
	}
}

@keyframes wdaaPriceNoticeExit {
	0% {
		opacity: 1;
		max-height: 80px;
		padding-top: 12px !important;
		margin-top: 14px !important;
		border-top-color: #e9edf2 !important;
		transform: translateY(0);
		overflow: hidden;
	}
	35% {
		opacity: 0.45;
		transform: translateY(6px);
		border-top-color: rgba(233, 237, 242, 0.4) !important;
	}
	70% {
		opacity: 0;
		border-top-color: transparent !important;
	}
	100% {
		opacity: 0;
		max-height: 0;
		height: 0 !important;
		min-height: 0 !important;
		padding-top: 0 !important;
		margin-top: 0 !important;
		border-top-color: transparent !important;
		border-top-width: 0 !important;
		overflow: hidden;
	}
}

.wdaa-live-price-notice.wdaa-animate-in {
	animation: wdaaPriceNoticeEnter 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
}

.wdaa-live-price-notice.wdaa-animating-out {
	animation: wdaaPriceNoticeExit 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
	pointer-events: none !important;
}

@keyframes wdaaPricePulse {
	0% {
		transform: scale(0.96);
		opacity: 0.85;
	}
	50% {
		transform: scale(1.02);
		opacity: 1;
	}
	100% {
		transform: scale(1);
		opacity: 1;
	}
}

.wdaa-live-price-notice .wdaa-price-display.wdaa-price-updated {
	animation: wdaaPricePulse 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 4. Standard WooCommerce variation price (for variable products without addons) */
@keyframes wdaaVariationPriceEnter {
	0% {
		opacity: 0;
		transform: translateY(12px);
	}
	100% {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes wdaaVariationPriceExit {
	0% {
		opacity: 1;
		transform: translateY(0);
	}
	100% {
		opacity: 0;
		transform: translateY(10px);
	}
}

.woocommerce-variation-price.wdaa-animate-in {
	animation: wdaaVariationPriceEnter 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.woocommerce-variation-price.wdaa-animating-out {
	animation: wdaaVariationPriceExit 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards;
	pointer-events: none !important;
}

@media (prefers-reduced-motion: reduce) {
	tr.woocommerce_reset_variations_link_tr,
	.woocommerce_reset_variations_link_tr,
	.variations_form .reset_variations,
	.woocommerce-variation-price,
	.wdaa-live-price-notice,
	.wdaa-live-price-notice .wdaa-price-display {
		animation: none !important;
		transform: none !important;
		transition: none !important;
	}
}

/* 5. SnappPay Widget Relocation on Addon Product Pages */
body.wdaa-has-addons .box-price-info-single .snapppay-widget:not(.wdaa-snapppay-moved),
body.wdaa-has-addons form.cart .snapppay-widget:not(.wdaa-snapppay-moved),
body.wdaa-has-addons .single_variation_wrap .snapppay-widget:not(.wdaa-snapppay-moved) {
	display: none !important;
}

.snapppay-widget.wdaa-snapppay-moved {
	display: flex !important;
	margin-top: 14px !important;
	margin-bottom: 0 !important;
	width: 100% !important;
	box-sizing: border-box !important;
	position: relative !important;
	z-index: auto !important;
	background: #ffffff !important;
	transform: none !important;
	animation: none !important;
	filter: none !important;
}

.snapppay-widget.wdaa-snapppay-moved .snapppay-widget-content {
	position: relative;
	z-index: 1;
	color: #1a1c23 !important;
}

.snapppay-widget.wdaa-snapppay-moved .snapppay-widget-title {
	color: #1a1c23 !important;
}

.snapppay-widget.wdaa-snapppay-moved .snapppay-widget-description {
	color: #626264 !important;
}

.snapppay-widget.wdaa-snapppay-moved .snapppay-widget-image {
	position: relative;
	z-index: 1;
}

@media (min-width: 1200px) {
	/* Align column 1 & column 2 contents: flex columns anchored to the grid item bottom */
	body.wdaa-has-addons div[class*="a-md:order-3"],
	body.wdaa-has-addons div[class*="max-w-[313px]"] {
		display: flex !important;
		flex-direction: column !important;
	}

	body.wdaa-has-addons div[class*="a-md:order-2"],
	body.wdaa-has-addons div[class*="max-w-[320px]"] {
		display: flex !important;
		flex-direction: column !important;
	}

	/* Anchor SnappPay widget to the bottom of column 2 */
	.snapppay-widget.wdaa-snapppay-moved {
		margin-top: auto !important;
		margin-bottom: 0 !important;
	}

	/* Anchor Free Shipping Banner to the bottom of column 1 */
	.wdaa-free-send-banner {
		margin-top: 14px !important;
		margin-bottom: 0 !important;
	}
}

@media (max-width: 1200px) {
	.snapppay-widget.wdaa-snapppay-moved,
	body.wdaa-has-addons .snapppay-widget {
		margin-bottom: 14px !important;
	}
}

/* 6. Free Shipping Banner */
#wdaa-free-send-banner.wdaa-hidden {
	display: none !important;
}

.wdaa-free-send-banner {
	display: flex !important;
	justify-content: space-between !important;
	align-items: center !important;
	background: #f0fdf9 !important;
	border: 1px solid #d1fae5 !important;
	border-radius: 17px !important;
	margin-top: 14px !important;
	margin-bottom: 16px !important;
	padding: 6px 18px !important;
	direction: rtl !important;
	box-sizing: border-box !important;
	width: 100% !important;
	min-height: 64px !important;
	position: relative !important;
	overflow: visible !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
}

.wdaa-free-send-title {
	color: #021959 !important;
	font-size: 14.5px !important;
	font-weight: 700 !important;
	white-space: nowrap !important;
	line-height: 1.4 !important;
	font-family: inherit !important;
}

.wdaa-free-send-svg {
	position: relative !important;
	display: flex !important;
	align-items: center !important;
	flex-shrink: 0 !important;
}

.wdaa-free-send-svg svg {
	width: 145px !important;
	max-width: 155px !important;
	height: auto !important;
	display: block !important;
	position: relative !important;
	bottom: -3px !important;
}

@media (max-width: 1200px) {
	.wdaa-free-send-banner {
		padding: 6px 14px !important;
		margin-top: 12px !important;
		margin-bottom: 14px !important;
		min-height: 60px !important;
	}
	.wdaa-free-send-title {
		font-size: 13.5px !important;
	}
	.wdaa-free-send-svg svg {
		width: 130px !important;
		bottom: -2px !important;
	}
}

@media (max-width: 380px) {
	.wdaa-free-send-banner {
		padding: 4px 10px !important;
		min-height: 56px !important;
	}
	.wdaa-free-send-title {
		font-size: 12.5px !important;
	}
	.wdaa-free-send-svg svg {
		width: 110px !important;
		bottom: -2px !important;
	}
}
