/* 公共商品卡片样式 - 用于首页和商品分类页面 */

/* 商品卡片样式 */
.product-item.new-style {
    background: #fff;
    border-radius: 8px 8px 12px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    width: 100%;
    min-width: 0;
    min-height: 210px;
    padding: 24px 0 0 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    transition: box-shadow .2s;
    border: 1px solid #1769AA;
    box-sizing: border-box;
}

.product-item.new-style:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    border-color: #2196f3;
}

.product-img-wrap {
    width: 100%;
    min-height: 160px;
    height: 160px;
    flex: 0 0 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    padding: 0 24px;
    box-sizing: border-box;
    background-color: #ffffff;
    overflow: hidden;
}

.product-img-wrap img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.product-title {
    width: 100%;
    min-width: 0;
    background: #1769aa;
    color: #fff;
    font-size: 14px;
    text-align: center;
    padding: 10px 8px;
    box-sizing: border-box;
    border-radius: 0 0 8px 8px;
    font-weight: 500;
    letter-spacing: 0;
    transition: background .2s;
    margin-top: auto;
    flex-shrink: 0;
    overflow: hidden;
}

.product-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    width: 100%;
}

.product-item.new-style:hover .product-title {
    background: #2196f3;
}

/* 分类标题栏样式 */
.category-title-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    background: linear-gradient(90deg, #93d7f7 0%, #96e0f3 100%);
    padding: 0 16px;
    height: 48px;
    border-radius: 8px 8px 0 0;
    position: relative;
    box-shadow: 0 2px 8px rgba(252, 182, 159, 0.10);
}

.category-title-center {
    grid-column: 2;
    justify-self: center;
    max-width: 100%;
    text-align: center;
    color: #222;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 1px;
    font-style: italic;
    cursor: pointer;
    transition: color .2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-title-center:hover {
    color: #1769aa;
}

/* 分类标题悬停商品弹窗 */
.category-block {
    position: relative;
    z-index: 1;
}

.category-block.is-popup-active {
    z-index: 300;
}

.category-hover-zone {
    position: relative;
}

.category-popup-anchor {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    z-index: 2;
}

.category-products-popup {
    position: relative;
    z-index: 2;
    display: none;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #b8dff5;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(23, 105, 170, 0.18);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-12px);
    visibility: hidden;
    transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s ease;
    will-change: opacity, transform;
}

.category-products-popup.is-mounted {
    pointer-events: auto;
}

.category-products-popup.is-open {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.category-products-popup-body {
    padding: 12px;
}

.category-products-popup-bar {
    display: none;
}

.category-products-popup-empty {
    padding: 24px 12px;
    text-align: center;
    color: #8c8c8c;
    font-size: 13px;
}

.category-products-popup-list {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    max-height: min(420px, 60vh);
    overflow-y: auto;
    align-items: start;
    scrollbar-width: thin;
    scrollbar-color: #b8dff5 transparent;
}

.category-products-popup-list::-webkit-scrollbar {
    width: 6px;
}

.category-products-popup-list::-webkit-scrollbar-track {
    background: transparent;
}

.category-products-popup-list::-webkit-scrollbar-thumb {
    background: #b8dff5;
    border-radius: 6px;
}

.category-products-popup-list::-webkit-scrollbar-thumb:hover {
    background: #93d7f7;
}

.category-products-popup-list .product-link {
    width: 100%;
    min-width: 0;
    display: block;
    text-decoration: none;
}

.category-products-popup-list .product-item.new-style {
    width: 100%;
    min-height: 0;
    height: auto;
    padding: 8px 6px 6px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border-radius: 6px;
    box-shadow: none;
    border-color: #e8e8e8;
}

.category-products-popup-list .product-item.new-style:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: #b8dff5;
}

.category-products-popup-list .product-img-wrap {
    width: 100%;
    min-width: 0;
    height: 100px;
    min-height: 100px;
    flex: 0 0 100px;
    padding: 6px;
    margin: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-products-popup-list .product-title {
    flex: none;
    min-width: 0;
    background: transparent;
    color: #333;
    font-size: 12px;
    line-height: 1.3;
    padding: 4px 2px 0;
    margin-top: 0;
    border-radius: 0;
    text-align: center;
    font-weight: 400;
}

.category-products-popup-list .product-item.new-style:hover .product-title {
    background: transparent;
    color: #1769aa;
}

.category-products-popup-list .product-img-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.category-products-popup-list .product-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-more {
    grid-column: 3;
    justify-self: end;
    color: #2196f3;
    font-size: 15px;
    text-decoration: none;
    font-weight: 500;
    transition: color .2s;
}

.category-more:hover {
    color: #1769aa;
    text-decoration: underline;
}

/* 首页分类商品网格 */
.category-product-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-top: 2px;
    padding: 2px 0 16px 0;
}

.category-product-grid .product-link {
    min-width: 0;
    display: flex;
}

.product-link {
    text-decoration: none;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .category-title-center{
        font-size: 16px;
    }

    .category-products-popup-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        max-height: 280px;
    }

    .category-products-popup-list .product-img-wrap {
        width: 100%;
        min-width: 0;
        min-height: 88px;
        height: 88px;
        flex: 0 0 88px;
        padding: 6px;
    }

    .category-products-popup-list .product-title {
        font-size: 11px;
        padding: 3px 2px 0;
        text-align: center;
    }

    .category-products-popup-body {
        padding: 8px;
    }

    /* 手机端「更多」全屏弹窗 */
    .category-products-popup.is-sheet {
        position: fixed;
        inset: 0;
        z-index: 1100;
        width: 100%;
        height: 100%;
        max-height: none;
        border: none;
        border-radius: 0;
        box-shadow: none;
        overflow: hidden;
        flex-direction: column;
        opacity: 1;
        visibility: visible;
        transform: translateY(100%);
        transition: transform 0.28s ease;
    }

    .category-products-popup.is-sheet.is-open {
        transform: translateY(0);
    }

    .category-products-popup.is-sheet .category-products-popup-bar {
        display: flex;
        align-items: center;
        flex: 0 0 44px;
        height: 44px;
        padding: 0 8px;
        border-bottom: 1px solid #eef0f3;
        background: #fff;
        box-sizing: border-box;
    }

    .category-products-popup-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        margin-right: 4px;
        border: none;
        background: transparent;
        color: #334155;
        font-size: 18px;
        cursor: pointer;
        flex-shrink: 0;
    }

    .category-products-popup-title {
        min-width: 0;
        font-size: 16px;
        font-weight: 700;
        color: #1e293b;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .category-products-popup.is-sheet .category-products-popup-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        padding: 10px;
        background: #f7f8fa;
    }

    .category-products-popup.is-sheet .category-products-popup-list {
        flex: 1 1 auto;
        max-height: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        align-content: start;
        gap: 8px;
    }

    .category-products-popup.is-sheet .category-products-popup-empty {
        margin: auto;
    }

    body.category-sheet-open {
        overflow: hidden;
    }

    .product-item.new-style {
        width: 100%;
        max-width: 100%;
        min-height: 170px;
        padding: 12px 0px 0 0px;
    }
    
    .product-img-wrap {
        width: 100%;
        min-height: 120px;
        height: 120px;
        flex: 0 0 120px;
        padding: 0 12px;
    }
    
    .product-title {
        font-size: 16px;
        padding: 6px 0 4px 0;
    }

    .category-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 10px 0;
    }
}
