/* ===========================
   Cart Modal V2
   =========================== */

/* Body lock khi modal mở */
body.cm2-body-lock {
	overflow: hidden;
}

/* Container */
.cm2 {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 999999;
	align-items: center;
	justify-content: center;
}

.cm2.cm2-active {
	display: flex;
}

/* Overlay */
.cm2-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(4px);
	animation: cm2FadeIn 0.25s ease;
}

/* Dialog */
.cm2-dialog {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
	width: 90%;
	max-width: 460px;
	max-height: 90vh;
	overflow-y: auto;
	animation: cm2SlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Header */
.cm2-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 20px 24px 16px;
	border-bottom: 1px solid #f0f0f0;
	background-color: #1a51a2;

}

.cm2-header-icon {
	flex-shrink: 0;
	display: flex;
}

.cm2-title {
	margin: 0;
	flex: 1;
	font-size: 16px;
	font-weight: 600;
	color: white;
	line-height: 1.4;
}

.cm2-close {
	flex-shrink: 0;
	background: none;
	border: none;
	cursor: pointer;
	padding: 6px;
	color: #999;
	border-radius: 8px;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cm2-close:hover {
	color: #333;
	background: #f5f5f5;
}

/* Body */
.cm2-body {
	padding: 20px 24px;
}

/* Product card */
.cm2-product {
	display: flex;
	gap: 16px;
	align-items: flex-start;
}

.cm2-product-image {
	flex-shrink: 0;
	width: 90px;
	height: 90px;
	border-radius: 10px;
	overflow: hidden;
	background: #f7f7f7;
	border: 1px solid #eee;
}

.cm2-product-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cm2-product-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.cm2-product-name {
	margin: 0;
	font-size: 15px;
	font-weight: 500;
	color: #1a1a1a;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cm2-product-price {
	font-size: 16px;
	font-weight: 700;
	color: #e53935;
}

.cm2-product-price del {
	color: #aaa;
	font-weight: 400;
	font-size: 13px;
}

.cm2-product-price ins {
	text-decoration: none;
}

.cm2-product-qty {
	font-size: 13px;
	color: #777;
}

/* Cart summary */
.cm2-summary {
	display: flex;
	align-items: center;
/* 	gap: 10px; */
	margin-top: 20px;
/* 	padding: 14px 16px;
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	border-radius: 10px; */
/* 	color: #15803d; */
	font-size: 14px;
}

.cm2-summary svg {
	flex-shrink: 0;
}

.cm2-summary-text strong {
	font-weight: 600;
}

/* Footer */
.cm2-footer {
/* 	display: flex; */
	gap: 10px;
	padding: 16px 24px 20px;
	border-top: 1px solid #f0f0f0;
	display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 480px) {
	.cm2-footer {
		grid-template-columns: repeat(1, minmax(0, 1fr));
	}

}

.cm2-btn {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 16px;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	text-align: center;
	cursor: pointer;
	transition: all 0.2s;
	border: none;
	line-height: 1.3;
}

/* Tiếp tục mua sắm */
.cm2-btn-continue {
	background: #6dbd45;
	color: #fff;
	flex: 0 0 auto;
}


.cm2-btn-continue:hover {
	background: #1a51a2;
	color: #fff;
}

/* Xem giỏ hàng */
.cm2-btn-cart {
	background: #1a51a2;
	color: #fff;
	border: 2px solid #ddd;
}

.cm2-btn-cart:hover {
	border-color: #bbb;
	background: #6dbd45;
	color: #fff;
}

/* Thanh toán */
.cm2-btn-checkout {
	background: red;
	color: #fff;
	grid-column: 1 / -1;
}

.cm2-btn-checkout:hover {
	opacity: 0.8 !important;
	color: #fff;

}

/* ===========================
   Error / Success State Toggle
   =========================== */

/* Mặc định ẩn cả hai icon & error content */
.cm2-header-icon--error,
.cm2-error-content,
.cm2-footer--error {
	display: none;
}

/* Success mode (default) */
.cm2--success .cm2-header-icon--success { display: flex; }
.cm2--success .cm2-header-icon--error { display: none; }
.cm2--success .cm2-success-content { display: block; }
.cm2--success .cm2-error-content { display: none; }
/* .cm2--success .cm2-footer--success { display: flex; } */
.cm2--success .cm2-footer--error { display: none; }

/* Error mode */
.cm2--error .cm2-header-icon--success { display: none; }
.cm2--error .cm2-header-icon--error { display: flex; }
.cm2--error .cm2-success-content { display: none; }
.cm2--error .cm2-error-content { display: block; }
.cm2--error .cm2-footer--success { display: none; }
.cm2--error .cm2-footer--error { display: flex; }

/* Error title color */
.cm2--error .cm2-title {
	color: #dc2626;
}

/* Error message */
.cm2-error-content {
	padding: 0;
}

.cm2-error-message {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 10px;
	color: #991b1b;
	font-size: 14px;
	line-height: 1.5;
}

/* Xem sản phẩm button */
.cm2-btn-view-product {
	background: #e53935;
	color: #fff;
}

.cm2-btn-view-product:hover {
	background: #c62828;
	color: #fff;
}

/* Animations */
@keyframes cm2FadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes cm2SlideUp {
	from {
		opacity: 0;
		transform: translateY(30px) scale(0.97);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 480px) {
	.cm2-dialog {
		width: 95%;
		border-radius: 14px;
	}

	.cm2-header {
		padding: 16px 18px 14px;
	}

	.cm2-title {
		font-size: 15px;
	}

	.cm2-body {
		padding: 16px 18px;
	}

	.cm2-product-image {
		width: 75px;
		height: 75px;
	}

	.cm2-footer {
		flex-direction: column;
		padding: 14px 18px 18px;
	}

	.cm2-btn {
		width: 100%;
	}

	.cm2-btn-continue {
		order: 1;
	}
	.cm2-btn-cart {
		order: 2;
	}
	.cm2-btn-checkout {
		order: 3;
	}
}
