/**
 * 两山·茶管家 - 商城页面专属增强样式
 * 高端电商UI效果、商品卡片、筛选器、购物车等
 */

/* ==================== 商品卡片增强 ==================== */

.product-card {
    position: relative;
    background: white;
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all 0.4s var(--ease-smooth);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(46,125,50,0.05) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.product-card:hover {
    transform: translateY(-12px);
    box-shadow:
        0 12px 32px rgba(0,0,0,0.12),
        0 0 0 1px rgba(46,125,50,0.1);
}

.product-card:hover::before {
    opacity: 1;
}

/* 商品图片容器 */
.product-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 比例 */
    overflow: hidden;
    background: #f8f8f8;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease-smooth);
}

.product-card:hover .product-image {
    transform: scale(1.08);
}

/* 商品标签 */
.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #FF6B6B 0%, #FF5252 100%);
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(255,82,82,0.4);
    z-index: 2;
    animation: badgePulse 2s ease-in-out infinite;
}

.product-badge.new {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    box-shadow: 0 2px 8px rgba(46,125,50,0.4);
}

.product-badge.hot {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    box-shadow: 0 2px 8px rgba(245,124,0,0.4);
}

/* 快速操作按钮 */
.product-quick-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s var(--ease-smooth);
    z-index: 2;
}

.product-card:hover .product-quick-actions {
    opacity: 1;
    transform: translateX(0);
}

.quick-action-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.quick-action-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(46,125,50,0.3);
}

.quick-action-btn.active {
    background: var(--primary-color);
    color: white;
}

/* 商品信息区 */
.product-info {
    padding: 20px;
    position: relative;
    z-index: 1;
}

.product-category {
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-card:hover .product-name {
    color: var(--primary-color);
}

.product-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 评分星星 */
.product-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.stars {
    display: flex;
    gap: 2px;
}

.star {
    color: #FFB800;
    font-size: 14px;
}

.star.empty {
    color: #E0E0E0;
}

.rating-count {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 价格区域 */
.product-price-section {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.current-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.original-price {
    font-size: 14px;
    color: var(--text-disabled);
    text-decoration: line-through;
}

.discount-badge {
    padding: 4px 8px;
    background: linear-gradient(135deg, #FF5252 0%, #E53935 100%);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
}

/* 销量和库存 */
.product-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-item i {
    color: var(--primary-color);
}

/* 添加购物车按钮 */
.add-to-cart-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--ease-smooth);
    position: relative;
    overflow: hidden;
}

.add-to-cart-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.add-to-cart-btn:hover::before {
    left: 100%;
}

.add-to-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46,125,50,0.4);
}

.add-to-cart-btn:active {
    transform: translateY(0);
}

.add-to-cart-btn.added {
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
}

/* ==================== 筛选侧边栏增强 ==================== */

.filter-sidebar {
    background: white;
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    position: sticky;
    top: 80px;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--divider-color);
}

.filter-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.clear-filters {
    font-size: 13px;
    color: var(--primary-color);
    cursor: pointer;
    transition: color 0.2s ease;
}

.clear-filters:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.filter-group {
    margin-bottom: 28px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group-title i {
    color: var(--primary-color);
    font-size: 14px;
}

/* 复选框美化 */
.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-checkbox:hover {
    background: var(--gradient-tea-subtle);
}

.filter-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.filter-checkbox label {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
}

.filter-checkbox .count {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--background-gray);
    padding: 2px 8px;
    border-radius: 10px;
}

/* 价格滑块 */
.price-slider-container {
    padding: 16px 0;
}

.price-slider {
    width: 100%;
    height: 6px;
    background: var(--divider-color);
    border-radius: 3px;
    position: relative;
    margin: 24px 0;
}

.price-slider-fill {
    position: absolute;
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 3px;
}

.price-slider-thumb {
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.price-slider-thumb:hover {
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 3px 10px rgba(46,125,50,0.4);
}

.price-values {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.price-input-wrapper {
    flex: 1;
    position: relative;
}

.price-input-wrapper input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: all 0.3s ease;
}

.price-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46,125,50,0.1);
}

.price-separator {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ==================== 商品排序栏 ==================== */

.products-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: white;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.products-count {
    font-size: 14px;
    color: var(--text-secondary);
}

.products-count strong {
    color: var(--text-primary);
    font-weight: 600;
}

.sort-options {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sort-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-right: 4px;
}

.sort-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.sort-btn:hover {
    background: var(--gradient-tea-subtle);
    border-color: var(--primary-color);
}

.sort-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: var(--primary-color);
}

.view-toggle {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--background-gray);
    border-radius: var(--radius-md);
}

.view-btn {
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.view-btn:hover {
    color: var(--primary-color);
}

.view-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* ==================== 购物车浮动按钮 ==================== */

.floating-cart {
    position: fixed;
    bottom: 40px;
    right: 40px;
    z-index: 1000;
}

.cart-button {
    position: relative;
    width: 64px;
    height: 64px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(46,125,50,0.4);
    transition: all 0.3s var(--ease-smooth);
}

.cart-button:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 32px rgba(46,125,50,0.5);
}

.cart-button:active {
    transform: translateY(-2px) scale(1);
}

.cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FF5252 0%, #E53935 100%);
    color: white;
    font-size: 12px;
    font-weight: 700;
    border-radius: 12px;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(255,82,82,0.4);
    animation: cartBounce 0.5s var(--ease-bounce);
}

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

/* ==================== 空状态 ==================== */

.empty-state {
    text-align: center;
    padding: 80px 40px;
}

.empty-icon {
    font-size: 80px;
    color: var(--text-disabled);
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.empty-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.empty-action {
    padding: 12px 32px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.empty-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46,125,50,0.4);
}

/* ==================== 加载骨架屏 ==================== */

.product-skeleton {
    background: white;
    border-radius: var(--radius-xl);
    overflow: hidden;
    padding: 16px;
}

.skeleton-image {
    width: 100%;
    padding-top: 100%;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.skeleton-text {
    height: 16px;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 12px;
}

.skeleton-text.short {
    width: 60%;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ==================== 响应式优化 ==================== */

@media (max-width: 768px) {
    .product-quick-actions {
        opacity: 1;
        transform: translateX(0);
    }

    .floating-cart {
        bottom: 20px;
        right: 20px;
    }

    .cart-button {
        width: 56px;
        height: 56px;
        font-size: 20px;
    }

    .products-toolbar {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .sort-options {
        flex-wrap: wrap;
    }
}
