/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    padding: 20px;
    color: #333;
    line-height: 1.5;
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* 头部样式 - 保留原有样式 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 15px;
    text-align: center;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* 检索输入板块 */
.search-input-section {
    padding: 15px;
    background: white;
}

.search-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #667eea;
    outline: none;
}

/* 按钮和筛选显示区 */
.button-display-section {
    padding: 15px;
    background: white;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.btn-primary:hover {
    background: #5a6fd8;
}

.btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.filter-display {
    flex: 1;
    min-height: 46px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 15px;
    background: #fafafa;
    overflow-x: auto;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-tag {
    background: #e8f4fc;
    color: #3498db;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.filter-tag-remove {
    cursor: pointer;
    color: #666;
    font-size: 0.8rem;
}

/* PC端筛选区域 */
.pc-filter-section {
    padding: 15px;
    background: white;
    border-top: 1px solid #f0f0f0;
    display: block;
}

.filter-section-header {
    margin-bottom: 20px;
}

.filter-section-header h3 {
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

.pc-filter-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pc-filter-row {
    display: flex;
    gap: 15px;
}

.pc-filter-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pc-filter-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
    text-align: center;
}

/* PC端下拉框样式 */
.pc-dropdown-wrapper {
    position: relative;
    width: 100%;
}

.pc-dropdown-trigger {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #333;
    transition: border-color 0.2s;
}

.pc-dropdown-trigger:hover {
    border-color: #667eea;
}

.pc-dropdown-trigger.active {
    border-color: #667eea;
    background: #f8f9ff;
}

.pc-dropdown-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pc-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 10px;
    z-index: 9999;
    display: none;
    margin-top: 5px;
}

.pc-dropdown-menu.show {
    display: block;
}

.pc-dropdown-option {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #333;
    transition: background 0.2s;
}

.pc-dropdown-option:hover {
    background: #f5f7fa;
}

.pc-dropdown-option.selected {
    background: #667eea;
    color: white;
}

/* PC端范围输入 */
.pc-range-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.pc-range-input:focus {
    outline: none;
    border-color: #667eea;
}

.pc-range-separator {
    display: block;
    text-align: center;
    margin: 5px 0;
    color: #666;
}

.pc-dropdown-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.pc-dropdown-actions button {
    flex: 1;
    padding: 6px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.pc-dropdown-apply {
    background: #667eea;
    color: white;
}

.pc-dropdown-clear {
    background: #f0f0f0;
    color: #666;
}

/* PC端成分输入 */
.pc-component-input {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pc-component-target, .pc-component-range {
    flex: 1;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
}

.pc-component-target:focus, .pc-component-range:focus {
    outline: none;
    border-color: #667eea;
}

.pc-component-separator {
    padding: 0 5px;
    color: #666;
    font-weight: bold;
}

/* PC端多选样式 */
.pc-multi-select {
    max-height: 200px;
    overflow-y: auto;
}

.pc-multi-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    cursor: pointer;
}

.pc-checkbox {
    cursor: pointer;
}

.pc-multi-option label {
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    flex: 1;
}

.pc-other-component-select select {
    width: 100%;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

/* 移动端筛选区域 */
.mobile-filter-section {
    display: none;
    padding: 15px;
    background: white;
    border-top: 1px solid #f0f0f0;
}

.mobile-filter-header {
    margin-bottom: 15px;
}

.mobile-filter-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
}

.mobile-filter-subtitle {
    font-size: 0.8rem;
    color: #999;
    text-align: center;
    margin-top: 5px;
}

/* 移动端折叠面板 */
.mobile-filter-panel {
    margin-bottom: 10px;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
}

.mobile-panel-header {
    padding: 15px;
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.mobile-panel-header.active {
    border-bottom: none;
}

.mobile-panel-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-panel-toggle {
    transition: transform 0.3s;
}

.mobile-panel-toggle.active {
    transform: rotate(180deg);
}

.mobile-panel-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 15px;
}

.mobile-panel-content.expanded {
    max-height: 800px;
    padding: 15px;
}

/* 移动端筛选项 */
.mobile-filter-item {
    margin-bottom: 15px;
}

.mobile-filter-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 6px;
}

.mobile-range-input {
    display: flex;
    align-items: center;
    gap: 5px;
}

.mobile-range-min, .mobile-range-range {
    flex: 1;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
}

.mobile-range-min:focus, .mobile-range-range:focus {
    outline: none;
    border-color: #667eea;
}

.mobile-range-separator {
    padding: 0 5px;
    color: #666;
    font-weight: bold;
}

.mobile-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
}

.mobile-select:focus {
    outline: none;
    border-color: #667eea;
}

/* 移动端多选 */
.mobile-multi-select {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.mobile-multi-option {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mobile-checkbox {
    cursor: pointer;
}

.mobile-multi-option label {
    font-size: 0.85rem;
    color: #333;
    cursor: pointer;
}

.mobile-other-component select {
    width: 100%;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

/* 结果区域 */
.results-section {
    padding: 15px;
    background: white;
    border-top: 1px solid #f0f0f0;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.results-header h3 {
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
}

/* 排序标签 */
.sort-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sort-tab {
    padding: 8px 16px;
    font-size: 0.85rem;
    background: #f0f0f0;
    border-radius: 20px;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    border: none;
    color: #666;
    transition: all 0.2s;
}

.sort-tab.active {
    background: #667eea;
    color: white;
}

/* 产品卡片 */
.results-container {
    min-height: 200px;
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.no-results i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 15px;
}

.no-results p {
    font-size: 1rem;
    color: #666;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #e0e0e0;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.product-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
    position: relative;
}

.product-code {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
}

.product-name {
    font-size: 1rem;
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
}

.product-price {
    font-size: 1.3rem;
    color: #e74c3c;
    font-weight: 700;
    margin-bottom: 5px;
}

.product-shipping {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.product-body {
    padding: 15px;
}

.product-specs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 15px;
}

.spec-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.spec-label {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.spec-value {
    font-size: 0.9rem;
    color: #2c3e50;
    font-weight: 600;
}

.product-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
}

.feature-tag {
    background: #e8f4fc;
    color: #3498db;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.product-footer {
    padding: 12px 15px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-view {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-view:hover {
    background: #5a6fd8;
}

.product-colors {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    font-size: 0.85rem;
}

/* 分页控件 */
.pagination {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.pagination-info {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.pagination-btn {
    padding: 8px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    color: #333;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    border-color: #667eea;
    color: #667eea;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-numbers {
    display: flex;
    gap: 5px;
}

.page-number {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    color: #333;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.page-number:hover {
    border-color: #667eea;
    color: #667eea;
}

.page-number.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    overflow-y: auto;
}

.modal-content {
    background: white;
    margin: 50px auto;
    width: 90%;
    max-width: 900px;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    z-index: 10001;
}

.close:hover {
    color: #333;
}

/* 产品详情页样式 */
.product-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #667eea;
}

.product-detail-title h2 {
    color: #2c3e50;
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.product-detail-title .product-code {
    color: #666;
    font-size: 0.9rem;
}

.product-detail-status {
    text-align: right;
}

.stock-status {
    display: inline-block;
    padding: 4px 12px;
    background: #28a745;
    color: white;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.product-detail-price {
    font-size: 1.8rem;
    color: #e74c3c;
    font-weight: 700;
    margin-bottom: 5px;
}

.shipping-time {
    color: #666;
    font-size: 0.9rem;
}

.detail-section {
    margin-bottom: 25px;
}

.detail-section h3 {
    color: #667eea;
    font-size: 1.1rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.detail-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.detail-item .label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 4px;
}

.detail-item .value {
    font-size: 0.95rem;
    color: #2c3e50;
    font-weight: 600;
}

.feature-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.feature-list span {
    background: #667eea;
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
}

.component-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.component-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
}

.component-item .material {
    font-size: 0.9rem;
    color: #2c3e50;
    margin-bottom: 4px;
}

.component-item .percentage {
    font-size: 1rem;
    color: #e74c3c;
    font-weight: 700;
}

.no-ribbing {
    color: #ff0000 !important;
    font-weight: 600;
}

.product-images {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 0;
}

.product-images img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: transform 0.2s;
}

.product-images img:hover {
    transform: scale(1.05);
}

/* 图片查看模态框 */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 10001;
}

.image-modal-content {
    position: relative;
    width: 90%;
    height: 90%;
    margin: 5% auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modal-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.image-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    z-index: 10002;
}

.image-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    transform: translateY(-50%);
}

.image-nav button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.2s;
}

.image-nav button:hover {
    background: rgba(255,255,255,0.3);
}

/* 页脚 */
footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 15px;
    margin-top: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 8px;
    }
    
    .pc-filter-section {
        display: none;
    }
    
    .mobile-filter-section {
        display: block;
    }
    
    .button-display-section {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .button-group {
        width: 100%;
    }
    
    .btn-primary, .btn-secondary {
        flex: 1;
        padding: 12px;
    }
    
    .filter-display {
        min-height: 40px;
        padding: 8px 12px;
    }
    
    .results-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .sort-tabs {
        justify-content: center;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 20px auto;
        width: 95%;
        padding: 15px;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .component-list {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .product-images img {
        width: 120px;
        height: 120px;
    }
    
    .image-modal-content {
        width: 100%;
        height: 100%;
        margin: 0;
    }
    
    #modal-image {
        max-width: 100%;
        max-height: 100%;
    }
    
    .mobile-multi-select {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.3rem;
    }
    
    .subtitle {
        font-size: 0.8rem;
    }
    
    .search-input {
        padding: 10px 12px;
        font-size: 0.95rem;
    }
    
    .mobile-panel-header {
        padding: 12px;
    }
    
    .mobile-panel-title {
        font-size: 0.9rem;
    }
    
    .sort-tab {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .product-card {
        border-radius: 6px;
    }
    
    .product-header {
        padding: 12px;
    }
    
    .product-body {
        padding: 12px;
    }
    
    .product-specs {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .pagination-controls {
        flex-wrap: wrap;
    }
    
    .page-number {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
}

/* 防止微信调整字体大小 */
body {
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
}

/* 改善微信中的滚动体验 */
html {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
}

/* 修复微信中输入框聚焦问题 */
input, textarea {
    -webkit-user-select: auto !important;
    user-select: auto !important;
}

/* 修复微信长按菜单 */
* {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
}

input, textarea {
    -webkit-user-select: auto;
    user-select: auto;
}