/**
 * Product Listing — 产品列表页样式（三视图共用）
 * 前缀: plist-
 * 断点: ≥1024px 4列 / 768-1023px 3列 / 480-767px 2列 / <480px 1列
 *
 * @package FitX
 */

/* ===========================
 * 页面容器
 * =========================== */

.plist-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

/* ===========================
 * 页头
 * =========================== */

.plist-header {
    margin-bottom: 28px;
}

.plist-title {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 auto;
    line-height: 1.2;
}

.plist-subtitle {
    font-size: 15px;
    color: #787c82;
    margin: 0 auto;
}

/* 面包屑（仅分类视图） */
.plist-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 14px;
}

.plist-breadcrumb a {
    color: #787c82;
    text-decoration: none;
    transition: color 0.2s;
}

.plist-breadcrumb a:hover {
    color: #c8102e;
}

.plist-breadcrumb__sep {
    color: #c0c4c9;
}

.plist-breadcrumb__current {
    color: #c8102e;
    font-weight: 600;
}

/* ===========================
 * 分类导航卡片
 * =========================== */

.plist-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.plist-nav__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 16px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    text-decoration: none;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    position: relative;
}

.plist-nav__card:hover {
    border-color: #c8102e;
    box-shadow: 0 4px 16px rgba(200, 16, 46, 0.1);
    transform: translateY(-2px);
}

.plist-nav__card.is-active {
    border-color: #c8102e;
    border-width: 2px;
    padding: 19px 15px 15px; /* 补偿加粗边框 */
    box-shadow: 0 4px 16px rgba(200, 16, 46, 0.12);
}

.plist-nav__icon {
    font-size: 26px;
    color: #c8102e;
    line-height: 1;
}

.plist-nav__label {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.3;
}

.plist-nav__count {
    font-size: 12px;
    color: #888;
    background: #f5f5f5;
    padding: 2px 10px;
    border-radius: 10px;
}

.plist-nav__card--new {
    border-style: dashed;
}

.plist-nav__badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
    background: #c8102e;
    padding: 2px 8px;
    border-radius: 3px;
}

/* ===========================
 * 子分类卡片（仅分类视图）
 * =========================== */

.plist-subcats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: -24px 0 32px; /* 紧跟导航卡片下方，收窄间距 */
}

.plist-subcats__card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
    text-decoration: none;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.plist-subcats__card:hover {
    border-color: #c8102e;
    background: #fff;
    box-shadow: 0 2px 10px rgba(200, 16, 46, 0.08);
}

.plist-subcats__label {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.3;
}

.plist-subcats__card:hover .plist-subcats__label {
    color: #c8102e;
}

.plist-subcats__count {
    font-size: 12px;
    color: #888;
    background: #fff;
    border: 1px solid #e8e8e8;
    padding: 1px 9px;
    border-radius: 10px;
    flex-shrink: 0;
}

/* ===========================
 * 产品网格
 * =========================== */

.plist-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* ── 产品卡片（与 component 推荐卡同风格：纵向） ── */

.plist-card {
    position: relative; /* Sponsored 角标定位基准 */
    display: flex;
    flex-direction: column;
    text-decoration: none;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.plist-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.plist-card__img {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #f9f9f9;
    overflow: hidden;
}

.plist-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.plist-card:hover .plist-card__img img {
    transform: scale(1.03);
}

.plist-card__img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #ccc;
}

.plist-card__info {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.plist-card__type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

/* 类型徽章三色（与详情页一致） */
.plist-card__type--machine {
    background: #c8102e15;
    color: #c8102e;
    border: 1px solid #c8102e40;
}

.plist-card__type--component {
    background: #00a32a15;
    color: #00a32a;
    border: 1px solid #00a32a40;
}

.plist-card__type--service {
    background: #dba61715;
    color: #b8880e;
    border: 1px solid #dba61740;
}

.plist-card__title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.plist-card:hover .plist-card__title {
    color: #c8102e;
}

.plist-card__model {
    font-size: 11px;
    color: #888;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* ===========================
 * 分页
 * =========================== */

.plist-pagination {
    margin-top: 40px;
}

.plist-pagination ul {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.plist-pagination .page-numbers {
    display: inline-block;
    min-width: 38px;
    padding: 8px 12px;
    text-align: center;
    font-size: 14px;
    color: #3c434a;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s;
}

.plist-pagination .page-numbers:hover:not(.current) {
    border-color: #c8102e;
    color: #c8102e;
}

.plist-pagination .page-numbers.current {
    background: #c8102e;
    color: #fff;
    border-color: #c8102e;
    font-weight: 600;
}

/* ===========================
 * 空状态
 * =========================== */

.plist-empty {
    text-align: center;
    padding: 80px 24px;
    background: #fff;
    border: 1px dashed #e0e0e0;
    border-radius: 10px;
}

.plist-empty i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 16px;
}

.plist-empty p {
    font-size: 15px;
    color: #787c82;
    margin: 0 0 16px;
}

.plist-empty__link {
    display: inline-block;
    padding: 10px 24px;
    background: #c8102e;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.plist-empty__link:hover {
    background: #a00d24;
    color: #fff;
}

/* ===========================
 * 响应式
 * =========================== */

@media (max-width: 1023px) {
    .plist-nav {
        grid-template-columns: repeat(3, 1fr);
    }

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

    .plist-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (max-width: 767px) {
    .plist-page {
        padding: 24px 16px 48px;
    }

    .plist-title {
        font-size: 26px;
    }

    .plist-nav {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .plist-subcats {
        grid-template-columns: repeat(2, 1fr);
        margin: -16px 0 24px;
    }

    .plist-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 479px) {
    .plist-nav {
        grid-template-columns: repeat(2, 1fr);
    }

    .plist-subcats {
        grid-template-columns: 1fr;
    }

    .plist-grid {
        grid-template-columns: 1fr;
    }
}


/* ===========================
 * 筛选（§5-11）与推广（§5-13）
 * =========================== */

.plist-page {
    --plist-promo: #b45309;
    --plist-promo-soft: #fff7ed;
    --plist-border: #e8e8e8;
    --plist-muted: #787c82;
}

/* 顶部关键词检索 */
.plist-search {
    display: flex;
    max-width: 640px;
    margin: 22px auto 0;
}
.plist-search__input {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 0 16px;
    border: 1px solid #dcdcde;
    border-right: 0;
    border-radius: 6px 0 0 6px;
    font-size: 14px;
    color: #1a1a2e;
    background: #fff;
    box-sizing: border-box;
}
.plist-search__input:focus {
    outline: none;
    border-color: #c8102e;
}
.plist-search__btn {
    height: 44px;
    padding: 0 20px;
    border: 0;
    border-radius: 0 6px 6px 0;
    background: #c8102e;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.plist-search__btn:hover {
    background: #a80d26;
}

/* 左右分栏 */
.plist-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    margin-top: 28px;
}

/* 左侧筛选面板 */
.plist-filters {
    background: #fff;
    border: 1px solid var(--plist-border);
    border-radius: 8px;
    padding: 18px 18px 6px;
}
.plist-filters__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    border-bottom: 1px solid #f0f0f1;
}
.plist-filters__title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
}
.plist-filters__reset {
    font-size: 12px;
    color: #c8102e;
    text-decoration: none;
}
.plist-filters__reset:hover {
    text-decoration: underline;
}

.plist-fgroup {
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f1;
}
.plist-fgroup:last-child {
    border-bottom: 0;
}
.plist-fgroup__title {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 10px;
}
.plist-fgroup__select {
    width: 100%;
    height: 34px;
    padding: 0 8px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    font-size: 13px;
    color: #3c434a;
    background: #fff;
    box-sizing: border-box;
}
.plist-fgroup__list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.plist-fgroup__item {
    margin: 0 0 8px;
}
.plist-fgroup__item:last-child {
    margin-bottom: 0;
}
.plist-fgroup__item label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #3c434a;
    cursor: pointer;
}
.plist-fgroup__item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: #c8102e;
    flex: 0 0 auto;
}
.plist-fgroup__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.plist-fgroup__count {
    font-size: 11px;
    color: #9ca3af;
    flex: 0 0 auto;
}

/* Sponsored only 开关 */
.plist-fswitch {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 0 16px;
    border-bottom: 1px solid #f0f0f1;
    cursor: pointer;
}
.plist-fswitch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.plist-fswitch__track {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: #dcdcde;
    position: relative;
    transition: background 0.2s;
    flex: 0 0 auto;
}
.plist-fswitch__knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}
.plist-fswitch input:checked + .plist-fswitch__track {
    background: var(--plist-promo);
}
.plist-fswitch input:checked + .plist-fswitch__track .plist-fswitch__knob {
    transform: translateX(16px);
}
.plist-fswitch__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--plist-promo);
}

/* 右侧工具栏 */
.plist-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    font-size: 14px;
    color: var(--plist-muted);
}
.plist-toolbar__count strong {
    color: #1a1a2e;
    font-size: 16px;
}
.plist-toolbar__per {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.plist-toolbar__per select {
    height: 32px;
    padding: 0 8px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    color: #3c434a;
}

/* 推广卡片与角标（独立于类型徽章） */
.plist-sponsored {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #fff;
    background: var(--plist-promo);
    box-shadow: 0 2px 8px rgba(180, 83, 9, 0.28);
}
.plist-card--promoted {
    border-color: #f0c9a0;
    background: var(--plist-promo-soft);
    box-shadow: 0 0 0 1px rgba(180, 83, 9, 0.08);
}
.plist-card--promoted:hover {
    border-color: var(--plist-promo);
    box-shadow: 0 4px 20px rgba(180, 83, 9, 0.16);
}

/* 响应式：筛选栏置顶展开，不做内部滚动 */
@media (max-width: 1023px) {
    .plist-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .plist-filters {
        padding: 16px;
    }
    .plist-fgroup__list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 16px;
    }
    .plist-fgroup__item {
        margin-bottom: 0;
    }
}
@media (max-width: 639px) {
    .plist-fgroup__list {
        grid-template-columns: 1fr;
    }
    .plist-search {
        margin-top: 18px;
    }
    .plist-search__btn {
        padding: 0 14px;
    }
}
