/* ═══════════════════════════════════════════════════════
   News Feed Page (消息流)
   Dark navy · Gold accents · Wire-service terminal feel
   ═══════════════════════════════════════════════════════ */

/* ─── Page Chrome ─────────────────────────────────────── */

.news-body {
    background: var(--bg-0);
    min-height: 100vh;
    color: var(--text-primary);
    font-family: var(--font-sans);
    position: relative;
    overflow-x: hidden;
}

.news-body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(circle, rgba(200, 169, 107, 0.03) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    z-index: 0;
}

.news-frame {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

/* ─── Header ──────────────────────────────────────────── */

.news-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--panel-border);
    margin-bottom: 0;
}

.news-header .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.news-header .brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.news-header .brand-name {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-strong);
    letter-spacing: -0.01em;
}

.news-nav-group {
    display: flex;
    gap: 4px;
}

.news-nav-link {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.news-nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.news-nav-link.is-active {
    color: var(--accent);
    background: rgba(200, 169, 107, 0.08);
}

.news-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Hero (masthead) ────────────────────────────────── */

.news-hero {
    padding: 28px 0 18px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.news-hero-copy {
    flex: 1;
    min-width: 200px;
}

.news-hero-kicker {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent);
    margin-bottom: 4px;
}

.news-hero-title {
    font-family: var(--font-serif);
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-strong);
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}

.news-hero-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
}

.news-hero-stats {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.news-hero-stat {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.news-hero-stat-val {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-strong);
    font-feature-settings: 'tnum';
}

.news-hero-stat-val.is-bull { color: var(--bullish); }
.news-hero-stat-val.is-bear { color: var(--bearish); }
.news-hero-stat-val.is-neut { color: var(--neutral); }

.news-hero-stat-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.news-connection-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 3px;
    vertical-align: middle;
}

.news-connection-dot.is-live {
    background: var(--success-color);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.news-connection-dot.is-offline {
    background: var(--danger-color);
}

.news-connection-dot.is-connecting {
    background: var(--warning-color);
    animation: pulse 1.4s infinite;
}

/* ─── Filter Bar (sticky) ────────────────────────────── */

.news-filter-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(6, 14, 31, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--panel-border);
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.news-filter-group {
    display: flex;
    align-items: center;
    gap: 3px;
}

.news-filter-group-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 3px;
    white-space: nowrap;
    font-weight: 600;
}

.news-filter-sep {
    width: 1px;
    height: 20px;
    background: var(--panel-border);
    margin: 0 4px;
}

.news-pill {
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 100px;
    border: 1px solid var(--panel-border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: var(--font-sans);
    white-space: nowrap;
    line-height: 1;
}

.news-pill:hover {
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.news-pill.is-active {
    background: rgba(200, 169, 107, 0.12);
    border-color: var(--accent);
    color: var(--accent);
}

.news-pill.is-active.is-bull {
    background: rgba(248, 113, 113, 0.1);
    border-color: var(--bullish);
    color: var(--bullish);
}

.news-pill.is-active.is-bear {
    background: rgba(52, 211, 153, 0.1);
    border-color: var(--bearish);
    color: var(--bearish);
}

.news-pill.is-active.is-neut {
    background: rgba(96, 165, 250, 0.1);
    border-color: var(--neutral);
    color: var(--neutral);
}

.news-filter-select {
    font-size: 0.72rem;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--panel-border);
    background: var(--bg-1);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    cursor: pointer;
}

.news-filter-select:focus {
    border-color: var(--accent);
    outline: none;
}

.news-search-input {
    font-size: 0.75rem;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--panel-border);
    background: var(--bg-1);
    color: var(--text-primary);
    font-family: var(--font-sans);
    width: 170px;
    transition: border-color 0.15s;
}

.news-search-input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px rgba(200, 169, 107, 0.1);
}

.news-search-input::placeholder {
    color: var(--text-muted);
}

.news-filter-badge {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    background: rgba(200, 169, 107, 0.15);
    color: var(--accent);
    padding: 2px 7px;
    border-radius: 100px;
    font-feature-settings: 'tnum';
}

.news-clear-btn {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 2px 4px;
}

.news-clear-btn:hover {
    color: var(--text-secondary);
}

/* ─── 2-Column Layout ────────────────────────────────── */

.news-feed-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
    padding-top: 18px;
    align-items: start;
}

@media (max-width: 960px) {
    .news-feed-layout {
        grid-template-columns: 1fr;
    }

    .news-sidebar {
        display: none;
    }
}

/* ─── Feed Column ────────────────────────────────────── */

.news-feed {
    min-width: 0;
}

.news-feed .impact-card.is-featured {
    margin-bottom: 12px;
}

/* ─── Load More ──────────────────────────────────────── */

.news-load-more-wrap {
    text-align: center;
    padding: 24px 0 8px;
}

.news-load-more-btn {
    font-size: 0.78rem;
    font-weight: 500;
    padding: 8px 28px;
    border-radius: 6px;
    border: 1px solid var(--panel-border);
    background: var(--surface-raised);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-sans);
}

.news-load-more-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.news-load-more-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ─── Loading / Empty / Error States ─────────────────── */

.news-state-msg {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.news-state-msg-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.news-skeleton-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 0;
}

.news-skeleton-row {
    height: 52px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    animation: shimmer 1.6s ease-in-out infinite;
}

/* ─── Sidebar (sticky) ───────────────────────────────── */

.news-sidebar {
    position: sticky;
    top: 52px;
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.06) transparent;
}

.news-sidebar-section {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 14px;
}

.news-sidebar-title {
    font-size: 0.68rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
    font-weight: 700;
}

/* ── Theme cards ── */

.news-theme-card {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.news-theme-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.news-theme-title {
    font-size: 0.78rem;
    color: var(--text-primary);
    margin-bottom: 3px;
    line-height: 1.35;
}

.news-theme-meta {
    display: flex;
    gap: 8px;
    font-size: 0.65rem;
    color: var(--text-muted);
    align-items: center;
}

.news-theme-sentiment {
    font-size: 0.6rem;
    padding: 1px 6px;
    border-radius: 100px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.news-theme-sentiment.is-bull {
    color: var(--bullish);
    background: rgba(248, 113, 113, 0.1);
}

.news-theme-sentiment.is-bear {
    color: var(--bearish);
    background: rgba(52, 211, 153, 0.1);
}

.news-theme-sentiment.is-neut {
    color: var(--neutral);
    background: rgba(96, 165, 250, 0.1);
}

/* ── Market context sidebar ── */

.news-context-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.75rem;
}

.news-context-label {
    color: var(--text-muted);
}

.news-context-val {
    color: var(--text-primary);
    font-weight: 500;
}

.news-regime-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(200, 169, 107, 0.12);
    color: var(--accent);
}

/* ── Source bar chart ── */

.news-source-bar {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.news-source-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.news-source-label {
    font-size: 0.68rem;
    color: var(--text-secondary);
    width: 56px;
    text-align: right;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-source-fill-wrap {
    flex: 1;
    height: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 2px;
    overflow: hidden;
}

.news-source-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, rgba(200, 169, 107, 0.35), rgba(200, 169, 107, 0.6));
    transition: width 0.4s ease;
}

.news-source-count {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-muted);
    width: 24px;
    text-align: right;
    font-feature-settings: 'tnum';
}

/* ─── Toast (new items) ──────────────────────────────── */

.news-toast {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    background: var(--accent);
    color: var(--bg-0);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 8px 22px;
    border-radius: 100px;
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(200, 169, 107, 0.3);
    animation: newsToastIn 0.3s ease-out;
    transition: opacity 0.2s;
}

.news-toast:hover {
    opacity: 0.9;
}

@keyframes newsToastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ─── Detail Drawer ──────────────────────────────────── */

.news-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.news-detail-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 480px;
    max-width: 90vw;
    z-index: 101;
    background: var(--surface-elevated);
    border-left: 1px solid var(--panel-border);
    overflow-y: auto;
    padding: 24px;
    animation: newsDrawerIn 0.25s ease-out;
}

@keyframes newsDrawerIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.news-detail-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.news-detail-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.news-detail-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.news-detail-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-strong);
    line-height: 1.4;
    margin-bottom: 12px;
}

.news-detail-section-label {
    font-size: 0.65rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    margin: 16px 0 6px;
}

.news-detail-reasoning {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
    border-left: 2px solid rgba(200, 169, 107, 0.3);
    padding-left: 12px;
    margin: 0;
}

.news-detail-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.news-detail-pill {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--panel-border);
}

.news-detail-body {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 8px 0;
}

.news-detail-original-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
    margin-top: 12px;
    padding: 4px 0;
}

.news-detail-original-link:hover {
    text-decoration: underline;
}

.news-detail-score-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 8px 0;
}

.news-detail-score-chip {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
    font-feature-settings: 'tnum';
}

.news-detail-score-chip.is-bull {
    color: var(--bullish);
    background: rgba(248, 113, 113, 0.1);
}

.news-detail-score-chip.is-bear {
    color: var(--bearish);
    background: rgba(52, 211, 153, 0.1);
}

.news-detail-score-chip.is-neut {
    color: var(--neutral);
    background: rgba(96, 165, 250, 0.1);
}

/* ─── New item highlight ─────────────────────────────── */

.news-item-new .impact-list-row,
.news-item-new.impact-list-row {
    animation: newsItemHighlight 2s ease-out;
}

@keyframes newsItemHighlight {
    0% {
        background: rgba(200, 169, 107, 0.08);
    }

    100% {
        background: transparent;
    }
}

/* ─── Light theme overrides ──────────────────────────── */

[data-theme="light"] .news-body {
    background: #f6f3ee;
    color: #1e293b;
}

[data-theme="light"] .news-body::before {
    background-image: radial-gradient(circle, rgba(200, 169, 107, 0.06) 1px, transparent 1px);
}

[data-theme="light"] .news-header {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .news-header .brand-name {
    color: #0f172a;
}

[data-theme="light"] .news-nav-link:hover {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .news-hero {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .news-hero-title {
    color: #0f172a;
}

[data-theme="light"] .news-filter-bar {
    background: rgba(246, 243, 238, 0.95);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .news-pill {
    border-color: rgba(0, 0, 0, 0.1);
    color: #64748b;
}

[data-theme="light"] .news-pill:hover {
    border-color: rgba(0, 0, 0, 0.2);
    color: #334155;
}

[data-theme="light"] .news-pill.is-active {
    background: rgba(200, 169, 107, 0.1);
}

[data-theme="light"] .news-filter-select,
[data-theme="light"] .news-search-input {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.12);
    color: #1e293b;
}

[data-theme="light"] .news-sidebar-section {
    background: rgba(0, 0, 0, 0.025);
    border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .news-toast {
    background: #c8a96b;
    color: #fff;
}

[data-theme="light"] .news-detail-overlay {
    background: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .news-detail-drawer {
    background: #faf8f4;
    border-left-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .news-detail-title {
    color: #0f172a;
}

[data-theme="light"] .news-detail-reasoning {
    border-left-color: rgba(200, 169, 107, 0.4);
}

[data-theme="light"] .news-source-fill-wrap {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .news-skeleton-row {
    background: rgba(0, 0, 0, 0.04);
}
