/* 产品中心页面样式 */
.products-page {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.page-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: #333;
}

/* 搜索功能样式 */
.search-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
}

.search-box input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #007bff;
}

.search-box button {
    padding: 12px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.search-box button:hover {
    background: #0056b3;
}

.search-icon {
    font-size: 18px;
}

.search-filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.search-filters select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.search-filters select:focus {
    outline: none;
    border-color: #007bff;
}

/* 全部商品按钮 */
.show-all-btn {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.show-all-btn:hover {
    background: #218838;
    transform: translateY(-2px);
}

.all-icon {
    font-size: 16px;
}

/* 主布局 - 使用CSS Grid确保高度对齐 */
.products-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    min-height: 100vh;
}

/* 左侧品类导航 */
.category-sidebar {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1.5rem;
    width: 300px;
    flex-shrink: 0;
    height: auto;
    min-height: 100vh;
}

/* 品类区域 */
.category-section {
    margin-bottom: 2rem;
}

.category-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #007bff;
}

/* 品牌列表 */
.brand-list {
    margin-bottom: 1rem;
}

.brand-item {
    margin-bottom: 0.5rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

.brand-header {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
    border: none;
    width: 100%;
    text-align: left;
}

.brand-header:hover {
    background: #e9ecef;
}

.brand-name {
    font-size: 0.95rem;
    color: #333;
    font-weight: 500;
}

/* 展开/折叠图标样式 */
.toggle-icon {
    color: #666;
    transition: transform 0.3s ease;
    font-size: 14px;
    font-style: normal;
    display: inline-block;
    width: 16px;
    height: 16px;
    text-align: center;
    line-height: 16px;
}

/* 品牌折叠状态 */
.brand-item.collapsed .quality-list {
    display: none;
    visibility: hidden;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.brand-item.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

/* 品质列表 */
.quality-list {
    background: white;
    border-top: 1px solid #e9ecef;
}

.quality-item {
    border-bottom: 1px solid #f1f3f4;
}

.quality-item:last-child {
    border-bottom: none;
}

.quality-header {
    background: #f8f9fa;
    padding: 0.6rem 1rem 0.6rem 2rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
}

.quality-header:hover {
    background: #e9ecef;
}

.quality-name {
    font-size: 0.9rem;
    color: #555;
    font-weight: 500;
}

.quality-item.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.quality-item.collapsed .model-list {
    display: none;
    visibility: hidden;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

/* 型号列表 */
.model-list {
    background: white;
    padding: 0.5rem 0;
}

.model-item {
    padding: 0.5rem 1rem 0.5rem 3rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: #666;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.model-item:hover {
    background: #f8f9fa;
    color: #007bff;
    border-left-color: #007bff;
}

.model-item.active {
    background: #e3f2fd;
    color: #007bff;
    border-left-color: #007bff;
    font-weight: 500;
}

/* 右侧产品展示 - 确保与左侧高度一致 */
.product-display {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 2rem;
    flex: 1;
    height: auto;
    min-height: 100vh;
}

/* 产品卡片样式 */
.product-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e9ecef;
    margin-bottom: 1.5rem;
    height: fit-content;
    min-height: 350px;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

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

.product-card .product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.product-card .product-info {
    padding: 1rem;
}

.product-card .product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.product-card .product-brand,
.product-card .product-quality,
.product-card .product-price {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.3rem;
    line-height: 1.2;
}

.product-card .product-price {
    color: #007bff;
    font-weight: 600;
    font-size: 1rem;
}

.product-card .product-description {
    font-size: 0.85rem;
    color: #888;
    line-height: 1.4;
    margin-top: 0.5rem;
}

/* 产品网格布局 - 由JavaScript动态控制 */

/* 产品图片展示 - 3列5行布局 */
.product-gallery {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    align-content: start;
    margin-bottom: 2rem;
}

.product-image {
    height: 320px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    border: 1px solid #e9ecef;
}

.product-image:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.image-placeholder {
    height: 200px;
    min-height: 200px;
    flex-shrink: 0;
    flex: 1;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #e9ecef;
}

.placeholder-icon {
    font-size: 3rem;
    color: #ccc;
}

/* 图片介绍文字 - 向上调整3毫米 */
.product-image .image-info {
    height: 120px;
    min-height: 120px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.7rem 1rem 1rem 1rem;
    text-align: center;
    background: white;
    margin-top: -3px !important;
}

.product-image .image-info h3 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    line-height: 1.3;
    font-weight: 600;
}

.product-image .image-info p {
    color: #666;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    line-height: 1.2;
}

/* 翻页功能样式 */
.pagination {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
    text-align: center;
    flex-shrink: 0;
}

.pagination-info {
    margin-bottom: 1rem;
    color: #666;
    font-size: 0.9rem;
}

.pagination-info span {
    margin: 0 1rem;
}

.pagination-info strong {
    color: #007bff;
    font-weight: 600;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 40px;
}

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

.page-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.page-btn:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.page-numbers {
    display: flex;
    gap: 0.25rem;
}

.page-icon {
    font-size: 12px;
}

/* 滚动条样式优化 */
.category-sidebar::-webkit-scrollbar,
.product-display::-webkit-scrollbar {
    width: 8px;
}

.category-sidebar::-webkit-scrollbar-track,
.product-display::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.category-sidebar::-webkit-scrollbar-thumb,
.product-display::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.category-sidebar::-webkit-scrollbar-thumb:hover,
.product-display::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 加载动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .products-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .category-sidebar {
        position: static;
        max-height: none;
        order: 2;
        margin-bottom: 1rem;
    }
    
    .product-display {
        order: 1;
    }
    
    .search-filters {
        justify-content: center;
    }
    
    .show-all-btn {
        margin-left: 0;
        margin-top: 1rem;
    }
}

@media (max-width: 768px) {
    .products-page {
        padding: 1rem 0;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .search-section {
        padding: 1rem;
    }
    
    .search-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .category-sidebar {
        padding: 1rem;
    }
    
    .product-display {
        padding: 1.5rem;
    }
    
    .product-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .product-image {
        height: 280px;
    }
    
    .image-placeholder {
        min-height: 180px;
    }
    
    .pagination-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .page-numbers {
        order: -1;
    }
}

@media (max-width: 480px) {
    .products-layout {
        gap: 0.5rem;
    }
    
    .search-section {
        padding: 0.8rem;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .category-sidebar {
        padding: 0.8rem;
    }
    
    .product-display {
        padding: 1rem;
    }
    
    .product-gallery {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .product-image {
        height: 260px;
    }
    
    .image-placeholder {
        min-height: 140px;
    }
    
    .brand-header,
    .quality-header {
        padding: 0.6rem 0.8rem;
    }
    
    .model-item {
        padding: 0.4rem 0.8rem 0.4rem 2.5rem;
    }
    
    .pagination {
        padding: 1rem;
    }
    
    .pagination-info span {
        display: block;
        margin: 0.5rem 0;
    }
}

/* 选中产品卡片样式 */
.selected-product-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.selected-product-card .product-image img {
    width: 100%;
    height: 300px;
    object-fit: contain;
    object-position: center;
    border-radius: 10px;
}

.selected-product-card .product-info h3 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 1rem;
}

.selected-product-card .product-info p {
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
    color: #666;
}

.selected-product-card .product-info .brand,
.selected-product-card .product-info .quality,
.selected-product-card .product-info .price {
    color: #333;
    font-weight: 500;
}

.selected-product-card .product-info .description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.selected-product-card .product-actions {
    margin-top: 1rem;
}

.selected-product-card .btn {
    padding: 0.8rem 2rem;
    font-size: 1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.selected-product-card .btn-primary {
    background: #007bff;
    color: white;
}

.selected-product-card .btn-primary:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .selected-product-card {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .selected-product-card .product-image img {
        height: 250px;
        object-fit: contain;
        object-position: center;
    }
}

/* 图片放大模态框样式 */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.image-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    text-align: center;
    animation: zoomIn 0.3s ease;
}

.modal-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: #ff6b6b;
    transform: scale(1.1);
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.modal-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.modal-prev {
    left: 20px;
}

.modal-next {
    right: 20px;
}

.modal-info {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    text-align: center;
    font-size: 14px;
    opacity: 0.8;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from { 
        opacity: 0;
        transform: scale(0.8);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    /* 产品网格优化 */
    .product-display {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 10px;
    }
    
    .product-card {
        min-height: 300px;
    }
    
    .product-card .product-image img {
        height: 150px;
    }
    
    .product-card .product-info {
        padding: 10px;
        font-size: 14px;
    }
    
    .product-card .product-name {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    /* 搜索和筛选优化 */
    .search-filters {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .search-box {
        width: 100%;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .filter-buttons {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .filter-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    /* 分页优化 */
    .pagination {
        flex-wrap: wrap;
        gap: 5px;
        padding: 15px;
    }
    
    .pagination button {
        padding: 10px 12px;
        font-size: 14px;
        min-width: 44px; /* 触摸友好的最小尺寸 */
    }
    
    /* 模态框优化 */
    .modal-content {
        max-width: 95%;
        max-height: 90vh;
        margin: 5vh auto;
    }
    
    .modal-nav {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .modal-prev {
        left: 15px;
    }
    
    .modal-next {
        right: 15px;
    }
    
    .modal-close {
        top: -40px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }
    
    .modal-image {
        max-height: 60vh;
    }
    
    /* 触摸优化 */
    .product-card {
        cursor: pointer;
        transition: transform 0.2s ease;
    }
    
    .product-card:active {
        transform: scale(0.98);
    }
    
    /* 移动端专用样式 */
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .product-display {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 5px;
    }
    
    .product-card {
        min-height: 250px;
    }
    
    .product-card .product-image img {
        height: 120px;
    }
    
    .search-filters {
        padding: 10px;
    }
    
    .filter-buttons {
        justify-content: center;
    }
    
    .pagination {
        padding: 10px;
    }
    
    .pagination button {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* 懒加载样式 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

.product-image img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    object-position: center;
    transition: opacity 0.3s ease;
}

.image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #666;
    font-size: 14px;
}
