/**
 * 子比商城自定义分类模板样式 - 响应式版
 */

html, body {
    overflow: hidden;
    height: 100%;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.zcs-shop-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f5f5f5;
    overflow: hidden;
}

/* 顶部一级分类 */
.zcs-top-cat {
    height: 90px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    padding: 10px 10px 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
    flex-shrink: 0;
    border-bottom: 1px solid #eee;
}
.zcs-top-cat::-webkit-scrollbar { display: none; }
.zcs-top-cat-list { display: inline-flex; gap: 8px; }
.zcs-top-cat-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 65px;
    flex-shrink: 0;
    cursor: pointer;
    text-decoration: none;
}
.zcs-top-cat-icon,
.zcs-top-cat-icon-placeholder {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: #fff;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.03);
}
.zcs-top-cat-icon img { width: 28px; height: 28px; object-fit: cover; }
.zcs-top-cat-name { font-size: 12px; color: #333; }
.zcs-top-cat-item.active .zcs-top-cat-name { color: #07c160; font-weight: 500; }

/* 主体内容区 */
.zcs-main-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* 左侧二级分类 */
.zcs-sidebar {
    width: 85px;
    background-color: #f5f5f5;
    overflow-y: auto;
    flex-shrink: 0;
    scrollbar-width: thin;
}
.zcs-sidebar::-webkit-scrollbar { width: 3px; }
.zcs-sidebar::-webkit-scrollbar-track { background: #e0e0e0; border-radius: 3px; }
.zcs-sidebar::-webkit-scrollbar-thumb { background: #bbb; border-radius: 3px; }
.zcs-sidebar-item {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #666;
    position: relative;
    cursor: pointer;
    text-decoration: none;
}
.zcs-sidebar-item.active {
    background-color: #fff;
    color: #333;
    font-weight: 600;
}
.zcs-sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    height: 70%;
    width: 4px;
    background-color: #07c160;
    border-radius: 0 4px 4px 0;
}
.zcs-sidebar-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 5px;
}
.zcs-no-cat {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 12px;
}

/* 右侧内容区 */
.zcs-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
    position: relative;
}
.zcs-sticky-header { flex-shrink: 0; }

/* 横幅 */
.zcs-banner { padding: 10px; background: #fff; }
.zcs-banner img { width: 100%; height: auto; max-height: 200px; object-fit: contain; border-radius: 8px; display: block; background: #f5f5f5; }

/* 三级分类 */
.zcs-sub-nav { padding: 0 10px; background: #fff; }
.zcs-sub-nav-scroll {
    display: flex;
    align-items: center;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 10px 0;
    gap: 10px;
}
.zcs-sub-nav-scroll::-webkit-scrollbar { display: none; }
.zcs-sub-tag {
    flex-shrink: 0;
    padding: 5px 14px;
    font-size: 13px;
    color: #666;
    background: #f5f5f5;
    border-radius: 16px;
    cursor: pointer;
    text-decoration: none;
}
.zcs-sub-tag.active {
    background-color: #e6f7ff;
    color: #1890ff;
    border: 1px solid #91d5ff;
    font-weight: 500;
}
.zcs-expand-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #666;
    padding: 5px 10px;
    background: #fafafa;
    border-radius: 16px;
    border: none;
    cursor: pointer;
}
.zcs-expand-btn svg { width: 12px; height: 12px; margin-left: 4px; fill: #999; }

/* 商品列表 - 响应式网格布局 */
.zcs-product-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: #fff;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
    align-content: flex-start;
}

/* 商品卡片 */
.zcs-product-card {
    background: #fff;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    text-decoration: none;
    margin-bottom: 0;
    width: 100%;
}
.zcs-product-image {
    width: 100px;
    height: 100px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f0f0f0;
}
.zcs-product-image img { width: 100%; height: 100%; object-fit: cover; }
.zcs-product-info {
    flex: 1;
    margin-left: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.zcs-product-title {
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 500;
}
.zcs-product-tags { margin-top: 4px; }
.zcs-tag-promo {
    font-size: 10px;
    color: #ff6b00;
    background: #fff7e6;
    padding: 1px 4px;
    border-radius: 2px;
    margin-right: 4px;
    border: 0.5px solid #ffd591;
    display: inline-block;
}
.zcs-product-price-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-top: 8px;
}
.zcs-product-price {
    color: #ff4d4f;
    font-size: 18px;
    font-weight: bold;
}
.zcs-product-price span { font-size: 12px; }
.zcs-price-badge {
    font-size: 11px;
    color: #ff4d4f;
    border: 1px solid #ff4d4f;
    border-radius: 4px;
    padding: 0 3px;
    margin-left: 4px;
}
.zcs-cart-btn {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 26px;
    height: 26px;
    background: #07c160;
    border-radius: 50% 50% 50% 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 2px 5px rgba(7, 193, 96, 0.4);
    transform: rotate(-10deg);
    cursor: pointer;
}
.zcs-cart-btn span { transform: rotate(10deg); }

/* 加载更多 */
.zcs-load-more-wrap { text-align: center; margin-top: 20px; padding: 10px; }
.zcs-load-more-btn {
    padding: 12px 30px;
    background: #fff;
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
}
.zcs-load-more-btn:hover { background: #ff6b6b; color: #fff; }

/* 暂无商品 */
.zcs-no-products { text-align: center; padding: 50px; background: #fff; border-radius: 12px; color: #999; }

/* 弹窗 - 覆盖整个右侧区域 */
.zcs-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: 8px;
}
.zcs-modal-overlay.show { display: block; opacity: 1; }
.zcs-modal-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 0 0 12px 12px;
    padding: 15px;
    max-height: 60vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.zcs-modal-overlay.show .zcs-modal-content { transform: translateY(0); }
.zcs-modal-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.zcs-modal-tag {
    padding: 8px 16px;
    background: #f5f5f5;
    border-radius: 20px;
    font-size: 13px;
    color: #333;
    text-decoration: none;
}
.zcs-modal-tag.selected { background: #e8f8ee; color: #07c160; font-weight: 600; }
.zcs-close-modal-hint { text-align: center; margin-top: 15px; color: #999; font-size: 12px; }

/* 响应式断点 */
@media (max-width: 768px) {
    .zcs-product-list {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 8px;
        padding: 8px;
    }
    .zcs-product-image {
        width: 80px;
        height: 80px;
    }
    .zcs-product-title {
        font-size: 13px;
    }
    .zcs-product-price {
        font-size: 16px;
    }
    .zcs-product-card {
        padding: 8px;
    }
    .zcs-product-info {
        margin-left: 8px;
    }
}

@media (max-width: 480px) {
    .zcs-product-list {
        grid-template-columns: 1fr;
    }
    .zcs-product-image {
        width: 90px;
        height: 90px;
    }
}