/* ==================================================================
 * Popup thanh toán (assets/js/checkout-modal.js)
 * ================================================================== */

html.cv-co-open {
	overflow: hidden;
}

.cv-co {
	position: fixed;
	inset: 0;
	z-index: 100001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
}

.cv-co[hidden] {
	display: none;
}

.cv-co__overlay {
	position: absolute;
	inset: 0;
	background: rgba(11, 32, 31, .6);
	backdrop-filter: blur(3px);
	animation: cv-co-fade .2s ease;
}

.cv-co__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 980px;
	max-height: calc(100vh - 48px);
	border-radius: var(--cv-radius-lg);
	background: #fff;
	box-shadow: 0 30px 80px rgba(11, 32, 31, .3);
	overflow: hidden;
	animation: cv-co-pop .24s var(--cv-ease);
}

.cv-co__dialog:focus {
	outline: none;
}

.cv-co__head {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
	padding: 14px 16px 14px 22px;
	border-bottom: 1px solid var(--cv-border);
	background: #fff;
}

.cv-co__title {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	font-family: var(--cv-font-heading);
	font-size: 16px;
	font-weight: 600;
	color: var(--cv-text);
}

.cv-co__title svg {
	color: var(--cv-primary);
}

.cv-co__full {
	font-size: 13px;
	font-weight: 500;
	color: var(--cv-text-muted) !important;
}

.cv-co__full:hover {
	color: var(--cv-primary) !important;
}

.cv-co__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--cv-surface-alt);
	color: var(--cv-text);
	cursor: pointer;
}

.cv-co__close:hover {
	background: var(--cv-border);
}

.cv-co__body {
	position: relative;
	flex: 1;
	min-height: 360px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

/* iframe ẩn (vẫn tải) cho tới khi trang thanh toán báo sẵn sàng; khung tạm chiếm chỗ */
.cv-co__frame {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	width: 100%;
	height: 600px;
	border: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease;
}

.cv-co.is-ready .cv-co__frame {
	position: static;
	opacity: 1;
	visibility: visible;
}

.cv-co.is-ready .cv-co__skeleton {
	display: none;
}

/* ---- khung tạm: cùng bố cục với woocommerce/checkout/form-checkout.php ---- */

.cv-co__skeleton {
	padding: 24px;
}

.cv-sk__grid {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	gap: 32px;
	align-items: start;
}

.cv-sk__summary,
.cv-sk__pay {
	padding: 24px;
	border: 1px solid var(--cv-border);
	border-radius: var(--cv-radius-lg);
}

.cv-sk__summary {
	background: var(--cv-surface-alt);
}

.cv-sk__h {
	margin: 0 0 16px;
	font-family: var(--cv-font-heading);
	font-size: 18px;
	font-weight: 600;
	color: var(--cv-text);
}

.cv-sk__item {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0 0 18px;
	padding: 12px;
	border: 1px solid var(--cv-border);
	border-radius: var(--cv-radius);
	background: #fff;
}

.cv-sk__thumb {
	flex-shrink: 0;
	width: 64px;
	height: 64px;
	border-radius: var(--cv-radius-sm);
	background: var(--cv-surface-alt);
	overflow: hidden;
}

.cv-sk__thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.cv-sk__name {
	display: -webkit-box;
	flex: 1;
	min-width: 0;
	overflow: hidden;
	font-family: var(--cv-font-heading);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	color: var(--cv-text);
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.cv-sk__price {
	font-family: var(--cv-font-heading);
	font-size: 16px;
	font-weight: 700;
	color: var(--cv-text);
	white-space: nowrap;
}

.cv-sk__trust {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 0;
	border-top: 1px solid var(--cv-border);
}

.cv-sk__dot {
	flex-shrink: 0;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: #fff;
}

.cv-sk__lines {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1;
}

.cv-sk__lines i,
.cv-sk__bar {
	display: block;
	height: 12px;
	border-radius: 6px;
	background: linear-gradient(90deg, #e9eef0 25%, #f5f8f9 37%, #e9eef0 63%);
	background-size: 400% 100%;
	animation: cv-sk-shimmer 1.3s ease infinite;
}

.cv-sk__lines i:first-child {
	width: 45%;
}

.cv-sk__lines i:last-child {
	width: 80%;
}

.cv-sk__name .cv-sk__bar {
	width: 80%;
}

.cv-sk__bar--row {
	height: 18px;
	margin: 0 0 14px;
}

.cv-sk__bar--box {
	height: 64px;
	margin: 6px 0 16px;
	border-radius: var(--cv-radius);
}

.cv-sk__bar--short {
	width: 60%;
	margin: 0 0 16px;
}

.cv-sk__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 56px;
	border-radius: var(--cv-radius);
	background: var(--cv-accent);
	opacity: .45;
	font-family: var(--cv-font-heading);
	font-size: 17px;
	font-weight: 600;
	color: #fff;
}

@keyframes cv-sk-shimmer {
	0% { background-position: 100% 50%; }
	100% { background-position: 0 50%; }
}

@media (max-width: 849px) {
	.cv-sk__grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 18px;
	}
}

@media (max-width: 549px) {
	.cv-co__skeleton {
		padding: 14px;
	}

	.cv-sk__summary,
	.cv-sk__pay {
		padding: 16px;
	}

	.cv-sk__trust:nth-child(n+5) {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cv-sk__lines i,
	.cv-sk__bar {
		animation: none;
	}
}

@keyframes cv-co-fade {
	from { opacity: 0; }
}

@keyframes cv-co-pop {
	from { opacity: 0; transform: translateY(14px) scale(.985); }
}

@keyframes cv-co-spin {
	to { transform: rotate(360deg); }
}

@media (max-width: 549px) {
	.cv-co {
		padding: 0;
		align-items: flex-end;
	}

	.cv-co__dialog {
		max-height: 96vh;
		border-radius: var(--cv-radius-lg) var(--cv-radius-lg) 0 0;
	}

	.cv-co__full {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cv-co__overlay,
	.cv-co__dialog {
		animation: none;
	}
}
