@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;700&family=Orbitron:wght@400;700&display=swap');

:root {
    --bg-color: #051021; /* 更深的蓝黑 */
    --card-bg: #0a192f; /* 深海军蓝 */
    --header-bg: rgba(10, 25, 47, 0.85); /* 标题栏背景 */
    --text-primary: #ccd6f6; /* 浅蓝灰 */
    --text-secondary: #8892b0; /* 灰蓝 */
    --text-tertiary: #a8b2d1; /* 稍亮一点的灰蓝 */
    --accent-color: #64ffda; /* 青色 */
    --accent-color-dark: #13a88a;
    --red-color: #ff7875; /* 柔和一点的红 */
    --yellow-color: #ffd666; /* 柔和一点的黄 */
    --green-color: #95de64; /* 柔和一点的绿 */
    --blue-color: #69b1ff; /* 辅助蓝 */
    --border-color: rgba(100, 255, 218, 0.15); /* 边框颜色稍明显 */
    --border-color-light: rgba(100, 255, 218, 0.3);
    --font-main: 'Noto Sans SC', sans-serif;
    --font-tech: 'Orbitron', sans-serif;
    --glow-color: rgba(100, 255, 218, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, var(--bg-color) 0%, #08142b 100%); /* 添加渐变背景 */
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px; /* 减少 body 边距 */
    overflow: hidden; /* 防止整个页面滚动 */
}

.container {
    width: 100%;
    max-width: 98%; /* 占满更多屏幕宽度 */
    background-color: rgba(0, 20, 40, 0.8); /* 半透明背景 */
    border: 1px solid var(--border-color);
    border-radius: 10px; /* 更圆润的边角 */
    padding: 15px; /* 减少容器内边距 */
    box-shadow: 0 0 35px rgba(100, 255, 218, 0.2), inset 0 0 15px rgba(100, 255, 218, 0.1); /* 内外辉光 */
    display: flex;
    flex-direction: column;
    min-height: 95vh; /* 使用最小高度，允许内容增长 */
    height: auto;
}

.header {
    text-align: center;
    margin-bottom: 15px; /* 减少间距 */
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px; /* 减少间距 */
    flex-shrink: 0; /* 防止 header 在 flex 布局中被压缩 */
}

.header h1 {
    font-family: var(--font-tech);
    color: var(--accent-color);
    font-size: 2em; /* 减小标题字号 */
    margin-bottom: 5px; /* 减少间距 */
    text-shadow: 0 0 15px var(--glow-color), 0 0 5px var(--accent-color);
}

/* Font Awesome beat animation */
.fa-beat {
  animation: fa-beat 1s ease-in-out infinite;
}
@keyframes fa-beat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}


.header p {
    color: var(--text-tertiary);
    font-size: 1em; /* 减小副标题字号 */
}

/* --- 新增：动态状态栏样式 --- */
.status-bar {
    flex-shrink: 0;
    margin-bottom: 15px;
    position: relative;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px 20px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
}

.status-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.status-bar .status-text {
    font-size: 0.95em;
    color: var(--text-tertiary);
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-bar .status-text i {
    color: var(--accent-color);
    animation: pulseIconSmall 2s infinite ease-in-out;
}

.progress-bar-container {
    width: 250px;
    height: 12px;
    background-color: rgba(0,0,0,0.3);
    border-radius: 6px;
    overflow: hidden;
    margin: 0 20px;
    border: 1px solid rgba(255,255,255,0.1);
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color-dark) 0%, var(--accent-color) 100%);
    border-radius: 6px;
    transition: width 0.5s ease-out; /* 宽度变化动画 */
}

.status-bar .timer {
    font-family: var(--font-tech);
    font-size: 1.1em;
    color: var(--accent-color);
    width: 60px;
    text-align: right;
}

.news-flash-message {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--green-color);
    color: var(--bg-color);
    padding: 8px 15px;
    border-radius: 5px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(149, 222, 100, 0.4);
    opacity: 0;
    transition: opacity 0.4s ease, top 0.4s ease;
    z-index: 100;
    pointer-events: none; /* 不可点击 */
}

.news-flash-message.show {
    top: -20px;
    opacity: 1;
}
/* --- END: 动态状态栏样式 --- */


.live-indicator {
    color: var(--red-color);
    font-size: 0.5em;
    vertical-align: middle;
    margin-left: 15px;
    animation: blinkLive 1.2s infinite;
    text-shadow: 0 0 8px var(--red-color);
}

.news-feed-container {
    flex-grow: 1; /* 占据剩余空间 */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 隐藏超出部分 */
    background-color: var(--card-bg);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3); /* 内部阴影增加深度 */
}

.feed-title {
    display: grid;
    /* 更新列布局: 增加来源列 */
    grid-template-columns: 3fr 1fr 1.8fr 1.2fr 1.2fr 1fr;
    padding: 12px 20px;
    background-color: var(--header-bg);
    color: var(--accent-color);
    font-weight: bold;
    font-size: 0.95em; /* 稍大 */
    border-bottom: 1px solid var(--border-color-light); /* 更亮的边框 */
    text-transform: uppercase; /* 标题大写 */
    letter-spacing: 0.5px;
}

.feed-title span i {
    margin-right: 8px;
    opacity: 0.8;
}

#news-feed {
    flex-grow: 1;
    overflow-y: auto; /* 保持元素可滚动 */
    padding: 0 5px; /* 左右留一点空隙 */
    position: relative;

    /* --- 新增：隐藏滚动条 --- */

    /* 隐藏 Firefox 的滚动条 */
    scrollbar-width: none;

    /* 隐藏 IE 和 Edge (旧版) 的滚动条 */
    -ms-overflow-style: none;

    /* --- 隐藏滚动条结束 --- */
}

/* --- 新增：隐藏 WebKit 浏览器 (Chrome, Safari, Edge 新版, Opera) 的滚动条 --- */
#news-feed::-webkit-scrollbar {
    display: none; /* 完全隐藏滚动条 */
    /* 或者可以设置宽度为0:
    width: 0;
    height: 0;
    */
}

.news-item {
    display: grid;
    /* 与标题对齐 */
    grid-template-columns: 3fr 1fr 1.8fr 1.2fr 1.2fr 1fr;
    align-items: start; /* 顶部对齐，因为内容高度可能不同 */
    background-color: transparent;
    border-bottom: 1px dashed var(--border-color); /* 虚线分隔 */
    padding: 15px 15px; /* 增加内边距 */
    opacity: 0; /* 初始透明 */
    transform: translateY(25px); /* 初始向下偏移 */
    animation: fadeInSlideUp 0.7s ease-out forwards;
    transition: background-color 0.4s ease, box-shadow 0.4s ease;
    min-height: 80px; /* 保证最小高度 */
}

.news-item:hover {
    background-color: rgba(100, 255, 218, 0.07); /* 悬停效果更明显 */
    box-shadow: inset 0 0 10px rgba(100, 255, 218, 0.1);
}

.news-item.placeholder {
    opacity: 0.4;
    animation: none; /* 占位符不需要动画 */
    border-bottom-style: solid;
}
.news-item.placeholder .fa-spinner { display: none; } /* 隐藏占位符的加载图标 */


/* --- Column Specific Styles --- */

.news-item .content {
    display: flex;
    flex-direction: column;
    padding-right: 20px; /* 与下一列间距 */
    gap: 5px; /* 内部元素间距 */
}

.news-item .timestamp {
    font-size: 0.8em;
    color: var(--text-secondary);
    font-family: var(--font-tech);
}

.news-item .headline {
    font-size: 1.05em; /* 稍大 */
    color: var(--text-primary);
    font-weight: 400;
    line-height: 1.45;
    margin-bottom: 5px;
}

.news-item .keywords {
    font-size: 0.8em;
    color: var(--text-secondary);
}
.news-item .keywords .keyword-content span {
    display: inline-block;
    background-color: rgba(100, 255, 218, 0.1);
    color: var(--accent-color);
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 5px;
    margin-top: 3px;
    font-size: 0.9em;
}
.news-item .keywords .keyword-content i { /* Style for spinner */
    color: var(--yellow-color);
    margin-left: 5px;
}

.source {
    font-size: 0.9em;
    color: var(--text-tertiary);
    font-weight: bold;
    padding-right: 15px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.source i {
    color: var(--yellow-color);
}

.analysis-status {
    font-size: 0.9em;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column; /* 垂直排列 */
    align-items: flex-start; /* 左对齐 */
    padding-right: 20px; /* 与下一列间距 */
    gap: 8px; /* 状态和置信度间距 */
}

.analysis-status .status-text {
    display: inline-block;
    transition: color 0.3s ease, opacity 0.3s ease;
    width: 100%; /* 占据宽度 */
}
.analysis-status .status-text i {
    margin-right: 8px;
    width: 1.3em; /* 固定图标宽度 */
    text-align: center;
    transition: transform 0.3s ease;
}
/* Different status colors and icons */
.analysis-status .status-receiving { color: var(--blue-color); }
.analysis-status .status-parsing { color: var(--yellow-color); }
.analysis-status .status-extracting { color: var(--yellow-color); }
.analysis-status .status-linking { color: var(--yellow-color); }
.analysis-status .status-quantifying { color: var(--yellow-color); }
.analysis-status .status-evaluating { color: var(--yellow-color); }
.analysis-status .status-complete { color: var(--green-color); }

.analysis-status .status-text i.fa-spin { animation: fa-spin 1.5s infinite linear; } /* Loading spin */
.analysis-status .status-text i:not(.fa-spin) { animation: pulseIconSmall 1.8s infinite ease-in-out; } /* Subtle pulse for static icons */


.analysis-status .confidence-score {
    font-size: 0.85em;
    color: var(--text-secondary);
    font-family: var(--font-tech);
}
.analysis-status .confidence-score .score-value {
    color: var(--text-primary);
    font-weight: bold;
}


.related-assets {
    font-size: 0.85em;
    color: var(--text-secondary);
    padding-right: 20px;
    line-height: 1.5;
}
.related-assets .asset-content span {
    display: inline-block;
    background-color: rgba(105, 177, 255, 0.1); /* Blueish background */
    color: var(--blue-color);
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 5px;
    margin-bottom: 4px; /* Spacing between assets */
    font-family: var(--font-tech);
    font-size: 0.95em;
}
.related-assets .asset-content i { /* Style for spinner */
    color: var(--yellow-color);
}
.related-assets .asset-placeholder { /* Style for placeholder */
     color: var(--text-secondary);
     opacity: 0.6;
}


.impact-assessment {
    font-size: 0.9em;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-right: 15px;
}
.impact-assessment span { /* Base style for score and desc */
    display: block;
}
.impact-assessment .impact-score {
    font-family: var(--font-tech);
    color: var(--text-secondary);
}
.impact-assessment .impact-score .score-value {
    font-weight: bold;
    color: var(--text-primary);
    margin-left: 5px;
}
.impact-assessment .impact-desc {
    color: var(--text-secondary);
}
.impact-assessment .impact-desc .desc-value {
    font-weight: bold;
    margin-left: 5px;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}
/* Color coding for impact description */
.impact-desc .desc-positive { background-color: rgba(149, 222, 100, 0.15); color: var(--green-color); }
.impact-desc .desc-neutral { background-color: rgba(136, 146, 176, 0.15); color: var(--text-secondary); }
.impact-desc .desc-negative { background-color: rgba(255, 120, 117, 0.15); color: var(--red-color); }
.impact-assessment i { /* Style for spinner */
    color: var(--yellow-color);
}


.panic-meter-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.panic-bar-bg {
    width: 100%;
    max-width: 110px; /* Slightly wider bar */
    height: 10px; /* Thicker bar */
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.panic-bar {
    height: 100%;
    border-radius: 4px; /* Keep slightly rounded inside */
    background: linear-gradient(90deg, var(--green-color) 0%, var(--accent-color) 100%); /* Default gradient */
    transition: width 0.6s cubic-bezier(0.25, 0.1, 0.25, 1), background 0.6s ease-out; /* Smoother transition */
    box-shadow: 0 0 8px rgba(100, 255, 218, 0.4);
}
/* Panic level color gradients */
.panic-bar.level-low { background: linear-gradient(90deg, var(--green-color) 0%, #b4e78c 100%); box-shadow: 0 0 8px rgba(149, 222, 100, 0.5); }
.panic-bar.level-medium { background: linear-gradient(90deg, var(--yellow-color) 0%, #ffe58f 100%); box-shadow: 0 0 8px rgba(255, 214, 102, 0.5); }
.panic-bar.level-high { background: linear-gradient(90deg, var(--red-color) 0%, #ffa39e 100%); box-shadow: 0 0 8px rgba(255, 120, 117, 0.5); }


.panic-text {
    font-size: 0.9em; /* Slightly larger */
    font-weight: bold;
    font-family: var(--font-tech);
    color: var(--text-primary);
    text-shadow: 0 0 3px rgba(0,0,0,0.5); /* Add subtle shadow for readability */
}

.footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85em;
}

.footer p {
    margin-bottom: 10px;
    font-family: var(--font-tech);
    opacity: 0.8;
}

.footer .status-icons {
    margin-top: 8px;
}

.footer .status-icons span {
    margin: 0 12px;
    white-space: nowrap;
}

.footer .status-icons i {
    color: var(--text-secondary);
    transition: color 0.5s ease, text-shadow 0.5s ease;
    margin-left: 3px;
}

.footer .status-icons i.active {
    color: var(--green-color);
    text-shadow: 0 0 6px var(--green-color);
}
/* Font Awesome fade animation */
.fa-fade {
  animation: fa-fade 1.5s ease-in-out infinite;
}
@keyframes fa-fade {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}


/* Animations */
@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(25px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseIconSmall {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
}


@keyframes blinkLive {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Font Awesome Spin */
.fa-spin {
  animation: fa-spin 1.2s infinite linear; /* Slightly slower spin */
}
@keyframes fa-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Helper class for elements appearing */
.fade-in-element {
    opacity: 0;
    animation: fadeInSimple 0.5s ease forwards;
}
@keyframes fadeInSimple {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- 24小时情绪统计 - 右上角定位和样式 --- */
.sentiment-stats-container {
    padding: 10px; /* 减少内边距 */
    margin-bottom: 15px; /* 减少与下方新闻列表的间距 */
    background-color: rgba(10, 25, 47, 0.7); /* 深色背景 */
    border-radius: 8px;
    border: 1px solid var(--border-color);
    flex-shrink: 0; /* 防止被压缩 */
}

.sentiment-stats {
    width: 100%;
}

.stats-title {
    color: var(--accent-color);
    font-size: 1.1em; /* 减小统计标题字号 */
    margin-bottom: 10px; /* 减少间距 */
    text-align: center;
    font-family: var(--font-tech);
}

.stats-title i {
    margin-right: 8px; /* 调整图标间距 */
    animation: pulseIconSmall 2s infinite ease-in-out;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* 调整最小宽度 */
    gap: 10px; /* 减小间距 */
}

.stat-item {
    background-color: var(--card-bg); /* 使用卡片背景色 */
    padding: 10px; /* 减少内边距 */
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center; /* 居中对齐 */
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-3px); /* 减小悬停效果 */
    box-shadow: 0 3px 12px rgba(100, 255, 218, 0.1);
}


.stat-label {
    font-size: 0.85em; /* 减小标签字号 */
    color: var(--text-secondary);
    margin-bottom: 5px; /* 减少间距 */
}

.stat-value {
    font-size: 1.5em; /* 减小数值字号 */
    font-weight: bold;
    color: var(--text-primary);
    font-family: var(--font-tech);
    line-height: 1;
}

.stat-trend {
    font-size: 1em;
    margin-left: 5px; /* 调整趋势图标位置 */
    display: inline-flex;
    align-items: center;
}

.stat-trend i {
    margin-left: 5px;
}

.stat-trend.up {
    color: var(--green-color);
}

.stat-trend.down {
    color: var(--red-color);
}

.stat-item-dist {
    grid-column: span 2; /* 占据两列 */
}

.dist-bars {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color-light);
}

.dist-bar {
    position: relative;
    text-align: center;
    font-size: 0.75em;
    color: var(--text-primary);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
}

.dist-bar .bar-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9em;
    color: var(--bg-color);
    font-weight: bold;
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.5);
}

.positive-bar {
    background-color: var(--green-color);
}
.neutral-bar {
    background-color: var(--text-secondary);
}
.negative-bar {
    background-color: var(--red-color);
}


/* --- Responsive Design --- */
@media (max-width: 1200px) {
    .feed-title,
    .news-item {
        /* 调整比例以适应来源列 */
        grid-template-columns: 2.5fr 1fr 1.5fr 1fr 1fr 1fr;
    }
}


@media (max-width: 992px) {
    .feed-title {
        /* 隐藏关联标的 */
        grid-template-columns: 3fr 1.2fr 2fr 1.5fr 1.5fr;
    }
    .feed-title .col-assets { display: none; }

    .news-item {
        grid-template-columns: 3fr 1.2fr 2fr 1.5fr 1.5fr;
    }
    .news-item .col-assets { display: none; }
}


@media (max-width: 768px) {
    body {
        padding: 0;
        min-height: 100vh;
    }

    .container {
        padding: 10px;
        border-radius: 0;
        border: none;
        min-height: 100vh;
        box-shadow: none;
    }

    .header h1 {
        font-size: 1.8em;
    }
    .header p {
        font-size: 0.9em;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr; /* 手机上两列 */
        gap: 10px;
    }

    .stat-item-dist {
        grid-column: 1 / -1; /* 情绪分布条占据整行 */
    }

    .feed-title {
        /* 在手机上，只显示主要内容和影响评估 */
        grid-template-columns: 1fr auto;
        padding: 10px 15px;
    }
    .feed-title .col-source,
    .feed-title .col-analysis,
    .feed-title .col-assets,
    .feed-title .col-panic {
        display: none;
    }

    .news-item {
        grid-template-columns: 1fr; /* 变成单列 */
        gap: 10px;
        padding: 15px;
        align-items: flex-start;
    }
    .news-item .content {
        grid-row: 1; /* 确保内容在第一行 */
        padding-right: 0;
    }
    /* 在移动端，将来源信息移动到时间戳旁边 */
    .news-item .timestamp::after {
        content: " | " attr(data-source); /* 使用 data-source 属性显示来源 */
        font-weight: bold;
        color: var(--text-tertiary);
        margin-left: 8px;
    }
    .news-item .impact-assessment {
        grid-row: 2; /* 影响评估在第二行 */
        display: flex;
        justify-content: space-between;
        align-items: center;
        background-color: rgba(0,0,0,0.2);
        padding: 8px;
        border-radius: 4px;
        width: 100%;
    }
    .news-item .col-source,
    .news-item .col-analysis,
    .news-item .col-assets,
    .news-item .col-impact,
    .news-item .col-panic {
        display: none; /* Hide all other columns except content */
    }

    .footer .status-icons {
        display: none; /* Hide status icons on mobile */
    }
}


/* --- Log Box Styles --- */

#status-log-container {
    width: 100%;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 10px;
    margin-top: 15px;
    border-radius: 4px;
    box-shadow: inset 0 1px 5px rgba(0,0,0,0.4);
}

.log-header {
    font-size: 0.9em;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 8px;
    font-family: var(--font-tech);
}

.log-header i {
    margin-right: 8px;
}

.log-box {
    width: 100%;
    height: 80px; /* Fixed height */
    overflow-y: auto;
    background-color: #020c1b; /* Even darker background */
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85em;
    color: var(--text-secondary);
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--card-bg);
}

.log-box::-webkit-scrollbar {
    width: 5px;
}

.log-box::-webkit-scrollbar-track {
    background: var(--card-bg);
}

.log-box::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 10px;
    border: 1px solid var(--card-bg);
}

.log-message {
    margin-bottom: 4px;
    padding-left: 10px;
    border-left: 2px solid var(--text-secondary);
    animation: fadeInSimple 0.5s ease;
}

.log-message:last-child {
    margin-bottom: 0;
}

.log-message.info {
    color: var(--blue-color);
    border-left-color: var(--blue-color);
}

.log-message.success {
    color: var(--green-color);
    border-left-color: var(--green-color);
}

.log-message.error {
    color: var(--red-color);
    border-left-color: var(--red-color);
    font-weight: bold;
}

.log-message.warn {
    color: var(--yellow-color);
    border-left-color: var(--yellow-color);
}
