/* gridproducts.html 页面样式 */

.dungar-menu-item-title:hover, .dungar-item-title:hover { color: #dd3232 !important; transition: all 0.3s ease; }
.contact-item:hover { color: #dd3232 !important; }
.contact-item:hover span { color: #dd3232 !important; }

/* ========== 左侧分类树 ========== */
.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, #dd3232 0%, #b82828 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, #c42a2a 0%, #a52222 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: #fff5f5;
}

.category-tree-header.active {
    background: #ffe8e8;
    border-left: 3px solid #dd3232;
}

.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: #dd3232;
    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: #fff5f5;
    color: #dd3232;
}

.category-child-item.active {
    background: #ffe8e8;
    color: #dd3232;
    border-left-color: #dd3232;
    font-weight: 500;
}

.category-child-item .child-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-child-item .child-icon {
    font-size: 5px;
    color: #dd3232;
}

.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: #dd3232;
    background: #fff0f0;
}

.category-grandchild-item.active {
    color: #dd3232;
    font-weight: 500;
    background: #ffe8e8;
}

.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: #dd3232;
}

/* ========== 主内容区域布局 ========== */
.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: #dd3232;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(221, 50, 50, 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: #dd3232;
}

/* 下拉框区域 */
.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: #dd3232;
    box-shadow: 0 0 0 2px rgba(221, 50, 50, 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: #dd3232;
}

/* 视图切换按钮 */
.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: #dd3232;
}

.grid-view-mode .modes-mode.active {
    background: #dd3232;
    border-color: #dd3232;
}

.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: #dd3232;
    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: #dd3232;
    color: #fff;
    border-color: #dd3232;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: #dd3232;
    color: #fff;
    border-color: #dd3232;
}

.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) {
    .shop-top-control {
        padding: 10px 12px;
        gap: 8px;
    }
    .product-search-input {
        font-size: 14px; /* 防止iOS缩放 */
    }
    #productList .product-item:nth-child(2n+1) {
        clear: left !important;
    }
}
