/* ============================================================
   产品列表-4 (productList_4) 专属样式
   还原自 eco-tableware.com 产品列表页(C:/tmp/eco-site/category.html 的 .products 布局):
     左栏 = Categories 分类树 + Hot Products(图+名列表), 右栏 = 标题条 + 卡片网格 + 翻页。
   实例级样式(颜色/字号/间距/模块宽度)由模板内联输出, 这里只放固定版式。
   引入方: templates/sitebuilder/modules/productList_4.html

   与产品列表-3 的有意偏差:
     1) 右栏是卡片网格(PC 固定 3 列 / 移动 2 列), 不是表格; 卡片只有图 + 产品名。
     2) 产品名颜色/字号是本模块配置项(不走全局配置-产品-产品名称), 模板内联输出。
   ============================================================ */

.ly_product_list_4 a { text-decoration: none; color: inherit; }
.ly_product_list_4 img { max-width: 100%; }

/* ---------- 整体两栏布局 ---------- */
.ly_product_list_4 .pl4_wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
}
.ly_product_list_4 .products_category_wrapper { width: 22%; margin-right: 3%; }
.ly_product_list_4 .list_wrapper { flex: 1; width: 75%; }
/* 关闭左侧分类时列表占满整行 */
.ly_product_list_4 .list_wrapper.full { width: 100%; }

/* ---------- 左栏标题条(Categories / Hot Products) ----------
   原站 .wrap-menu .cate-top: 高 47px 绿底 #94c33b 白字 18px Verdana(热销标题同款) */
.ly_product_list_4 .pl4_box_title {
    height: 47px;
    line-height: 47px;
    padding: 0 15px;
    box-sizing: border-box;
    background-color: #94c33b;
    font-size: 18px;
    font-family: Verdana, Arial;
    text-overflow: ellipsis;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    word-break: break-word;
}

/* ---------- 左侧分类树 ----------
   子级默认收起(.next_box 上由 JS 加 .closed), 点击有子级的父项展开/收起,
   无子级的项点击跳分类页; 缩进对齐原站 .wrap-menu: 一级 .name padding-left 15px
   (与标题条 text-indent 15px 同值) / 二级 .sublist li a 42px / 三级 li.v3 a 52px */
.ly_product_list_4 .pl4_cate_box { margin-bottom: 20px; }
.ly_product_list_4 .pl4_cate_box .cate_item {
    display: inline-block;
    position: relative;
    line-height: 32px;
    font-size: 14px;
    padding-right: 20px;
    box-sizing: border-box;
}
.ly_product_list_4 .pl4_cate_box .cate_item:hover { text-decoration: none; }
.ly_product_list_4 .pl4_cate_box .cate_item h2,
.ly_product_list_4 .pl4_cate_box .cate_item h3,
.ly_product_list_4 .pl4_cate_box .cate_item h4 {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}
.ly_product_list_4 .pl4_cate_box .category_box { padding: 8px 0; }
.ly_product_list_4 .pl4_cate_box .category_box .item_title {
    margin: 5px 0;
    position: relative;
}
/* 子级容器不带缩进, 缩进落在各级链接自身的 padding-left 上(取原站绝对值,
   保证一级与标题条 15px 对齐、二级 42px / 三级 52px 递进不受容器嵌套影响);
   .closed 由 JS 加: 子级默认收起, 点父项展开/收起 */
.ly_product_list_4 .pl4_cate_box .category_box .next_box.closed { display: none; }
.ly_product_list_4 .pl4_cate_box .category_box .one_title .cate_item { padding-left: 15px; }
.ly_product_list_4 .pl4_cate_box .category_box .sec_box .cate_item { padding-left: 42px; }
.ly_product_list_4 .pl4_cate_box .category_box .third_box .cate_item { padding-left: 52px; }
/* 当前选中的分类(点击后由 JS 加 cur), 颜色由模板内联的 .cate_item.cur 规则给, 这里只加粗 */
.ly_product_list_4 .pl4_cate_box .category_box .cate_item.cur { font-weight: 600; }
/* 租户还没建产品分类时的占位文案 */
.ly_product_list_4 .pl4_cate_box .category_box .category_empty {
    padding: 10px 0;
    font-size: 14px;
    color: #999;
}

/* ---------- 左侧 Hot Products ----------
   列表容器外框 + 内边距取原站 .left_outer .hot_pro .list(style.css:117):
   border 1px solid #eee + padding 25px 19px */
.ly_product_list_4 .pl4_hot_box .pl4_hot_list {
    padding: 25px 19px;
    border: 1px solid #eee;
    box-sizing: border-box;
}
.ly_product_list_4 .pl4_hot_box .pl4_hot_list .pl4_hot_item {
    display: flex;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #e8e8e8;
}
.ly_product_list_4 .pl4_hot_box .pl4_hot_list .pl4_hot_item:last-child { border-bottom: none; }
.ly_product_list_4 .pl4_hot_box .pl4_hot_list .pl4_hot_item .pic {
    flex: none;
    margin-right: 12px;
    width: 80px;
    height: 80px;
    background-color: #fff;
    position: relative;
    display: block;
    overflow: hidden;
}
.ly_product_list_4 .pl4_hot_box .pl4_hot_list .pl4_hot_item .pic img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ly_product_list_4 .pl4_hot_box .pl4_hot_list .pl4_hot_item .pic img.pic_default {
    object-fit: contain;
    background: #f7f7f7;
}
.ly_product_list_4 .pl4_hot_box .pl4_hot_list .pl4_hot_item .g_name {
    flex: 1;
    line-height: 18px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}
/* 移动端才显示的底部 Hot Products */
.ly_product_list_4 .list_bottom_box { display: none; }

/* ---------- 右栏横幅图(同 news_list_4 的 banner 版式)
   第四轮验收: 按图片实际分辨率展示 —— 不拉伸不裁剪, 图自然尺寸,
   超宽才被 max-width:100% 兜底缩放, 高度自适应 ---------- */
.ly_product_list_4 .list_wrapper .banner { margin-bottom: 24px; }
.ly_product_list_4 .list_wrapper .banner img { display: block; width: 100%; height: auto; }

/* ---------- 右栏标题条 + 移动端分类触发 ---------- */
.ly_product_list_4 .list_wrapper .top_title {
    height: 44px;
    line-height: 44px;
    overflow: hidden;
    font-size: 20px;
    color: #222222;
    text-transform: uppercase;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    word-break: break-word;
    position: relative;
}
.ly_product_list_4 .list_wrapper .top_title h1 {
    display: inline;
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}
/* 产品数量与标题(h1)同一套样式: 字号/字重/颜色/大小写全继承标题条, 只保留与标题的间距 */
.ly_product_list_4 .list_wrapper .top_title .pro_count {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    text-transform: inherit;
    margin-left: 10px;
}
.ly_product_list_4 .list_wrapper .top_title i { display: none; }

/* ---------- 产品网格: PC 固定 3 列, 卡片 = 图 + 产品名 ---------- */
.ly_product_list_4 .list_box { margin-top: 24px; }
.ly_product_list_4 .list_box .pl4_grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}
.ly_product_list_4 .list_box .pl4_grid .pl4_card .pic_box {
    display: block;
    position: relative;
    width: 100%;
    height: 0;
    padding-top: 100%;
    overflow: hidden;
    background-color: #fff;
}
.ly_product_list_4 .list_box .pl4_grid .pl4_card .pic_box img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s, opacity .4s;
}
.ly_product_list_4 .list_box .pl4_grid .pl4_card .pic_box img.pic_default {
    object-fit: contain;
    background: #f7f7f7;
}
/* 图片指向: 渐变放大 / 切换第二张图 */
.ly_product_list_4 .list_box .pl4_grid .pic_box img:nth-of-type(2) { opacity: 0; z-index: -1; }
.ly_product_list_4 .list_box .pl4_grid .pic_box.hover_scale_img:hover img {
    transform: scale(1.05);
    -webkit-transform: scale(1.05);
    -ms-transform: scale(1.05);
}
.ly_product_list_4 .list_box .pl4_grid .pic_box.switch_second_img:hover img:nth-of-type(2) { opacity: 1; z-index: 1; }
/* 老草稿或异常数据若没有输出第二张图，也不能把唯一的主图隐藏成空白 */
.ly_product_list_4 .list_box .pl4_grid .pic_box.switch_second_img:has(img:nth-of-type(2)):hover img:nth-of-type(1) {
    opacity: 0;
    z-index: -1;
}
/* 产品名: 居中, 单行超出省略; 颜色/字号由模板内联输出 */
.ly_product_list_4 .list_box .pl4_grid .pl4_card .g_name {
    display: block;
    margin-top: 12px;
    line-height: 20px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- 翻页 ----------
   还原原站 .ueeshop_responsive_turn_page.s1(style.css 212-219):
   页码块 47x47 边框 #e6e6e6 圆角 2px 字 16px; 当前页 = 绿底 #94c33b 白字;
   普通页灰底 #f5f7f6(responsive.css:62 span 背景)黑字; hover 红底白字为定制口径
   (原站分页无 hover 变红, 红取 #DE3232 与详情缩略图选中边框同色, style.css:184)。
   底部不留白(margin-bottom: 0): 模块下间距由模板内联的 padding-bottom 驱动(默认 = 上间距),
   分页不再自带 60px 底部留白, 避免与模块下间距叠加成双倍空隙。 */
.ly_product_list_4 .turn_page { margin: 30px 0 0; text-align: center; }
.ly_product_list_4 .turn_page a,
.ly_product_list_4 .turn_page span {
    display: inline-block;
    min-width: 47px;
    height: 47px;
    line-height: 45px;
    margin: 0 7px;
    padding: 0 6px;
    border: 1px solid #e6e6e6;
    border-radius: 2px;
    box-sizing: border-box;
    font-size: 16px;
    color: #333;
    /* 分页三种状态背景色走实例配置(默认 = 原样式), 边框跟随背景色保持一致观感 */
    background-color: var(--pl4-pager-bg, #f5f7f6);
    text-align: center;
}
.ly_product_list_4 .turn_page a:hover {
    border-color: var(--pl4-pager-hover-bg, #de3232);
    background-color: var(--pl4-pager-hover-bg, #de3232);
    color: #fff;
}
.ly_product_list_4 .turn_page span.cur {
    border-color: var(--pl4-pager-active-bg, #94c33b);
    background-color: var(--pl4-pager-active-bg, #94c33b);
    color: #fff;
    cursor: default;
}
.ly_product_list_4 .turn_page:empty { display: none; }

/* ---------- 无数据 ---------- */
.ly_product_list_4 .search_no_data { padding: 40px 0; color: #333; text-align: center; }

/* JS 控制的显隐(空态), 用 class 而不是 style 便于覆盖 */
.ly_product_list_4 .pl4_hide { display: none !important; }

/* 编辑态描边(hover/选中)与 cursor 统一在 editor.css 的 .deco-module::before 覆盖层里,
   本文件不再重复一套 outline: outline 会被模块内贴边的元素盖住一段。 */

/* 编辑态不再有专属默认 padding-top: 模块上下间距由配置的 pcSpacing 驱动,
   站点渲染已补库默认(上下 50px), 足以容纳编辑态左上角的模块名 label, 不需要再垫高。 */

/* ============================================================
   移动端
   ============================================================ */
@media screen and (max-width: 1000px) {
    .ly_product_list_4 .pl4_wrapper { flex-wrap: wrap; width: 100%; }

    /* 分类面板改为浮层, 由标题条上的箭头触发(居中 92% 宽, 与产品列表-3 同口径) */
    .ly_product_list_4 .products_category_wrapper {
        display: none;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        background-color: #fff;
        z-index: 10006;
        width: 92%;
        box-sizing: border-box;
        box-shadow: 5px 5px 5px 0 rgb(0 0 0 / 30%);
    }
    .ly_product_list_4 .products_category_wrapper.show { display: block; }
    .ly_product_list_4 .products_category_wrapper .pl4_cate_box .pl4_box_title { display: none; }
    .ly_product_list_4 .products_category_wrapper .pl4_cate_box .category_box {
        padding: 10px 14px;
        max-height: 225px;
        overflow: auto;
    }
    /* 左侧 Hot Products 在移动端隐藏, 改由 list_bottom_box 显示 */
    .ly_product_list_4 .products_category_wrapper .pl4_hot_box { display: none; }
    .ly_product_list_4 .pl4_hot_box.list_bottom_box { display: block; margin-top: 25px; }

    .ly_product_list_4 .list_wrapper { width: 100%; flex: auto; }
    .ly_product_list_4 .list_wrapper .top_title {
        padding: 0 35px 0 15px;
        height: 43px;
        line-height: 41px;
        border: 1px solid #e8e8e8;
        box-sizing: border-box;
        margin-top: 12px;
    }
    .ly_product_list_4 .list_wrapper .top_title i {
        display: block;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        right: 14px;
        width: 16px;
        height: 16px;
        cursor: pointer;
        font-style: normal;
    }
    .ly_product_list_4 .list_wrapper .top_title i::before,
    .ly_product_list_4 .list_wrapper .top_title i::after {
        content: '';
        position: absolute;
        background-color: currentColor;
    }
    .ly_product_list_4 .list_wrapper .top_title i::before { top: 7px; left: 2px; width: 12px; height: 2px; }
    .ly_product_list_4 .list_wrapper .top_title i::after { top: 2px; left: 7px; width: 2px; height: 12px; }
    .ly_product_list_4 .list_wrapper .top_title i.cur::after { display: none; }

    /* 网格移动端 2 列, 间距收紧 */
    .ly_product_list_4 .list_box .pl4_grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px 12px;
    }
    .ly_product_list_4 .list_box .pl4_grid .pl4_card .g_name { margin-top: 8px; line-height: 18px; }

    .ly_product_list_4 .turn_page { margin: 20px 0 0; }
    .ly_product_list_4 .search_no_data { padding: 20px 0; }
}
