* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

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

header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

header h1 {
    margin-bottom: 15px;
    color: #2c3e50;
}

nav {
    display: flex;
    gap: 10px;
}

.nav-btn {
    padding: 10px 20px;
    border: none;
    background: #ecf0f1;
    color: #34495e;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: #bdc3c7;
}

.nav-btn.active {
    background: #3498db;
    color: white;
}

.page {
    display: none;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.page.active {
    display: block;
}

.page h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

/* 查询页面样式 */
.query-section {
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.options-group {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.options-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
}

/* 筛选行 - 日期和排序在同一行 */
.filter-row {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-item label {
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}

.filter-item input[type="date"] {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    min-width: 130px;
    height: 36px;
    background: white;
    cursor: pointer;
    position: relative;
}

/* 让整个日期输入框都可以点击弹出日期选择器 */
.filter-item input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    background: transparent;
}

.filter-item input[type="date"]:focus,
.filter-item select:focus {
    outline: none;
    border-color: #3498db;
}

.filter-item input[type="date"]:hover,
.filter-item select:hover {
    border-color: #3498db;
}

.filter-item select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    cursor: pointer;
    height: 36px;
}

.date-separator {
    color: #666;
    font-size: 13px;
}

/* 可排序表头 */
th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    background: #2c3e50;
}

th.sort-asc::after {
    content: ' ↑';
}

th.sort-desc::after {
    content: ' ↓';
}

.button-group {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

/* 结果表格样式 */
.results-section {
    margin-top: 30px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table thead {
    background: #34495e;
    color: white;
}

table th, table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table tbody tr:hover {
    background: #f8f9fa;
}

.not-found {
    margin-top: 20px;
    padding: 15px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
}

.not-found ul {
    list-style: none;
    margin-top: 10px;
}

.not-found li {
    padding: 5px 0;
}

/* 文档管理页面样式 */
.upload-section {
    margin-bottom: 30px;
}

.data-type-selector {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.data-type-selector > label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #555;
}

.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    transition: all 0.2s;
}

.radio-label:hover {
    border-color: #3498db;
    background: #fff;
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.radio-label input[type="radio"]:checked + .radio-text {
    color: #3498db;
    font-weight: 500;
}

.radio-label:has(input[type="radio"]:checked) {
    border-color: #3498db;
    background: #e3f2fd;
}

.upload-area {
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 15px;
}

.upload-area:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

.upload-area.dragover {
    border-color: #3498db;
    background: #e3f2fd;
}

.upload-hint {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 10px;
}

/* 统计页面样式 */
.stats-section {
    margin-bottom: 30px;
}

.stats-section h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.stat-card.futures {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.stat-card.stock {
    background: linear-gradient(135deg, #F2994A 0%, #F2C94C 100%);
}

.stat-card h3 {
    font-size: 16px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-card p {
    font-size: 32px;
    font-weight: bold;
}

.doc-stats-section {
    margin-top: 30px;
}

.supplier-stats {
    margin-top: 20px;
}

.supplier-stats h4 {
    margin-bottom: 15px;
    color: #555;
}

.futures-type {
    background: #11998e;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* 数据类型标签 */
.data-type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.data-type-badge.type-futures {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    color: white;
}

.data-type-badge.type-stock {
    background: linear-gradient(135deg, #F2994A, #F2C94C);
    color: white;
}

/* 数据来源徽章 */
.source-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.source-badge.source-external {
    background: linear-gradient(135deg, #F2994A, #F2C94C);
    color: white;
}

.source-badge.source-internal {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    color: white;
}

/* 美国产标记 */
.is-us-yes {
    color: #dc2626;
    font-weight: bold;
    background: #fef2f2;
    padding: 2px 6px;
    border-radius: 3px;
}

/* 价格单元格 */
.price-cell {
    font-family: 'Consolas', 'Monaco', monospace;
    text-align: right;
    color: #2563eb;
    font-weight: 500;
}

/* 加载和消息提示 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1001;
    max-width: 400px;
}

.message.success {
    background: #27ae60;
    color: white;
}

.message.error {
    background: #e74c3c;
    color: white;
}

.message.info {
    background: #3498db;
    color: white;
}

/* 状态标签 */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.success {
    background: #27ae60;
    color: white;
}

.status-badge.error {
    background: #e74c3c;
    color: white;
}

.status-badge.info {
    background: #3498db;
    color: white;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .page {
        padding: 15px;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    table {
        font-size: 12px;
    }
    
    table th, table td {
        padding: 8px;
    }
}

