/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 头部样式 */
header {
    background-color: #fff;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

/* 添加橙色装饰条 */
header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #ff8c00, #ffad33, #ff8c00);
    border-radius: 0 0 2px 2px;
}

header h1 {
    color: #ff8c00;
    font-size: 1.8rem;
}

.search-container {
    display: flex;
    max-width: 400px;
    width: 100%;
}

.search-container input {
    flex: 1;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 1rem;
}

.search-container button {
    padding: 0.8rem 1.5rem;
    background-color: #ff8c00;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.search-container button:hover {
    background-color: #e07b00;
    box-shadow: 0 3px 8px rgba(255, 140, 0, 0.3);
}

/* 主要内容样式 */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ff8c00' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
}

.filter-section {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-section h2 {
    margin-bottom: 1.2rem;
    color: #333;
    font-size: 1.3rem;
    font-weight: 600;
    position: relative;
    padding-left: 12px;
}

/* 标题装饰下划线 */
.filter-section h2::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 12px;
    width: 60px;
    height: 3px;
    background-color: #ff8c00;
    border-radius: 1.5px;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group h3 {
    margin-bottom: 0.8rem;
    color: #555;
    font-size: 1rem;
    font-weight: 500;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background-color: #f8f9fa;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.filter-btn:hover::before {
    left: 100%;
}

.filter-btn:hover {
    background-color: #e9ecef;
    border-color: #ff8c00;
    transform: translateY(-1px);
}

.filter-btn.active {
    background-color: #ff8c00;
    color: white;
    border-color: #ff8c00;
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.3);
}

/* 商品列表样式 */
.product-list {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #ffecd0;
    position: relative;
    overflow: hidden;
}

.product-list::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(to bottom, #ffad33, #ff8c00);
    border-radius: 0 3px 3px 0;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.product-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    background-color: #fff;
    position: relative;
}

/* 卡片装饰角 */
.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 40px 40px 0;
    border-color: transparent #ff8c00 transparent transparent;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover::before {
    opacity: 1;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(255, 140, 0, 0.2);
    border-color: #ff8c00;
}

.product-image {
    height: 200px;
    overflow: hidden;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s ease;
    padding: 10px;
}

.product-card:hover .product-image img {
    transform: scale(1.08);
}

.product-info {
    padding: 1rem;
    text-align: center;
}

.product-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.7rem;
    color: #333;
    font-weight: 600;
    line-height: 1.3;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-specs {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

/* 无商品提示样式 */
.no-products {
    text-align: center;
    color: #999;
    padding: 3rem;
    font-style: italic;
    grid-column: 1 / -1;
}

/* 详情页样式 */
.product-detail-container {
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #ffecd0;
    position: relative;
    overflow: hidden;
}

/* 详情页装饰边框 */
.product-detail-container::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 1px dashed #ffd591;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0.5;
}

.product-detail-container h2 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 700;
    border-bottom: 2px solid #ffecd0;
    padding-bottom: 0.8rem;
    position: relative;
}

/* 标题装饰效果 */
.product-detail-container h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100px;
    height: 2px;
    background-color: #ff8c00;
}

.back-link {
    display: inline-flex;
    align-items: center;
    margin-bottom: 1.5rem;
    color: #ff8c00;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
}

.back-link:before {
    content: '←';
    margin-right: 5px;
    font-size: 1.2rem;
}

.back-link:hover {
    background-color: rgba(255, 140, 0, 0.1);
    transform: translateX(-3px);
}

.product-detail-container h2 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 700;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.8rem;
}

.product-images {
    margin: 2rem 0;
    background-color: #fffaf0;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #ffecd0;
}

.main-image {
    width: 100%;
    height: 400px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    border-radius: 8px;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s ease;
}

.main-image:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 20px;
    transition: transform 0.5s ease;
}

.main-image:hover img {
    transform: scale(1.03);
}

.thumbnails {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.thumbnail {
    width: 100px;
    height: 100px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    object-fit: contain;
    background-color: #fff;
    padding: 8px;
}

.thumbnail:hover {
    border-color: #ff8c00;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.2);
}

.thumbnail.active {
    border-color: #ff8c00;
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.3);
}

.product-info {
    padding: 1.5rem 0;
    border-top: 1px solid #eee;
}

.product-info p {
    margin-bottom: 0.8rem;
}

/* 页脚样式 */
footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .main-image {
        height: 300px;
    }
    
    .thumbnails {
        flex-wrap: wrap;
    }
}

/* 分页相关样式 */
.pagination-container {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #ffecd0;
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
}

/* 分页容器装饰 */
.pagination-container::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 2px;
    background-color: #ff8c00;
    border-radius: 1px;
}

.page-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: #666;
}

/* 每页显示数量选择器样式 */
#items-per-page {
    padding: 0.3rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

#items-per-page:hover {
    border-color: #ff8c00;
}

/* 分页控件样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* 分页按钮样式 */
.pagination button {
    padding: 0.5rem 0.8rem;
    border: 1px solid #ddd;
    background-color: #fff;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.pagination button:hover:not(:disabled) {
    background-color: #f8f9fa;
    border-color: #ff8c00;
    color: #ff8c00;
}

/* 分页导航按钮样式 */
.pagination-nav {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

.pagination-nav button {
    padding: 0.5rem 1rem;
    font-weight: 500;
}

/* 页码按钮样式 */
.page-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 活动状态样式 */
.page-btn.active,
.page-btn.active:hover {
    background-color: #ff8c00;
    color: white;
    border-color: #ff8c00;
    box-shadow: 0 2px 6px rgba(255, 140, 0, 0.3);
}

/* 禁用状态样式 */
.pagination button:disabled {
    background-color: #f5f5f5;
    color: #ccc;
    border-color: #ddd;
    cursor: not-allowed;
}

/* 分页省略号样式 */
.pagination-dots {
    padding: 0.5rem 0.8rem;
    color: #666;
    font-size: 1rem;
}

/* 分页响应式设计 */
/* 添加视口元数据，确保移动设备正确显示 */
@media (max-width: 320px) {
    /* 小型手机（iPhone SE等）响应式样式 */
    header {
        padding: 0.8rem 1rem;
    }
    
    header h1 {
        font-size: 1.4rem;
    }
    
    .search-container button {
        padding: 0.6rem 1rem;
    }
    
    main {
        padding: 1rem;
    }
    
    .filter-section,
    .product-list {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .filter-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .product-image {
        height: 180px;
    }
    
    .product-detail-container {
        padding: 1rem;
    }
    
    .main-image {
        height: 250px;
    }
    
    .thumbnail {
        width: 80px;
        height: 80px;
    }
    
    footer {
        padding: 1rem;
    }
}

@media (max-width: 480px) and (min-width: 321px) {
    /* 中型手机（iPhone、Android手机）响应式样式 */
    header {
        padding: 0.8rem 1.2rem;
    }
    
    header h1 {
        font-size: 1.6rem;
    }
    
    main {
        padding: 1.2rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .product-image {
        height: 160px;
    }
    
    .filter-btn {
        padding: 0.45rem 0.9rem;
    }
    
    .main-image {
        height: 280px;
    }
    
    .pagination button {
        padding: 0.4rem 0.7rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    /* 平板设备响应式样式 */
    header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 1.2rem;
    }
    
    .main-image {
        height: 300px;
    }
    
    .thumbnails {
        flex-wrap: wrap;
    }
    
    .pagination-container {
        padding: 1.2rem;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    /* 小型笔记本/平板横屏响应式样式 */
    main {
        padding: 1.5rem;
        max-width: 100%;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .product-list,
    .filter-section {
        padding: 1.2rem;
    }
}

/* 增强原有分页响应式样式 */
@media (max-width: 600px) {
    .page-info {
        flex-direction: column;
        gap: 0.8rem;
        align-items: flex-start;
    }
    
    .pagination {
        flex-direction: column;
        gap: 1rem;
    }
    
    .pagination-nav {
        margin-left: 0;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-btn {
        min-width: 32px;
        height: 32px;
    }
}

/* 为移动设备优化组件显示 */
/* 确保所有交互元素有足够大的触摸目标区域 */
button, .filter-btn, .thumbnail, .back-link {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255, 140, 0, 0.2);
}

/* 优化触摸交互效果 */
button:active, .filter-btn:active, .back-link:active {
    transform: scale(0.97);
    transition: transform 0.1s;
}

/* 增强移动端按钮样式 */
@media (max-width: 768px) {
    button {
        min-height: 44px; /* 符合触摸目标区域标准 */
        min-width: 44px; /* 符合触摸目标区域标准 */
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
    }
    
    /* 优化搜索按钮 */
    .search-container button {
        min-height: 48px;
        font-weight: 500;
    }
    
    /* 优化筛选按钮 */
    .filter-btn {
        min-height: 38px;
        min-width: 70px;
        border-radius: 20px;
        white-space: nowrap;
    }
    
    /* 优化分页按钮 */
    .pagination button {
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 优化图片显示 */
    .product-image img {
        transition: none; /* 移动设备上禁用过渡效果，提升性能 */
    }
    
    .main-image img {
        transition: none; /* 移动设备上禁用过渡效果，提升性能 */
    }
    
    /* 优化缩略图 */
    .thumbnail {
        border-width: 1px;
        padding: 6px;
    }
    
    /* 优化产品卡片 */
    .product-card {
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    
    /* 优化返回链接 */
    .back-link {
        min-height: 44px;
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
        display: inline-flex;
        align-items: center;
    }
    
    /* 优化标题大小 */
    .product-detail-container h2 {
        font-size: 1.5rem;
    }
    
    /* 优化段落文字 */
    p {
        line-height: 1.7;
    }
    
    /* 增强焦点样式，提高可访问性 */
    button:focus-visible, .filter-btn:focus-visible, .back-link:focus-visible {
        outline: 2px solid #ff8c00;
        outline-offset: 2px;
    }
}

/* 为小屏幕设备优化字体大小和间距 */
@media (max-width: 480px) {
    body {
        font-size: 15px; /* 稍微增大基础字体大小，提升可读性 */
    }
    
    h1, h2, h3, h4, h5, h6 {
        line-height: 1.3;
    }
    
    .filter-section h2 {
        font-size: 1.2rem;
    }
    
    .filter-group h3 {
        font-size: 0.95rem;
    }
    
    /* 增加元素间距，提升可读性 */
    .product-info {
        padding: 1.2rem 0;
    }
    
    .product-info h3 {
        min-height: auto;
        margin-bottom: 0.5rem;
    }
    
    /* 优化详情页布局 */
    .product-info p {
        margin-bottom: 1rem;
    }
    
    /* 优化筛选区域布局 */
    .filter-options {
        gap: 0.6rem;
    }
    
    /* 优化产品网格布局 */
    .products-grid {
        gap: 1.2rem;
    }
}

/* 禁用移动设备上的某些悬停效果，减少不必要的渲染 */
@media (hover: none) and (pointer: coarse) {
    .product-card:hover::before {
        opacity: 0; /* 禁用移动设备上的卡片装饰角 */
    }
    
    .main-image:hover {
        box-shadow: 0 2px 8px rgba(0,0,0,0.05); /* 禁用悬停阴影效果 */
    }
    
    .search-container button:hover {
        background-color: #ff8c00; /* 保持原始颜色 */
        box-shadow: none;
    }
}