/* 全局样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 40px;
    background: #ffffff;
    color: #1a1a1a;
    transition: background-color 0.3s ease, color 0.3s ease;
    /* 防止系统深色模式影响文本渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 系统深色模式检测 - 针对 macOS 和其他系统的深色模式 */
@media (prefers-color-scheme: dark) {
    body:not(.light-mode) {
        background: #0d1117;
        color: #e6edf3;
    }

    body:not(.light-mode) h1 {
        color: #e6edf3;
    }

    body:not(.light-mode) .file-card {
        background: #161b22;
        border-color: #30363d;
        color: #e6edf3;
    }

    body:not(.light-mode) .file-name {
        color: #58a6ff;
    }

    body:not(.light-mode) .file-desc {
        color: #c9d1d9;
    }

    body:not(.light-mode) .footer-info {
        color: #c9d1d9;
    }

    body:not(.light-mode) .footer-info a {
        color: #58a6ff;
    }

    body:not(.light-mode) .back-link {
        color: #58a6ff;
    }

    body:not(.light-mode) .markdown-body {
        background: #161b22;
        color: #e6edf3;
    }
}

/* 夜间模式样式 */
body.dark-mode {
    background: #0d1117;
    color: #c9d1d9;
}

/* 标题样式 */
h1 {
    text-align: center;
    color: #1a1a1a;
    margin-bottom: 30px;
}

body.dark-mode h1 {
    color: #c9d1d9;
}

/* 文件网格布局 */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 文件卡片样式 */
.file-card {
    background: #ffffff;
    border: 1px solid #d1d9e0;
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s, background-color 0.3s ease, border-color 0.3s ease;
}

body.dark-mode .file-card {
    background: #161b22;
    border-color: #30363d;
    color: #c9d1d9;
}

.file-card:hover {
    box-shadow: 0 2px 8px rgba(27,31,35,0.15);
}

body.dark-mode .file-card:hover {
    box-shadow: 0 2px 8px rgba(88,166,255,0.15);
}

/* 文件名样式 */
.file-name {
    font-size: 1.2em;
    font-weight: bold;
    color: #0969da;
    margin-bottom: 5px;
}

body.dark-mode .file-name {
    color: #58a6ff;
}

/* 链接样式 */
.file-link {
    text-decoration: none;
    color: inherit;
}

/* 文件描述样式 */
.file-desc {
    color: #4a525c;
    font-size: 0.9em;
    margin-top: 10px;
}

body.dark-mode .file-desc {
    color: #8b949e;
}

/* 文件日期样式 */
.file-date {
    color: #6a737d;
    font-size: 0.8em;
    margin-top: 5px;
    font-family: monospace;
}

body.dark-mode .file-date {
    color: #8b949e;
}

/* 月份分栏样式 */
.month-section {
    margin-bottom: 40px;
}

.month-title {
    font-size: 1.5em;
    color: #1a1a1a;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #d1d9e0;
    font-weight: 600;
}

body.dark-mode .month-title {
    color: #c9d1d9;
    border-bottom-color: #30363d;
}

/* 底部信息样式 */
.footer-info {
    text-align: center;
    margin-top: 40px;
    color: #4a525c;
}

body.dark-mode .footer-info {
    color: #8b949e;
}

.footer-info a {
    color: #0969da;
    text-decoration: none;
}

body.dark-mode .footer-info a {
    color: #58a6ff;
}

.footer-info a:hover {
    text-decoration: underline;
}

/* 返回链接样式 */
.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #0969da;
    text-decoration: none;
    font-weight: bold;
}

body.dark-mode .back-link {
    color: #58a6ff;
}

.back-link:hover {
    text-decoration: underline;
}

/* 基础表格样式 - 确保表格在各种模式下都有清晰的边框 */
.markdown-body table {
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    width: 100% !important;
    margin: 16px 0 !important;
}

.markdown-body table th,
.markdown-body table td {
    padding: 8px 12px !important;
    border: 1px solid #d1d9e0 !important;
    text-align: left !important;
}

.markdown-body table th {
    background-color: #f6f8fa !important;
    font-weight: 600 !important;
    color: #1a1a1a !important;
}

.markdown-body table td {
    background-color: #ffffff !important;
    color: #1a1a1a !important;
}

/* 表格条纹效果 */
.markdown-body table tr:nth-child(2n) {
    background-color: #f6f8fa !important;
}

.markdown-body table tr:nth-child(2n) td {
    background-color: transparent !important;
}

/* 表格悬停效果 */
.markdown-body table tr:hover {
    background-color: #f0f5fa !important;
}

.markdown-body table tr:hover td {
    background-color: transparent !important;
}

/* Markdown 内容区域样式 */
.markdown-body {
    max-width: 800px;
    margin: 0 auto;
    background: #ffffff;
    padding: 30px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: background-color 0.3s ease, color 0.3s ease;
    color: #1a1a1a;
}

body.dark-mode .markdown-body {
    background: #161b22;
    color: #c9d1d9;
}

/* 夜间模式下的代码块样式 */
body.dark-mode .markdown-body pre {
    background-color: #0d1117 !important;
    border: 1px solid #30363d !important;
}

body.dark-mode .markdown-body code {
    background-color: rgba(110, 118, 129, 0.4) !important;
    color: #c9d1d9 !important;
}

/* 夜间模式下的表格样式 */
body.dark-mode .markdown-body table {
    border-color: #30363d !important;
}

body.dark-mode .markdown-body table th,
body.dark-mode .markdown-body table td {
    border-color: #30363d !important;
    background-color: #161b22 !important;
    color: #c9d1d9 !important;
}

/* 夜间模式下的引用样式 */
body.dark-mode .markdown-body blockquote {
    border-left-color: #30363d !important;
    color: #8b949e !important;
}

/* 夜间模式下的段落和文本样式 */
body.dark-mode .markdown-body p,
body.dark-mode .markdown-body li,
body.dark-mode .markdown-body td,
body.dark-mode .markdown-body th {
    color: #c9d1d9 !important;
}

/* 夜间模式下的标题样式 */
body.dark-mode .markdown-body h1,
body.dark-mode .markdown-body h2,
body.dark-mode .markdown-body h3,
body.dark-mode .markdown-body h4,
body.dark-mode .markdown-body h5,
body.dark-mode .markdown-body h6 {
    color: #c9d1d9 !important;
    border-bottom-color: #30363d !important;
}

/* 夜间模式下的链接样式 */
body.dark-mode .markdown-body a {
    color: #58a6ff !important;
}

body.dark-mode .markdown-body a:hover {
    color: #79c0ff !important;
}

/* 夜间模式下的强调文本 */
body.dark-mode .markdown-body strong {
    color: #c9d1d9 !important;
}

body.dark-mode .markdown-body em {
    color: #c9d1d9 !important;
}

/* 夜间模式下的行内代码样式增强 */
body.dark-mode .markdown-body code {
    background-color: rgba(110, 118, 129, 0.4) !important;
    color: #c9d1d9 !important;
    border-radius: 3px !important;
    padding: 0.2em 0.4em !important;
}

/* 夜间模式下的删除线和添加线 */
body.dark-mode .markdown-body del {
    color: #8b949e !important;
}

body.dark-mode .markdown-body ins {
    color: #c9d1d9 !important;
    background-color: rgba(46, 160, 67, 0.15) !important;
}

/* 夜间模式下的列表标记 */
body.dark-mode .markdown-body ul li::marker,
body.dark-mode .markdown-body ol li::marker {
    color: #8b949e !important;
}

/* 夜间模式下的水平线 */
body.dark-mode .markdown-body hr {
    background-color: #30363d !important;
    border: 0 !important;
    height: 1px !important;
}

/* 夜间模式下的图片边框 */
body.dark-mode .markdown-body img {
    border-color: #30363d !important;
}

/* 重要：覆盖 GitHub Markdown CSS 的默认样式 */
body.dark-mode .markdown-body .highlight {
    background-color: #0d1117 !important;
}

body.dark-mode .markdown-body .highlight pre {
    background-color: #0d1117 !important;
}

/* 确保所有文本元素都有足够的对比度 */
body.dark-mode .markdown-body *:not(pre):not(code):not(a) {
    color: #c9d1d9 !important;
}

/* 特殊处理链接颜色以保持可识别性 */
body.dark-mode .markdown-body a * {
    color: #58a6ff !important;
}

/* macOS 深色模式下的特殊处理 */
@media (prefers-color-scheme: dark) {
    body:not(.light-mode) .markdown-body {
        background: #161b22 !important;
        color: #e6edf3 !important;
    }

    body:not(.light-mode) .markdown-body p,
    body:not(.light-mode) .markdown-body li,
    body:not(.light-mode) .markdown-body td,
    body:not(.light-mode) .markdown-body th,
    body:not(.light-mode) .markdown-body h1,
    body:not(.light-mode) .markdown-body h2,
    body:not(.light-mode) .markdown-body h3,
    body:not(.light-mode) .markdown-body h4,
    body:not(.light-mode) .markdown-body h5,
    body:not(.light-mode) .markdown-body h6 {
        color: #e6edf3 !important;
    }

    body:not(.light-mode) .markdown-body a {
        color: #58a6ff !important;
    }

    body:not(.light-mode) .markdown-body code {
        background-color: rgba(110, 118, 129, 0.4) !important;
        color: #e6edf3 !important;
    }

    body:not(.light-mode) .markdown-body pre {
        background-color: #0d1117 !important;
        border-color: #30363d !important;
    }

    body:not(.light-mode) .markdown-body blockquote {
        color: #c9d1d9 !important;
        border-left-color: #30363d !important;
    }

    body:not(.light-mode) .markdown-body table {
        border-color: #30363d !important;
    }

    body:not(.light-mode) .markdown-body table th,
    body:not(.light-mode) .markdown-body table td {
        border-color: #30363d !important;
        background-color: #161b22 !important;
        color: #e6edf3 !important;
    }
}

/* 针对 macOS 深色模式但网站使用浅色模式的特殊处理 */
@media (prefers-color-scheme: dark) {
    body.light-mode {
        background: #ffffff !important;
        color: #1a1a1a !important;
    }

    body.light-mode h1 {
        color: #1a1a1a !important;
    }

    body.light-mode .file-card {
        background: #ffffff !important;
        border-color: #d1d9e0 !important;
        color: #1a1a1a !important;
    }

    body.light-mode .file-name {
        color: #0969da !important;
    }

    body.light-mode .file-desc {
        color: #4a525c !important;
    }

    body.light-mode .footer-info {
        color: #4a525c !important;
    }

    body.light-mode .footer-info a {
        color: #0969da !important;
    }

    body.light-mode .back-link {
        color: #0969da !important;
    }

    body.light-mode .markdown-body {
        background: #ffffff !important;
        color: #1a1a1a !important;
    }

    /* 确保浅色模式下的 markdown 内容清晰可见 */
    body.light-mode .markdown-body p,
    body.light-mode .markdown-body li,
    body.light-mode .markdown-body td,
    body.light-mode .markdown-body th,
    body.light-mode .markdown-body h1,
    body.light-mode .markdown-body h2,
    body.light-mode .markdown-body h3,
    body.light-mode .markdown-body h4,
    body.light-mode .markdown-body h5,
    body.light-mode .markdown-body h6 {
        color: #1a1a1a !important;
    }

    body.light-mode .markdown-body a {
        color: #0969da !important;
    }

    body.light-mode .markdown-body code {
        background-color: rgba(175, 184, 193, 0.2) !important;
        color: #1a1a1a !important;
    }

    body.light-mode .markdown-body pre {
        background-color: #f6f8fa !important;
        border-color: #d1d9e0 !important;
        color: #1a1a1a !important;
    }

    body.light-mode .markdown-body blockquote {
        color: #4a525c !important;
        border-left-color: #d1d9e0 !important;
    }

    /* 确保表格在混合模式下清晰可见 */
    body.light-mode .markdown-body table {
        border-color: #d1d9e0 !important;
        background: #ffffff !important;
    }

    body.light-mode .markdown-body table th {
        background-color: #f6f8fa !important;
        border-color: #d1d9e0 !important;
        color: #1a1a1a !important;
        font-weight: 600 !important;
    }

    body.light-mode .markdown-body table td {
        background-color: #ffffff !important;
        border-color: #d1d9e0 !important;
        color: #1a1a1a !important;
    }

    /* 表格条纹效果 */
    body.light-mode .markdown-body table tr:nth-child(2n) {
        background-color: #f6f8fa !important;
    }

    body.light-mode .markdown-body table tr:nth-child(2n) td {
        background-color: transparent !important;
    }

    /* 表格悬停效果 */
    body.light-mode .markdown-body table tr:hover {
        background-color: #f0f5fa !important;
    }

    body.light-mode .markdown-body table tr:hover td {
        background-color: transparent !important;
    }
}

/* 强制覆盖 GitHub Markdown CSS 的表格样式 */
.markdown-body table {
    border: 1px solid #d1d9e0 !important;
}

.markdown-body table th {
    border: 1px solid #d1d9e0 !important;
}

.markdown-body table td {
    border: 1px solid #d1d9e0 !important;
}

/* 针对 GitHub 表格样式的特殊处理 */
.markdown-body table tbody tr {
    background-color: #ffffff !important;
}

.markdown-body table tbody tr:nth-child(2n) {
    background-color: #f6f8fa !important;
}

/* 确保表格边框在混合模式下清晰可见 */
@media (prefers-color-scheme: dark) {
    body.light-mode .markdown-body table {
        box-shadow: 0 0 0 1px #d1d9e0 !important;
    }

    body.light-mode .markdown-body table th,
    body.light-mode .markdown-body table td {
        box-shadow: inset 0 0 0 1px #d1d9e0 !important;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    body {
        color: #000000;
        background: #ffffff;
    }

    body.dark-mode {
        color: #ffffff;
        background: #000000;
    }
}

/* 主题切换按钮样式 */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(27,31,35,0.1);
}

body.dark-mode .theme-toggle {
    background: #161b22;
    border-color: #30363d;
    color: #c9d1d9;
}

.theme-toggle:hover {
    box-shadow: 0 2px 8px rgba(27,31,35,0.15);
}

body.dark-mode .theme-toggle:hover {
    box-shadow: 0 2px 8px rgba(88,166,255,0.15);
}

/* 报告生成按钮样式 */
.report-button {
    position: fixed;
    top: 20px;
    right: 80px;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(27,31,35,0.1);
}

body.dark-mode .report-button {
    background: #161b22;
    border-color: #30363d;
    color: #c9d1d9;
}

.report-button:hover {
    box-shadow: 0 2px 8px rgba(27,31,35,0.15);
}

body.dark-mode .report-button:hover {
    box-shadow: 0 2px 8px rgba(88,166,255,0.15);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: #ffffff;
    margin: 15% auto;
    padding: 30px;
    border: 1px solid #d1d9e0;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 16px rgba(27,31,35,0.15);
    position: relative;
}

body.dark-mode .modal-content {
    background-color: #161b22;
    border-color: #30363d;
    color: #c9d1d9;
}

.close {
    color: #6a737d;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #0969da;
}

body.dark-mode .close {
    color: #8b949e;
}

body.dark-mode .close:hover,
body.dark-mode .close:focus {
    color: #58a6ff;
}

.modal h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #1a1a1a;
    font-size: 1.5em;
}

body.dark-mode .modal h2 {
    color: #c9d1d9;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1a1a1a;
}

body.dark-mode .form-group label {
    color: #c9d1d9;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d9e0;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    background: #ffffff;
    color: #1a1a1a;
}

body.dark-mode .form-group input {
    background: #0d1117;
    border-color: #30363d;
    color: #c9d1d9;
}

.form-group input:focus {
    outline: none;
    border-color: #0969da;
    box-shadow: 0 0 0 2px rgba(9, 105, 218, 0.2);
}

body.dark-mode .form-group input:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

.form-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.submit-button {
    background: #0969da;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.submit-button:hover {
    background: #0550ae;
}

body.dark-mode .submit-button {
    background: #58a6ff;
}

body.dark-mode .submit-button:hover {
    background: #79c0ff;
}

.cancel-button {
    background: #f6f8fa;
    color: #1a1a1a;
    border: 1px solid #d1d9e0;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.cancel-button:hover {
    background: #f0f5fa;
}

body.dark-mode .cancel-button {
    background: #21262d;
    color: #c9d1d9;
    border-color: #30363d;
}

body.dark-mode .cancel-button:hover {
    background: #30363d;
}

.status-message {
    margin-top: 20px;
}

.status-message .loading {
    color: #6a737d;
    font-style: italic;
}

.status-message .success {
    color: #28a745;
    font-weight: 600;
}

.status-message .error {
    color: #dc3545;
    font-weight: 600;
}

body.dark-mode .status-message .loading {
    color: #8b949e;
}

body.dark-mode .status-message .success {
    color: #3fb950;
}

body.dark-mode .status-message .error {
    color: #f85149;
}

/* 股票分析按钮样式 */
.ticker-button {
    position: fixed;
    top: 20px;
    right: 140px;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(27,31,35,0.1);
    display: flex;
    align-items: center;
    gap: 5px;
}

body.dark-mode .ticker-button {
    background: #161b22;
    border-color: #30363d;
    color: #c9d1d9;
}

.ticker-button:hover {
    box-shadow: 0 2px 8px rgba(27,31,35,0.15);
}

body.dark-mode .ticker-button:hover {
    box-shadow: 0 2px 8px rgba(88,166,255,0.15);
}

.button-icon {
    font-size: 16px;
}

.button-text {
    font-size: 14px;
    font-weight: 500;
}