/**
 * 每日财经罗盘 - 仪表盘样式
 */

/* ========== 仪表盘容器 ========== */
.dashboard {
    margin-bottom: 30px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* ========== 指数卡片 ========== */
.index-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.index-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.index-card .name {
    font-size: 0.9rem;
    color: #9ca3af;
    margin-bottom: 8px;
}

.index-card .price {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.index-card .change {
    font-size: 1rem;
    font-weight: 600;
}

.index-card .change.up {
    color: #ef4444;
}

.index-card .change.down {
    color: #22c55e;
}

.index-card .mini-chart {
    height: 40px;
    margin-top: 12px;
}

/* ========== 统计卡片 ========== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-card .icon {
    font-size: 2rem;
}

.stat-card .info {
    flex: 1;
}

.stat-card .label {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-bottom: 4px;
}

.stat-card .value {
    font-size: 1.3rem;
    font-weight: 600;
}

.stat-card .value.positive {
    color: #ef4444;
}

.stat-card .value.negative {
    color: #22c55e;
}

.stat-card .value.neutral {
    color: #fbbf24;
}

/* ========== 行业热力图 ========== */
.heatmap-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.heatmap-section h3 {
    font-size: 1rem;
    color: #9ca3af;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.heatmap-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.heatmap-item {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    min-width: 80px;
    transition: transform 0.15s;
}

.heatmap-item:hover {
    transform: scale(1.05);
}

.heatmap-item .name {
    display: block;
    margin-bottom: 2px;
}

.heatmap-item .pct {
    font-size: 0.75rem;
    opacity: 0.9;
}

/* 热力图颜色等级 */
.heatmap-item.level-5 {
    background: #991b1b;
    color: #fef2f2;
}

.heatmap-item.level-4 {
    background: #dc2626;
    color: #fff;
}

.heatmap-item.level-3 {
    background: #ef4444;
    color: #fff;
}

.heatmap-item.level-2 {
    background: #f87171;
    color: #fff;
}

.heatmap-item.level-1 {
    background: #fca5a5;
    color: #7f1d1d;
}

.heatmap-item.level-0 {
    background: #6b7280;
    color: #fff;
}

.heatmap-item.level--1 {
    background: #86efac;
    color: #14532d;
}

.heatmap-item.level--2 {
    background: #4ade80;
    color: #fff;
}

.heatmap-item.level--3 {
    background: #22c55e;
    color: #fff;
}

.heatmap-item.level--4 {
    background: #16a34a;
    color: #fff;
}

.heatmap-item.level--5 {
    background: #166534;
    color: #dcfce7;
}

/* ========== 涨跌统计 ========== */
.breadth-bar {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    height: 24px;
    display: flex;
    overflow: hidden;
    margin-bottom: 8px;
}

.breadth-bar .up-bar {
    background: linear-gradient(90deg, #ef4444, #f87171);
    height: 100%;
    transition: width 0.5s ease;
}

.breadth-bar .down-bar {
    background: linear-gradient(90deg, #22c55e, #4ade80);
    height: 100%;
    transition: width 0.5s ease;
}

.breadth-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #9ca3af;
}

.breadth-labels .up-label {
    color: #ef4444;
}

.breadth-labels .down-label {
    color: #22c55e;
}

/* ========== 龙头股展示 ========== */
.leaders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.leader-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px 16px;
    transition: transform 0.15s, background 0.15s;
}

.leader-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
}

.leader-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.leader-name {
    font-weight: 600;
    color: #f472b6;
    font-size: 0.95rem;
}

.leader-code {
    font-size: 0.75rem;
    color: #6b7280;
    font-family: monospace;
}

.leader-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.leader-board {
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.leader-reason {
    font-size: 0.75rem;
    color: #9ca3af;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========== 情绪仪表盘 ========== */
.sentiment-gauge {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.sentiment-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.sentiment-emoji {
    font-size: 3rem;
}

.sentiment-info {
    flex: 1;
}

.sentiment-label {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-bottom: 4px;
}

.sentiment-score {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.sentiment-level {
    font-size: 1rem;
    font-weight: 500;
    margin-left: 12px;
    opacity: 0.9;
}

.sentiment-bar {
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    height: 12px;
    overflow: hidden;
    margin-bottom: 8px;
}

.sentiment-fill {
    height: 100%;
    border-radius: 8px;
    transition: width 0.5s ease;
}

.sentiment-markers {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #6b7280;
    margin-top: 4px;
}

.sentiment-desc {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ========== 龙虎榜 ========== */
.dragon-tiger-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.dt-column {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    overflow: hidden;
}

.dt-header {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.9rem;
}

.dt-header.positive {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.dt-header.negative {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.dt-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.dt-stock {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dt-name {
    font-weight: 500;
    color: #e4e4e7;
    font-size: 0.9rem;
}

.dt-code {
    font-size: 0.75rem;
    color: #6b7280;
    font-family: monospace;
}

.dt-data {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.dt-amount {
    font-weight: 600;
    font-size: 0.9rem;
}

.dt-amount.positive {
    color: #ef4444;
}

.dt-amount.negative {
    color: #22c55e;
}

.dt-reason {
    font-size: 0.7rem;
    color: #9ca3af;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========== 技术分析 ========== */
.tech-analysis-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.tech-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tech-label {
    font-size: 0.8rem;
    color: #9ca3af;
}

.tech-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #e4e4e7;
}

.tech-value.bullish,
.tech-value.buy,
.tech-value.oversold {
    color: #ef4444;
}

.tech-value.bearish,
.tech-value.sell,
.tech-value.overbought {
    color: #22c55e;
}

.tech-value.positive {
    color: #ef4444;
}

.tech-value.negative {
    color: #22c55e;
}

.tech-signals {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.tech-signal {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.tech-indicators {
    display: flex;
    gap: 24px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.indicator {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ind-name {
    font-size: 0.75rem;
    color: #6b7280;
}

.ind-value {
    font-size: 1rem;
    font-weight: 600;
    color: #e4e4e7;
}

.ind-value.bullish,
.ind-value.buy,
.ind-value.oversold {
    color: #ef4444;
}

.ind-value.bearish,
.ind-value.sell,
.ind-value.overbought {
    color: #22c55e;
}

.ind-value.neutral {
    color: #fbbf24;
}

/* ========== K线图表 ========== */
.kline-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.kline-chart {
    width: 100%;
    height: 400px;
}

.kline-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #9ca3af;
}

.legend-color {
    width: 12px;
    height: 3px;
    border-radius: 2px;
}

/* ========== 资金流向 ========== */
.fundflow-section {
    margin-bottom: 24px;
}

.fundflow-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 16px;
}

.fundflow-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
}

.fundflow-title {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-bottom: 12px;
    text-align: center;
}

.fundflow-chart-small {
    width: 100%;
    height: 160px;
}

.fundflow-chart {
    width: 100%;
    height: 300px;
}

/* ========== 历史趋势 ========== */
.history-section {
    margin-bottom: 24px;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.history-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
}

.history-title {
    font-size: 0.9rem;
    color: #9ca3af;
    margin-bottom: 12px;
}

.history-chart {
    width: 100%;
    height: 200px;
}

/* ========== 更新通知 ========== */
.update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.update-notification.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.update-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.update-icon {
    font-size: 1.2rem;
}

.update-text {
    color: #fff;
    font-size: 0.9rem;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.update-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.update-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.update-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
}

.update-close:hover {
    color: #fff;
}

/* ========== 设置面板 ========== */
.settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.settings-panel.active {
    opacity: 1;
    visibility: visible;
}

.settings-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.settings-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    background: #1e1e2e;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.settings-panel.active .settings-content {
    transform: translateY(0);
}

[data-theme="light"] .settings-content {
    background: #fff;
    border-color: #e5e7eb;
}

.settings-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

[data-theme="light"] .settings-header {
    border-bottom-color: #f3f4f6;
}

.settings-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #f3f4f6;
}

[data-theme="light"] .settings-header h3 {
    color: #111827;
}

.settings-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.settings-close:hover {
    color: #fff;
}

[data-theme="light"] .settings-close:hover {
    color: #111827;
}

.settings-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.setting-group {
    margin-bottom: 24px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-title {
    font-size: 0.85rem;
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    cursor: pointer;
    color: #d1d5db;
}

[data-theme="light"] .setting-item {
    color: #4b5563;
}

.setting-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
}

.settings-footer {
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

[data-theme="light"] .settings-footer {
    background: #f9fafb;
}

.btn-save {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.btn-reset {
    background: transparent;
    color: #9ca3af;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}

[data-theme="light"] .btn-reset {
    border-color: #d1d5db;
    color: #6b7280;
}

/* 关注高亮 */
.heatmap-item.favorite {
    border: 2px solid #fbbf24;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .index-card .price {
        font-size: 1.5rem;
    }

    .heatmap-item {
        min-width: 70px;
        padding: 8px 10px;
        font-size: 0.75rem;
    }

    .dragon-tiger-grid {
        grid-template-columns: 1fr;
    }

    .tech-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tech-indicators {
        flex-wrap: wrap;
    }

    .kline-chart {
        height: 300px;
    }

    .fundflow-grid {
        grid-template-columns: 1fr;
    }

    .fundflow-chart {
        height: 250px;
    }

    .history-grid {
        grid-template-columns: 1fr;
    }
}