/* ========== 基础样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: #1a1a3a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --text-muted: #606080;
    --accent-blue: #00d4ff;
    --accent-green: #00ff88;
    --accent-red: #ff4757;
    --accent-orange: #ffa502;
    --border-color: #2a2a4a;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 
                 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.app {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* ========== 头部 ========== */
.header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, rgba(0, 255, 136, 0.05) 100%);
    border-radius: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.header h1 {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.status-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: 20px;
    font-size: 13px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-orange);
    animation: pulse 2s infinite;
}

.status.connected .status-dot {
    background: var(--accent-green);
}

.status.error .status-dot {
    background: var(--accent-red);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.update-time {
    color: var(--text-muted);
    font-size: 13px;
}

/* ========== 行情卡片 ========== */
.quotes-section {
    margin-bottom: 20px;
    overflow-x: auto;
    padding: 5px 0;
}

.quotes-container {
    display: flex;
    gap: 12px;
    padding: 5px;
}

.quote-card {
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 15px 20px;
    min-width: 150px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.quote-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-blue);
}

.quote-name {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.quote-price {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.quote-change {
    display: block;
    font-size: 13px;
    margin-top: 5px;
}

.quote-change.up {
    color: var(--accent-green);
}

.quote-change.down {
    color: var(--accent-red);
}

/* ========== 控制栏 ========== */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.filter-buttons {
    display: flex;
    gap: 8px;
}

.filter-btn {
    padding: 10px 18px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 25px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.filter-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #000;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 10px 18px;
    border: none;
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: 25px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: var(--accent-blue);
    color: #000;
}

.action-btn.active {
    background: var(--accent-green);
    color: #000;
}

/* ========== 统计信息 ========== */
.stats {
    display: flex;
    justify-content: center;
    gap: 25px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.stats strong {
    color: var(--accent-blue);
}

/* ========== 新闻列表 ========== */
.news-container {
    min-height: 400px;
}

.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* 新闻卡片 */
.news-item {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 12px;
    border-left: 4px solid var(--border-color);
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.news-item:hover {
    transform: translateX(5px);
    background: rgba(26, 26, 58, 0.8);
}

/* 新闻重要程度样式 */
.news-item.low {
    border-left-color: #555;
}

.news-item.low .news-content {
    color: var(--text-secondary);
}

.news-item.medium {
    border-left-color: var(--accent-orange);
    background: linear-gradient(90deg, rgba(255, 165, 2, 0.1) 0%, transparent 30%);
}

.news-item.medium .news-content {
    color: #ffd93d;
}

.news-item.high {
    border-left-color: var(--accent-red);
    background: linear-gradient(90deg, rgba(255, 71, 87, 0.15) 0%, transparent 30%);
}

.news-item.high .news-content {
    color: #ff6b7a;
    font-weight: 600;
}

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

.news-time {
    font-size: 12px;
    color: var(--text-muted);
}

.news-tag {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 10px;
    font-weight: 500;
}

.news-tag.low {
    background: rgba(85, 85, 85, 0.3);
    color: #888;
}

.news-tag.medium {
    background: rgba(255, 165, 2, 0.2);
    color: var(--accent-orange);
}

.news-tag.high {
    background: rgba(255, 71, 87, 0.2);
    color: var(--accent-red);
}

.news-content {
    font-size: 14px;
    line-height: 1.8;
    word-break: break-word;
}

/* ========== 页脚 ========== */
.footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 12px;
}

.footer p {
    margin-bottom: 5px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .app {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .filter-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .stats {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .quote-card {
        min-width: 130px;
    }
}

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}
