/**
 * Category Products Display Plugin Styles
 */

.cpd-categories-container {
    margin: 20px 0;
}

.cpd-category-section {
    margin-bottom: 40px;
}

.cpd-category-title {
    font-size: 24px !important;
    font-weight: 400 !important;
    padding-bottom: 10px;
    color: #333;
    text-align: left;
    margin: 0 auto !important;
}
.cpd-category-info .cpd-product-title{
    text-align: center;
}

.cpd-category-description {
    margin-bottom: 20px;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.cpd-products-grid {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.cpd-products-grid.columns-1 {
    grid-template-columns: 1fr;
}

.cpd-products-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.cpd-products-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.cpd-products-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.cpd-products-grid.columns-5 {
    grid-template-columns: repeat(5, 1fr);
}

.cpd-products-grid.columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

.cpd-product-item {
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #fff;
    position: relative;
}

.cpd-product-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-2px);
}

.cpd-product-image {
    position: relative;
    overflow: hidden;
}

.cpd-product-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.cpd-product-item:hover .cpd-product-image img {
    transform: scale(1.05);
}

.cpd-product-info {
    padding: 15px;
    background-color: #fff;
}

.cpd-product-title {
    font-size: 16px;
    font-weight: 400;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.cpd-product-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.cpd-product-title a:hover {
    color: #ed0000;
}

.cpd-product-price {
    font-size: 18px;
    font-weight: 700;
    color: #0073aa;
    margin-bottom: 10px;
}

.cpd-product-price del {
    color: #999;
    font-weight: 400;
    margin-right: 8px;
}

.cpd-product-rating {
    margin-bottom: 15px;
}

.cpd-product-rating .star-rating {
    font-size: 14px;
}

.cpd-product-actions {
    margin: 0 auto;
}

.cpd-add-to-cart {
    width: 100%;
    padding: 10px 15px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.3s ease;
    cursor: pointer;
    display: inline-block;
}

.cpd-add-to-cart:hover {
    background: #005a87;
    color: #fff;
}

.cpd-add-to-cart:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* 分类信息卡片样式 */
.cpd-category-info-card {
    /*! background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); */
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}



.cpd-category-image {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cpd-category-default-icon {
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.cpd-category-default-icon svg {
    width: 60px;
    height: 60px;
    opacity: 0.9;
}

.cpd-category-title a {
    color: #007cba;
    font-weight: 600;
}

.cpd-category-title a:hover {
    color: #005a87;
}

.cpd-product-title.cpd-category-title a {
  color: rgba(0,0,0,0.8) !important;
  font-size: 24px;
  font-weight: 200;
}

.cpd-category-description {
    color: #6c757d;
    font-style: italic;
    font-size: 0.9em;
}

.cpd-category-count {
    color: #495057;
    font-size: 0.85em;
    font-weight: 500;
}

.cpd-category-link-button {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white !important;
    border: none;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cpd-category-link-button:hover {
    background: linear-gradient(135deg, #005a87 0%, #004066 100%);
    transform: translateY(-1px);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .cpd-products-grid.columns-4,
    .cpd-products-grid.columns-5,
    .cpd-products-grid.columns-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .cpd-products-grid.columns-3,
    .cpd-products-grid.columns-4,
    .cpd-products-grid.columns-5,
    .cpd-products-grid.columns-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cpd-category-section {
        padding: 15px;
    }
    
    .cpd-category-title {
        font-size: 20px;
    }
    
    .cpd-category-default-icon svg {
        width: 40px;
        height: 40px;
    }
    
    .cpd-category-description {
        font-size: 0.8em;
    }
    
    .cpd-category-count {
        font-size: 0.75em;
    }
}

@media (max-width: 480px) {
    .cpd-products-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    .cpd-category-section {
        padding: 10px;
        margin-bottom: 30px;
    }
    
    .cpd-category-title {
        font-size: 18px;
    }
    
    .cpd-product-info {
        padding: 12px;
    }
}

/* 加载状态 */
.cpd-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.cpd-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: cpd-spin 1s linear infinite;
    z-index: 1000;
}

@keyframes cpd-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* FacetWP兼容性样式 */
.facetwp-template .cpd-categories-container {
    transition: opacity 0.3s ease;
}

.facetwp-template .cpd-loading {
    opacity: 0.5;
}

/* 空状态样式 */
.cpd-no-products {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* WooCommerce兼容性 */
.woocommerce .cpd-categories-container {
    margin: 0;
}

.woocommerce .cpd-product-item .button {
    margin: 0;
}

/* 可访问性改进 */
.cpd-product-item:focus-within {
    outline: 2px solid #e60012;
    outline-offset: 2px;
}

.cpd-add-to-cart:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.cpd-add-to-cart:disabled:hover {
    background: #ccc;
}

/* 分类信息区域样式 */
.cpd-category-info {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.cpd-category-info-content {
    flex: 1;
    min-width: 200px;
}

.cpd-category-info-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #333;
}

.cpd-category-info-text {
    font-size: 14px;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

.cpd-category-info-actions {
    flex-shrink: 0;
}
.cpd-category-info-card{
    align-items: center;
  display: flex;
  text-align: center;
}

.cpd-category-link-button {
    background: #0073aa;
    color: #fff !important;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
    border: none;
    cursor: pointer;
}

.cpd-category-link-button:hover {
    background: #005a87;
    color: #666666 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.cpd-category-link-button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* 响应式设计 - 分类信息区域 */
@media (max-width: 768px) {
    .cpd-category-info {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    
    .cpd-category-info-content {
        min-width: auto;
    }
    
    .cpd-category-info-title {
        font-size: 16px;
    }
    
    .cpd-category-link-button {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .cpd-category-info {
        margin-top: 20px;
        padding: 12px;
    }
    
    .cpd-category-info-title {
        font-size: 15px;
    }
    
    .cpd-category-info-text {
        font-size: 13px;
    }
}


/* ========== 基础变量，可按品牌色调整 ========== */
:root{
  --cpd-text: #222;
   /* 次级文字 */
  --cpd-muted: #666;
  --cpd-border: #ddd;
  --cpd-card: #f5f5f5;

  /* 三种标签颜色（浅底深字）*/
  --cpd-track-bg: #e6eefc;
  --cpd-track-fg: #244c99;

  --cpd-single-bg: #eaf7ef;
  --cpd-single-fg: #1f6b3a;

  --cpd-oem-bg: #f6efe6;
  --cpd-oem-fg: #8a5300;
}

/* ========== 摘要区字体与排版 ========== */
.cpd-product-excerpt{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--cpd-text);
  line-height: 1.6;
  font-size: 14px;
}

.cpd-product-excerpt p{
  margin: 0;                 /* 贴合卡片整体节奏 */
  color: var(--cpd-muted);
}

.cpd-product-excerpt p strong{
  display: block;            /* 每条加粗信息独占一行 */
  margin: 0 0 .35rem 0;
  color: var(--cpd-text);
  font-weight: 600;
  font-size: 14px;
}

/* 小屏更紧凑，大屏略放大 */
@media (min-width: 768px){
  .cpd-product-excerpt{ font-size: 15px; }
  .cpd-product-excerpt p strong{ font-size: 15px; }
}

/* ========== 标签容器 ========== */
.cpd-tags{
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;                /* 标签之间的间距 */
  margin-top: .6rem;         /* 与文字区分 */
}

/* ========== 通用标签风格 ========== */
.cpd-tag{
  display: inline-flex;
  align-items: center;
  padding: .35rem .6rem;
  border-radius: .5rem;
  border: 1px solid var(--cpd-border);
  background: #eee;
  color: #2b2b2b;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  box-shadow: inset 0 -1px rgba(0,0,0,.04);
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
  user-select: none;
}
.cpdc-tag{
  color: #2b2b2b;
  font-size: 13px;
  line-height: 1;
  white-space: normal;
}
/* 加粗样式 */
.cpdc-tag strong,
.cpdc-tag b,
.cpdc-tag .bold-text {
  font-weight: 600; /* 或 700 */
}
/* 交互反馈（可点击或不可点击都好看） */
.cpd-tag:hover{ transform: translateY(-1px); }
.cpd-tag:active{ transform: translateY(0); box-shadow: none; }

/* 大小可选（需要时加类名） */
.cpd-tag--sm{ padding: .25rem .5rem; font-size: 12px; }
.cpd-tag--lg{ padding: .45rem .75rem; font-size: 14px; }

/* ========== 三种标签主题 ========== */
.cpd-tag--track{
  background: var(--cpd-track-bg);
  color: var(--cpd-track-fg);
  border-color: color-mix(in srgb, var(--cpd-track-fg) 20%, #fff);
}

.cpd-tag--single{
  background: var(--cpd-single-bg);
  color: var(--cpd-single-fg);
  border-color: color-mix(in srgb, var(--cpd-single-fg) 20%, #fff);
}

.cpd-tag--oem{
  background: var(--cpd-oem-bg);
  color: var(--cpd-oem-fg);
  border-color: color-mix(in srgb, var(--cpd-oem-fg) 20%, #fff);
}

/* ========== 灰底卡片里的层次（可选） ========== */
.product-card .cpd-product-excerpt{
  background: transparent;
}

.product-card .cpd-tags .cpd-tag{
  background: #e9e9e9;
}

.cpd-product-excerpt strong {
    font-size: 16px;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}