/* ========== 产品中心页面样式 ========== */

/* 搜索和筛选区域 */
.filter-section {
    background: white;
    padding: 30px 0;
    border-bottom: 1px solid #eee;
}

.search-box {
    position: relative;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 12px 20px 12px 50px;
    border: 2px solid #eee;
    border-radius: 30px;
    font-size: 1rem;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.1);
}

.search-box i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

/* 分类标签 */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.category-tab {
    padding: 8px 20px;
    border: 2px solid #eee;
    border-radius: 25px;
    background: white;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.category-tab:hover,
.category-tab.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

/* 产品网格 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
}

.product-item {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.product-item:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.product-item .product-image {
    height: 200px;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
}

.product-item .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.product-item:hover .product-image img {
    transform: scale(1.1);
}

.product-item .product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 95, 122, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.product-item:hover .product-overlay {
    opacity: 1;
}

.product-overlay .view-btn {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.2rem;
    cursor: pointer;
    transform: scale(0);
    transition: var(--transition);
}

.product-item:hover .view-btn {
    transform: scale(1);
}

.product-item .product-info {
    padding: 1.2rem;
    text-align: center;
}

.product-item .product-info h5 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
    line-height: 1.3;
    height: 2.6em; /* 允许最多2行 */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 分页 */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 50px;
}

.pagination .page-link {
    border: none;
    color: var(--text-color);
    padding: 10px 18px;
    margin: 0 3px;
    border-radius: 8px;
    transition: var(--transition);
}

.pagination .page-link:hover,
.pagination .page-item.active .page-link {
    background: var(--primary-color);
    color: white;
}

/* 产品统计 */
.products-count {
    color: var(--text-light);
    font-size: 0.9rem;
}

.products-count span {
    color: var(--primary-color);
    font-weight: 600;
}

/* 无结果提示 */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.no-results i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 1rem;
}

.no-results h4 {
    margin-bottom: 5px;
}

/* Modal Zoom & Pan Styles */
.product-modal .modal-xl {
    max-width: 90vw;
}

.product-view-container {
    width: 100%;
    height: 80vh; /* Fixed height for the viewer */
    overflow: hidden;
    position: relative;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
}

.product-view-container:active {
    cursor: grabbing;
}

.product-modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.1s ease-out;
    transform-origin: center center;
    user-select: none; /* Prevent selection while dragging */
    -webkit-user-drag: none;
}

.zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 10;
}

.zoom-controls button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dee2e6;
    background: white;
    transition: all 0.2s;
}

.zoom-controls button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Prevent layout shift when modal opens - Force scrollbar to stay */
body.modal-open {
    padding-right: 0 !important;
    overflow-y: scroll !important;
}

/* Prevent navbar from shifting */
body.modal-open .fixed-top {
    padding-right: 0 !important;
}

/* 响应式 */
@media (max-width: 1199px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .product-item .product-image {
        height: 170px;
    }
    
    .product-item .product-info {
        padding: 1rem;
    }
    
    .product-item .product-info h5 {
        font-size: 0.88rem;
        height: 2.4em;
    }
}

@media (max-width: 991px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .product-item .product-image {
        height: 180px;
    }
    
    .product-item .product-info h5 {
        font-size: 0.9rem;
        height: 2.4em;
    }
}

@media (max-width: 575px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .product-item .product-image {
        height: 150px;
    }
    
    .product-item .product-info {
        padding: 1rem;
    }
    
    .product-item .product-info h5 {
        font-size: 0.82rem;
        line-height: 1.2;
        height: 2.4em;
    }
    
    .category-tabs {
        justify-content: center;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .product-item .product-info h5 {
        font-size: 0.8rem;
        height: 2.6em; /* 稍微增加高度以适应更长的英文名称 */
    }
    
    .product-item .product-image {
        height: 140px;
    }
}
