/* assets/css/style.css */

:root {
    --primary-color: #333;
    --accent-color: #007bff;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
}

body {
    background-color: var(--bg-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 80px; /* 为底部导航栏留出空间 */
    /* 移除点击高亮 (无蓝条效果) */
    -webkit-tap-highlight-color: transparent; 
}

/* 隐藏滚动条但保留滚动功能 */
::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* 站点 Logo 顶栏 */
.logo-bar {
    text-align: center;
    padding: 15px 10px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
}

.logo-bar img {
    max-height: 40px;
    max-width: 40%;
    object-fit: contain;
}

/* 语言切换按钮 (固定右上角) */
.lang-toggle {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1100;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
}

/* 宣传图 (横幅, 横屏) */
.banner-wrap {
    width: 100%;
    background: #fff;
}

.banner-wrap img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 260px;
    object-fit: cover;
}

/* 分类导航 (三级) */
.chips-row {
    display: flex;
    align-items: center;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.chips-row + .chips-row {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #eee;
}

/* 分类chip: 封面在名称上面 */
.cat-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 6px 14px;
    margin: 0 5px;
    border-radius: 14px;
    background: #f2f2f2;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.cat-chip .chip-cover {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    margin-bottom: 4px;
    background: #eee;
}

.cat-chip .chip-name {
    font-size: 12px;
    color: #666;
    line-height: 1.2;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cat-chip.active {
    background: var(--primary-color);
}

.cat-chip.active .chip-name {
    color: #fff;
}

/* 分类导航栏 */
.category-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 10px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.category-btn {
    display: inline-block;
    padding: 8px 20px;
    margin: 0 5px;
    border-radius: 20px;
    background: #eee;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.category-btn.active {
    background: var(--primary-color);
    color: #fff;
}

/* 产品橱窗网格 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 手机端默认2列 */
    gap: 10px;
    padding: 10px;
}

@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr); /* 平板/电脑端4列 */
        gap: 20px;
        padding: 20px;
        max-width: 1200px;
        margin: 0 auto;
    }
}

/* 产品卡片 */
.product-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    transition: transform 0.2s;
    cursor: pointer;
    position: relative;
    aspect-ratio: 1 / 1; /* 正方形展示 */
}

.product-card:active {
    transform: scale(0.98);
}

.product-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 产品名称浮层 (卡片底部) */
.product-name {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 18px 6px 6px;
    font-size: 12px;
    color: #fff;
    text-align: center;
    background: linear-gradient(transparent, rgba(0,0,0,0.65));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 底部固定导航栏 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom); /* 适配iPhone底部横条 */
}

.nav-item {
    text-align: center;
    color: #666;
    font-size: 12px;
    flex: 1;
    cursor: pointer;
    position: relative;
}

.nav-item i {
    font-size: 20px;
    display: block;
    margin-bottom: 4px;
}

.nav-item .badge {
    position: absolute;
    top: -5px;
    right: 25%;
    background: red;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 10px;
}

/* 弹窗样式优化 */
.modal-content {
    border-radius: 15px;
    border: none;
}

.carousel-item img {
    border-radius: 10px;
    width: 100%;
    height: 300px;
    object-fit: cover;
}
@media (min-width: 768px) {
    .carousel-item img {
        height: 500px;
    }
}

/* 输入框样式 */
.custom-input {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    width: 100%;
    margin-bottom: 10px;
}

/* PC 端布局：仅在桌面宽度启用，移动端沿用上面的原有规则 */
@media (min-width: 992px) {
    body {
        padding-bottom: 32px;
    }

    .logo-bar {
        padding: 20px 24px;
    }

    .logo-bar img {
        max-width: 320px;
        max-height: 64px;
    }

    .banner-wrap {
        text-align: center;
        background: #f1f3f5;
        border-bottom: 1px solid #e8eaed;
        overflow: hidden;
    }

    .banner-wrap a {
        display: block;
        line-height: 0;
    }

    .banner-wrap img {
        display: block;
        width: auto;
        max-width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
        margin: 0 auto;
    }

    .category-nav {
        padding: 14px 24px;
    }

    .category-nav .container-fluid {
        max-width: 1440px;
        margin: 0 auto;
        padding: 0;
    }

    .chips-row {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        overflow: visible;
        white-space: normal;
    }

    .chips-row + .chips-row {
        margin-top: 12px;
        padding-top: 12px;
    }

    .cat-chip {
        min-width: 88px;
        margin: 0;
        padding: 8px 14px;
        border-radius: 6px;
    }

    .cat-chip .chip-cover {
        width: 52px;
        height: 52px;
        border-radius: 6px;
    }

    .cat-chip .chip-name {
        max-width: 112px;
        font-size: 13px;
    }

    .product-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 20px;
        max-width: 1440px;
        padding: 28px 32px 48px;
    }

    .product-card {
        aspect-ratio: auto;
        border: 1px solid #eceff1;
        border-radius: 6px;
        box-shadow: 0 5px 16px rgba(15, 23, 42, 0.06);
        display: flex;
        flex-direction: column;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .product-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 9px 22px rgba(15, 23, 42, 0.11);
    }

    .product-card img {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
        object-fit: contain;
        background: #fff;
        padding: 8px;
    }

    .product-name {
        position: static;
        min-height: 48px;
        padding: 11px 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #212529;
        background: #fff;
        font-size: 14px;
        line-height: 1.35;
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .bottom-nav {
        left: auto;
        right: 24px;
        bottom: 24px;
        width: auto;
        padding: 6px;
        gap: 4px;
        border: 1px solid #e6e8eb;
        border-radius: 8px;
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    }

    .nav-item {
        flex: 0 0 auto;
        min-width: 82px;
        padding: 8px 10px;
        border-radius: 6px;
        font-size: 13px;
    }

    .nav-item:hover {
        background: #f3f5f7;
    }

    .product-modal-dialog {
        max-width: 1000px;
    }

    .product-modal-body {
        display: grid;
        grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
        min-height: 560px;
    }

    .product-carousel,
    .product-carousel .carousel-inner,
    .product-carousel .carousel-item {
        height: 100%;
    }

    .product-carousel .carousel-item img {
        width: 100%;
        height: 560px;
        border-radius: 0;
        object-fit: contain;
        background: #f7f8f9;
    }

    .product-actions {
        display: flex;
        flex-direction: column;
        justify-content: center;
        border-left: 1px solid #edf0f2;
    }
}
