/* ========================================
   黄金走势预测系统 - 主样式表
   ======================================== */

/* --- CSS Variables --- */
:root {
    --bg-primary: #0a0a0a;
    --bg-card: #111111;
    --bg-card-hover: #1a1a1a;
    --bg-elevated: #1e1e1e;
    --border: #222222;
    --border-light: #333333;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --text-muted: #666666;
    --gold: #f5af19;
    --gold-light: #f7c948;
    --gold-dark: #c78510;
    --green: #00ff88;
    --green-bg: rgba(0, 255, 136, 0.1);
    --red: #ff4444;
    --red-bg: rgba(255, 68, 68, 0.1);
    --blue: #448aff;
    --blue-bg: rgba(68, 138, 255, 0.1);
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* --- Header --- */
.page-header {
    padding: 40px 0 30px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 2.4em;
    background: linear-gradient(135deg, var(--gold), #f12711);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.page-header .subtitle {
    color: var(--text-muted);
    font-size: 1em;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: border-color 0.3s ease;
}

.card:hover {
    border-color: var(--border-light);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.card-header .icon {
    font-size: 1.3em;
}

.card-header h3 {
    font-size: 1.1em;
    color: var(--text-primary);
    font-weight: 600;
}

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

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    .page-header h1 {
        font-size: 1.8em;
    }
}

/* --- Price --- */
.price-display .current-price {
    font-size: 3em;
    font-weight: 700;
    color: var(--gold);
    font-family: var(--font-mono);
    letter-spacing: -1px;
}

.price-display .price-label {
    color: var(--text-muted);
    font-size: 0.85em;
    margin-top: 4px;
}

.price-change {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    margin-top: 12px;
    font-family: var(--font-mono);
}

.price-change.up {
    background: var(--green-bg);
    color: var(--green);
}

.price-change.down {
    background: var(--red-bg);
    color: var(--red);
}

.price-change.neutral {
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.price-meta {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85em;
    color: var(--text-muted);
}

/* --- Metrics --- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.metric-item {
    background: var(--bg-elevated);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}

.metric-value {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--gold);
    font-family: var(--font-mono);
}

.metric-label {
    font-size: 0.78em;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Chart --- */
.chart-section {
    margin-bottom: 30px;
}

.chart-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.chart-controls {
    display: flex;
    gap: 8px;
}

.chart-btn {
    padding: 6px 16px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
}

.chart-btn:hover, .chart-btn.active {
    border-color: var(--gold);
    color: var(--gold);
}

.chart-container {
    height: 420px;
    position: relative;
}

/* --- Forecast Table --- */
.forecast-table {
    width: 100%;
    border-collapse: collapse;
}

.forecast-table th {
    text-align: left;
    padding: 10px 8px;
    color: var(--text-muted);
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.forecast-table td {
    padding: 10px 8px;
    font-size: 0.9em;
    border-bottom: 1px solid var(--border);
}

.forecast-table tr:last-child td {
    border-bottom: none;
}

.forecast-table .trend-up {
    color: var(--green);
}

.forecast-table .trend-down {
    color: var(--red);
}

/* --- News --- */
.news-list {
    max-height: 500px;
    overflow-y: auto;
}

.news-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.news-item:last-child {
    border-bottom: none;
}

.news-item .news-title {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95em;
    display: block;
    margin-bottom: 6px;
    line-height: 1.5;
}

.news-item .news-title:hover {
    color: var(--gold);
}

.news-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8em;
    color: var(--text-muted);
}

.news-source {
    color: var(--gold);
}

.sentiment-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
}

.sentiment-positive {
    background: var(--green-bg);
    color: var(--green);
}

.sentiment-negative {
    background: var(--red-bg);
    color: var(--red);
}

.sentiment-neutral {
    background: var(--bg-elevated);
    color: var(--text-muted);
}

/* --- Sentiment Gauge --- */
.sentiment-gauge {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 16px 0;
}

.gauge-bar {
    flex: 1;
    height: 8px;
    background: linear-gradient(to right, var(--red), var(--text-muted), var(--green));
    border-radius: 4px;
    position: relative;
}

.gauge-indicator {
    position: absolute;
    top: -6px;
    width: 20px;
    height: 20px;
    background: var(--text-primary);
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.sentiment-label {
    font-size: 1.1em;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

.sentiment-score {
    font-size: 0.85em;
    color: var(--text-muted);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold), #f12711);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82em;
}

.action-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* --- Status Bar --- */
.status-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 20px;
    margin: 20px 0;
    font-size: 0.85em;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

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

.status-bar.loading .status-dot {
    background: var(--gold);
}

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

/* --- Loading --- */
.loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

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

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

/* --- Backtest --- */
.backtest-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .backtest-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Validation Summary --- */
.validation-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.validation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border-radius: 8px;
}

.validation-item .val-name {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.validation-item .val-score {
    font-family: var(--font-mono);
    font-size: 1.1em;
    font-weight: 600;
}

.validation-item .val-score.good {
    color: var(--green);
}

.validation-item .val-score.ok {
    color: var(--gold);
}

.validation-item .val-score.bad {
    color: var(--red);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3em;
    margin-bottom: 12px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 0.95em;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Nav Tabs --- */
.nav-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
    overflow-x: auto;
}

.nav-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9em;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
}

.nav-tab:hover {
    color: var(--text-primary);
}

.nav-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-muted);
    font-size: 0.85em;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}
