/**
 * 产品列表样式
 * Yanjing Theme - Product List Styles
 * 
 * 功能：
 * - 响应式网格布局
 * - 图片悬停切换效果
 * - 属性色块显示
 * - 品牌和价格样式
 */

/* ============================================
   产品列表容器
   ============================================ */

.woocommerce ul.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 单个产品项 */
.yanjing-product-item {
    position: relative;
    background: transparent;
    border-radius: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: none;
}

.yanjing-product-item:hover {
    box-shadow: none;
    transform: none;
}

.yanjing-product-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ============================================
   产品图片区域
   ============================================ */

.yanjing-product-image {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 aspect ratio */
    overflow: hidden;
    background: #f9f9f9;
}

.yanjing-product-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.yanjing-product-main-image,
.yanjing-product-hover-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.yanjing-product-main-image {
    opacity: 1;
    z-index: 1;
}

.yanjing-product-hover-image {
    opacity: 0;
    z-index: 2;
}

/* 悬停时切换图片 */
.yanjing-product-item:hover .yanjing-product-main-image {
    opacity: 0;
}

.yanjing-product-item:hover .yanjing-product-hover-image {
    opacity: 1;
}

/* ============================================
   产品标签（促销、新品等）
   ============================================ */

.yanjing-product-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 3px;
    background: #ab8e66;
    color: #fff;
}

.yanjing-badge-sale {
    background: #e74c3c;
}

.yanjing-badge-featured {
    background: #3498db;
    left: auto;
    right: 15px;
}

/* ============================================
   收藏/愿望清单按钮
   ============================================ */

.yanjing-wishlist-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease;
}

.yanjing-wishlist-btn svg {
    fill: none;
    stroke: #000;
    transition: all 0.3s ease;
}

.yanjing-wishlist-btn:hover svg {
    fill: #ab8e66;
    stroke: #ab8e66;
}

.yanjing-wishlist-btn.active svg {
    fill: #ab8e66;
    stroke: #ab8e66;
}

/* ============================================
   产品信息区域
   ============================================ */

.yanjing-product-content {
    padding: 15px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 品牌名称 */
.yanjing-product-brand {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #000;
    margin-bottom: 8px;
}

/* 产品标题 */
.yanjing-product-title {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    margin: 0 0 10px;
    min-height: 42px;
    text-transform: uppercase;
}

.yanjing-product-title a {
    color: #000;
    text-decoration: none;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.yanjing-product-title a:hover {
    color: #ab8e66;
}

/* 产品价格 */
.yanjing-product-price {
    font-size: 13px;
    font-weight: 600;
    color: #000;
    margin-bottom: 12px;
}

.yanjing-product-price del {
    color: #999;
    font-weight: 400;
    margin-right: 8px;
    font-size: 14px;
}

.yanjing-product-price ins {
    text-decoration: none;
    color: #ab8e66;
}

/* ============================================
   变体信息切换效果
   ============================================ */

/* 默认信息容器 */
.yanjing-product-default-info {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* 变体信息容器（默认隐藏） */
.yanjing-product-variations-info {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 15px 0;
}

/* 悬停内容区域时：隐藏默认信息，显示变体信息 */
.yanjing-product-item.has-variations .yanjing-product-content:hover .yanjing-product-default-info {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.yanjing-product-item.has-variations .yanjing-product-content:hover .yanjing-product-variations-info {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.4s ease 0.1s;
}

/* 变体信息需要相对定位的父容器 */
.yanjing-product-content {
    position: relative;
}

/* 属性名称标签 */
.yanjing-variations-label {
    font-size: 13px;
    font-weight: 600;
    color: #000;
    text-transform: uppercase;
    margin-bottom: 10px;
    text-align: left;
    width: 100%;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.4s ease 0.15s, transform 0.4s ease 0.15s;
}

/* 悬停时属性名称渐显 */
.yanjing-product-item.has-variations .yanjing-product-content:hover .yanjing-variations-label {
    opacity: 1;
    transform: translateY(0);
}

/* 变体图片网格 */
.yanjing-variations-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    align-items: flex-start;
    justify-content: flex-start;
}

/* 单个变体项 */
.yanjing-variation-item {
    width: 20px;
    height: 20px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    flex-shrink: 0;
    opacity: 0;
    transform: translateY(-5px);
}

/* 为每个变体项添加延迟渐显效果 */
.yanjing-variation-item:nth-child(1) {
    transition: opacity 0.3s ease 0.2s, transform 0.3s ease 0.2s, border-color 0.2s ease;
}

.yanjing-variation-item:nth-child(2) {
    transition: opacity 0.3s ease 0.25s, transform 0.3s ease 0.25s, border-color 0.2s ease;
}

.yanjing-variation-item:nth-child(3) {
    transition: opacity 0.3s ease 0.3s, transform 0.3s ease 0.3s, border-color 0.2s ease;
}

.yanjing-variation-item:nth-child(4) {
    transition: opacity 0.3s ease 0.35s, transform 0.3s ease 0.35s, border-color 0.2s ease;
}

.yanjing-variation-item:nth-child(5) {
    transition: opacity 0.3s ease 0.4s, transform 0.3s ease 0.4s, border-color 0.2s ease;
}

.yanjing-variation-item:nth-child(6) {
    transition: opacity 0.3s ease 0.45s, transform 0.3s ease 0.45s, border-color 0.2s ease;
}

.yanjing-variation-item:nth-child(n+7) {
    transition: opacity 0.3s ease 0.5s, transform 0.3s ease 0.5s, border-color 0.2s ease;
}

/* 悬停时变体项渐显 */
.yanjing-product-item.has-variations .yanjing-product-content:hover .yanjing-variation-item {
    opacity: 1;
    transform: translateY(0);
}

.yanjing-variation-item:hover {
    border-color: #000;
    transform: translateY(0) scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.yanjing-variation-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ============================================
   加入购物车按钮
   ============================================ */

/* 隐藏购物车按钮，与 Recently Viewed 保持一致 */
.yanjing-product-actions {
    display: none;
    margin-top: auto;
}

.yanjing-product-actions .button {
    width: 100%;
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.yanjing-product-actions .button:hover {
    background: #ab8e66;
    color: #fff;
}

.yanjing-product-actions .added_to_cart {
    display: inline-block;
    margin-top: 10px;
    font-size: 12px;
    color: #ab8e66;
    text-decoration: none;
}

.yanjing-product-actions .added_to_cart:hover {
    text-decoration: underline;
}

/* ============================================
   响应式布局
   ============================================ */

/* 大屏幕 - 4列 */
@media (min-width: 1200px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(4, 1fr);
        gap: 35px;
    }
}

/* 中等屏幕 - 3列 */
@media (min-width: 992px) and (max-width: 1199px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
}

/* 平板 - 2列 */
@media (min-width: 768px) and (max-width: 991px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .yanjing-product-brand,
    .yanjing-product-title,
    .yanjing-product-price {
        font-size: 12px;
    }
}

/* 手机 - 2列（小间距） */
@media (max-width: 767px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .yanjing-product-content {
        padding: 10px 0;
    }
    
    .yanjing-product-variations-info {
        padding: 10px 0;
    }
    
    .yanjing-product-brand {
        font-size: 11px;
    }
    
    .yanjing-product-title {
        font-size: 11px;
        min-height: 36px;
    }
    
    .yanjing-product-price {
        font-size: 11px;
    }
    
    .yanjing-product-badge {
        font-size: 10px;
        padding: 4px 8px;
        top: 10px;
        left: 10px;
    }
    
    .yanjing-wishlist-btn {
        width: 32px;
        height: 32px;
        top: 10px;
        right: 10px;
    }
    
    .yanjing-wishlist-btn svg {
        width: 16px;
        height: 16px;
    }
    
    /* 移动端变体样式调整 */
    .yanjing-variations-grid {
        gap: 5px;
    }
    
    .yanjing-variation-item {
        width: 18px;
        height: 18px;
    }
    
    .yanjing-variations-label {
        font-size: 11px;
        margin-bottom: 8px;
    }
}

/* 小手机 - 1列 */
@media (max-width: 480px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .yanjing-product-actions .button {
        padding: 10px 15px;
        font-size: 12px;
    }
}

/* ============================================
   愿望清单通知提示
   ============================================ */

.wishlist-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #ab8e66;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.3s ease;
}

.wishlist-notification.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.wishlist-notification-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #ab8e66;
}

.wishlist-notification-icon svg {
    width: 100%;
    height: 100%;
    fill: #ab8e66;
    stroke: #ab8e66;
}

/* 对勾图标样式 */
.wishlist-notification-icon svg polyline {
    fill: none;
    stroke: #ab8e66;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wishlist-notification-text {
    flex: 1;
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

/* 移动端样式 */
@media (max-width: 767px) {
    .wishlist-notification {
        bottom: 20px;
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(20px);
        min-width: calc(100% - 40px);
        max-width: 90%;
    }
    
    .wishlist-notification.show {
        transform: translateX(-50%) translateY(0);
    }
}

/* ============================================
   加载动画
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.yanjing-product-item {
    animation: fadeInUp 0.5s ease forwards;
}

/* 交错动画效果 */
.yanjing-product-item:nth-child(1) { animation-delay: 0.05s; }
.yanjing-product-item:nth-child(2) { animation-delay: 0.1s; }
.yanjing-product-item:nth-child(3) { animation-delay: 0.15s; }
.yanjing-product-item:nth-child(4) { animation-delay: 0.2s; }
.yanjing-product-item:nth-child(5) { animation-delay: 0.25s; }
.yanjing-product-item:nth-child(6) { animation-delay: 0.3s; }
.yanjing-product-item:nth-child(7) { animation-delay: 0.35s; }
.yanjing-product-item:nth-child(8) { animation-delay: 0.4s; }

/* ============================================
   无库存状态
   ============================================ */

.yanjing-product-item.outofstock {
    opacity: 0.6;
}

.yanjing-product-item.outofstock .yanjing-product-image::after {
    content: 'Out of Stock';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 15;
}

/* ============================================
   评分星级
   ============================================ */

.yanjing-product-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
    font-size: 12px;
}

.yanjing-product-rating .star-rating {
    font-size: 12px;
}

.yanjing-product-rating .woocommerce-review-link {
    color: #999;
    text-decoration: none;
    font-size: 11px;
}

.yanjing-product-rating .woocommerce-review-link:hover {
    color: #ab8e66;
}

