/* ==========================================================================
   মডিউল: Cart — হেডারের ব্যাগ বাটন, কার্ডের "কার্টে যোগ", Side Cart প্যানেল
   ========================================================================== */

/* ── হেডারের ব্যাগ বাটন ── */
.arianerptheme-cart-toggle {
	position: relative;
}

.arianerptheme-cart-count {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border: 2px solid var(--arianerptheme-surface);
	border-radius: 999px;
	background: var(--arianerptheme-danger);
	color: #fff;
	font-size: .7rem;
	font-weight: 700;
	line-height: 16px;
	text-align: center;
}

.arianerptheme-cart-count[hidden] {
	display: none;
}

.arianerptheme-cart-toggle.is-bump {
	animation: arianerptheme-cart-bump .45s ease;
}

@keyframes arianerptheme-cart-bump {
	0%, 100% { transform: scale(1); }
	35% { transform: scale(1.18); }
	70% { transform: scale(.95); }
}

/* ── কার্ডের বাটন এলাকা: "কার্টে যোগ" + ছোট WhatsApp আইকন পাশাপাশি (কার্ডের উচ্চতা অপরিবর্তিত থাকে) ── */
.arianerptheme-product__actions:has(> .arianerptheme-cart-add) {
	grid-template-columns: minmax(0, 1fr) auto;
}

.arianerptheme-product__actions:has(> .arianerptheme-cart-add) > .arianerptheme-btn--whatsapp {
	width: 40px;
	padding-inline: 0;
}

.arianerptheme-product__actions:has(> .arianerptheme-cart-add) > .arianerptheme-btn--whatsapp > span {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

@media (max-width: 480px) {
	.arianerptheme-product__actions:has(> .arianerptheme-cart-add) > .arianerptheme-btn--whatsapp {
		width: 38px;
	}
}

.arianerptheme-cart-add {
	overflow: hidden;
}

.arianerptheme-cart-add__label {
	overflow: hidden;
	text-overflow: ellipsis;
}

.arianerptheme-cart-add.is-in-cart {
	background: color-mix(in srgb, var(--arianerptheme-primary) 14%, var(--arianerptheme-surface));
	color: var(--arianerptheme-primary);
	border-color: var(--arianerptheme-primary);
}

/* ছোট মোবাইলে "কার্টে (৩)" লেখার জায়গা দিতে আইকন লুকানো */
@media (max-width: 480px) {
	.arianerptheme-cart-add.is-in-cart .arianerptheme-cart-add__icon {
		display: none;
	}
}

.arianerptheme-cart-add.is-bump {
	animation: arianerptheme-cart-bump .45s ease;
}

/* ── প্যানেল (ডান দিক থেকে) ── */
.arianerptheme-cart {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: var(--arianerptheme-z-panel);
	display: flex;
	flex-direction: column;
	width: min(92vw, 420px);
	background: var(--arianerptheme-surface);
	border-left: 1px solid var(--arianerptheme-border);
	box-shadow: -8px 0 32px rgba(0, 0, 0, .25);
	transform: translateX(102%);
	visibility: hidden;
	transition: transform .25s ease, visibility .25s;
}

/* খোলার সময় visibility সাথে সাথে — ফোকাস যেন বসে (Drawer-এর মতো) */
.arianerptheme-cart.is-open {
	transform: none;
	visibility: visible;
	transition: transform .25s ease, visibility 0s;
}

.admin-bar .arianerptheme-cart {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar .arianerptheme-cart {
		top: 46px;
	}
}

.arianerptheme-cart__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: var(--arianerptheme-header-h);
	padding: 8px 12px 8px var(--arianerptheme-gutter);
	border-bottom: 1px solid var(--arianerptheme-border);
}

.arianerptheme-cart__title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 1.1rem;
}

.arianerptheme-cart__title-count {
	color: var(--arianerptheme-muted);
	font-weight: 500;
}

.arianerptheme-cart__notice {
	margin: 0;
	padding: 10px var(--arianerptheme-gutter);
	background: color-mix(in srgb, var(--arianerptheme-danger) 12%, var(--arianerptheme-surface));
	color: var(--arianerptheme-danger);
	font-size: .88rem;
	font-weight: 600;
}

.arianerptheme-cart__notice[hidden] {
	display: none;
}

.arianerptheme-cart__body {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.arianerptheme-cart__items {
	margin: 0;
	padding: 0;
	list-style: none;
}

.arianerptheme-cart__items[hidden] {
	display: none;
}

/* ── আইটেম ── */

/* সদ্য যোগ হওয়া পণ্য — একবার হালকা জ্বলে ওঠে */
.arianerptheme-cart-item.is-new {
	animation: arianerptheme-cart-new 1.6s ease both;
}

@keyframes arianerptheme-cart-new {
	0%, 35% { background: color-mix(in srgb, var(--arianerptheme-primary) 16%, transparent); }
	100% { background: transparent; }
}

.arianerptheme-cart-item {
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr) auto;
	gap: 12px;
	padding: 14px var(--arianerptheme-gutter);
	border-bottom: 1px solid var(--arianerptheme-border);
}

.arianerptheme-cart-item__media img {
	display: block;
	width: 64px;
	height: 64px;
	padding: 4px;
	object-fit: contain;
	border: 1px solid var(--arianerptheme-border);
	border-radius: var(--arianerptheme-radius-sm);
	background: var(--arianerptheme-media-bg);
}

.arianerptheme-cart-item.is-unavailable .arianerptheme-cart-item__media img {
	opacity: .5;
	filter: grayscale(.8);
}

.arianerptheme-cart-item__info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.arianerptheme-cart-item__name {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	font-size: .92rem;
	font-weight: 600;
	line-height: 1.35;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.arianerptheme-cart-item__meta,
.arianerptheme-cart-item__unit {
	margin: 0;
	overflow: hidden;
	color: var(--arianerptheme-muted);
	font-size: .75rem;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.arianerptheme-cart-item__warn {
	margin: 2px 0 0;
	color: var(--arianerptheme-danger);
	font-size: .78rem;
	font-weight: 600;
}

.arianerptheme-cart-item__warn[hidden],
.arianerptheme-cart-item__meta[hidden] {
	display: none;
}

.arianerptheme-cart-item__side {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	justify-content: space-between;
	gap: 8px;
}

.arianerptheme-cart-item__remove {
	display: inline-grid;
	place-items: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--arianerptheme-muted);
	cursor: pointer;
}

.arianerptheme-cart-item__remove:hover {
	background: color-mix(in srgb, var(--arianerptheme-danger) 12%, transparent);
	color: var(--arianerptheme-danger);
}

.arianerptheme-cart-item__remove .arianerptheme-icon {
	width: 18px;
	height: 18px;
}

.arianerptheme-cart-item__total {
	font-size: .98rem;
	white-space: nowrap;
}

/* ── খালি অবস্থা ── */
.arianerptheme-cart__empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 48px var(--arianerptheme-gutter);
	text-align: center;
}

.arianerptheme-cart__empty[hidden] {
	display: none;
}

.arianerptheme-cart__empty-icon {
	display: inline-grid;
	place-items: center;
	width: 72px;
	height: 72px;
	margin-bottom: 8px;
	border-radius: 50%;
	background: var(--arianerptheme-surface-2);
	color: var(--arianerptheme-muted);
}

.arianerptheme-cart__empty-icon .arianerptheme-icon {
	width: 32px;
	height: 32px;
}

.arianerptheme-cart__empty-title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
}

.arianerptheme-cart__empty-text {
	margin: 0 0 12px;
	color: var(--arianerptheme-muted);
	font-size: .9rem;
}

/* ── ফুটার ── */
.arianerptheme-cart__foot {
	display: grid;
	gap: 8px;
	padding: 14px var(--arianerptheme-gutter) calc(14px + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid var(--arianerptheme-border);
	background: var(--arianerptheme-surface);
	box-shadow: 0 -6px 16px rgba(0, 0, 0, .06);
}

.arianerptheme-cart__foot[hidden] {
	display: none;
}

.arianerptheme-cart__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	font-size: 1rem;
}

.arianerptheme-cart__subtotal {
	color: var(--arianerptheme-primary);
	font-size: 1.25rem;
}

.arianerptheme-cart__hint {
	margin: 0 0 4px;
	color: var(--arianerptheme-muted);
	font-size: .8rem;
}
