/**
 * 收藏功能样式
 * 支持图标和按钮两种收藏样式
 */

/* 收藏按钮基础样式 */
.favorite-button,
.favorite-icon {
    position: relative;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    z-index: 10;
}

/* 图标样式收藏按钮 */
.favorite-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    backdrop-filter: blur(4px);
}

.favorite-icon:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.favorite-icon.is-favorited {
    background: rgba(220, 53, 69, 0.9);
    color: white;
}

.favorite-icon.is-favorited:hover {
    background: rgba(220, 53, 69, 1);
}

/* 按钮样式收藏按钮 */
.favorite-button {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    color: #6c757d;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    gap: 6px;
}

.favorite-button:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
    transform: translateY(-1px);
}

.favorite-button.is-favorited {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

.favorite-button.is-favorited:hover {
    background: #c82333;
    border-color: #bd2130;
}

/* 收藏图标 */
.favorite-button i,
.favorite-icon i {
    font-size: 16px;
    transition: all 0.3s ease;
}

.favorite-icon i {
    font-size: 18px;
}

/* 收藏文本 */
.favorite-text {
    font-size: 14px;
    margin-left: 4px;
}

/* 收藏计数 */
.favorite-count {
    font-size: 12px;
    margin-left: 4px;
    opacity: 0.8;
}

/* 加载状态 */
.favorite-button.loading,
.favorite-icon.loading {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}

.favorite-button.loading i,
.favorite-icon.loading i {
    animation: spin 1s linear infinite;
}

/* 动画效果 */
.favorite-button.animating i,
.favorite-icon.animating i {
    animation: heartBeat 0.8s ease-in-out;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.3); }
    28% { transform: scale(1); }
    42% { transform: scale(1.3); }
    70% { transform: scale(1); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 悬停提示 */
.favorite-button[data-tooltip]:hover::before,
.favorite-icon[data-tooltip]:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-top: 4px;
}

.favorite-button[data-tooltip]:hover::after,
.favorite-icon[data-tooltip]:hover::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

/* 消息提示样式 */
.favorite-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
    animation: slideIn 0.3s ease-out;
}

.favorite-message.success {
    border-left: 4px solid #28a745;
}

.favorite-message.success i {
    color: #28a745;
}

.favorite-message.error {
    border-left: 4px solid #dc3545;
}

.favorite-message.error i {
    color: #dc3545;
}

.favorite-message.hiding {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* 收藏列表样式 */
.user-favorites-list {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.user-favorites-list[data-columns="2"] {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.user-favorites-list[data-columns="3"] {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.user-favorites-list[data-columns="4"] {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.favorite-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

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

.favorite-item-image {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
}

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

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

.favorite-item-info {
    padding: 15px;
}

.favorite-item-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

.favorite-item-title a {
    color: #212529;
    text-decoration: none;
}

.favorite-item-title a:hover {
    color: #007bff;
}

.favorite-item-artist,
.favorite-item-price,
.favorite-item-date {
    margin: 4px 0;
    font-size: 14px;
    color: #6c757d;
}

.favorite-item-price {
    font-weight: 600;
    color: #28a745;
}

.favorite-item-link {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    transition: background 0.3s ease;
}

.favorite-item-link:hover {
    background: #0056b3;
}

/* 空状态样式 */
.favorites-empty,
.favorites-notice {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.favorites-empty i {
    font-size: 48px;
    margin-bottom: 20px;
    color: #dee2e6;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .favorite-icon {
        width: 35px;
        height: 35px;
        top: 8px;
        right: 8px;
    }
    
    .favorite-icon i {
        font-size: 16px;
    }
    
    .favorite-button {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .favorite-message {
        right: 10px;
        left: 10px;
        min-width: auto;
    }
    
    .user-favorites-list {
        grid-template-columns: 1fr;
    }
}

/* 产品卡片中的收藏按钮位置调整 */
.product-card .favorite-icon,
.auction-item .favorite-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
}

/* 详情页面收藏按钮样式 */
.artwork-title-wrapper .favorite-button,
.auction-title-wrapper .favorite-button {
    margin-left: 15px;
}