/* Products Page Specific Styles */

/* 翻页后焦点会回到标题（无障碍定位用），标题不是可点控件，不显示焦点框 */
.catalog-page #categoryTitle:focus,
.catalog-page #categoryTitle:focus-visible { outline: none; }

/* Products and product details share this stylesheet. The catalog has its own palette. */
.catalog-page .products-header h2,
.catalog-page .view-btn:hover,
.catalog-page .empty-state a {
    color: var(--ink);
}

.catalog-page .breadcrumb-container { background: #fafafa; }
.catalog-page .breadcrumb a { color: var(--muted); }
.catalog-page .breadcrumb a:hover { color: var(--ink); text-decoration: underline; }
.catalog-page .search-wrap { border-color: var(--line); }
.catalog-page .search-wrap:focus-within { outline: 2px solid var(--ink); outline-offset: 1px; }
.catalog-page .sidebar-header {
    background: #fff;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
}

.catalog-page .view-btn.active,
.catalog-page .page-num.active,
.catalog-page .page-btn:hover:not(:disabled) {
    background: var(--soft);
    color: var(--blue);
    border-color: var(--line);
}

.catalog-page .subcategory-item:is(:hover, :focus-visible, .active) {
    padding-left: 45px;
    color: var(--ink);
    background: var(--soft);
    border-left-color: var(--blue);
}

.catalog-page .subcategory-item.active { font-weight: 700; }
.catalog-page .reference-categories summary:hover { background: var(--soft); }
.catalog-page .subcategory-item:focus-visible,
.catalog-page .reference-categories summary:focus-visible,
.catalog-page .product-image:focus-visible { outline-offset: -3px; }
.catalog-page #sortSelect:focus,
.catalog-page .page-num:hover { border-color: var(--ink); }

.catalog-page .product-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.catalog-page .product-card:is(:hover, :focus-within) {
    border-color: #777;
    box-shadow: 0 3px 12px #0000000c;
    transform: none;
}

.catalog-page .product-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 16px 18px 18px;
}

.catalog-page .product-name {
    margin: 0 0 3px;
    font-size: 17px;
    color: var(--ink);
}

/* 卡片只保留图片 + 型号后，收紧图片区与文字留白，避免底部空档 */
.catalog-page .product-image { height: 176px; }
.catalog-page .product-info { padding: 12px 16px 14px; }
.catalog-page .product-name { margin: 0; }

.catalog-page .right-sidebar .sb-item { color: var(--muted); }
.catalog-page .right-sidebar .sb-item:hover { color: var(--ink); }
.catalog-page .main-footer { background: #252525; color: #ddd; }
.catalog-page .footer-section a { color: #ddd; }
.catalog-page .footer-bottom { color: #bdbdbd; }

/* Breadcrumb */
.breadcrumb-container {
    background: #f8f9fa;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #666;
}

.breadcrumb a {
    color: #2a5298;
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb a:hover {
    color: #ff6b35;
}

.breadcrumb .separator {
    color: #999;
}

.breadcrumb .current {
    color: #333;
    font-weight: 600;
}

/* Products Section Layout */
.products-section {
    padding: 40px 0;
    background: #f5f5f5;
    min-height: 70vh;
}

.products-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    align-items: start;
}

/* Category Sidebar */
.category-sidebar {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow: hidden;
    position: sticky;
    top: 150px;
}

.sidebar-header {
    background: linear-gradient(135deg, #2a5298, #1e3c72);
    color: white;
    padding: 20px;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-menu {
    padding: 10px 0;
}

.subcategory-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px 12px 45px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.subcategory-item:hover,
.subcategory-item.active {
    background: white;
    color: #2a5298;
    border-left-color: #ff6b35;
    padding-left: 50px;
}

/* Products Main Content */
.products-main {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.products-header h2 {
    color: #1e3c72;
    font-size: 28px;
    margin: 0;
}

.view-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

#sortSelect {
    padding: 8px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    background: white;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s;
}

#sortSelect:focus {
    outline: none;
    border-color: #2a5298;
}

.view-toggle {
    display: flex;
    gap: 5px;
    background: #f5f5f5;
    padding: 3px;
    border-radius: 5px;
}

.view-btn {
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.3s;
}

.view-btn:hover {
    color: #2a5298;
}

.view-btn.active {
    background: white;
    color: #2a5298;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Product Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

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

.product-card {
    background: white;
    border: 2px solid #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
}

.product-card:hover {
    border-color: #2a5298;
    box-shadow: 0 5px 20px rgba(0,0,0,0.12);
    transform: translateY(-5px);
}

.product-image {
    width: 100%;
    height: 220px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

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

.product-card:hover .product-image img {
    transform: scale(1.1);
}

.product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff6b35;
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
}

.product-info {
    padding: 20px;
}

.product-category {
    color: #2a5298;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.product-name {
    color: #333;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
}

.product-specs {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    font-size: 13px;
    color: #666;
}

.product-specs li {
    padding: 5px 0;
    display: flex;
    gap: 8px;
}

.product-specs li i {
    color: #28a745;
    font-size: 12px;
    margin-top: 3px;
}

.product-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.product-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #2a5298, #1e3c72);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(30,60,114,0.3);
}

.btn-secondary {
    background: white;
    color: #2a5298;
    border: 2px solid #2a5298;
}

.btn-secondary:hover {
    background: #2a5298;
    color: white;
}

/* List View Styles */
.products-grid.list-view .product-card {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 0;
}

.products-grid.list-view .product-image {
    height: 100%;
}

.products-grid.list-view .product-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.products-grid.list-view .product-actions {
    max-width: 400px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
}

.page-btn {
    padding: 10px 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
}

.page-btn:hover:not(:disabled) {
    background: #2a5298;
    color: white;
    border-color: #2a5298;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.page-num {
    padding: 10px 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 45px;
    text-align: center;
}

.page-num:hover {
    background: #f8f9fa;
    border-color: #2a5298;
}

.page-num.active {
    background: #2a5298;
    color: white;
    border-color: #2a5298;
}

.catalog-page .pagination,
.catalog-page .page-numbers {
    flex-wrap: wrap;
    justify-content: center;
}

.catalog-page .pagination {
    gap: 6px;
}

.catalog-page .page-num,
.catalog-page .page-btn {
    display: inline-grid;
    place-items: center;
    min-width: 36px;
    min-height: 40px;
    padding: 4px;
    font: inherit;
}

.page-gap > summary::-webkit-details-marker {
    display: none;
}

.page-gap-options {
    position: absolute;
    z-index: 2;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: min(260px, 100%);
    max-height: 185px;
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
    gap: 5px;
    padding: 8px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 4px 16px #252b3226;
}

.catalog-page .pagination {
    position: relative;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state i {
    font-size: 64px;
    color: #ccc;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: #333;
    margin-bottom: 10px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .products-layout {
        grid-template-columns: 250px 1fr;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 992px) {
    .products-layout {
        grid-template-columns: 1fr;
    }
    
    .category-sidebar {
        position: static;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .products-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .view-controls {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .products-grid.list-view .product-card {
        grid-template-columns: 1fr;
    }
    
    .products-main {
        padding: 20px;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .view-toggle {
        display: none;
    }
}

@media (max-width: 576px) {
    .breadcrumb-container {
        padding: 10px 0;
    }
    
    .breadcrumb {
        font-size: 12px;
    }
    
    .products-header h2 {
        font-size: 22px;
    }
    
    #sortSelect {
        width: 100%;
    }
}
