﻿:root {
    --primary-dark: #212529;
    --gray-light: #f8f9fa;
}

.product-card {
    transition: transform .2s ease, box-shadow .2s ease;
    border: none;
    border-radius: 8px;
    overflow: hidden;
}

.product-title {
    font-size: .90rem;
    font-weight: 700;
    margin-bottom: .5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4em;
    min-height: 2.8em;
    word-break: break-all;
}

.product-desc {
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4em;
    max-height: 2.8em;
    white-space: normal; /* 允许正常换行 */
    word-break: keep-all; /* 确保单词不会在中间被切断 */
    overflow-wrap: break-word; /* 只在必要时换行 */
}

.custom-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* 列表模式 */
.list-view .product-item {
    width: 100% !important;
}

.list-view .product-title {
    min-height: 1.5em;
}

.list-view .card {
    flex-direction: row;
}

.list-view .img-container {
    width: 150px;
    height: 150px;
    flex-shrink: 0;
}
/* 价格样式 */
.price-wrapper {
    min-height: 45px;
    display: flex;
    align-items: center;
}

.product-price-now {
    font-weight: 800;
    color: #dc3545;
    font-size: 1.1rem;
}

.product-price-old {
    text-decoration: line-through;
    color: #6c757d;
    font-size: .6rem;
    margin-left: 4px;
}

/* 防止卡片内的文字受链接影响变色 */
.product-card a.stretched-link {
    color: inherit;
    text-decoration: none;
}

/* 移除链接点击时的蓝色轮廓 */
.product-card a.stretched-link:focus {
    outline: none;
    box-shadow: none;
}

/* 悬停效果优化 */
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1) !important;
}

.discount-badge {
    font-size: .7rem;
    padding: 2px 5px;
    background-color: #FFE3F0;
    color: #dc3545;
    border-radius: 3px;
    font-weight: 700;
    margin-left: 5px;
}

/* 只有在 Grid 模式下显示多个，List 模式可以考虑缩小 */
.list-view .badge {
    font-size: 0.65rem;
    padding: 2px 4px;
}

/* 确保标签不会被 stretched-link 盖住 */
.badge {
    position: relative;
    z-index: 12;
}

/* 移动端优化 */
@media (max-width: 576px) {
    h5.header-title {
        font-size: .95rem !important;
        max-width: 40%;
    }

    .btn-group-sm > .btn, .btn-sm {
        padding: .25rem .4rem !important;
        font-size: .8rem;
    }

    #product-container:not(.list-view) .product-item {
        padding-left: 6px;
        padding-right: 6px;
    }

    #product-container:not(.list-view) .card-body {
        padding: 8px;
    }

    #product-container:not(.list-view) .product-price-now {
        font-size: .95rem;
    }
}

@media (min-width: 768px) {
    .list-view .img-container {
        width: 260px;
        height: auto;
    }
}
