/**
 * NexaShop Advanced Cart Widget Styles (Dropdown & Offcanvas Drawer)
 * Comprehensive styling for Cart Trigger, Price, Count Badge,
 * Free Shipping Progress Bar, Quantity Controller, Empty & Filled States,
 * Dropdown Popup and Slide-in Offcanvas Drawer.
 *
 * @package NexaShop
 * @subpackage ElementorWidgets
 */

/* ==========================================================================
   1. Base Widget Wrap & Triggers
   ========================================================================== */
.nexashop-cart-widget-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
	direction: rtl;
	box-sizing: border-box;
	font-family: inherit;
}

/* Vertical divider between header elements */
.nexashop-cart-vertical-divider {
	display: inline-block;
	width: 1px;
	height: 24px;
	background-color: #e0e0e2;
	margin: 0 10px;
	flex-shrink: 0;
}

/* Trigger Button Container */
.nexashop-cart-trigger {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 8px 12px;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 10px;
	color: #3f4064;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
	user-select: none;
	outline: none;
	box-sizing: border-box;
}

.nexashop-cart-trigger:hover {
	color: #0c0c0c;
	background-color: #f7f7f8;
}

/* --------------------------------------------------------------------------
   Trigger Layout Options:
   - vertical_icon_top: Icon Top, Price Bottom (Matches user screenshot)
   - vertical_icon_bottom: Price Top, Icon Bottom
   - horizontal_icon_right: Icon Right, Price Left
   - horizontal_icon_left: Icon Left, Price Right
   -------------------------------------------------------------------------- */
.nexashop-cart-widget-wrap.layout-vertical_icon_top .nexashop-cart-trigger {
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
}

.nexashop-cart-widget-wrap.layout-vertical_icon_bottom .nexashop-cart-trigger {
	flex-direction: column-reverse;
	align-items: center;
	justify-content: center;
	text-align: center;
}

.nexashop-cart-widget-wrap.layout-horizontal_icon_right .nexashop-cart-trigger {
	flex-direction: row;
	align-items: center;
}

.nexashop-cart-widget-wrap.layout-horizontal_icon_left .nexashop-cart-trigger {
	flex-direction: row-reverse;
	align-items: center;
}

.nexashop-cart-widget-wrap.layout-icon_only .nexashop-cart-price-wrap {
	display: none !important;
}

.nexashop-cart-widget-wrap.layout-price_only .nexashop-cart-icon-wrap {
	display: none !important;
}

/* Trigger Alignment */
.nexashop-cart-widget-wrap.align-center {
	justify-content: center;
}
.nexashop-cart-widget-wrap.align-right {
	justify-content: flex-start;
}
.nexashop-cart-widget-wrap.align-left {
	justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   Icon Container & SVG
   -------------------------------------------------------------------------- */
.nexashop-cart-icon-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 26px;
	line-height: 1;
	transition: all 0.25s ease;
	flex-shrink: 0;
}

.nexashop-cart-icon-wrap .dashicons {
	font-size: 26px;
	width: 26px;
	height: 26px;
	color: currentColor;
	line-height: 1;
}

.nexashop-cart-icon-wrap svg {
	width: 26px;
	height: 26px;
	stroke: currentColor;
	fill: none;
	display: block;
	transition: transform 0.25s ease, stroke 0.25s ease;
}

.nexashop-cart-trigger:hover .nexashop-cart-icon-wrap svg {
	transform: scale(1.06);
}

/* --------------------------------------------------------------------------
   Price Text & Prefix/Suffix in Trigger
   -------------------------------------------------------------------------- */
.nexashop-cart-price-wrap {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	font-size: 13.5px;
	font-weight: 800;
	line-height: 1.25;
	white-space: nowrap;
	color: inherit;
	transition: color 0.2s ease;
}

.nexashop-cart-custom-label {
	display: inline-block;
	color: inherit;
	font-size: 13.5px;
	font-weight: 700;
	line-height: 1.3;
	white-space: nowrap;
	transition: color 0.2s ease;
}

.nexashop-cart-widget-wrap.layout-horizontal_icon_right .nexashop-cart-price-wrap,
.nexashop-cart-widget-wrap.layout-horizontal_icon_left .nexashop-cart-price-wrap {
	align-items: flex-start;
}

.nexashop-cart-price-value {
	display: inline-block;
	color: inherit;
	font-weight: inherit;
	font-family: inherit;
}

.nexashop-cart-price-prefix,
.nexashop-cart-price-suffix {
	font-size: 0.85em;
	opacity: 0.85;
	font-weight: 600;
}

.nexashop-cart-trigger:hover .nexashop-cart-price-wrap {
	color: inherit;
}

/* --------------------------------------------------------------------------
   Counter Badge (Small indicator on the icon)
   -------------------------------------------------------------------------- */
.nexashop-cart-count-badge {
	position: absolute;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background-color: #c83e46;
	color: #ffffff;
	font-size: 11px;
	font-weight: 800;
	min-width: 18px;
	height: 18px;
	line-height: 1;
	border-radius: 6px;
	text-align: center;
	padding: 0 4px;
	box-sizing: border-box;
	border: 1.5px solid #ffffff;
	transform: translate(var(--ns-badge-x, 0px), var(--ns-badge-y, 0px));
	transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s ease;
	z-index: 2;
	pointer-events: none;
}

.nexashop-cart-count-badge.pos-top-right {
	top: -6px;
	right: -8px;
	bottom: auto;
	left: auto;
}

.nexashop-cart-count-badge.pos-top-left {
	top: -6px;
	left: -8px;
	bottom: auto;
	right: auto;
}

.nexashop-cart-count-badge.pos-bottom-right {
	bottom: -5px;
	right: -7px;
	top: auto;
	left: auto;
}

.nexashop-cart-count-badge.pos-bottom-left {
	bottom: -5px;
	left: -7px;
	top: auto;
	right: auto;
}

.nexashop-cart-count-badge.pos-inline {
	position: relative;
	top: auto;
	right: auto;
	bottom: auto;
	left: auto;
	margin-right: 4px;
}

.nexashop-cart-count-badge.is-badge-disabled,
.nexashop-cart-count-badge.hide-on-zero.is-empty {
	display: none !important;
}


/* ==========================================================================
   2. Dropdown Panel (Classic Header Popup)
   ========================================================================== */
.nexashop-cart-dropdown-panel {
	position: absolute;
	top: calc(100% + 12px);
	left: 0;
	width: 390px;
	max-width: 92vw;
	background: #ffffff;
	border-radius: 16px;
	border: 1px solid #eef0f3;
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
	padding: 16px 18px;
	box-sizing: border-box;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px) scale(0.98);
	transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease;
	z-index: 99999;
	direction: rtl;
	text-align: right;
}

/* Hover or Click Open in Dropdown Mode */
.nexashop-cart-widget-wrap.open-style-dropdown.mode-hover:hover .nexashop-cart-dropdown-panel,
.nexashop-cart-widget-wrap.open-style-dropdown.is-open .nexashop-cart-dropdown-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

/* Subtle triangle arrow for Dropdown */
.nexashop-cart-dropdown-panel::before {
	content: '';
	position: absolute;
	top: -6px;
	left: 24px;
	width: 12px;
	height: 12px;
	background-color: #ffffff;
	border-top: 1px solid #eef0f3;
	border-left: 1px solid #eef0f3;
	transform: rotate(45deg);
	z-index: 1;
}


/* ==========================================================================
   3. Offcanvas Drawer Panel (Slide-in from Right or Left)
   ========================================================================== */
/* Backdrop Overlay */
.nexashop-cart-drawer-overlay {
	position: fixed;
	inset: 0;
	background-color: rgba(15, 23, 42, 0.55);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	z-index: 999998;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
}

.nexashop-cart-drawer-overlay.is-open {
	opacity: 1;
	visibility: visible;
}

/* Drawer Shell */
.nexashop-cart-drawer-panel {
	position: fixed;
	top: 0;
	bottom: 0;
	width: 410px;
	max-width: 92vw;
	height: 100vh;
	background-color: #ffffff;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	box-shadow: 0 0 50px rgba(0, 0, 0, 0.2);
	transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.38s ease;
	visibility: hidden;
	direction: rtl;
	text-align: right;
	box-sizing: border-box;
}

/* Drawer Positions */
.nexashop-cart-drawer-panel.drawer-pos-right {
	right: 0;
	left: auto;
	transform: translateX(100%);
}

.nexashop-cart-drawer-panel.drawer-pos-left {
	left: 0;
	right: auto;
	transform: translateX(-100%);
}

.nexashop-cart-drawer-panel.is-open {
	transform: translateX(0);
	visibility: visible;
}

/* Body scroll lock when drawer is active */
body.nexashop-cart-drawer-locked {
	overflow: hidden !important;
}

/* Drawer Header */
.nexashop-cart-drawer-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 22px;
	border-bottom: 1px solid #f1f3f6;
	background-color: #fafbfc;
	flex-shrink: 0;
}

.nexashop-cart-drawer-header-info {
	display: flex;
	align-items: center;
	gap: 8px;
}

.nexashop-cart-drawer-title {
	font-size: 15px;
	font-weight: 800;
	color: #0c0c0c;
}

.nexashop-cart-drawer-count {
	font-size: 12px;
	font-weight: 700;
	color: #0284c7;
	background-color: #e0f2fe;
	padding: 3px 8px;
	border-radius: 6px;
}

/* Drawer Close Button */
.nexashop-cart-drawer-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 8px;
	border: none;
	background-color: transparent;
	color: #64748b;
	cursor: pointer;
	transition: all 0.2s ease;
	font-size: 16px;
	padding: 0;
	line-height: 1;
}

.nexashop-cart-drawer-close:hover {
	background-color: #fee2e2;
	color: #ef4444;
	transform: rotate(90deg);
}

.nexashop-cart-drawer-close svg {
	width: 18px;
	height: 18px;
	stroke: currentColor;
	fill: none;
}

/* Drawer Scrollable Body */
.nexashop-cart-drawer-body {
	flex: 1 1 auto;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 16px 20px;
	display: flex;
	flex-direction: column;
}


/* ==========================================================================
   4. Free Shipping Progress Bar
   ========================================================================== */
.nexashop-cart-shipping-bar-wrap {
	background-color: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 12px 14px;
	margin-bottom: 16px;
	flex-shrink: 0;
}

.nexashop-cart-shipping-msg {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12.5px;
	font-weight: 700;
	color: #334155;
	margin-bottom: 8px;
	line-height: 1.4;
}

.nexashop-cart-shipping-msg.is-unlocked {
	color: #16a34a;
}

.nexashop-cart-shipping-msg svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	fill: currentColor;
}

.nexashop-cart-shipping-track {
	width: 100%;
	height: 6px;
	background-color: #e2e8f0;
	border-radius: 10px;
	overflow: hidden;
	position: relative;
}

.nexashop-cart-shipping-fill {
	height: 100%;
	background: linear-gradient(90deg, #10b981, #059669);
	border-radius: 10px;
	transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.nexashop-cart-shipping-fill.is-complete {
	background: linear-gradient(90deg, #16a34a, #22c55e);
}


/* ==========================================================================
   5. Dropdown Header Row
   ========================================================================== */
.nexashop-cart-dropdown-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-bottom: 12px;
	margin-bottom: 12px;
	border-bottom: 1px solid #f1f3f6;
}

.nexashop-cart-dropdown-header .nexashop-cart-header-title {
	font-size: 14.5px;
	font-weight: 800;
	color: #0c0c0c;
}

.nexashop-cart-dropdown-header .nexashop-cart-header-count {
	font-size: 12px;
	font-weight: 700;
	color: #0284c7;
	background-color: #f0f9ff;
	padding: 2px 7px;
	border-radius: 5px;
}


/* ==========================================================================
   6. Product Items List
   ========================================================================== */
.nexashop-cart-items-list {
	list-style: none;
	margin: 0;
	padding: 0;
	flex: 1 1 auto;
	overflow-y: auto;
	max-height: 380px;
	scrollbar-width: thin;
	scrollbar-color: #cbd5e1 transparent;
}

.nexashop-cart-items-list::-webkit-scrollbar {
	width: 5px;
}
.nexashop-cart-items-list::-webkit-scrollbar-thumb {
	background-color: #cbd5e1;
	border-radius: 10px;
}

/* Item Row */
.nexashop-cart-item {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid #f1f5f9;
	position: relative;
	transition: opacity 0.25s ease, background-color 0.2s ease;
}

.nexashop-cart-item:last-child {
	border-bottom: none;
}

.nexashop-cart-item.is-loading {
	opacity: 0.45;
	pointer-events: none;
}

/* Item Thumbnail */
.nexashop-cart-item-thumb {
	position: relative;
	width: 68px;
	height: 68px;
	min-width: 68px;
	border-radius: 10px;
	border: 1px solid #edf2f7;
	overflow: hidden;
	background-color: #f8fafc;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.nexashop-cart-item-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.nexashop-cart-item:hover .nexashop-cart-item-thumb img {
	transform: scale(1.05);
}

/* Item Info Column */
.nexashop-cart-item-info {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.nexashop-cart-item-name {
	font-size: 13px;
	font-weight: 700;
	line-height: 1.45;
	color: #1e293b;
	text-decoration: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	transition: color 0.2s ease;
	padding-left: 20px; /* space for quick remove */
}

.nexashop-cart-item-name:hover {
	color: #ef4444;
}

/* Variations Meta */
.nexashop-cart-item-variations {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	font-size: 11px;
	color: #64748b;
}

.nexashop-cart-variation-badge {
	background-color: #f1f5f9;
	padding: 1px 6px;
	border-radius: 4px;
	font-weight: 600;
}

/* Quick Remove Button on Top Left */
.nexashop-cart-item-quick-remove {
	position: absolute;
	top: 10px;
	left: 0;
	background: transparent;
	border: none;
	color: #94a3b8;
	cursor: pointer;
	padding: 2px;
	border-radius: 4px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.nexashop-cart-item-quick-remove:hover {
	color: #ef4444;
	background-color: #fee2e2;
}

.nexashop-cart-item-quick-remove svg {
	width: 14px;
	height: 14px;
	stroke: currentColor;
	fill: none;
}

/* Bottom Row of Item (Quantity Controller & Price) */
.nexashop-cart-item-actions-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 4px;
}

/* Smart Quantity Controller (+, Number, Trash/-) */
.nexashop-cart-qty-pill {
	display: inline-flex;
	align-items: center;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	background-color: #ffffff;
	padding: 2px 4px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.nexashop-cart-qty-btn {
	background: transparent;
	border: none;
	width: 24px;
	height: 24px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #ef394e;
	cursor: pointer;
	border-radius: 6px;
	transition: background-color 0.2s ease, color 0.2s ease;
	padding: 0;
	font-size: 13px;
	line-height: 1;
}

.nexashop-cart-qty-btn:hover {
	background-color: #fee2e2;
	color: #b91c1c;
}

.nexashop-cart-qty-btn.is-disabled,
.nexashop-cart-qty-btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
	pointer-events: none;
}

.nexashop-cart-qty-btn svg {
	width: 13px;
	height: 13px;
	stroke: currentColor;
	fill: none;
}

.nexashop-cart-qty-center {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 26px;
	padding: 0 4px;
}

.nexashop-cart-qty-num {
	font-size: 13px;
	font-weight: 800;
	color: #0c0c0c;
	line-height: 1.1;
}

.nexashop-cart-qty-max-label {
	font-size: 9px;
	font-weight: 700;
	color: #e11d48;
	line-height: 1;
}

/* Item Price Display */
.nexashop-cart-item-price {
	font-size: 13.5px;
	font-weight: 800;
	color: #0c0c0c;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	gap: 3px;
}

.nexashop-cart-item-price .woocommerce-Price-currencySymbol {
	font-size: 10.5px;
	font-weight: 700;
	color: #64748b;
}


/* ==========================================================================
   7. Empty Cart State
   ========================================================================== */
.nexashop-cart-empty-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 36px 16px;
	flex: 1 1 auto;
}

.nexashop-cart-empty-icon-wrap {
	width: 80px;
	height: 80px;
	border-radius: 50%;
	background-color: #f1f5f9;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 16px;
	color: #94a3b8;
}

.nexashop-cart-empty-icon-wrap svg {
	width: 42px;
	height: 42px;
	stroke: currentColor;
	fill: none;
}

.nexashop-cart-empty-title {
	font-size: 15px;
	font-weight: 800;
	color: #1e293b;
	margin-bottom: 6px;
}

.nexashop-cart-empty-subtitle {
	font-size: 12.5px;
	color: #64748b;
	line-height: 1.5;
	max-width: 270px;
	margin-bottom: 20px;
}

.nexashop-cart-empty-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 22px;
	background-color: #ef394e;
	color: #ffffff;
	border-radius: 10px;
	font-size: 13px;
	font-weight: 700;
	text-decoration: none;
	transition: all 0.25s ease;
	box-shadow: 0 4px 14px rgba(239, 57, 78, 0.25);
}

.nexashop-cart-empty-btn:hover {
	background-color: #dc2626;
	color: #ffffff;
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(239, 57, 78, 0.35);
}


/* ==========================================================================
   8. Panel Footer: Totals & Action Buttons
   ========================================================================== */
.nexashop-cart-panel-footer {
	margin-top: auto;
	padding-top: 14px;
	border-top: 1px solid #f1f5f9;
	background-color: #ffffff;
	flex-shrink: 0;
}

.nexashop-cart-footer-totals {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 14px;
}

.nexashop-cart-footer-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 13px;
	color: #64748b;
}

.nexashop-cart-footer-row.is-total {
	font-size: 14.5px;
	font-weight: 800;
	color: #0c0c0c;
	padding-top: 4px;
}

.nexashop-cart-footer-row.is-total .nexashop-cart-footer-price {
	font-size: 16px;
	font-weight: 900;
	color: #0c0c0c;
}

.nexashop-cart-footer-price .woocommerce-Price-currencySymbol {
	font-size: 11px;
	font-weight: 700;
	color: #64748b;
	margin-right: 2px;
}

/* Action Buttons */
.nexashop-cart-footer-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Primary Button: ثبت سفارش و پرداخت */
.nexashop-cart-btn-checkout {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 12px 20px;
	background-color: #ef394e;
	color: #ffffff;
	border: none;
	border-radius: 12px;
	font-size: 14px;
	font-weight: 800;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.25s ease;
	box-sizing: border-box;
	box-shadow: 0 4px 16px rgba(239, 57, 78, 0.28);
}

.nexashop-cart-btn-checkout:hover {
	background-color: #dc2626;
	color: #ffffff;
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(239, 57, 78, 0.38);
}

.nexashop-cart-btn-checkout svg {
	width: 18px;
	height: 18px;
	stroke: currentColor;
	fill: none;
}

/* Secondary Button: مشاهده سبد خرید */
.nexashop-cart-btn-view {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 10px 16px;
	background-color: #f8fafc;
	color: #334155;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	font-size: 12.5px;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.2s ease;
	box-sizing: border-box;
}

.nexashop-cart-btn-view:hover {
	background-color: #f1f5f9;
	color: #0f172a;
	border-color: #cbd5e1;
}

/* Tertiary Button / Link: افزودن بیشتر / ادامه خرید */
.nexashop-cart-btn-continue {
	display: block;
	text-align: center;
	font-size: 12px;
	font-weight: 700;
	color: #64748b;
	text-decoration: none;
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 4px;
	transition: color 0.2s ease;
}

.nexashop-cart-btn-continue:hover {
	color: #ef394e;
}


/* ==========================================================================
   9. Responsive Adjustments
   ========================================================================== */
@media (max-width: 767px) {
	.nexashop-cart-dropdown-panel {
		width: 320px;
		left: 0;
		padding: 14px;
	}

	.nexashop-cart-drawer-panel {
		width: 100vw;
		max-width: 100vw;
	}
}
