/**
 * Wishlist page + drawer UI (Phase 6C.2).
 */

.vn-wishlist-page {
	padding-block: 40px 72px;
}

.vn-wishlist-page__header {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 24px;
	margin-bottom: 32px;
}

.vn-wishlist-page__catalog {
	background: transparent;
}

.vn-wishlist-page__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 32px 24px;
	align-items: stretch;
}

.vn-wishlist-page__grid > .vn-product-card {
	min-width: 0;
	width: 100%;
}

.vn-wishlist-page__catalog .vn-product-card__img-wrap {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	background: #f7f7f7;
}

.vn-wishlist-page__catalog .vn-product-card__img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}
.vn-wishlist-page__eyebrow,
.vn-wishlist-drawer__eyebrow {
	margin: 0 0 6px;
	font-size: 0.8125rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #777;
}

.vn-wishlist-page__title {
	margin: 0;
	font-size: clamp(1.5rem, 2.5vw, 2rem);
}

.vn-wishlist-page__count {
	font-size: 0.9375rem;
	color: #666;
	white-space: nowrap;
}

.vn-wishlist-empty,
.vn-wishlist-drawer__empty {
	text-align: center;
	padding: 32px 16px;
}

.vn-wishlist-empty__icon,
.vn-wishlist-drawer__empty-icon {
	display: flex;
	justify-content: center;
	margin-bottom: 16px;
	color: #bbb;
}

.vn-wishlist-empty h2 {
	margin: 0 0 10px;
	font-size: 1.25rem;
}

.vn-wishlist-empty p,
.vn-wishlist-drawer__empty p {
	margin: 0 0 18px;
	color: #666;
}

.vn-wishlist-drawer-root {
	--vn-wishlist-drawer-width: min(430px, 100%);
}

.vn-wishlist-drawer__overlay {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	padding: 0;
	background: rgba(0, 0, 0, 0.42);
	z-index: 100001;
	cursor: pointer;
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.vn-wishlist-drawer-root:has(.vn-wishlist-drawer.is-open) .vn-wishlist-drawer__overlay:not([hidden]) {
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
}

.vn-wishlist-drawer {
	position: fixed;
	inset-block: 0;
	inset-inline-end: 0;
	width: min(430px, 100%);
	height: 100dvh;
	background: #fff;
	transform: translateX(100%);
	visibility: hidden;
	pointer-events: none;
	transition:
		transform 0.25s ease,
		visibility 0.25s ease;
	z-index: 100002;
	display: flex;
	flex-direction: column;
	box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
}

.vn-wishlist-drawer.is-open {
	transform: translateX(0);
	visibility: visible;
	pointer-events: auto;
}

.vn-wishlist-drawer__header {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 18px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.vn-wishlist-drawer__title {
	margin: 0;
	font-size: 1.125rem;
}

.vn-wishlist-drawer__close {
	font-size: 1.5rem;
	line-height: 1;
	flex-shrink: 0;
}

.vn-wishlist-drawer__close:focus-visible,
.vn-wishlist-item__remove:focus-visible,
.vn-wishlist-item__cart:focus-visible {
	outline-offset: 2px;
}

.vn-wishlist-drawer__content {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 0 16px;
}

.vn-wishlist-drawer__list {
	display: flex;
	flex-direction: column;
}

.vn-wishlist-item {
	position: relative;
	display: grid;
	grid-template-columns: 80px minmax(0, 1fr);
	gap: 14px;
	padding: 16px 42px 16px 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.vn-wishlist-item__image {
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	background: #f7f7f7;
	border-radius: 6px;
}

.vn-wishlist-item__image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.vn-wishlist-item__title {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	margin: 0 0 6px;
	font-size: 0.9375rem;
	line-height: 1.35;
	color: inherit;
	text-decoration: none;
}

.vn-wishlist-item__title:hover {
	color: var(--primary-green, #2e7d32);
}

.vn-wishlist-item__price {
	margin-bottom: 8px;
	font-size: 0.875rem;
}

.vn-wishlist-item__status {
	color: #888;
}

.vn-wishlist-item__cart {
	font-size: 0.8125rem;
}

.vn-wishlist-item__cart.is-loading {
	opacity: 0.65;
	cursor: wait;
}

.vn-wishlist-item__remove {
	position: absolute;
	top: 14px;
	right: 0;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	font-size: 1.25rem;
	line-height: 1;
}

.vn-wishlist-drawer__footer {
	flex: 0 0 auto;
	padding: 16px;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.vn-wishlist-drawer__view-all {
	font-size: 0.9375rem;
	text-align: center;
}

.vn-wishlist-drawer__loading,
.vn-wishlist-drawer__error {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 32px 12px;
	text-align: center;
	color: #666;
}

.vn-wishlist-drawer__error {
	color: var(--red-sale, #e53935);
}

.vn-wishlist-drawer__error button {
	border: 0;
	background: transparent;
	color: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.vn-spinner {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 2px solid rgba(0, 0, 0, 0.12);
	border-top-color: var(--primary-green, #2e7d32);
	border-radius: 50%;
	animation: vn-wishlist-spin 0.7s linear infinite;
}

@keyframes vn-wishlist-spin {
	to {
		transform: rotate(360deg);
	}
}

body.vn-wishlist-drawer-open {
	overflow: hidden;
}

@media (max-width: 1199px) {
	.vn-wishlist-page__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.vn-wishlist-page {
		width: min(100%, calc(100% - 24px));
	}

	.vn-wishlist-page__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 24px 14px;
	}
}

@media (max-width: 575px) {
	.vn-wishlist-page {
		padding-block: 28px 52px;
	}

	.vn-wishlist-page__header {
		align-items: flex-start;
		flex-direction: column;
		gap: 8px;
	}

	.vn-wishlist-page__grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.vn-wishlist-drawer {
		width: min(100%, 390px);
	}
}
