/**
 * Cart popup - overlay + layout cho popup thêm vào giỏ thành công.
 *
 * Bám thông số giao diện mẫu xanhsam (header xanh, ảnh 70px, tên clamp 2 dòng,
 * chữ phụ #979797, CTA grid 2 cột viền trên, dock đáy mobile). Site không dùng
 * Bootstrap nên tự định nghĩa cơ chế modal. Màu CTA theo brand navy #045387.
 */

.nm-cart-popup {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease;
}

.nm-cart-popup.is-open {
	opacity: 1;
	visibility: visible;
}

.nm-cart-popup .modal-dialog {
	width: 100%;
	max-width: 440px;
	transform: translateY(-12px);
	transition: transform 0.2s ease;
}

.nm-cart-popup.is-open .modal-dialog {
	transform: translateY(0);
}

.nm-cart-popup .modal-content {
	position: relative;
	background: #fff;
	border-radius: 5px;
	padding: 0 0 15px; /* Không padding ngang: header tự tràn full 2 mép. */
	font-size: 1rem;
	overflow: hidden;
}

/* Trung hòa .row/.col của Flatsome trong popup để layout không bị gutter/flex lệch. */
.nm-cart-popup .row,
.nm-cart-popup .row-noGutter {
	display: block;
	max-width: none;
	margin: 0;
	padding: 0;
}

.nm-cart-popup .modal-left {
	width: 100%;
	max-width: 100%;
	padding: 0; /* Để header tràn full; padding ngang đặt ở .modal-body. */
}

.nm-cart-popup .modal-right {
	width: 100%;
	max-width: 100%;
	padding: 0 20px;
}

.nm-cart-popup .modal-body {
	padding: 1rem;
}

.nm-cart-popup .close {
	position: absolute;
	right: 15px;
	top: 9px;
	z-index: 9;
	padding: 0;
	margin: 0;
	min-width: unset;
	min-height: unset;
	border: 0;
	background: none;
	font-size: 24px;
	line-height: 1;
	color: #2eb346;
	cursor: pointer;
}

.nm-cart-popup .close:hover {
	opacity: 0.8;
}

/* Header xanh full-bleed (tràn 2 mép modal-content). */
.nm-cart-popup .modal-title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 0.5rem;
	padding: 10px 20px;
	background: #eff8f0;
	color: #2eb346;
	font-size: 1rem;
	font-weight: 400;
	border-radius: 2px;
}

.nm-cart-popup .modal-title .nm-cart-popup-check {
	flex: 0 0 auto;
}

/* Sản phẩm vừa thêm */
.nm-cart-popup .media {
	display: flex;
	align-items: center;
}

.nm-cart-popup .thumb_img {
	position: relative;
	width: 70px;
	min-width: 70px;
	height: 70px;
	min-height: 70px;
	margin-right: 1.25rem;
	border-radius: 0;
	overflow: hidden;
	text-align: center;
}

.nm-cart-popup .thumb-1x1 {
	width: 100%;
	height: 100%;
}

.nm-cart-popup .thumb-1x1 img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.nm-cart-popup .body_content {
	font-size: 1rem;
	line-height: 1.3;
}

.nm-cart-popup .product-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	white-space: initial;
	overflow: hidden;
	margin: 0;
	font-size: 1rem;
	font-weight: 400;
	line-height: 1.4;
	color: var(--text-color, #222);
}

.nm-cart-popup .variant_title {
	margin-top: 4px;
	color: #979797;
	font-size: 0.9em;
}

/* Tổng giỏ */
.nm-cart-popup .right_title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0;
	padding-top: 20px;
	border-top: 1px solid #f0f1f2;
}

.nm-cart-popup .right_title > a {
	font-weight: 600;
	color: #222;
	text-decoration: none;
}

.nm-cart-popup .text-right {
	text-align: right;
}

.nm-cart-popup .price {
	font-weight: 700;
	color: #045387;
}

.nm-cart-popup .count {
	color: #979797;
	font-size: 0.85em;
}

/* CTA: grid 2 cột, viền trên */
.nm-cart-popup .cart-action {
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-gap: 10px;
	margin-top: 20px;
	padding-top: 25px;
	border-top: 1px solid #f0f1f2;
}

/* "Thanh toán" (btn-main) dạng viền outline. */
.nm-cart-popup .btn-main {
	display: block;
	padding: 7px 20px;
	font-size: 14px;
	font-weight: 500;
	text-align: center;
	text-decoration: none;
	border-radius: 5px;
	background: #fff;
	color: #045387;
	border: 1px solid #045387;
	transition: opacity 0.15s ease;
}

.nm-cart-popup .btn-main:hover {
	filter: brightness(1.2);
}

/* "Xem giỏ hàng" (checkout_button) dạng nền đầy. */
.nm-cart-popup .btn-main.checkout_button {
	background: #045387;
	color: #fff;
}

.nm-cart-popup .btn-main.checkout_button:hover {
	color: #fff;
}

/* Ẩn link "Xem giỏ hàng" WooCommerce tự chèn sau nút (đã thay bằng popup). */
.added_to_cart.wc-forward {
	display: none !important;
}

/* Loading giữa màn hình khi đang thêm vào giỏ. */
.nm-cart-loading {
	position: fixed;
	inset: 0;
	z-index: 100001;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.4);
}

.nm-cart-loading.is-active {
	display: flex;
}

.nm-cart-loading__spinner {
	width: 44px;
	height: 44px;
	border: 3px solid rgba(4, 83, 135, 0.25);
	border-top-color: #045387;
	border-radius: 50%;
	animation: nm-cart-spin 0.7s linear infinite;
}

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

/* Khóa cuộn nền khi popup mở */
body.nm-cart-popup-open {
	overflow: hidden;
}

/* Mobile: dock đáy màn hình */
@media (max-width: 600px) {
	.nm-cart-popup {
		align-items: flex-end;
		padding: 0;
		z-index: 99999;
	}

	.nm-cart-popup .modal-dialog {
		max-width: none;
		transform: translateY(100%);
	}

	.nm-cart-popup.is-open .modal-dialog {
		transform: translateY(0);
	}

	.nm-cart-popup .modal-content {
		border-radius: 5px 5px 0 0;
	}
}
