/* css/dev-log.css */

/* --- 新增：全局滚动条样式 --- */
html {
    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: #26c6da #f0f0f0;
}

html::-webkit-scrollbar {
    width: 8px;
}

html::-webkit-scrollbar-track {
    background: #f0f0f0;
}

html::-webkit-scrollbar-thumb {
    background-color: #26c6da;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

html::-webkit-scrollbar-thumb:hover {
    background-color: #00acc1;
}


/* --- 新增：布局与侧边栏样式 --- */
body {
    display: flex; /* 使用Flexbox进行主布局 */
    justify-content: space-between; /* 使侧边栏和主内容分开 */
    transition: background-color 0.3s ease, color 0.3s ease; /* 新增：平滑过渡 */
}

.sidebar {
    width: 220px;
    position: fixed; /* 固定在视口中 */
    top: 0;
    right: 0; /* 从left改为right */
    height: 100vh; /* 占满整个视口高度 */
    background-color: #e9ecef;
    padding: 2rem;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1); /* 阴影方向反转 */
    z-index: 10;
    overflow-y: auto;
    border-left: 1px solid #ddd; /* 从border-right改为border-left */
    border-right: none;
    transition: background-color 0.3s ease, border-color 0.3s ease; /* 新增：平滑过渡 */
}

/* 新增：主题切换器容器与按钮样式 */
.theme-switcher-container {
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #ccc;
}

.theme-toggle-button {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #0056b3;
    background-color: #f8f9fa;
    color: #0056b3;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease-in-out;
}

.theme-toggle-button:hover {
    background-color: #0056b3;
    color: #fff;
    box-shadow: 0 0 8px rgba(0, 86, 179, 0.4);
}


.sidebar-content h3 {
    margin-top: 0;
    color: #0056b3;
    border-bottom: 2px solid #0056b3;
    padding-bottom: 0.5rem;
}

.style-switcher {
    margin: 1rem 0;
}

.style-switcher label {
    cursor: pointer;
    margin-left: 0.5rem;
    user-select: none; /* 防止选中文本 */
}

/* 新增：光阴神迹容器样式 */
.project-duration-container {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #ccc;
    text-align: left; /* 从 center 改为 left */
}

.duration-title {
    color: #5a5a5a;
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 0.8rem;
}

#project-duration-text {
    font-size: 0.9rem;
    color: #333;
    font-style: italic;
    margin: 0;
    line-height: 1.5; /* 新增：增加行高，防止文本过于拥挤 */
}

/* 新增：为时间单位添加不同颜色 */
.time-days { color: #d9534f; font-weight: bold; }
.time-hours { color: #5cb85c; font-weight: bold; }
.time-minutes { color: #f0ad4e; font-weight: bold; }
.time-seconds { color: #337ab7; font-weight: bold; }


/* 新增：电梯导航样式 */
.elevator-container {
    margin-top: 2.5rem;
    border-top: 1px solid #ccc;
    padding-top: 1.5rem;
}

.elevator-title {
    color: #5a5a5a;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.elevator-nav a {
    display: block;
    padding: 0.5rem 0.8rem;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
}

.elevator-nav a:hover {
    background-color: #007bff;
    color: #fff;
}

/* 新增：电梯导航激活状态 */
.elevator-nav a.active {
    background-color: #0056b3;
    color: #fff;
    font-weight: bold;
    box-shadow: 0 0 8px rgba(0, 86, 179, 0.5);
}

/* 新增：为特殊导航链接添加样式 */
.elevator-nav-special {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #ccc;
    font-style: italic;
    text-align: center;
}

/* 新增：主内容包装器样式 */
.main-content-wrapper {
    flex-grow: 1;
    margin-right: 220px; /* 为右侧边栏留出空间 */
    padding: 2rem 4rem; /* 将内边距移到这里，以获得更好的背景控制 */
    display: flex;
    justify-content: center; /* 使内部的内容容器居中 */
}

/* 新增：当处于对比模式时，包装器的样式 */
.main-content-wrapper.compare-mode {
    justify-content: space-around; /* 让两个日志内容均匀分布 */
    align-items: flex-start; /* 顶部对齐 */
    /* 新增：固定高度并隐藏溢出，封印页面主滚动条 */
    height: calc(100vh - 4rem); /* 减去padding的高度，以防止出现双滚动条 */
    overflow: hidden;
}

#log-content-container {
    max-width: 800px; /* 恢复最大宽度限制 */
    width: 100%; /* 确保在窄屏时能正常缩放 */
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd;
    /* 从这里移除 padding 和 margin，由包装器控制 */
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease; /* 新增：平滑过渡 */
}

/* 新增：对比模式下，主容器变为flex容器 */
#log-content-container.compare-mode {
    display: flex;
    max-width: none; /* 取消最大宽度，让其可以扩展 */
    gap: 2rem; /* 两个日志之间的间距 */
    background: none; /* 移除背景和边框，由内部的列来显示 */
    box-shadow: none;
    border: none;
    height: 100%; /* 新增：让容器占满包装器的高度 */
}

/* 新增：对比模式下的日志列样式 */
.log-column {
    flex: 1 1 600px; /* flex-basis为600px，可以伸缩 */
    max-width: 700px;
    padding: 2rem 3rem; /* 为列本身添加内边距 */
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd;
    /* 新增：让列可以独立滚动 */
    overflow-y: auto;
    height: 100%;
    /* 新增：修正盒模型，防止内边距导致溢出 */
    box-sizing: border-box;
    /* 新增：Firefox滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: #26c6da #f0f0f0;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease; /* 新增：平滑过渡 */
}


.loading-text {
    text-align: center;
    font-style: italic;
    color: #888;
}

h1 {
    color: #0056b3;
    border-bottom: 2px solid #0056b3;
    padding-bottom: 0.75rem; /* 增加底部内边距 */
    margin-top: 0;
    letter-spacing: 0.1em; /* 新增：增加字间距 */
    text-align: center; /* 新增：标题居中，更有仪式感 */
    transition: color 0.3s ease, border-bottom-color 0.3s ease; /* 新增：平滑过渡 */
}

h2 {
    color: #d9534f;
    margin-top: 3rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.3rem;
    transition: color 0.3s ease, border-bottom-color 0.3s ease; /* 新增：平滑过渡 */
}

h3 {
    color: #5a5a5a;
    margin-top: 2rem;
    transition: color 0.3s ease; /* 新增：平滑过渡 */
}

strong, b {
    color: #333;
}

a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #0056b3;
}

pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    font-family: 'Fira Code', 'Courier New', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid #eee;
}

code {
    background-color: #e9ecef;
    color: #c7254e;
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    border-radius: 3px;
    font-family: 'Fira Code', 'Courier New', monospace;
    word-break: break-all; /* 新增：允许在任意字符间断行，防止长字符串溢出 */
}

pre > code {
    color: inherit;
    background-color: transparent;
    border-radius: 0;
    padding: 0;
}

hr {
    border: 0;
    height: 1px;
    background-color: #ddd;
    margin: 3rem 0;
}

/* --- 新增：时间轴样式 --- */
.timeline {
    position: relative;
    margin-top: 2rem;
    padding: 1rem 0;
}

/* 中心垂直线 */
.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 18px; /* (40px/2) - (4px/2) = 18px to center the line*/
    width: 4px;
    height: 100%;
    background-color: #e9ecef;
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    padding-left: 50px; /* 为时间点和线留出空间 */
}

/* 最后一个条目，让线不要超出 */
.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: 8px; /* (40px/2) - (24px/2) = 8px */
    top: 0;
    width: 24px;
    height: 24px;
    background-color: #fff;
    border: 4px solid #007bff;
    border-radius: 50%;
    z-index: 1;
}

.timeline-content {
    position: relative;
    top: -5px; /* 微调内容与时间点的垂直对齐 */
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 8px;
    border: 1px solid #ddd;
    transition: background-color 0.3s ease, border-color 0.3s ease; /* 新增：平滑过渡 */
}

/* 时间轴内容中的元素样式需要重置一些边距 */
.timeline-content > *:first-child {
    margin-top: 0;
}
.timeline-content > *:last-child {
    margin-bottom: 0;
}


/* --- 暗黑模式样式 --- */

/* 新增：暗黑模式全局滚动条 */
.dark-mode html {
    scrollbar-color: #61dafb #1f1f1f;
}

.dark-mode html::-webkit-scrollbar-track {
    background: #1f1f1f;
}

.dark-mode html::-webkit-scrollbar-thumb {
    background-color: #61dafb;
}

.dark-mode html::-webkit-scrollbar-thumb:hover {
    background-color: #9efbff;
}


body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

.dark-mode .sidebar {
    background-color: #1f1f1f;
    border-left-color: #444; /* 从border-right-color改为border-left-color */
    border-right-color: transparent;
    box-shadow: -2px 0 5px rgba(0,0,0,0.5); /* 阴影方向反转 */
}

.dark-mode .sidebar-content h3 {
    color: #61dafb;
    border-bottom-color: #61dafb;
}

.dark-mode .elevator-container {
    border-top-color: #444;
}

.dark-mode .elevator-title {
    color: #e0e0e0;
}

.dark-mode .elevator-nav a {
    color: #e0e0e0;
}

.dark-mode .elevator-nav a:hover {
    background-color: #61dafb;
    color: #1f1f1f;
}

/* 新增：暗黑模式下电梯导航激活状态 */
.dark-mode .elevator-nav a.active {
    background-color: #9efbff;
    color: #1f1f1f;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(158, 251, 255, 0.6);
}

/* 新增：暗黑模式下光阴神迹样式 */
.dark-mode .project-duration-container {
    border-top-color: #444;
}

.dark-mode .duration-title {
    color: #e0e0e0;
}

.dark-mode #project-duration-text {
    color: #ced4da;
}

/* 新增：暗黑模式下的时间单位颜色 */
.dark-mode .time-days { color: #ff8b8b; }
.dark-mode .time-hours { color: #82e0aa; }
.dark-mode .time-minutes { color: #ffd580; }
.dark-mode .time-seconds { color: #80d1ff; }

/* 新增：暗黑模式下特殊链接的边框颜色 */
.dark-mode .elevator-nav-special {
    border-top-color: #444;
}

.dark-mode #log-content-container {
    background-color: #2a2a2a;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    border-color: #444;
}

.dark-mode h1 {
    color: #61dafb;
    border-bottom-color: #61dafb;
}

.dark-mode h2 {
    color: #fca311;
    border-bottom-color: #555;
}

.dark-mode h3 {
    color: #e0e0e0;
}

.dark-mode strong, .dark-mode b {
    color: #f9c74f;
}

.dark-mode a {
    color: #61dafb;
}

.dark-mode a:hover {
    color: #21a1c4;
}

.dark-mode pre {
    background-color: #161616;
    border-color: #444;
}

.dark-mode code {
    background-color: #333;
    color: #ff8b8b;
}

.dark-mode pre > code {
    color: inherit;
    background-color: transparent;
}

.dark-mode hr {
    background-color: #444;
}

.dark-mode .timeline::before {
    background-color: #333;
}

.dark-mode .timeline-dot {
    background-color: #2a2a2a;
    border-color: #fca311;
}

.dark-mode .timeline-content {
    background-color: #2c3034;
    border-color: #444;
}

.dark-mode .log-column {
    background-color: #212529;
    border-color: #444;
    color: #ced4da;
    /* 新增：暗黑模式下也应用滚动 */
    overflow-y: auto;
    height: 100%;
    /* 新增：Firefox滚动条样式 */
    scrollbar-color: #61dafb #2c3034;
}

.dark-mode #log-content-container.compare-mode {
    background: none;
}

/* --- 新增：自定义滚动条样式 (适用于Webkit内核浏览器) --- */
.log-column::-webkit-scrollbar {
    width: 8px;
}

.log-column::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.log-column::-webkit-scrollbar-thumb {
    background-color: #26c6da;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.log-column::-webkit-scrollbar-thumb:hover {
    background-color: #00acc1;
}

/* 暗黑模式下的Webkit滚动条 */
.dark-mode .log-column::-webkit-scrollbar-track {
    background: #2c3034;
}

.dark-mode .log-column::-webkit-scrollbar-thumb {
    background-color: #61dafb;
}

.dark-mode .log-column::-webkit-scrollbar-thumb:hover {
    background-color: #9efbff;
}


/* --- 移动端响应式布局 --- */
@media (max-width: 1200px) { /* 调整断点以更好地处理双列布局 */
    #log-content-container.compare-mode {
        flex-direction: column; /* 在较窄的屏幕上，列垂直堆叠 */
        gap: 1.5rem;
    }
}
@media (max-width: 768px) {
    body {
        padding: 0; /* 在移动端移除body的内边距，因为每个部分将独立处理 */
        display: block; /* 恢复块级布局，让侧边栏和内容垂直排列 */
        -webkit-text-size-adjust: 100%; /* 防止iOS横屏时字体自动放大 */
    }

    .sidebar {
        position: static; /* 取消固定定位 */
        width: 100%;
        height: auto;
        box-shadow: 0 -2px 5px rgba(0,0,0,0.1); /* 阴影改为在上方 */
        padding: 0rem 0rem; /* 再次修正：削减垂直内边距 */
        border-left: none; /* 移除桌面端的边框 */
        border-bottom: 1px solid #ddd;
        order: -1; /* 新增：在Flexbox布局中，将侧边栏（现在是顶部栏）置于主内容之上 */
    }

    /* 新增：移动端的主题切换器容器调整 */
    .theme-switcher-container {
        flex-basis: 100%;
        padding-bottom: 0;
        margin-bottom: 0;
        border-bottom: none;
    }

    .sidebar-content {
        display: flex;
        flex-wrap: wrap; /* 启用换行，这是实现布局的关键 */
        justify-content: center; /* 水平居中切换器 */
        align-items: center; /* 垂直居中对齐 */
    }

    .sidebar-content h3 {
        flex-basis: 100%; /* 让标题占据一整行，强制换行 */
        margin: 0;
        border-bottom: 1px solid #ddd; /* 加个下边框，视觉上更好看 */
        padding-bottom: 0rem;
        text-align: left; /* 修正：恢复左对齐 */
    }

    .dark-mode .sidebar-content h3 {
        border-bottom-color: #444;
    }

    /* 修正：移除之前添加的错误样式，并调整容器边距 */
    .style-switcher {
        /* 恢复默认，让其根据内容自适应宽度，水平排列 */
        flex-grow: 1; /* 让它们均分空间 */
        text-align: left; 
    }
    
    .project-duration-container {
        flex-basis: 100%; /* 让该容器也占据一整行 */
        margin-top: 0; /* 移除外边距，由父级gap控制 */
        padding-top: 0rem; /* 大幅削减内边距 */
        border-top: 1px solid #ddd;
    }

    /* 新增：进一步压缩内部间距 */
    .duration-title {
        margin-bottom: 0.4rem;
    }

    /* 新增：移动端隐藏电梯导航 */
    .elevator-container {
        display: none;
    }

    .main-content-wrapper {
        margin-right: 0;
        padding: 0;
    }

    #log-content-container {
        max-width: none; /* 在移动端移除最大宽度限制 */
        padding: 1.5rem 1rem;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }

    #log-content-container.compare-mode {
        padding: 0; /* 对比模式下，由列来控制内边距 */
    }

    .log-column {
        max-width: none;
        border-radius: 0;
    }

    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .timeline::before {
        /* 新的中心线位置：dot.left (8px) + dot.width/2 (10px) - line.width/2 (2px) = 16px */
        left: 16px;
    }

    .timeline-item {
        padding-left: 40px; /* 减少左边距，为点和线留出空间 */
    }

    .timeline-dot {
        width: 20px;  /* 缩小时间点 */
        height: 20px;
        /* left: 8px 保持不变，维持视觉上的对齐感 */
    }

    .timeline-content {
        padding: 1rem;
    }
}