/* --- 全新暗色主题信息窗格 --- */
#chartjs-tooltip {
    opacity: 0;
    pointer-events: none;
    position: fixed;
    top: 50%;
    left: 30px; /* 初始位置居左 */
    transform: translateY(-50%) scale(0.95); /* 只在Y轴上居中 */
    background: #2d3748; /* 深灰色背景 */
    border: 1px solid #4a5568;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    color: #e2e8f0; /* 默认使用浅色文字 */
    width: 90%;
    max-width: 550px;
    z-index: 2000;
    transition: opacity 0.25s ease, transform 0.25s ease;
    display: flex;
    flex-direction: column;
    cursor: move; /* 整个窗格可拖动 */
}

#chartjs-tooltip.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
}

.tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #4a5568; /* 统一的深色边框 */
    background-color: transparent; /* 移除白色背景 */
    border-radius: 0; /* 移除头部的圆角，保持整体感 */
}

.tooltip-header .date {
    font-weight: 600;
    font-size: 1.1em;
}

#tooltip-close-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #64748b;
    transition: color 0.2s;
}

#tooltip-close-btn:hover {
    color: #1e293b;
}

.tooltip-content {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #334155;
    margin: 0;
    padding: 0;
    background-color: #f1f5f9;
    font-size: 16px;
}

.container {
    width: 90%;
    margin: 0 auto;
    padding: 30px 20px;
}

h1 {
    text-align: center;
    color: #1e293b;
    font-size: 2.2em;
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Tab 样式 */
.tab-container {
    margin-bottom: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
}

.tab-buttons {
    display: flex;
    border-bottom: 1px solid #eef2f7;
    background: #f8fafc;
}

.tab-button {
    padding: 16px 32px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #64748b;
    transition: all 0.3s ease;
    position: relative;
    flex: 1;
    text-align: center;
}

.tab-button.active {
    color: #3b82f6;
    background: #fff;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #3b82f6;
    border-radius: 3px 3px 0 0;
}

.tab-button:hover:not(.active) {
    color: #3b82f6;
    background-color: #f1f5f9;
}

.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 公告时间线查询 Tab --- */
#filter-container {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 40px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

#filter-container:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.filter-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

#stockCodeInput {
    flex-grow: 1;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    min-width: 200px;
}

#stockCodeInput:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
    outline: none;
}

#filterButton, #sortButton {
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    font-size: 1em;
}

#filterButton {
    background-color: #3b82f6;
    color: white;
}

#filterButton:hover {
    background-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    transform: translateY(-2px);
}

#filterButton:active, #sortButton:active {
    transform: translateY(1px);
}

#sortButton {
    background-color: #f1f5f9;
    color: #475569;
}

#sortButton:hover {
    background-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

#stock-search-container {
    position: relative;
    flex-grow: 1;
}

#stock-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 10px 15px rgba(0,0,0,0.1);
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
}

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

.suggestion-item:hover {
    background-color: #f1f5f9;
}

#type-filter-container {
    text-align: left;
    border-top: 1px solid #e2e8f0;
    padding-top: 25px;
}

#type-filter-container h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #1e293b;
    font-size: 1.3em;
    font-weight: 600;
}

#type-filter-container div {
    display: inline-block;
    margin-right: 25px;
    margin-bottom: 12px;
}

#timeline {
    position: relative;
    padding-left: 20px;
}

#timeline:before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, #e2e8f0, #cbd5e1, #e2e8f0);
    left: 100px; /* 调整到与日期右侧对齐 */
    margin-left: -1.5px;
}

.tag-group {
    margin-bottom: 56px;
}

.sub-tag-title {
    font-size: 1.08em;
    color: #2980b9;
    font-weight: 600;
    margin: 18px 0 10px 140px;
    letter-spacing: 1px;
    padding-left: 8px;
    border-left: 3px solid #d0e6f7;
}

.collapse-btn {
    margin-right: 10px;
    background: none;
    border: none;
    color: #888;
    font-size: 1.2em;
    cursor: pointer;
    vertical-align: middle;
    transition: color 0.2s, background 0.2s;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    line-height: 24px;
    display: inline-block;
    text-align: center;
    outline: none;
}
.collapse-btn:hover {
    color: #3498db;
    background: #eaf4fb;
}

.timeline-list {
    transition: max-height 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.3s;
    overflow: hidden;
}

.tag-title {
    font-size: 1.6em;
    color: #2c3e50;
    margin-bottom: 25px;
    padding-left: 140px;
    position: relative;
}

/* .tag-title:before 已移除，不再显示大圆点 */

.timeline-item {
    position: relative;
    margin-bottom: 36px;
    padding-left: 140px; /* 减少左边距 */
    min-height: 60px;
    transition: box-shadow 0.2s, background 0.2s;
    display: flex;
    align-items: flex-start;
}
.timeline-item:hover {
    background: #f0f6fa;
    box-shadow: 0 2px 12px rgba(52,152,219,0.08);
    border-radius: 8px;
}

.timeline-date {
    position: absolute;
    left: 0;
    top: 16px;
    width: 100px; /* 调整宽度 */
    text-align: right;
    padding-right: 20px; /* 增加一些右边距，使其与时间线分开 */
    font-weight: bold;
    color: #7f8c8d;
    font-size: 1em;
    letter-spacing: 1px;
    white-space: nowrap;
}

.sub-tag-title-wrap {
    display: flex;
    align-items: center;
    margin: 18px 0 10px 140px;
    user-select: none;
    cursor: pointer;
}
.sub-collapse-btn {
    margin-right: 8px;
    background: none;
    border: none;
    color: #2980b9;
    font-size: 1.1em;
    cursor: pointer;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    line-height: 20px;
    display: inline-block;
    text-align: center;
    outline: none;
    transition: color 0.2s, background 0.2s;
}
.sub-collapse-btn:hover {
    color: #fff;
    background: #2980b9;
}

.sub-timeline-list {
    margin-bottom: 8px;
}
/* .timeline-dot 样式已移除 */

.timeline-month-marker {
    position: relative;
    background-color: #e2e8f0;
    color: #475569;
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: 600;
    font-size: 0.9em;
    margin: 40px 0 20px 60px;
    display: inline-block;
    z-index: 1;
}

.timeline-month-marker::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -48px;
    width: 40px;
    height: 2px;
    background-color: #cbd5e1;
}

.timeline-content {
    position: relative;
    background: #fff;
    padding: 20px 24px 18px 24px;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.10);
    transition: box-shadow 0.2s;
    margin-left: 10px;
    min-width: 0;
    flex: 1 1 0;
    word-break: break-all;
}

.timeline-content h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.18em;
    font-weight: 600;
    line-height: 1.3;
}

.details {
    font-size: 0.96em;
    color: #555;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    word-break: break-all;
}

.stock-code {
    font-weight: bold;
}

.summary {
    background: #f6fafd;
    color: #2c3e50;
    font-size: 1.04em;
    margin: 10px 0 0 0;
    padding: 12px 16px;
    border-radius: 7px;
    line-height: 1.7;
    box-shadow: 0 1px 4px rgba(52,152,219,0.06);
    border-left: 4px solid #3498db;
    word-break: break-all;
}
.repeat-tag {
    display: inline-block;
    background: #e74c3c;
    color: #fff;
    font-size: 0.85em;
    font-weight: bold;
    border-radius: 8px;
    padding: 2px 8px 2px 8px;
    margin-left: 8px;
    vertical-align: middle;
    letter-spacing: 1px;
    box-shadow: 0 1px 4px rgba(231,76,60,0.10);
}

/* --- 新闻热点频次分析 Tab --- */
.chart-wrapper {
    position: relative;
    height: 500px;
    width: 100%;
    margin: 2em 0;
    background-color: #fff;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 1em;
    box-sizing: border-box;
}

.controls {
    text-align: center;
    margin-bottom: 2em;
    padding: 1em;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.controls label {
    font-weight: bold;
    margin-right: 1em;
}

.controls select {
    padding: 0.5em;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 150px;
}

#loading-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2em;
    font-size: 1.2em;
    color: #555;
}

.spinner {
  border: 4px solid rgba(0, 0, 0, 0.1);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border-left-color: #3b82f6;
  margin-right: 1em;
  animation: spin 1s ease infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.error-message {
    text-align: center;
    padding: 2em;
    background-color: #ffebee;
    color: #c62828;
    border-radius: 8px;
}

#chartjs-tooltip {
    opacity: 0;
    position: absolute;
    background: rgba(30, 41, 59, 0.85);
    color: white;
    border-radius: 8px;
    transition: all .2s ease;
    cursor: pointer;
    pointer-events: none;
    transform: translate(-50%, 0);
    padding: 15px;
    font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
    font-size: 14px;
    z-index: 100;
    width: auto;
    min-width: 250px;
    max-width: 400px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#chartjs-tooltip .tooltip-header {
    font-weight: bold;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

#chartjs-tooltip .tooltip-content .tooltip-label {
    font-weight: bold;
    color: #94a3b8;
}

#chartjs-tooltip .tooltip-content .tooltip-value {
    color: #e2e8f0;
}

#chartjs-tooltip a {
    color: #7dd3fc;
    text-decoration: none;
    display: block;
    margin-top: 5px;
    transition: color 0.2s;
}

#chartjs-tooltip a:hover {
    color: #0ea5e9;
    text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.5em;
    }
    
    #filter-container {
        padding: 15px;
    }
    
    .filter-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    #stockCodeInput {
        width: 100%;
    }
    
    #timeline {
        padding-left: 10px;
    }
    
    #timeline:before {
        left: 20px;
    }
    
    .timeline-item {
        padding-left: 40px;
    }
    
    .timeline-date {
        position: relative;
        width: auto;
        text-align: left;
        margin-bottom: 5px;
    }
    
    .tag-title {
        padding-left: 40px;
    }
    
    .tag-title:before {
        left: 20px;
    }
    
    .sub-tag-title-wrap {
        margin-left: 40px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
        font-size: 13px;
    }
    
    h1 {
        font-size: 1.3em;
    }
    
    #filter-container {
        padding: 10px;
    }
    
    #filterButton, #sortButton {
        padding: 10px 15px;
    }
    
    .timeline-content {
        padding: 15px;
    }
    
    .tag-title {
        font-size: 1.3em;
    }
}

/* --- Sub-category Styles --- */
.subcategory-group {
    margin-top: 20px;
    padding-left: 20px;
    border-left: 2px solid #e0e0e0;
}

.subcategory-title {
    font-size: 1.1em;
    font-weight: bold;
    color: #555;
    margin-bottom: 15px;
    position: relative;
}

/* .subcategory-title::before {
    content: '';
    position: absolute;
    left: -29px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background-color: #777;
    border-radius: 50%;
} */

/* --- Collapsible Section Styles --- */
.item-count {
    font-size: 0.8em;
    color: #888;
    font-weight: normal;
    margin-left: 8px;
}

.collapsible {
    cursor: pointer;
    position: relative;
    padding-left: 20px; /* 为箭头腾出空间 */
}

.collapsible::before {
    content: '▼';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
    transition: transform 0.2s ease-in-out;
}

.collapsible.collapsed::before {
    transform: translateY(-50%) rotate(-90deg);
}

/* --- Tooltip News List Scrollbar --- */
.tooltip-news-list {
    max-height: 150px;
    overflow-y: auto;
    margin-top: 5px;
    padding-right: 10px; /* 为滚动条留出空间 */
}

/* 美化滚动条 (适用于 Webkit 浏览器, 如 Chrome, Safari) */
.tooltip-news-list::-webkit-scrollbar {
    width: 6px;
}

.tooltip-news-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.tooltip-news-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.tooltip-news-list::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}


/* Tooltip 内部的舆情总结样式 */
.tooltip-divider {
    height: 1px;
    background-color: #e2e8f0;
    margin: 12px 0;
}

.tooltip-summary {
    margin-top: 8px;
    padding-top: 8px;
    font-size: 0.95em;
    color: #475569;
    line-height: 1.6;
    white-space: pre-wrap; /* 保持换行 */
    word-wrap: break-word;
}

/* --- 优化图表提示框中的舆情总结样式 --- */
.tooltip-summary {
    color: #1e293b; /* 使用更深的颜色以提高可读性 */
    font-size: 0.95em;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0; /* 添加一个分隔线 */
}

.tooltip-summary strong {
    color: #3b82f6; /* 让“舆情动态”标签更突出 */
    font-weight: 600;
}


/* 减小舆情总结中段落的间距 */
.tooltip-summary p {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}


/* --- 新闻热点频次分析 Tab 的控件样式 --- */
.controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}


/* --- 新闻热点频次分析 Tab Controls --- */
.hotpoint-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 30px;
}

#company-select, #period-select {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    background-color: #fff;
    transition: all 0.3s ease;
}

#company-select:focus, #period-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
    outline: none;
}

#company-select {
    min-width: 300px; /* 增加最小宽度 */
    flex-grow: 1;     /* 允许它增长以适应更长的内容 */
}
