/* ==================== 基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ==================== 头部 ==================== */
.header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 24px 32px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 28px;
    color: #333;
    font-weight: 700;
}

.stats {
    display: flex;
    gap: 24px;
}

.stat-item {
    font-size: 14px;
    color: #666;
}

.stat-item strong {
    font-size: 18px;
    color: #667eea;
    margin-left: 4px;
}

/* ==================== 导航标签 ==================== */
.tabs {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* ==================== 内容区域 ==================== */
.content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 24px;
    min-height: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== 卡片 ==================== */
.card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.card h2 {
    font-size: 20px;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #667eea;
}

.card h3 {
    font-size: 16px;
    color: #555;
    margin-bottom: 16px;
}

.section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #eee;
}

.section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* ==================== 表单 ==================== */
.form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.flex-1 {
    flex: 1;
}

.form-group label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.form-group input,
.form-group select {
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    min-width: 140px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ==================== 按钮 ==================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-danger {
    background: #ff4757;
    color: white;
}

.btn-danger:hover {
    background: #ff3344;
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
}

/* ==================== 物料ID列表 ==================== */
.material-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.material-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.material-item:hover {
    background: #f5f5f5;
}

.material-item input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
}

.material-item .material-name {
    flex: 1;
    font-size: 14px;
}

.material-item .material-id {
    font-size: 12px;
    color: #999;
    margin-left: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 进度条 */
.progress-bar {
    position: relative;
    width: 100%;
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    margin-top: 16px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

/* ==================== 商品列表 ==================== */
.product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.product-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.product-card {
    border: 1px solid #eee;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.product-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f5f5f5;
}

.product-info {
    padding: 16px;
}

.product-title {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    height: 42px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 12px;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.product-price {
    font-size: 18px;
    color: #ff4757;
    font-weight: 700;
}

.product-price::before {
    content: '¥';
    font-size: 14px;
}

.product-volume {
    font-size: 12px;
    color: #999;
}

.product-tags {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.product-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #f0f0f0;
    color: #666;
}

.product-tag.commission {
    background: #fff3e0;
    color: #f57c00;
}

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination button:hover {
    border-color: #667eea;
    color: #667eea;
}

.pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== 筛选区域 ==================== */
.filter-section {
    background: #fafafa;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

/* ==================== 加载状态 ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    margin-top: 16px;
    font-size: 16px;
}

/* ==================== 消息提示 ==================== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1001;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: #2ed573;
}

.toast.error {
    background: #ff4757;
}

/* ==================== 辅助类 ==================== */
.text-muted {
    color: #999;
    font-size: 14px;
}

.text-center {
    text-align: center;
}

.mt-16 {
    margin-top: 16px;
}

.mb-16 {
    margin-bottom: 16px;
}

/* ==================== 导出结果 ==================== */
.export-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 12px;
}

.export-file span {
    font-size: 14px;
    color: #333;
}

.export-file .count {
    color: #667eea;
    font-weight: 500;
}

.export-file a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.export-file a:hover {
    text-decoration: underline;
}

/* ==================== 数据统计 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.stats-item {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.stats-item .label {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.stats-item .value {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1 1 45%;
    }

    .form-row {
        flex-direction: column;
    }

    .form-group {
        width: 100%;
    }

    .form-group input,
    .form-group select {
        min-width: 100%;
    }

    .product-list {
        grid-template-columns: 1fr;
    }
}
