/* wwwroot/css/home.css */
/* ==============================================
                   全局通用样式
                   ============================================== */
.section-spacing {
    padding: 30px 0;
}

.section-title {
    margin-bottom: 40px;
    position: relative;
}

    .section-title::after {
        content: '';
        position: absolute;
        bottom: -10px;
        left: 50%;
        transform: translateX(-50%);
        width: 80px;
        height: 3px;
        background-color: #0d6efd;
    }

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

    .hover-lift:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    }

.transition-all {
    transition: all 0.3s ease;
}

/* ==============================================
                   1. 幻灯展示区 (Banners表图片)
                   ============================================== */
.carousel-section .carousel-item {
    position: relative;
    min-height: 300px;
    height: auto;
}

.carousel-section .carousel-img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
}

.carousel-section .carousel-caption {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    bottom: auto;
    right: auto;
    text-align: center;
    width: 80%;
    /* 统一文字样式，和备用Banner一致 */
    color: white !important;
}

    .carousel-section .carousel-caption h1 {
        font-size: 3.5rem;
        font-weight: 700;
        margin-bottom: 20px;
        text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    }

    .carousel-section .carousel-caption p.lead {
        font-size: 1.25rem;
        margin-bottom: 30px;
        text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    }

/* ==============================================
                   2. 主推品类区 (Categories表图片) - 移除ProductCount依赖
                   ============================================== */
.categories-section {
    background-color: #f8f9fa;
}

.category-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    background-color: white;
    height: 100%;
}

    .category-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
    }
/* 品类图片容器 */
.category-image-container {
/*    width: 150px;*/
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    background-color: rgba(13, 110, 253, 0.1);
/*    border-radius: 50%;*/
    overflow: hidden;
}

.category-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-card h5 {
    font-weight: 600;
    margin-bottom: 10px;
}

/* ==============================================
                   3. 推荐产品区 (Products表图片)
                   ============================================== */
.product-card {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: visible;
    height: 100%;
    position: relative;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15) !important;
}

.product-image-container {
    height: 220px;
    overflow: hidden;
    position: relative;
    background-color: #f8f9fa; /* 添加背景色 */
}

/* 产品状态标记容器 */
.product-badges-container {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 10;
}

/* 产品状态标记样式 */
.product-badge {
    padding: 5px 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

.product-badge.featured {
    background-color: #0d6efd;
}

.product-badge.new {
    background-color: #198754;
}

.product-badge.hot {
    background-color: #dc3545;
}

.product-badge.promotion {
    background-color: #fd7e14;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: scale-down;
    transition: transform 0.5s ease, opacity 0.3s ease;
/*    opacity: 0.9;*/
}

/* 图片加载完成后恢复完全不透明 - 使用!important确保覆盖 */
.product-image.loaded {
    opacity: 1 !important;
}

/* 图片加载错误时也恢复不透明 */
.product-image[alt] {
    background-color: #f8f9fa;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-info {
    padding: 20px;
    position: relative;
}

.product-name {
    font-weight: 600;
    margin-bottom: 10px;
    /* height: 40px; */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-description {
    font-size: 0.9rem;
    margin-bottom: 10px;
    /* height: 40px; */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0d6efd;
    margin-bottom: 10px;
}

.stock-status {
    font-size: 0.9rem;
    margin-bottom: 15px;
}

    .stock-status.有货 {
        color: #198754;
    }

    .stock-status.库存紧张 {
        color: #fd7e14;
    }

    .stock-status.缺货 {
        color: #dc3545;
    }

.product-actions {
    position: absolute;
    bottom: -50px;
    left: 0;
    right: 0;
    padding: 0 10px 20px;
    opacity: 0;
    transform: translateY(0);
    transition: all 0.3s ease;
}

.product-card:hover .product-actions {
    opacity: 1;
    transform: translateY(-50px);
}

/* ==============================================
                   动画效果 (统一管理)
                   ============================================== */
.animate-in {
    animation: fadeInUp 0.6s ease forwards;
}

.pulse-animation {
    animation: pulse 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* ==============================================
                   响应式适配
                   ============================================== */
@media (max-width: 992px) {

    .carousel-section .carousel-caption h1 {
        font-size: 2.8rem;
    }
}

@media (max-width: 768px) {
    .section-spacing {
        padding: 40px 0;
    }

    .carousel-section .carousel-caption h1 {
        font-size: 2.2rem;
    }

    .product-image-container {
        height: 180px;
    }
}

@media (max-width: 576px) {

    .carousel-section .carousel-caption h1 {
        font-size: 1.8rem;
    }

    .category-image-container {
        width: 60px;
        height: 60px;
    }

    .category-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .product-card, .category-card {
        border-radius: 8px;
    }
}