/* products.css */
/* 商品列表容器 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 单个商品项 */
.product-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    background: #fff;
}

.product-item:hover {
    transform: translateY(-5px);
}

.product-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-bottom: 3px solid #f8f9fa;
}

.product-info {
    padding: 20px;
    text-align: center;
}

.product-id {
    font-size: 1.4rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 600;
}

/* 收藏按钮 */
.favorite-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorite-toggle.active {
    background: #ff4757;
    color: white;
}

/* 收藏侧边栏调整 */
#favoritesList .fav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    margin: 8px 0;
    background: #f8f9fa;
    border-radius: 6px;
    transition: background 0.2s;
}

#favoritesList .fav-link {
    color: #2c3e50;
    text-decoration: none;
    flex-grow: 1;
}

#favoritesList .fav-link:hover {
    color: #3498db;
}

#favoritesList .remove-btn {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 8px;
}

.empty-tip {
    color: #95a5a6;
    text-align: center;
    padding: 20px;
}


/* 响应式设计 */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
        padding: 30px 15px;
    }
    
    .product-image {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .favorites-sidebar {
        width: 100%;
        right: -100%;
    }
}
/* 收藏按钮激活状态 */
.favorite-btn.active,
.favorite-toggle.active {
    background: #ff4757;
    color: white;
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.favorite-btn .btn-text::after {
    content: "收藏商品";
}
.favorite-btn.active .btn-text::after {
    content: "已收藏";
}
.favorites-sidebar {
    position: fixed;
    right: -250px; /* 默认隐藏 */
    top: 75px;
    width: 150px;
    height: calc(100% - 75px);
    background: white;
    box-shadow: -2px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow-y: auto;
}

.favorites-sidebar.active {
    right: 0; /* 完全显示 */
}

/* 侧边栏触发标签 */
.sidebar-trigger {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: #ff4757;
    color: white;
    padding: 30px 6px;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    z-index: 999;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
    writing-mode: vertical-rl;
    text-orientation: upright;
}
