/* gridproducts.html 页面样式 */

.shorelev-menu-item-title:hover, .shorelev-item-title:hover { color: #E8870C !important; transition: all 0.3s ease; }
.contact-item:hover { color: #E8870C !important; }
.contact-item:hover span { color: #E8870C !important; }

/* 移动端专属按钮 - PC端隐藏 */
.product-mobile-actions {
    display: none;
}
.mobile-all-products {
    display: none;
}

/* ========== 左侧分类树 ========== */
.category-sidebar {
    width: 240px;
    min-width: 240px;
    background: #fff;
    border-radius: 6px;
    overflow: visible;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.category-sidebar::-webkit-scrollbar {
    width: 4px;
}
.category-sidebar::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}
.category-sidebar::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

.category-header {
    background: linear-gradient(135deg, #E8870C 0%, #B57309 100%);
    color: #fff;
    padding: 13px 16px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.3s ease;
    position: sticky;
    top: 0;
    z-index: 10;
    border-radius: 6px 6px 0 0;
}

.category-header:hover {
    background: linear-gradient(135deg, #C96E08 0%, #9A5F07 100%);
}

.category-header i {
    transition: transform 0.3s ease;
}

.category-tree {
    padding: 0;
    list-style: none;
    margin: 0;
}

.category-tree-item {
    border-bottom: 1px solid #f0f0f0;
}

.category-tree-item:last-child {
    border-bottom: none;
}

/* 一级分类 */
.category-tree-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    user-select: none;
}

.category-tree-header:hover {
    background: #FFF8ED;
}

.category-tree-header.active {
    background: #FEF0D5;
    border-left: 3px solid #E8870C;
}

.category-tree-header .category-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.category-tree-header .category-name i.folder-icon {
    color: #E8870C;
    font-size: 14px;
}

.category-tree-header .toggle-icon {
    color: #999;
    font-size: 11px;
    transition: transform 0.3s ease;
    transform: rotate(180deg);
}

.category-tree-header.expanded .toggle-icon {
    transform: rotate(0deg);
}

/* 二级分类容器 */
.category-tree-children {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    background: #fafafa;
    transition: max-height 0.4s ease-out;
}

.category-tree-children.show {
    max-height: 2000px;
    transition: max-height 0.6s ease-in;
}

/* 二级分类项 */
.category-child-wrapper {
    border-bottom: 1px solid #eee;
}

.category-child-wrapper:last-child {
    border-bottom: none;
}

.category-child-item {
    padding: 10px 16px 10px 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #555;
    border-left: 3px solid transparent;
    user-select: none;
}

.category-child-item:hover {
    background: #FFF8ED;
    color: #E8870C;
}

.category-child-item.active {
    background: #FEF0D5;
    color: #E8870C;
    border-left-color: #E8870C;
    font-weight: 500;
}

.category-child-item .child-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-child-item .child-icon {
    font-size: 5px;
    color: #E8870C;
}

.category-child-item .child-toggle {
    font-size: 10px;
    color: #999;
    transition: transform 0.3s ease;
    transform: rotate(180deg);
}

.category-child-item.expanded .child-toggle {
    transform: rotate(0deg);
}

/* 三级分类容器 */
.category-grandchildren {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    background: #f5f5f5;
    transition: max-height 0.4s ease-out;
}

.category-grandchildren.show {
    max-height: 1000px;
    transition: max-height 0.5s ease-in;
}

.category-grandchild-item {
    padding: 9px 16px 9px 44px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    color: #777;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-grandchild-item:hover {
    color: #E8870C;
    background: #FFF8ED;
}

.category-grandchild-item.active {
    color: #E8870C;
    font-weight: 500;
    background: #FEF0D5;
}

.category-grandchild-item .grandchild-dot {
    width: 4px;
    height: 4px;
    background: #ccc;
    border-radius: 50%;
    flex-shrink: 0;
}

.category-grandchild-item:hover .grandchild-dot,
.category-grandchild-item.active .grandchild-dot {
    background: #E8870C;
}

/* ========== 主内容区域布局 ========== */
.products-layout {
    display: flex;
    gap: 24px;
    padding: 20px 0;
}

.products-main {
    flex: 1;
    min-width: 0;
}

/* ========== 工具栏 ========== */
.shop-top-control {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    margin-bottom: 16px;
    flex-wrap: nowrap;
}

/* 搜索框 - 自适应填满剩余空间 */
.product-search-form {
    display: flex;
    align-items: center;
    position: relative;
    flex: 1;
    min-width: 160px;
    max-width: 320px;
}

.product-search-input {
    padding: 8px 36px 8px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 13px;
    width: 100%;
    transition: all 0.2s ease;
    background: #fafafa;
    color: #333;
}

.product-search-input:focus {
    outline: none;
    border-color: #E8870C;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(232, 135, 12, 0.1);
}

.product-search-input::placeholder {
    color: #aaa;
    font-size: 12px;
}

/* 搜索图标 */
.search-icon-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s ease;
}

.search-icon-btn:hover {
    color: #E8870C;
}

/* 下拉框区域 */
.shop-top-control .select-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 !important;
    border-right-width: 0px;
    flex-shrink: 0;
}

.shop-top-control .select-form .title {
    font-size: 12px;
    color: #888;
    font-weight: 500;
    white-space: nowrap;
}

.shop-top-control .chosen-container {
    min-width: 160px !important;
}

.shop-top-control .chosen-container .chosen-single {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    background: #fafafa;
    height: auto;
    line-height: 18px;
    font-size: 12px;
}

.shop-top-control .chosen-container-active .chosen-single {
    border-color: #E8870C;
    box-shadow: 0 0 0 2px rgba(232, 135, 12, 0.1);
}

.shop-top-control .chosen-container .chosen-drop {
    border-radius: 4px;
    border-color: #e0e0e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.shop-top-control .chosen-container .chosen-results li.highlighted {
    background: #E8870C;
}

/* 视图切换按钮 */
.grid-view-mode {
    display: flex;
    align-items: center;
}

.grid-view-mode .inner {
    display: flex;
    gap: 4px;
}

.grid-view-mode .modes-mode {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.grid-view-mode .modes-mode:hover {
    border-color: #E8870C;
}

.grid-view-mode .modes-mode.active {
    background: #E8870C;
    border-color: #E8870C;
}

.grid-view-mode .modes-mode.active span {
    background: #fff;
}

/* ========== 产品列表加载/空状态 ========== */
.product-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #999;
    grid-column: 1 / -1;
    min-height: 400px;
}

.product-loading i {
    font-size: 40px;
    animation: spin 1s linear infinite;
    color: #E8870C;
    margin-right: 15px;
}

.product-loading span {
    font-size: 15px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.product-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: #999;
    grid-column: 1 / -1;
    flex-direction: column;
    min-height: 400px;
}

.product-empty i {
    font-size: 56px;
    margin-bottom: 16px;
    color: #e0e0e0;
}

.product-empty h4 {
    font-size: 16px;
    color: #666;
    margin: 0 0 8px 0;
}

.product-empty p {
    font-size: 13px;
    color: #999;
    margin: 0;
}

/* ========== 分页 ========== */
.product-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px 0;
    margin-top: 16px;
}

.pagination-btn {
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    color: #333;
}

.pagination-btn:hover:not(:disabled) {
    background: #E8870C;
    color: #fff;
    border-color: #E8870C;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: #E8870C;
    color: #fff;
    border-color: #E8870C;
}

.pagination-info {
    color: #666;
    font-size: 13px;
    margin: 0 12px;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ========== 产品卡片 ========== */
/* 修复YOU MAY ALSO LIKE容器溢出 */
.related .owl-stage-outer,
.up-sells .owl-stage-outer {
    overflow: visible !important;
}

#productList .product-item {
    display: flex;
    flex-direction: column;
    min-height: 320px;
    float: left !important;
    clear: none !important;
}
#productList .product-item .product-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 380px;
}
#productList .product-item .product-thumb {
    flex-shrink: 0;
}
#productList .product-item .product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 80px;
}
#productList .product-item .product-name {
    min-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 确保分页信息显示 */
#paginationInfo {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #666 !important;
    background: transparent !important;
}

/* Product Introduction */
.product-intro {
    font-size: 12px;
    color: #666;
    margin: 5px 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 清除浮动 */
#productList .product-item:nth-child(4n+1) {
    clear: left !important;
}

/* ========== 响应式 ========== */
@media (max-width: 1199px) {
    #productList .product-item:nth-child(3n+1) {
        clear: left !important;
    }
    .category-sidebar {
        width: 220px;
        min-width: 220px;
    }
    .product-search-form {
        max-width: 240px;
    }
}

@media (max-width: 991px) {
    .products-layout {
        flex-direction: column;
    }
    .category-sidebar {
        width: 100%;
        min-width: 100%;
        max-height: none;
        position: static;
    }
    .product-search-form {
        max-width: none;
        flex: 1;
    }
    .shop-top-control {
        flex-wrap: wrap;
    }
    .shop-top-control .select-form {
        flex-shrink: 1;
    }
    .shop-top-control .chosen-container {
        min-width: 120px !important;
    }
    #productList .product-item:nth-child(3n+1) {
        clear: left !important;
    }
}

@media (max-width: 767px) {
    /* ========== 工具栏：All + 搜索 + 双下拉同一行 ========== */
    .products-layout .category-sidebar {
        display: none !important;
    }
    .shop-top-control {
        display: grid !important;
        grid-template-columns: 46px minmax(0, 1fr) 64px 86px;
        align-items: center;
        gap: 5px;
        width: 100%;
        padding: 8px !important;
        margin-bottom: 10px !important;
        background: #fffef9 !important;
        border: 1px solid #dfe4d7 !important;
        border-radius: 12px !important;
        box-shadow: none !important;
    }
    .mobile-all-products {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 3px;
        height: 34px;
        border-radius: 9px;
        font-size: 9.5px;
        font-weight: 600;
        line-height: 1;
        white-space: nowrap;
        text-decoration: none;
        color: #fff !important;
        background: #202a22;
    }
    .mobile-all-products i {
        font-size: 10px;
    }
    .product-search-form {
        width: 100%;
        max-width: none;
        min-width: 0;
    }
    .product-search-input {
        height: 34px !important;
        min-height: 34px !important;
        padding: 0 26px 0 9px !important;
        border: 1px solid #dde2d5 !important;
        border-radius: 9px !important;
        background: #f7f8f2 !important;
        font-size: 11px !important;
    }
    .product-search-input::placeholder {
        font-size: 10px;
    }
    .search-icon-btn {
        right: 3px;
        display: grid;
        place-items: center;
        width: 22px !important;
        height: 22px !important;
        min-height: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 50% !important;
        font-size: 9px;
        color: #fff !important;
        background: #202a22 !important;
    }
    .search-icon-btn:hover {
        color: #fff;
    }
    .shop-top-control .select-form {
        display: block !important;
        width: 100% !important;
        min-width: 0;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }
    .shop-top-control .select-form .title {
        display: none !important;
    }
    .shop-top-control .chosen-container {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }
    .shop-top-control .chosen-container .chosen-single {
        position: relative;
        display: block;
        height: 34px !important;
        padding: 0 13px 0 6px !important;
        overflow: hidden;
        font-size: 9.5px;
        line-height: 32px !important;
        color: #34422e !important;
        background: #fff !important;
        border: 1px solid #d8ddd0 !important;
        border-radius: 9px !important;
        box-shadow: none !important;
    }
    .shop-top-control .chosen-container .chosen-single span {
        display: block;
        margin: 0 !important;
        overflow: hidden;
        font-size: 9.5px;
        line-height: 32px;
        text-overflow: ellipsis;
        white-space: nowrap !important;
    }
    .shop-top-control .chosen-container .chosen-single div {
        display: none !important;
    }
    .shop-top-control .chosen-container .chosen-single::after {
        content: "\f107";
        position: absolute;
        top: 50%;
        right: 4px;
        transform: translateY(-50%);
        font-family: FontAwesome;
        font-size: 9px;
        line-height: 1;
        color: #8a957e;
    }
    .shop-top-control .chosen-container-active .chosen-single {
        border-color: #E8870C !important;
        box-shadow: 0 0 0 2px rgba(232, 135, 12, .1) !important;
    }
    .shop-top-control .chosen-container .chosen-drop {
        width: 100% !important;
        min-width: 168px !important;
        left: 0 !important;
        right: auto !important;
        margin-top: 4px;
        overflow: hidden;
        font-size: 11px;
        border: 1px solid #d8ddd0;
        border-radius: 9px;
        box-shadow: 0 8px 20px rgba(38, 51, 33, .12);
    }
    .shop-top-control .filter-choice .chosen-container .chosen-drop {
        left: auto !important;
        right: 0 !important;
    }
    .shop-top-control .chosen-container .chosen-drop .chosen-results {
        max-height: 220px;
    }
    .shop-top-control .chosen-container .chosen-drop .chosen-results li {
        padding: 8px 10px;
        font-size: 11px;
        line-height: 1.35;
        border-radius: 6px;
    }
    .shop-top-control .chosen-container .chosen-drop .chosen-results li.highlighted {
        background: #E8870C;
        color: #fff;
    }
    .shop-top-control .grid-view-mode {
        display: none !important;
    }

    /* ========== 产品卡片：左图右文 ========== */
    #productList,
    #productList.product-grid,
    #productList.list-products {
        min-height: 0 !important;
    }
    #productList .product-item {
        width: 100% !important;
        float: none !important;
        clear: none !important;
        margin-bottom: 8px;
        min-height: 0 !important;
    }
    #productList .product-item .product-inner {
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        min-height: 0 !important;
        height: auto !important;
        padding: 0 !important;
        border: 1px solid #eee !important;
        border-radius: 6px !important;
        overflow: hidden !important;
    }
    #productList .product-item .product-top {
        position: absolute;
        top: 4px;
        left: 4px;
        z-index: 5;
    }
    #productList .product-item .product-top .flash {
        font-size: 10px;
        padding: 2px 6px;
    }
    #productList .product-item .product-thumb {
        width: 78px !important;
        min-width: 78px !important;
        max-width: 78px !important;
        margin-bottom: 0 !important;
        margin-left: 3px;
        flex-shrink: 0;
        align-self: center !important;
        position: relative;
    }
    #productList .product-item .product-thumb .thumb-inner {
        height: auto !important;
    }
    #productList .product-item .product-thumb img {
        width: 78px !important;
        height: 78px !important;
        object-fit: cover !important;
        border-radius: 0 !important;
        margin: 0 !important;
    }
    /* 移动端隐藏 hover 浮层 */
    #productList .product-item .thumb-group {
        display: none !important;
    }
    #productList .product-item .product-info {
        flex: 1 !important;
        min-width: 0;
        min-height: 0 !important;
        text-align: left !important;
        padding: 8px 10px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        gap: 2px;
    }
    #productList .product-item .product-name {
        min-height: 0 !important;
        height: auto !important;
        margin: 0 !important;
        font-size: 13px !important;
        font-weight: 600;
        line-height: 1.35 !important;
        overflow: hidden;
        text-overflow: ellipsis;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow-wrap: anywhere;
    }
    #productList .product-item .product-name a {
        font-size: 13px !important;
        line-height: inherit !important;
    }
    #productList .product-item .product-intro {
        min-height: 0 !important;
        height: auto !important;
        margin: 0 !important;
        font-size: 11px !important;
        line-height: 1.45 !important;
        color: #7b876f !important;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    #productList .product-item .group-info {
        display: none !important;
    }

    /* 移动端操作按钮 */
    .product-mobile-actions {
        display: flex;
        gap: 6px;
        margin-top: 2px;
    }
    .product-mobile-actions .btn-mobile-favorite,
    .product-mobile-actions .btn-mobile-chat {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 4px 8px;
        border-radius: 3px;
        font-size: 11px;
        font-weight: 500;
        text-decoration: none;
        transition: all 0.2s ease;
        border: 1px solid #e0e0e0;
        background: #fff;
        color: #555;
    }
    .product-mobile-actions .btn-mobile-favorite {
        color: #E8870C;
        border-color: #E8870C;
    }
    .product-mobile-actions .btn-mobile-favorite:hover,
    .product-mobile-actions .btn-mobile-favorite.active {
        background: #E8870C;
        color: #fff;
    }
    .product-mobile-actions .btn-mobile-chat {
        color: #fff;
        background: #E8870C;
        border-color: #E8870C;
    }
    .product-mobile-actions .btn-mobile-chat:hover {
        background: #C96E08;
    }
    .product-mobile-actions .btn-mobile-favorite i,
    .product-mobile-actions .btn-mobile-chat i {
        font-size: 12px;
    }

    /* 移动端侧边栏默认折叠 */
    .category-sidebar {
        border-radius: 0;
        box-shadow: none;
        margin-bottom: 0;
    }
    .category-header {
        border-radius: 0;
        padding: 10px 12px;
        font-size: 14px;
    }
    .category-tree {
        display: none;
    }
    .category-tree.show {
        display: block;
    }

    /* 分页缩小 */
    .product-pagination {
        padding: 6px 0 2px;
        margin-top: 2px;
        margin-bottom: 0;
    }
    .pagination-btn {
        padding: 4px 10px;
        font-size: 12px;
    }
    .pagination-info {
        font-size: 12px !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* 隐藏桌面端 footer，只保留底部导航 */
    .footer {
        display: none !important;
    }
}

/* Desktop catalog card alignment */
@media (min-width: 768px) {
    #productList .product-item .product-inner {
        min-height: 0;
    }

    #productList .product-item .thumb-inner > a {
        display: block;
        aspect-ratio: 1 / 1;
        background-color: #fff;
    }

    #productList .product-item .thumb-inner > a > img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center;
    }

    #productList .product-item .product-info {
        justify-content: flex-start;
        min-height: 0;
    }

    #productList .product-item .product-name,
    #productList .product-item .product-intro {
        height: 2.8em;
        min-height: 2.8em;
        line-height: 1.4;
        overflow-wrap: anywhere;
    }
}

/* Mobile only: remove the oversized page heading and tighten the catalogue top area. */
@media (max-width: 760px) {
    .cx-products .cx-page-intro {
        padding: 10px 5% 0 !important;
    }
    .cx-products .cx-page-intro .eyebrow {
        display: block;
        margin-bottom: 6px !important;
        font-size: 9px;
    }
    .cx-products .cx-page-intro h1 {
        display: none !important;
    }
    .cx-products .cx-page-intro p {
        margin: 0 !important;
        font-size: 12px !important;
        line-height: 1.5 !important;
        color: #7b876f !important;
    }
    .cx-products .main-content-product {
        padding-top: 8px !important;
        /* 预留底部固定导航高度，避免分页被遮挡 */
        padding-bottom: 56px !important;
    }
    .cx-products .products-layout {
        padding: 4px 0 0 !important;
        margin-bottom: 0 !important;
        gap: 10px !important;
    }
    .cx-products .products-main {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    /* 移动端隐藏页尾 “Let’s get to work” CTA，分页信息作为页面最后内容 */
    .cx-products .cx-site-cta {
        display: none !important;
    }
}
