/* Git 管理面板样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f5f6fa; color: #2c3e50; line-height: 1.6; }
.header { background: #fff; border-bottom: 1px solid #e1e4e8; padding: 0; }
.header-inner { max-width: 1100px; margin: 0 auto; padding: 16px 30px; display: flex; align-items: center; justify-content: space-between; position: relative; }
.header-inner::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; background: #0366d6; border-radius: 0 2px 2px 0; }
.header-left { display: flex; align-items: center; gap: 16px; margin-left: 16px; }
.header-left h1 { font-size: 16px; font-weight: 600; color: #24292e; }
.header-left .sub { font-size: 12px; color: #586069; }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-right .repo-select { font-size: 14px; padding: 4px 10px; border: 1px solid #e1e4e8; border-radius: 6px; background: #f6f8fa; color: #24292e; cursor: pointer; }
.header-right .repo-select:focus { border-color: #0366d6; outline: none; }

/* 用户头像 + 下拉框 */
.user-dropdown { position: relative; cursor: pointer; user-select: none; }
.user-trigger { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; transition: background 0.15s; }
.user-trigger:hover { background: #f1f3f5; }
.avatar-small { width: 28px; height: 28px; border-radius: 50%; background: #0366d6; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; overflow: hidden; flex-shrink: 0; }
.avatar-small img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-size: 13px; color: #24292e; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-arrow { font-size: 10px; color: #8e8ea0; }
.dropdown-menu { display: none; position: absolute; top: 100%; right: 0; background: #fff; border: 1px solid #e1e4e8; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.1); min-width: 140px; z-index: 100; overflow: hidden; }
.dropdown-menu::before { content: ''; position: absolute; top: -6px; left: 0; right: 0; height: 6px; }
.user-dropdown:hover .dropdown-menu { display: block; }
.dropdown-item { display: block; padding: 10px 16px; font-size: 13px; color: #24292e; text-decoration: none; cursor: pointer; }
.dropdown-item:hover { background: #f6f8fa; }
.dropdown-item:last-child { color: #d73a49; }
.dropdown-divider { height: 1px; background: #e1e4e8; margin: 0; }
.nav { background: #fff; border-bottom: 1px solid #e1e4e8; display: flex; justify-content: center; }
.nav-inner { max-width: 1100px; width: 100%; display: flex; gap: 4px; padding: 0 30px; }
.nav-inner a { padding: 12px 20px; text-decoration: none; color: #586069; font-size: 14px; border-bottom: 2px solid transparent; cursor: pointer; }
.nav-inner a:hover { color: #0366d6; }
.nav-inner a.active { color: #0366d6; border-bottom-color: #0366d6; font-weight: 500; }
.container { max-width: 1100px; margin: 0 auto; padding: 24px 0px; }
.loading { text-align: center; padding: 40px; color: #8e8ea0; font-size: 14px; }

.commit-list { list-style: none; }
.commit-item { background: #fff; border: 1px solid #e1e4e8; border-radius: 8px; margin-bottom: 12px; padding: 16px 20px; transition: box-shadow 0.2s; }
.commit-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.commit-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.commit-hash { font-family: 'SF Mono', Consolas, monospace; font-size: 13px; background: #f1f8ff; color: #0366d6; padding: 2px 8px; border-radius: 4px; cursor: pointer; }
.commit-msg { font-size: 15px; font-weight: 500; color: #24292e; }
.commit-meta { font-size: 12px; color: #586069; }
.commit-author { font-weight: 500; color: #24292e; }
.commit-files { margin-top: 10px; padding-top: 10px; border-top: 1px solid #f1f3f5; }
.stats-bar { display: inline-block; font-size: 12px; font-family: 'SF Mono', monospace; }
.stat-add { color: #28a745; }
.stat-del { color: #d73a49; }

.diff-box { background: #fff; border: 1px solid #e1e4e8; border-radius: 8px; overflow: hidden; }
.diff-body { padding: 16px 20px; overflow-x: auto; }
.diff-line { font-family: 'SF Mono', Consolas, monospace; font-size: 13px; white-space: pre; line-height: 1.5; }
.diff-add { background: #e6ffed; color: #22863a; }
.diff-del { background: #ffeef0; color: #cb2431; }
.diff-hunk { color: #6a737d; background: #f1f5f9; }

.branch-item { background: #fff; border: 1px solid #e1e4e8; border-radius: 8px; padding: 12px 20px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; }
.branch-name { font-family: 'SF Mono', Consolas, monospace; font-size: 14px; font-weight: 500; color: #0366d6; }
.branch-current { background: #28a745; color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 3px; }
.branch-meta { font-size: 12px; color: #586069; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid #e1e4e8; border-radius: 8px; padding: 20px; }
.stat-card .num { font-size: 32px; font-weight: 600; color: #0366d6; }
.stat-card .label { font-size: 13px; color: #586069; margin-top: 4px; }
.stat-card .sub { font-size: 12px; color: #8e8ea0; margin-top: 6px; }
.chart-bar { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding: 12px 0; border-bottom: 1px solid #e1e4e8; }
.chart-col { flex: 1; background: #0366d6; border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.chart-col:hover { background: #0255b8; }
.chart-col .count { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; color: #586069; }
.chart-col .day { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 10px; color: #8e8ea0; }

.file-item { background: #fff; border: 1px solid #e1e4e8; border-radius: 6px; padding: 10px 20px; margin-bottom: 4px; display: flex; align-items: center; gap: 10px; cursor: pointer; touch-action: manipulation; }
.file-item:hover { background: #f6f8fa; }
.file-icon { font-size: 18px; }
.file-name { font-size: 14px; color: #0366d6; }
.file-dir { color: #24292e; font-weight: 500; }
.breadcrumb { font-size: 14px; margin-bottom: 16px; display: flex; gap: 6px; align-items: center; }
.breadcrumb a { color: #0366d6; cursor: pointer; }
.breadcrumb .sep { color: #8e8ea0; }

.search-box { display: flex; gap: 8px; margin-bottom: 20px; }
.search-box input { flex: 1; padding: 10px 14px; border: 1px solid #e1e4e8; border-radius: 6px; font-size: 14px; }
.search-box button { padding: 10px 20px; background: #0366d6; color: #fff; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; }

.compare-box { display: flex; gap: 12px; margin-bottom: 20px; max-width: 1100px; }
.compare-box select { flex: 1; min-width: 0; max-width: 400px; padding: 10px 14px; border: 1px solid #e1e4e8; border-radius: 6px; font-size: 14px; }

.contrib-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.contrib-bar .name { width: 120px; font-size: 14px; font-weight: 500; }
.contrib-bar .bar-bg { flex: 1; height: 24px; background: #f1f3f5; border-radius: 4px; overflow: hidden; }
.contrib-bar .bar-fill { height: 100%; background: #0366d6; border-radius: 4px; display: flex; align-items: center; padding-left: 8px; color: #fff; font-size: 12px; }

.btn { display: inline-block; padding: 6px 14px; background: #0366d6; color: #fff; text-decoration: none; border-radius: 5px; font-size: 13px; cursor: pointer; border: none; touch-action: manipulation; }
.btn:hover { background: #0255b8; }
.back { margin-bottom: 16px; }
pre.code { background: #f6f8fa; border: 1px solid #e1e4e8; border-radius: 8px; padding: 16px; overflow-x: auto; font-family: 'SF Mono', Consolas, monospace; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.load-more { text-align: center; padding: 20px; }
.load-more button { padding: 10px 28px; background: #fff; border: 1px solid #0366d6; color: #0366d6; border-radius: 6px; font-size: 14px; cursor: pointer; }
.load-more button:hover { background: #0366d6; color: #fff; }
.load-more .no-more { color: #8e8ea0; font-size: 13px; }
.load-more .loading-tip { color: #8e8ea0; font-size: 13px; }
.page-info { text-align: center; font-size: 12px; color: #8e8ea0; margin-top: 8px; }

/* Settings */
.header-right .settings-link { font-size: 12px; color: #0366d6; text-decoration: underline; cursor: pointer; }
.header-right .settings-link:hover { color: #0255b8; }
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-content { background: #fff; border-radius: 12px; width: 90%; max-width: 560px; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 8px 30px rgba(0,0,0,0.15); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.modal-header h2 { font-size: 16px; font-weight: 600; color: #24292e; margin: 0; }
.modal-close { font-size: 22px; color: #8e8ea0; cursor: pointer; line-height: 1; }
.modal-close:hover { color: #24292e; }
.modal-body { padding: 16px 24px; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid #e1e4e8; }
.settings-field { margin-bottom: 16px; }
.settings-field label { display: block; font-size: 13px; font-weight: 500; color: #24292e; margin-bottom: 4px; }
.settings-field .hint { font-size: 11px; color: #8e8ea0; margin-top: 2px; }
.settings-field input { width: 100%; padding: 8px 12px; border: 1px solid #e1e4e8; border-radius: 6px; font-size: 13px; box-sizing: border-box; }
.settings-field input:focus { border-color: #0366d6; outline: none; box-shadow: 0 0 0 3px rgba(3,102,214,0.15); }
.settings-avatar { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #e1e4e8; }
.avatar-placeholder { width: 64px; height: 64px; border-radius: 50%; background: #0366d6; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 500; }

/* Markdown 渲染 */
.markdown-body { padding: 16px 0; font-size: 15px; line-height: 1.7; color: #24292e; word-wrap: break-word; }
.markdown-body h1 { font-size: 24px; margin: 20px 0 12px; padding-bottom: 8px; border-bottom: 1px solid #e1e4e8; }
.markdown-body h2 { font-size: 20px; margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid #e1e4e8; }
.markdown-body h3 { font-size: 17px; margin: 16px 0 8px; }
.markdown-body p { margin: 0 0 12px; }
.markdown-body code { background: #f1f3f5; padding: 2px 6px; border-radius: 4px; font-size: 13px; font-family: monospace; }
.markdown-body pre { background: #f6f8fa; padding: 14px 16px; border-radius: 8px; overflow-x: auto; font-size: 13px; line-height: 1.5; border: 1px solid #e1e4e8; margin: 0 0 12px; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote { border-left: 4px solid #d0d7de; padding: 0 12px; color: #656d76; margin: 0 0 12px; }
.markdown-body ul, .markdown-body ol { padding-left: 24px; margin: 0 0 12px; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body table { border-collapse: collapse; width: 100%; margin: 0 0 12px; font-size: 13px; }
.markdown-body th, .markdown-body td { border: 1px solid #d0d7de; padding: 8px 12px; text-align: left; }
.markdown-body th { background: #f6f8fa; font-weight: 500; }
.markdown-body a { color: #0366d6; text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }
.markdown-body img { max-width: 100%; }

/* 热度图滚动容器 */
.heatmap-scroll { overflow-x: auto; scrollbar-width: none; }
.heatmap-scroll::-webkit-scrollbar { display: none; }

/* ===== 文件树 ===== */
.file-tree { font-size: 13px; }
.file-tree ul { list-style: none; padding: 0; margin: 0; }
.file-tree li { margin: 0; }
.tree-node { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 4px; cursor: pointer; }
.tree-node:hover { background: #f6f8fa; }
.tree-dir { font-weight: 500; }
.tree-file { padding-left: 20px; font-weight: normal; }
.tree-toggle { font-size: 10px; color: #8e8ea0; width: 12px; text-align: center; flex-shrink: 0; }
.tree-icon { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; }
.tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-children { padding-left: 20px; }

/* ===== 分栏文件浏览 ===== */
.split-panel { display: flex; gap: 0; min-height: 400px; border: 1px solid #e1e4e8; border-radius: 8px; overflow: hidden; }
.tree-panel { width: 260px; flex-shrink: 0; border-right: 1px solid #e1e4e8; background: #fafbfc; overflow-y: auto; }
.tree-scroll { padding: 8px; }
.content-panel { flex: 1; min-width: 0; padding: 16px; overflow-x: auto; }

.tree-list { list-style: none; padding: 0; margin: 0; }
.tree-list li { margin: 0; }
.tree-dir, .tree-file { display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 4px; cursor: pointer; font-size: 13px; touch-action: manipulation; }
.tree-dir:hover, .tree-file:hover { background: #e8eaed; }
.tree-dir { font-weight: 500; }
.tree-toggle { font-size: 10px; color: #8e8ea0; width: 14px; text-align: center; flex-shrink: 0; }
.tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-children { padding-left: 18px; }

@media (max-width: 768px) {
    .split-panel { flex-direction: column; min-height: auto; }
    .tree-panel { width: 100%; border-right: none; border-bottom: 1px solid #e1e4e8; max-height: 260px; }
    .tree-dir, .tree-file { padding: 8px 6px; }
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
    .container { padding: 16px 12px; }
    .header-inner { padding: 0 12px; flex-wrap: wrap; gap: 6px; }
    .header-left h1 { font-size: 16px; }
    .header-right .repo-select { font-size: 11px; }
    .user-name { display: none; }
    .header-right { gap: 6px; }

    .nav-inner { padding: 0 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 0; scrollbar-width: none; }
    .nav-inner::-webkit-scrollbar { display: none; }
    .nav-inner a { padding: 10px 12px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }

    .commit-item { padding: 10px 12px; }
    .commit-header { flex-wrap: wrap; gap: 4px; }
    .commit-hash { font-size: 11px; }
    .commit-msg { font-size: 12px; }
    .commit-meta { font-size: 11px; }
    .commit-files { font-size: 11px; }

    .file-item { padding: 8px 12px; font-size: 13px; }
    .branch-item { padding: 8px 12px; font-size: 12px; flex-wrap: wrap; }
    .branch-name { font-size: 13px; }
    .branch-meta { font-size: 11px; }

    .compare-box { flex-direction: column; gap: 8px; max-width: 100%; }
    .compare-box select { max-width: 100%; }

    .diff-box { overflow-x: auto; }
    .diff-line { font-size: 11px; white-space: pre-wrap; word-break: break-all; }

    .search-box input { font-size: 12px; padding: 8px 10px; }
    .chart-bar { height: 100px; }
    .chart-col .count { font-size: 9px; }
    .chart-col .day { font-size: 8px; }

    .modal-content { width: 95%; max-width: 100%; margin: 10px; }
    .settings-field input { font-size: 12px; padding: 6px 10px; }
    .settings-avatar { flex-direction: column; align-items: flex-start; gap: 10px; }

    .pre, .code { font-size: 12px; padding: 10px; }

    .contrib-bar { flex-wrap: wrap; gap: 4px; }
    .contrib-bar .name { width: auto; font-size: 12px; }
    .bar-bg { height: 20px; }
    .bar-fill { font-size: 11px; }
}

@media (max-width: 480px) {
    .header-left h1 { font-size: 14px; }
    .header-right .repo-select { font-size: 10px; }
    .nav-inner a { padding: 8px 8px; font-size: 11px; }
    .commit-msg { font-size: 11px; }
    .container { padding: 12px 8px; }
}
