/* 
   ==========================================================================
   MARSRADAR 11.0 - STREAMLINED & PRECISE
   Header Fix & Inline Progress Management
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bg-base: #000000;
    --bg-surface: #0a0a0b;
    --bg-hover: #1c1c1e;
    --text-main: #f5f5f7;
    --text-dim: #a1a1a6;
    --text-muted: #86868b;
    --accent: #2997ff;
    --border: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] {
    --bg-base: #f9f7f2;
    --bg-surface: #f1efea;
    --bg-hover: #f0ede6;
    --text-main: #1d1d1f;
    --text-dim: #515154;
    --text-muted: #86868b;
    --accent: #d16d41;
    --border: rgba(0, 0, 0, 0.08);
}

svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    width: 16px;
    height: 16px;
}

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

body {
    background: var(--bg-base);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    height: 100vh;
    overflow: hidden;
}

/* Header Layout Fix */
.header {
    height: 56px;
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-base);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 40px;
}

.logo {
    min-width: 180px;
    white-space: nowrap;
}

.logo-text {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.4em;
    text-transform: uppercase;
}

.nav-tabs {
    display: flex;
    gap: 24px;
}

.nav-tab {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    padding: 22px 0;
    position: relative;
    transition: 0.2s;
}

.nav-tab.active,
.nav-tab:hover {
    color: var(--text-main);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
}

/* Header Right - Force Horizontal */
.header-right {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 12px;
}

/* Inline Progress */
.report-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-percent {
    font-family: 'JetBrains Mono';
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    display: none;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 4px;
    transition: 0.2s;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

/* Compact Search */
.search-box {
    position: relative;
    width: 160px;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 6px 10px 6px 30px;
    border-radius: 4px;
    color: var(--text-main);
    font-size: 11px;
}

.search-icon {
    position: absolute;
    left: 10px;
    width: 12px;
    color: var(--text-muted);
}

/* Layout Containers */
.main-content {
    display: flex;
    height: calc(100vh - 56px);
}

.dual-stream-container {
    flex: 1;
    display: flex;
    background: var(--border);
    gap: 1px;
}

.message-stream {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-base);
}

.stream-header {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    background: var(--bg-surface);
    font-size: 10px;
    font-weight: 800;
    color: var(--text-dim);
    letter-spacing: 0.1em;
}

.message-list {
    flex: 1;
    overflow-y: auto;
}

/* Message Items */
.message-row {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 16px;
    cursor: pointer;
}

.message-row:hover {
    background: var(--bg-hover);
}

.message-row.important {
    border-left: 2px solid var(--accent);
    background: rgba(41, 151, 255, 0.03);
}

.row-time {
    width: 44px;
    font-family: 'JetBrains Mono';
    font-size: 11px;
    color: var(--text-muted);
}

.row-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.row-source {
    font-size: 9px;
    font-weight: 800;
    color: var(--accent);
    text-transform: uppercase;
}

.row-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
}

/* Sidebar */
.sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    background: var(--bg-base);
    border-left: 1px solid var(--border);
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    overflow-y: visible;
    flex-shrink: 0;
}

.sidebar-section:first-child {
    max-height: 50%;
    overflow-y: auto;
}

.sidebar-section:last-child {
    flex: 1;
    overflow-y: auto;
    border-bottom: none;
}

.sidebar-title {
    font-size: 9px;
    font-weight: 800;
    color: var(--text-dim);
    letter-spacing: 0.15em;
    margin-bottom: 16px;
    text-transform: uppercase;
}

/* Market Grid */
.market-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.market-card {
    padding: 4px 0;
}

.market-card .name {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.market-card .value {
    font-family: 'JetBrains Mono';
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.value.up {
    color: #30d158;
}

.value.down {
    color: #ff453a;
}

/* Immersive Search View */
#searchResultsView {
    display: none;
    position: fixed;
    inset: 56px 0 0 0;
    background: var(--bg-base);
    z-index: 900;
    padding: 60px 15%;
    overflow-y: auto;
    flex-direction: column;
}

/* Modals - 全新设计 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    display: none;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.modal-content {
    background: var(--bg-base);
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-header h1 {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.4;
    color: var(--text-main);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    line-height: 1.8;
    color: var(--text-dim);
    font-size: 14px;
}

.modal-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

/* 报告 Markdown 排版 */
.modal-body h1 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 24px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--accent);
}

.modal-body h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin: 28px 0 16px 0;
    padding-left: 12px;
    border-left: 3px solid var(--accent);
}

.modal-body h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    margin: 20px 0 12px 0;
}

.modal-body p {
    margin: 0 0 16px 0;
}

.modal-body ul,
.modal-body ol {
    margin: 0 0 16px 0;
    padding-left: 20px;
}

.modal-body li {
    margin-bottom: 8px;
}

.modal-body strong {
    color: var(--text-main);
    font-weight: 700;
}

.modal-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

.modal-body em {
    color: var(--text-muted);
    font-style: italic;
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 128, 128, 0.5);
}

/* 加载动画 */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}