/**
 * WooCommerce Favorites - Frontend Styles
 *
 * @package WC_Favorites
 * @version 1.0.0
 */

/* ========================================
   收藏按钮（商品图片右上角）
   ======================================== */
.wc-favorite-wrapper-image {
	position: absolute;
	top: 15px;
	right: 15px;
	z-index: 10;
	/* 优化：防止延迟显示 */
	opacity: 1;
	visibility: visible;
}

.wc-favorite-wrapper-image .wc-favorite-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 45px;
	height: 45px;
	padding: 0;
	background: rgba(255, 255, 255, 0.95);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: all 0.2s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	/* 优化：防止布局偏移 */
	flex-shrink: 0;
}

.wc-favorite-wrapper-image .wc-favorite-btn:hover {
	background: #fff;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	transform: scale(1.05);
}

.wc-favorite-wrapper-image .wc-favorite-btn.loading {
	opacity: 0.6;
	pointer-events: none;
}

.wc-favorite-wrapper-image .wc-favorite-icon-img {
	width: 45px;
	height: 45px;
	transition: transform 0.2s ease;
	/* 优化：防止图片闪烁 */
	display: block;
	image-rendering: -webkit-optimize-contrast;
	image-rendering: crisp-edges;
}

.wc-favorite-wrapper-image .wc-favorite-btn.favorited .wc-favorite-icon-img {
	animation: heartBeat 0.3s ease;
}

@keyframes heartBeat {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.15); }
}

/* 确保产品图片容器有相对定位 */
.woocommerce div.product div.images,
.vs-gallery-main {
	position: relative;
}

/* 响应式调整 */
@media (max-width: 768px) {
	.wc-favorite-wrapper-image {
		top: 10px;
		right: 10px;
	}
	
	.wc-favorite-wrapper-image .wc-favorite-btn {
		width: 40px;
		height: 40px;
	}
	
	.wc-favorite-wrapper-image .wc-favorite-icon-img {
		width: 40px;
		height: 40px;
	}
}

/* ========================================
   我的收藏页面
   ======================================== */
.wc-favorites-page {
	padding: 20px 0;
}

/* 空状态 */
.wc-favorites-empty {
	text-align: center;
	padding: 60px 20px;
}

.wc-favorites-empty svg {
	color: #ddd;
	margin-bottom: 20px;
}

.wc-favorites-empty p {
	font-size: 16px;
	color: #666;
	margin-bottom: 20px;
}

/* 收藏网格 */
.wc-favorites-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 24px;
	margin-bottom: 40px;
}

@media (max-width: 768px) {
	.wc-favorites-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 16px;
	}
}

@media (max-width: 480px) {
	.wc-favorites-grid {
		grid-template-columns: 1fr;
	}
}

/* 收藏商品项 */
.wc-favorite-item {
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	overflow: hidden;
	transition: all 0.3s ease;
}

.wc-favorite-item:hover {
	box-shadow: 0 4px 12px rgba(0,0,0,0.1);
	transform: translateY(-2px);
}

/* 商品图片 */
.wc-favorite-image {
	position: relative;
	overflow: hidden;
	aspect-ratio: 1;
}

.wc-favorite-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.wc-favorite-item:hover .wc-favorite-image img {
	transform: scale(1.05);
}

/* 移除按钮 - 改为与详情页一致的圆形图标按钮 */
.wc-remove-favorite {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 45px;
	height: 45px;
	background: rgba(255, 255, 255, 0.95);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: all 0.2s ease;
	z-index: 2;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	padding: 0;
}

.wc-favorite-item:hover .wc-remove-favorite {
	opacity: 1;
}

.wc-remove-favorite:hover {
	background: #fff;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	transform: scale(1.05);
}

.wc-remove-favorite img {
	width: 45px;
	height: 45px;
	display: block;
}

.wc-remove-favorite.loading {
	opacity: 0.5;
	pointer-events: none;
}

/* 商品信息 */
.wc-favorite-info {
	padding: 16px;
}

.wc-favorite-name {
	margin: 0 0 8px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
}

.wc-favorite-name a {
	color: #333;
	text-decoration: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wc-favorite-name a:hover {
	color: #0073aa;
}

.wc-favorite-price {
	margin-bottom: 12px;
	font-size: 16px;
	font-weight: 700;
	color: #e74c3c;
}

.wc-favorite-actions {
	margin-top: 12px;
}

.wc-favorite-actions .button {
	width: 100%;
	text-align: center;
	padding: 10px;
	font-size: 13px;
}

.wc-out-of-stock {
	display: block;
	text-align: center;
	padding: 10px;
	background: #f5f5f5;
	color: #999;
	border-radius: 4px;
	font-size: 13px;
}

/* 分页 */
.wc-favorites-pagination {
	margin-top: 40px;
	text-align: center;
}

.wc-favorites-pagination .page-numbers {
	display: inline-flex;
	gap: 8px;
	list-style: none;
	padding: 0;
	margin: 0;
}

.wc-favorites-pagination .page-numbers li {
	display: inline-block;
}

.wc-favorites-pagination a,
.wc-favorites-pagination span {
	display: inline-block;
	padding: 8px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	text-decoration: none;
	color: #333;
	transition: all 0.3s ease;
}

.wc-favorites-pagination a:hover {
	background: #0073aa;
	border-color: #0073aa;
	color: #fff;
}

.wc-favorites-pagination .current {
	background: #0073aa;
	border-color: #0073aa;
	color: #fff;
}

/* ========================================
   通知提示
   ======================================== */
.wc-favorites-notice {
	position: fixed;
	top: 20px;
	right: 20px;
	padding: 15px 25px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	z-index: 99999;
	transform: translateX(120%);
	transition: transform 0.3s ease;
	box-shadow: 0 4px 20px rgba(0,0,0,0.15);
	max-width: 300px;
}

.wc-favorites-notice.show {
	transform: translateX(0);
}

.wc-favorites-notice-success {
	background: #10B981;
	color: #fff;
}

.wc-favorites-notice-error {
	background: #EF4444;
	color: #fff;
}

.wc-favorites-notice-info {
	background: #3B82F6;
	color: #fff;
}

/* ========================================
   响应式调整
   ======================================== */
@media (max-width: 768px) {
	.wc-favorite-btn {
		padding: 10px 20px;
		font-size: 13px;
	}
	
	.wc-favorites-notice {
		right: 10px;
		left: 10px;
		max-width: none;
	}
}
