/**
 * 产品分类页样式 - 自定义cr-前缀类名
 * @package Chenren
 */

/* ========================================
   容器
   ======================================== */
.cr-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   面包屑导航 - 与产品详情页统一样式
   ======================================== */
.pd-breadcrumb {
    background-color: #f5f5f5;
    padding: 15px 0;
}

.pd-breadcrumb-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    font-size: 14px;
    color: #666;
}

.pd-breadcrumb-nav a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
}

.pd-breadcrumb-nav a:hover {
    color: #e91e63;
}

.pd-breadcrumb-sep {
    margin: 0 10px;
    color: #999;
}

.pd-breadcrumb-current {
    color: #333;
    font-weight: 500;
}

/* ========================================
   主布局
   ======================================== */
.cr-archive-main {
    padding: 30px 0 60px;
    background: #fff;
}

.cr-archive-layout {
    display: flex;
    gap: 40px;
}

/* ========================================
   左侧边栏 - 分类导航 20%
   ======================================== */
.cr-archive-sidebar {
    width: 20%;
    min-width: 200px;
    flex-shrink: 0;
}

.cr-nav-group {
    margin-bottom: 2px;
    border: 1px solid #e5e5e5;
    background: #fff;
}

.cr-nav-header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f5f5f5;
    cursor: pointer;
    position: relative;
    gap: 8px;
}

.cr-nav-group.is-open .cr-nav-header {
    background: #c41230;
}

.cr-nav-parent-link {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    text-decoration: none;
    flex: 1;
}

.cr-nav-parent-link:hover {
    color: #c41230;
}

.cr-nav-group.is-open .cr-nav-parent-link {
    color: #fff;
}

.cr-nav-group.is-open .cr-nav-parent-link:hover {
    color: #fff;
}

.cr-nav-toggle {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 1px solid #999;
    border-bottom: 1px solid #999;
    transform: rotate(45deg);
    cursor: pointer;
    padding: 0;
    margin-left: 5px;
    transition: transform 0.3s;
}

.cr-nav-group.is-open .cr-nav-toggle {
    border-color: #fff;
    transform: rotate(-135deg);
}

/* 分类标签容器 - 提示框样式，位于分类名称右上方 */
.cr-nav-tag-wrap {
    display: inline-block;
    position: relative;
    vertical-align: top;
    margin-top: -12px;
    margin-left: 5px;
    margin-bottom: 8px;
}

/* 标签主体 - 提示框 */
.cr-nav-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    color: #fff;
    white-space: nowrap;
    line-height: 1.4;
    font-weight: 500;
    border-radius: 3px;
    border-bottom-left-radius: 0;
}

/* 提示框左下角尖角 - 使用独立元素，指向分类名称 */
.cr-nav-tag-arrow {
    position: absolute;
    left: -10px;
    bottom: 0;
    width: 0;
    height: 0;
    border-bottom: 6px solid #f59e0b;
    border-left: 12px solid transparent;
}

/* 子分类列表 */
.cr-nav-children {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 0;
}

.cr-nav-children.is-visible {
    max-height: 500px;
    opacity: 1;
    transition: max-height 0.4s ease-in, opacity 0.3s ease-in;
}

.cr-nav-child-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 15px;
    border-top: 1px solid #eee;
}

.cr-nav-child-item.is-current {
    background: #fff5f7;
}

.cr-nav-child-link {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #555;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.cr-nav-child-link:hover,
.cr-nav-child-item.is-current .cr-nav-child-link {
    color: #c41230;
}

.cr-nav-arrow {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 1px solid #c41230;
    border-bottom: 1px solid #c41230;
    transform: rotate(-45deg);
    margin-left: 5px;
}

.cr-nav-arrow::before {
    content: '';
}

.cr-nav-child-name {
    flex: 1;
}

/* ========================================
   右侧内容区 80%
   ======================================== */
.cr-archive-content {
    flex: 1;
    min-width: 0;
}

/* 标题和描述 */
.cr-archive-header {
    margin-bottom: 25px;
}

.cr-archive-title {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin: 0 0 15px;
    line-height: 1.3;
}

.cr-archive-desc {
    font-size: 14px;
    line-height: 1.9;
    color: #555;
}

/* 描述展开/收缩样式 */
.cr-archive-desc-wrapper {
    position: relative;
}

.cr-archive-desc-wrapper.cr-desc-collapsible {
    overflow: hidden;
    transition: max-height 1s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: max-height;
}

.cr-archive-desc-wrapper.cr-desc-collapsed {
    max-height: 52px; /* 约2行文字 */
}

.cr-archive-desc-wrapper.cr-desc-collapsed::after {
    content: '...';
    position: absolute;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right, transparent, #fff 50%);
    padding-left: 20px;
}

.cr-archive-desc-wrapper.cr-desc-expanded {
    max-height: none;
}

.cr-archive-desc-wrapper.cr-desc-expanded::after {
    display: none;
}

.cr-zoom-btn.active {
    border-color: #c41230;
    color: #c41230;
}

.cr-zoom-btn.active .cr-zoom-icon {
    transform: rotate(-135deg);
}

/* 自定义内容块样式 - 与主标题描述样式一致 */
.cr-content-blocks {
    margin-top: 25px;
}

.cr-content-block {
    margin-bottom: 25px;
}

.cr-content-block:last-child {
    margin-bottom: 0;
}

.cr-block-title {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin: 0 0 15px;
    line-height: 1.3;
}

.cr-block-content {
    font-size: 14px;
    line-height: 1.9;
    color: #555;
}

.cr-block-image {
    margin-top: 10px;
}

.cr-block-image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.cr-archive-desc a {
    color: #c41230;
    text-decoration: none;
}

.cr-archive-desc a:hover {
    text-decoration: underline;
}

/* ========================================
   筛选工具栏
   ======================================== */
.cr-archive-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 25px;
}

.cr-toolbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cr-zoom-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
}

.cr-zoom-btn:hover {
    border-color: #c41230;
    color: #c41230;
}

.cr-zoom-icon {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    transform: rotate(45deg);
    margin-left: 8px;
    vertical-align: middle;
    transition: transform 0.3s;
}

.cr-toolbar-right {
    display: flex;
    align-items: center;
    gap: 25px;
}

.cr-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cr-filter-label {
    font-size: 13px;
    color: #666;
}

.cr-filter-select {
    padding: 7px 32px 7px 12px;
    border: 1px solid #ddd;
    font-size: 13px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none;
    cursor: pointer;
    border-radius: 3px;
    min-width: 100px;
}

.cr-filter-select:focus {
    outline: none;
    border-color: #c41230;
}

/* ========================================
   产品网格
   ======================================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.product-card {
    background: #fff;
    border: 1px solid #eee;
    overflow: hidden;
    padding: 4px;
    transition: box-shadow 0.3s ease;
}

.product-card:hover {
    box-shadow: 0 4px 15px rgba(238, 134, 167, 0.6);
}

/* 产品图片区域 */
.product-image {
    position: relative;
    overflow: hidden;
}

.product-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.product-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s ease;
}

.product-image .img-secondary {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
}

.product-image:hover .img-primary {
    opacity: 0;
}

.product-image:hover .img-secondary {
    opacity: 1;
}

/* 折扣标签 */
.discount-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #9c27b0;
    color: #fff;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.discount-tag.yellow {
    background-color: #ff9800;
}

.discount-tag.green {
    background-color: #4caf50;
}

.product-image:hover .discount-tag {
    opacity: 0;
}

/* NEW ARRIVAL 覆盖层 */
.new-arrival {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #fff;
    z-index: 5;
    width: 80%;
    transition: opacity 0.3s ease;
}

.product-image:hover .new-arrival {
    opacity: 0;
}

.arrival-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.arrival-heading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.arrival-text {
    position: relative;
    padding: 0 30px;
    font-size: 14px;
}

.arrival-text::before,
.arrival-text::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 20px;
    height: 1px;
    background-color: #fff;
}

.arrival-text::before {
    left: 0;
}

.arrival-text::after {
    right: 0;
}

/* 产品信息 */
.product-info {
    padding: 15px 0 0 0;
    text-align: center;
}

.product-title {
    font-size: 13px;
    color: #333;
    margin: 0 0 10px;
    line-height: 1.5;
    height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-title a {
    color: inherit;
    text-decoration: none;
}

.product-title a:hover {
    color: #c41230;
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.current-price {
    font-size: 18px;
    font-weight: bold;
    color: #c41230;
}

.original-price {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
}

.product-btn {
    display: block;
    color: #fff;
    text-align: center;
    padding: 5px;
    text-decoration: none;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    background: linear-gradient(#e9c1b2, #f7c5b3 5%, #f3ae9c 6%, #ef937f 10%, #ed8579 15%, #e65262 50%, #dd1242 98%, #db5e71 100%);
    box-shadow: 2px 1px 5px rgba(0, 0, 0, .4);
    transition: opacity 0.3s;
}

.product-btn:hover {
    opacity: 0.9;
}

/* 无产品提示 */
.cr-no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: #666;
    background: #f9f9f9;
    border-radius: 8px;
}

.cr-no-products p {
    margin: 0;
    font-size: 15px;
}

/* ========================================
   分页
   ======================================== */
.cr-pagination {
    margin-top: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.cr-pagination a,
.cr-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.2s;
}

.cr-pagination a:hover {
    border-color: #c41230;
    color: #c41230;
}

.cr-pagination .current {
    background: #c41230;
    border-color: #c41230;
    color: #fff;
}

.cr-pagination .dots {
    border: none;
    background: transparent;
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .cr-archive-layout {
        gap: 30px;
    }
}

@media (max-width: 992px) {
    .cr-archive-layout {
        flex-direction: column-reverse;
    }
    
    .cr-archive-sidebar {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .cr-nav-group {
        flex: 1;
        min-width: 180px;
    }
    
    .cr-archive-title {
        font-size: 24px;
    }
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .cr-archive-toolbar {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .cr-toolbar-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .cr-archive-title {
        font-size: 22px;
    }
    
    .cr-archive-desc {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .cr-container {
        padding: 0 15px;
    }
    
    .cr-archive-main {
        padding: 20px 0 40px;
    }
    
    .cr-nav-group {
        min-width: 100%;
    }
}
