/* ============================================
   Product Listing Page Styles
   ============================================ */

/* Layout */
.products-layout { display: flex; gap: 24px; padding: 36px 0; }
.products-sidebar { width: 240px; flex-shrink: 0; }
.products-content { flex: 1; min-width: 0; }

/* Sidebar */
.sidebar-section {
    margin-bottom: 18px;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
}
.sidebar-section h3 {
    background: var(--bg-table-header);
    color: var(--text-primary);
    padding: 12px 16px;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-light);
}
.sidebar-section > div,
.sidebar-section > ul,
.sidebar-section > form { padding: 14px; }

/* Filter */
.filter-row { margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.filter-row:last-child { margin-bottom: 0; }
.filter-row select {
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    max-width: 100%;
    font-size: 12px;
    border-radius: var(--radius-sm);
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}
.filter-row select:focus { border-color: var(--border-focus); box-shadow: 0 0 0 2px var(--primary-glow); }
.filter-row select:disabled { opacity: 0.55; cursor: not-allowed; }
.filter-row button {
    padding: 8px 16px;
    cursor: pointer;
    border: none;
    font-weight: 500;
    font-size: 12px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.filter-row button:first-of-type {
    background: var(--button-primary);
    color: #fff;
    flex: 1;
}
.filter-row button:first-of-type:hover { background: var(--button-primary-hover); }
.filter-row button:last-of-type {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    flex: 1;
}
.filter-row button:last-of-type:hover { border-color: var(--primary); color: var(--primary); }

/* Treeview */
.lightTreeview { list-style: none; padding: 0; margin: 0; }
.lightTreeview ul, .lightTreeview ol { margin: 0; padding: 0; list-style: none; display: block; }
.lightTreeview li {
    font-size: 12px;
    line-height: 20px;
    padding: 3px 0 3px 14px;
    margin: 0;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-fast);
}
.lightTreeview li:hover { color: var(--primary); }
.lightTreeview li.node-last-open { background-position: 0 -111px; }
.lightTreeview li.node-last-close { background-position: -32px -67px; }
.lightTreeview li span.flex-ico {
    background-image: url(/images/bg105.png);
    background-repeat: no-repeat;
    float: left;
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.lightTreeview li.node-last-close span.flex-close { background-position: 6px 4px; }
.lightTreeview li.node-last-open span.flex-open { background-position: 4px -24px; }
.lightTreeview ol li { color: var(--text-light); }
.lightTreeview ol li a { color: inherit; text-decoration: none; display: block; }
.lightTreeview ol li a.active { color: var(--primary); font-weight: 600; }
.lightTreeview ol li:hover a { color: var(--primary); }

#productContact p { margin: 6px 0; font-size: 11px; color: var(--text-secondary); line-height: 1.5; }
#productContact strong { font-weight: 400; }
.contact-info p { color: var(--text-secondary); font-size: 12px; line-height: 1.8; }

/* Product Table */
#plist {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 20px;
    font-size: 13px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}
#plist .title { background: var(--bg-table-header); }
#plist .title th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary);
    font-size: 13px;
}
#plist .title th:first-child { text-align: center; }
#plist .title th:nth-child(2) { min-width: 200px; }
#plist td {
    padding: 14px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
    font-size: 13px;
    color: var(--text-secondary);
}
#plist td:nth-child(2) { min-width: 200px; }
#plist tr:last-child td { border-bottom: none; }
#plist .gray { background: var(--bg-table-row-alt); }
#plist tbody tr:hover td { background: var(--primary-pale); }
#plist .img { text-align: center; width: 180px; }
#plist .img .carbtn { margin-bottom: 6px; font-size: 12px; }
#plist .img .carbtn input[type="checkbox"] { margin-right: 3px; accent-color: var(--primary); }
#plist .img .image img {
    width: 100px;
    height: 75px;
    object-fit: cover;
    border: 1px solid var(--border-light);
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
#plist tbody tr:hover .img .image img { border-color: var(--primary); }
#plist .img a { color: var(--primary); text-decoration: none; font-size: 12px; }
#plist .img a:hover { text-decoration: underline; }
#plist .desc .pdno { margin-bottom: 12px; }
#plist .desc .pdno a { color: var(--text-primary); font-size: 14px; text-decoration: none; }
#plist .desc .pdno a:hover { color: var(--primary); }
#plist .desc .pdno .pdno-prefix { font-weight: 400; color: var(--text-primary); font-size: 14px; }
#plist .desc .pdno .pdno-num { font-weight: 700; color: var(--primary); font-size: 14px; }
#plist .desc h3 { margin: 0 0 4px 0; font-size: 13px; font-weight: 600; }
#plist .desc h3 a { color: var(--text-primary); text-decoration: none; }
#plist .desc h3 a:hover { color: var(--primary); }
#plist .desc h4.blue { margin: 0 0 4px; color: var(--primary); font-size: 12px; font-weight: 500; }
#plist .desc .text { margin: 0; font-size: 12px; line-height: 1.6; color: var(--text-secondary); }
#plist .modellist { color: var(--text-secondary); font-size: 12px; }
.spec-value { color: var(--text-primary); font-weight: 500; }

/* makes 内容（仅小屏显示，桌面端隐藏） */
#plist .desc .makes-mobile { display: none; }

/* Cart column */
#plist .cart-th { width: 120px; text-align: center !important; }
#plist .cart-cell { text-align: center; vertical-align: middle; }
#plist .cart-cell .cart-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Brand List */
.brand-list-wrapper { padding: 0; }
.brand-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.brand-list li {
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}
.brand-list li:last-child { border-bottom: none; }
.brand-list li:hover { background: var(--primary-pale); }
.brand-list li.active { background: var(--primary-pale); }
.brand-list li a {
    display: block;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
.brand-list li:hover a { color: var(--primary); }
.brand-list li.active a { color: var(--primary); font-weight: 600; }
.brand-list .brand-item-hidden { display: none; }

/* 更多品牌项 - 与列表项样式一致 */
.brand-list .brand-more-item {
    border-bottom: none;
    cursor: pointer;
}
.brand-list .brand-more-item a {
    display: block;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
    cursor: pointer;
}
.brand-list .brand-more-item:hover { background: var(--primary-pale); }.brand-list .brand-more-item:hover a { color: var(--primary); }
.brand-list .brand-more-item a { color: var(--primary); }

/* ============================================
   Mobile Filter Bar & Drawer (hidden on desktop)
   ============================================ */
.mobile-filter-bar,
.sidebar-drawer-header,
.filter-overlay { display: none; }

/* ============================================
   Responsive - Tablet & Mobile
   ============================================ */
@media (max-width: 991px) {
    .products-layout { flex-direction: column; gap: 0; padding: 20px 0; }

    /* Mobile filter bar */
    .mobile-filter-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 14px;
    }
    .mobile-filter-btn {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        padding: 8px 16px;
        background: var(--bg-white);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        font-size: 14px;
        font-weight: 600;
        color: var(--text-primary);
        cursor: pointer;
        transition: all var(--transition-fast);
    }
    .mobile-filter-btn:hover { border-color: var(--primary); color: var(--primary); }
    .mobile-product-count { color: var(--text-secondary); font-size: 13px; }
    .mobile-product-count .page-count { color: var(--primary); font-weight: 700; }

    /* Sidebar → bottom sheet drawer */
    .filter-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 2200;
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--transition), visibility var(--transition);
    }
    .filter-overlay.show { opacity: 1; visibility: visible; }
    .products-sidebar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        max-height: 84vh;
        overflow-y: auto;
        background: var(--bg-white);
        z-index: 2300;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
        transform: translateY(105%);
        transition: transform 0.32s ease;
        padding-bottom: 24px;
    }
    .products-sidebar.open { transform: translateY(0); }
    .sidebar-drawer-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 18px;
        border-bottom: 1px solid var(--border-light);
        font-size: 16px;
        font-weight: 700;
        color: var(--text-primary);
        position: sticky;
        top: 0;
        background: var(--bg-white);
        z-index: 2;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }
    .filter-drawer-close {
        background: none;
        border: none;
        font-size: 24px;
        line-height: 1;
        cursor: pointer;
        color: var(--text-light);
        padding: 0 4px;
        transition: color var(--transition-fast);
    }
    .filter-drawer-close:hover { color: var(--primary); }

    /* Product table → stacked cards */
    #plist { border: none; }
    #plist .title { display: none; }
    #plist, #plist tbody { display: block; width: 100%; }
    #plist tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        position: relative;
        border: 1px solid var(--border-light);
        border-radius: var(--radius-md);
        margin-bottom: 14px;
        padding: 14px;
        background: var(--bg-card);
    }
    #plist tbody tr:hover td { background: transparent; }
    #plist td { border-bottom: none; padding: 0; }
    #plist td.img { width: 86px; flex-shrink: 0; text-align: left; padding-right: 0 !important; }
    #plist .img .image img { width: 86px; height: 86px; object-fit: contain; margin: 0; }
    #plist td.desc { flex: 1; min-width: 0; padding-left: 12px; padding-right: 26px; }
    #plist td:nth-child(2) { min-width: 0; }
    #plist .desc .pdno { margin-bottom: 4px; }
    #plist .desc .text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
    /* 小屏：makes 移入描述盒内，超出 2 行省略；原独立车型列隐藏 */
    #plist td.modellist { display: none; }
    #plist .desc .makes-mobile {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin: 4px 0 0;
        font-size: 12px;
        line-height: 1.6;
        color: var(--text-light);
    }
    #plist td.cart-cell { position: absolute; top: 12px; right: 12px; }
}
