/* 基础样式 */
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    line-height: 1.5;
}

.main-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏样式 */
sidebar {
    width: 250px;
    padding: 20px;
    border-right: 3px solid #ddd;
    overflow-y: auto;
    z-index: 100;
    position: sticky;
    top: 60px;
    left: 0;
    height: calc(100vh - 120px);
    align-self: flex-start;
}

/* 为侧边栏添加顶部和底部渐变过渡 */
sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    pointer-events: none;
    z-index: 10;
}

sidebar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    pointer-events: none;
    z-index: 10;
}

.sidebar-header {
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 20px;
    margin: 0;
    padding: 0;
}

sidebar h3 {
    font-size: 16px;
    margin: 25px 0 15px 0;
    font-weight: 600;
}

sidebar ul {
    padding: 0;
    margin: 0;
    list-style: none;
}

sidebar ul li {
    margin-bottom: 8px;
}

sidebar ul li a {
    text-decoration: none;
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    position: relative;
}

sidebar ul li a:hover {
    background-color: rgba(226, 0, 0, 0.05);
    transform: translateX(2px);
    border-left: 3px solid #e20000;
}

/* 二级菜单样式 */
.category-list {
    margin-bottom: 15px;
}

.platform-list {
    margin-top: 5px;
    margin-left: 15px;
    display: none;
}

.platform-list li {
    margin-bottom: 5px;
}

.platform-list li a {
    font-size: 13px;
    padding: 6px 10px;
    border-left: 2px solid #eee;
}

.platform-item:hover {
    border-left: 2px solid #e20000 !important;
}

/* 默认状态 */
.category-item > a:after {
    content: "+";
    float: right;
    font-weight: bold;
    transition: transform 0.3s ease;
}

/* 激活状态 */
.category-item > a.active:after {
    content: "+";
}

/* 展开状态优先级更高 */
.category-item > a.expanded:after {
    content: "-";
}

sidebar ul li a:hover {
    background-color: #f0f0f0;
}

/* 修复侧边栏悬浮样式冲突 */
sidebar ul li a.active {
    font-weight: 500;
    background-color: rgba(226, 0, 0, 0.1);
    color: #e20000;
}

/* 搜索框 */
.sidebar-search {
    margin: 20px 0;
}

.sidebar-search input {
    color: #777;
    background-color: transparent;
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.sidebar-search input:focus {
    outline: none;
}

/* 主内容区 */
main {
    padding: 30px;
    box-sizing: border-box;
    flex: 1;
    width: calc(100% - 250px);
    min-height: 100vh;
    position: relative;
    background: transparent;
}

/* Page banner - full width hero image */
.page-banner {
    position: relative;
    left: 0;
    width: 100%;
    background-color: transparent;
    overflow: hidden;
    pointer-events: none !important;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-banner * {
    pointer-events: none !important;
}

.page-banner-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    display: block;
    pointer-events: none !important;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    cursor: default !important;
}

/* 为banner下面的内容添加顶部间距 */
.header-banner {
    margin-top: 0;
    background: linear-gradient(135deg, rgba(226, 0, 0, 0.06) 0%, rgba(226, 0, 0, 0.02) 100%);
    text-align: center;
    position: relative;
    overflow: hidden;
    padding: 40px 20px;
    border-radius: 12px;
    margin-bottom: 40px;
    box-shadow: 0 4px 20px rgba(226, 0, 0, 0.08);
}

.header-banner .banner-content {
    position: relative;
    z-index: 2;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-banner h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #e20000, #ff4444);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-banner p {
    font-size: 1.2rem;
    margin: 0;
    font-weight: 300;
}

/* 产品网格 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* 自动填充，最小宽度300px */
    gap: 25px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 100%;
}

/* 产品区域 */
.products-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 30px;
}

.products-header {
    display: block; /* 改为块级元素，实现垂直排列 */
    width: 100%;
    margin-bottom: 20px;
}

/* 产品卡片 */
.product-item {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    height: 350px;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    width: 100%;
    position: relative;
    cursor: pointer;
    border: 1px solid #eee;
}

.product-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 35px rgba(226, 0, 0, 0.12);
}

.product-image {
    height: 150px;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #eee;
    position: relative;
    transition: background-color 0.3s ease;
}

.product-image img {
    max-width: 100%;
    max-height: 130px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-item:hover .product-image img {
    transform: scale(1.03);
}

.product-title {
    font-size: 16px;
    margin: 0 0 10px 0;
    font-weight: 600;
    height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    transition: color 0.3s ease;
}

.product-item:hover .product-title {
    color: #e20000;
}

.product-description {
    font-size: 14px;
    flex: 1;
    margin-bottom: 15px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    line-height: 1.5;
}

.product-info {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

.product-link {
    display: inline-block;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    transition: all 0.3s ease;
    align-self: flex-start;
    min-width: 100px;
    transform: translateY(0);
    font-size: 14px;
    border: none;
}

.product-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(226, 0, 0, 0.3);
}

.product-link:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(226, 0, 0, 0.2);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 40px 0;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination-button {
    padding: 10px 16px;
    min-width: 44px;
    border: 1px solid #e9ecef;
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    background: #ffffff;
    color: #495057;
    font-weight: 500;
}

.pagination-button:hover:not(.disabled) {
    color: #e20000;
    border-color: #e20000;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(226, 0, 0, 0.15);
}

.pagination-button.active {
    background: #e20000;
    color: white;
    border-color: #e20000;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(226, 0, 0, 0.25);
}

.pagination-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 8px;
    color: #999;
}

.prev-button, .next-button {
    padding: 8px 15px;
}

/* 其他辅助样式 */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.no-products {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
    border-radius: 8px;
}

.error-message {
    color: #d32f2f;
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* 产品数量统计 */
.products-count {
    font-size: 24px;
    color: #e20000;
    margin: 0 0 30px 0;
    padding: 20px 0 15px 0;
    border-bottom: 3px solid transparent;
    display: block;
    width: 100%;
    font-weight: 700;
    position: relative;
}

.products-count::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #e20000, #ff4444);
}

.products-count::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -3px;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #e20000, #ff4444);
}

.products-count .right-underline {
    position: absolute;
    right: 0;
    bottom: -3px;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #e20000, #ff4444);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* 平板上自动适应 */
        gap: 20px; /* 减小间距 */
        width: 100%;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    sidebar {
        position: relative;
        width: 100%;
        height: auto;
        max-height: 300px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        top: auto;
        left: auto;
        align-self: auto;
    }
    
    /* 移动端移除渐变效果 */
    sidebar::before,
    sidebar::after {
        display: none;
    }
    
    main {
        margin-left: 0; /* 移动端移除左边距 */
        width: 100%;
        padding: 15px;
        position: relative;
    }
    
    /* Reset page banner for mobile */
    .page-banner {
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        height: 180px;
        margin-bottom: 20px;
        background-color: transparent; /* 移动端也去掉背景色 */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .page-banner-img {
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        object-fit: contain; /* 移动端也防止拉伸 */
        object-position: center;
        display: block;
    }
    
    .header-banner {
        padding: 30px 20px;
        margin-bottom: 25px;
        border-radius: 8px;
    }
    
    .header-banner h1 {
        font-size: 2rem;
    }
    
    .header-banner p {
        font-size: 1rem;
    }
    
    .product-item:hover {
        transform: translateY(-3px);
    }
    
    .product-link {
        padding: 8px 16px;
        font-size: 13px;
        border-radius: 4px;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
        gap: 15px;
    }
    
    .product-item {
        height: auto;
        min-height: 300px;
    }
    
    .products-header {
        margin-bottom: 15px;
    }
}

/* 简化的滚动条样式 */
sidebar::-webkit-scrollbar {
    width: 6px;
}

sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #e20000, #ff4444);
    border-radius: 3px;
}

sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #ff4444, #e20000);
}

/* 键盘焦点样式 */
.product-link:focus,
.pagination-button:focus,
sidebar ul li a:focus {
    outline: 2px solid #e20000;
    outline-offset: 2px;
}

@keyframes expandLine {
    to {
        background-size: 80px 3px;
    }
}

/* 加载动画样式 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--body-bg, #ffffff);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(226, 0, 0, 0.2);
    border-top: 4px solid #e20000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fade-out {
    opacity: 0;
    pointer-events: none;
}

.right-underline {
    display: inline-block;
    width: 100%;
    height: 2px;
    background: #e20000;
    margin-top: 4px;
    margin-left: 2px;
}

/* 键盘导航样式 */
.using-keyboard *:focus {
    outline: 2px solid #e20000 !important;
    outline-offset: 2px !important;
}
