/* 全局样式重置 */
* {
    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;
    color: #333;
    line-height: 1.6;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
}

/* 分类标签 */
.category-tabs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.tab-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
}

/* 主内容区 */
.main-container {
    padding: 30px 0;
}

.content-wrapper {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* 左侧筛选栏 */
.sidebar {
    width: 260px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 120px;
}

.filter-section {
    margin-bottom: 24px;
}

.filter-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1f2937;
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #4b5563;
    transition: color 0.2s;
}

.checkbox-label:hover {
    color: #667eea;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.btn-clear {
    width: 100%;
    padding: 10px;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    color: #6b7280;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear:hover {
    background: #e5e7eb;
    color: #374151;
}

/* 右侧商品展示区 */
.goods-area {
    flex: 1;
    min-height: 500px;
}

.goods-header {
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.result-info {
    font-size: 15px;
    color: #6b7280;
}

.data-update {
    font-size: 13px;
    color: #9ca3af;
}

/* 商品网格 */
.goods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* 商品卡片 */
.goods-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.goods-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

.goods-thumb {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    margin-bottom: 16px;
    background: #f3f4f6;
}

.goods-name {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
    line-height: 1.4;
}

.goods-speed {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 12px;
}

.goods-speed.no-data {
    color: #9ca3af;
    font-size: 16px;
}

.goods-category {
    font-size: 13px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 4px 12px;
    border-radius: 12px;
}

/* 速度标签 */
.speed-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.speed-badge.lightning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.speed-badge.fast {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

.speed-badge.normal {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #374151;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 4px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #9ca3af;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    right: 30px;
    bottom: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 99;
}

.back-to-top:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .goods-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
        margin-bottom: 12px;
    }

    /* 移动端表格/列表模式 */
    .goods-grid {
        display: block; /* 取消网格布局，改为垂直堆叠 */
        gap: 0;
    }

    .goods-card {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 4px 10px;
        padding: 12px 15px;
        margin-bottom: 8px;
        text-align: left;
        width: 100%;
        flex-direction: unset;
        align-items: center;
        border-bottom: 1px solid #eee;
        border-radius: 8px;
    }

    /* 隐藏图片和徽章 */
    .goods-thumb, .speed-badge {
        display: none;
    }

    /* 调整名称样式 */
    .goods-name {
        grid-column: 1;
        grid-row: 1;
        font-size: 15px;
        margin-bottom: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 调整分类样式 */
    .goods-category {
        grid-column: 1;
        grid-row: 2;
        padding: 0;
        background: none;
        font-size: 12px;
        color: #999;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 调整速度样式 */
    .goods-speed {
        grid-column: 2;
        grid-row: 1 / span 2;
        margin-bottom: 0;
        font-size: 16px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    .goods-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .category-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 隐藏滚动条但保留功能 */
    .category-tabs::-webkit-scrollbar {
        height: 0;
        width: 0;
    }

    .tab-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    /* 针对更小屏幕的微调 */
    .goods-card {
        padding: 10px 12px;
    }
    
    .goods-name {
        font-size: 14px;
    }
    
    .goods-speed {
        font-size: 14px;
    }

    .back-to-top {
        right: 20px;
        bottom: 20px;
        width: 45px;
        height: 45px;
    }
}
