/* articleContent.css - 文章内容页面样式（已添加随笔悬浮窗功能） */

/* 基础重置与全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    line-height: 1.8;
    color: #2c3e50;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    min-height: 100vh;
    padding: 20px;
    padding-top: 80px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 悬浮导航栏 - 9个链接样式（与全局保持一致） */
body > a {
    display: inline-block;
    position: fixed;
    top: 0;
    z-index: 1000;
    text-decoration: none;
    padding: 10px 6px;
    font-weight: 600;
    font-size: 0.75rem;
    color: #fff;
    background-color: rgba(52, 73, 94, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    text-align: center;
    backdrop-filter: blur(10px);
    height: 45px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 导航链接悬停效果 */
body > a:hover {
    background-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 为每个导航链接定位 - 8个左侧导航链接 */
body > a[href='/'] {
    left: 0;
    width: 8%;
    min-width: 55px;
}

body > a[href='/publicShare'] {
    left: 8%;
    width: 12%;
    min-width: 85px;
}

body > a[href='/article'] {
    left: 20%;
    width: 8%;
    min-width: 60px;
    background-color: #3498db;
}

body > a[href='/chat'] {
    left: 28%;
    width: 10%;
    min-width: 70px;
}

body > a[href='/tools'] {
    left: 38%;
    width: 8%;
    min-width: 60px;
}

body > a[href='/login'] {
    left: 46%;
    width: 7%;
    min-width: 55px;
}

body > a[href='/signUp'] {
    left: 53%;
    width: 7%;
    min-width: 55px;
}

body > a[href='/comment'] {
    left: 60%;
    width: 12%;
    min-width: 85px;
}

/* xsx图片链接单独处理，固定在右上角 */
body > a[href='/xsx'] {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1001;
    width: 55px;
    height: 45px;
    background: transparent;
    border: none;
    padding: 0;
    backdrop-filter: none;
}

/* 文本内容样式 - 普通文本段落 */
.text {
    font-family: 'Segoe UI', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.8;
    color: #2c3e50;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 25px 30px;
    margin: 20px auto;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    white-space: pre-wrap;
    word-wrap: break-word;
    text-indent: 2em;
    letter-spacing: 0.5px;
    max-width: 100%;
    overflow-x: auto;
}

/* 代码块样式 - 重点美化部分 */
.code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #d4d4d4;
    background-color: #1e1e1e;
    padding: 20px 25px;
    margin: 20px auto;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
    position: relative;
    border-left: 4px solid #3498db;
}

/* 代码块滚动条美化 */
.code::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.code::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 3px;
}

.code::-webkit-scrollbar-thumb {
    background: #6a9955;
    border-radius: 3px;
}

.code::-webkit-scrollbar-thumb:hover {
    background: #4a7a3a;
}

/* 图片样式 */
img {
    display: block;
    max-width: 90%;
    height: auto;
    margin: 30px auto;
    border-radius: 16px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
    border: 3px solid white;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: #f8f9fa;
}

img:hover {
    transform: scale(1.02);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.2);
}

/* 响应式设计 - 移动端 */
@media (max-width: 768px) {
    body {
        padding: 15px;
        padding-top: 100px;
    }
    
    /* 导航栏在小屏幕上垂直堆叠 */
    body > a:not([href='/xsx']) {
        position: fixed;
        display: block;
        width: 100% !important;
        left: 0 !important;
        top: auto;
        padding: 8px 12px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 0.8rem;
        height: 36px;
        text-align: left;
        padding-left: 20px;
    }
    
    /* 为每个导航链接设置垂直位置 - 8个链接 */
    body > a[href='/']:not([href='/xsx']) {
        top: 0;
    }
    
    body > a[href='/publicShare']:not([href='/xsx']) {
        top: 36px;
    }
    
    body > a[href='/article']:not([href='/xsx']) {
        top: 72px;
    }
    
    body > a[href='/chat']:not([href='/xsx']) {
        top: 108px;
    }
    
    body > a[href='/tools']:not([href='/xsx']) {
        top: 144px;
    }
    
    body > a[href='/login']:not([href='/xsx']) {
        top: 180px;
    }
    
    body > a[href='/signUp']:not([href='/xsx']) {
        top: 216px;
    }
    
    body > a[href='/comment']:not([href='/xsx']) {
        top: 252px;
    }
    
    /* xsx图片链接在移动端调整位置 */
    body > a[href='/xsx'] {
        position: fixed;
        top: 0;
        right: 0;
        width: 45px;
        height: 36px;
    }
    
    .text, .code {
        padding: 15px 20px;
        margin: 15px auto;
    }
    
    .text {
        font-size: 14px;
    }
    
    .code {
        font-size: 12px;
    }
    
    img {
        max-width: 95%;
        margin: 20px auto;
    }
}

/* 平板设备 */
@media (min-width: 769px) and (max-width: 1024px) {
    body > a:not([href='/xsx']) {
        font-size: 0.7rem;
        padding: 10px 4px;
        height: 42px;
    }
    
    body > a[href='/publicShare']:not([href='/xsx']),
    body > a[href='/comment']:not([href='/xsx']) {
        font-size: 0.65rem;
    }
    
    .text {
        font-size: 15px;
    }
    
    .code {
        font-size: 13px;
    }
}

/* 桌面端优化 */
@media (min-width: 1025px) {
    body > a:not([href='/xsx']) {
        padding: 12px 8px;
        font-size: 0.8rem;
    }
    
    .text {
        font-size: 16px;
        padding: 30px 40px;
    }
    
    .code {
        font-size: 14px;
        padding: 20px 30px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInFromTop {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.text, .code, img {
    animation: fadeIn 0.6s ease-out;
}

body > a:not([href='/xsx']) {
    animation: slideInFromTop 0.5s ease-out;
}

.text {
    animation-delay: 0.1s;
}

.code {
    animation-delay: 0.2s;
}

img {
    animation-delay: 0.3s;
}

/* 添加装饰元素 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(to right, #3498db, #2ecc71, #9b59b6, #f39c12);
    z-index: 1002;
}

/* 添加当前页面指示器 */
body > a[href='/article']:not([href='/xsx'])::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 3px;
    background-color: #fff;
    border-radius: 3px 3px 0 0;
}

/* 添加页面背景装饰点 */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(52, 152, 219, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 30%, rgba(46, 204, 113, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 50% 80%, rgba(155, 89, 182, 0.05) 0%, transparent 20%);
    z-index: -1;
    pointer-events: none;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* 选中文本样式 */
::selection {
    background-color: #3498db;
    color: white;
}

/* 小屏幕手机优化 */
@media (max-width: 480px) {
    body > a:not([href='/xsx']) {
        font-size: 0.7rem;
        padding: 6px 10px;
        height: 32px;
    }
    
    body > a[href='/']:not([href='/xsx']) {
        top: 0;
    }
    
    body > a[href='/publicShare']:not([href='/xsx']) {
        top: 32px;
    }
    
    body > a[href='/article']:not([href='/xsx']) {
        top: 64px;
    }
    
    body > a[href='/chat']:not([href='/xsx']) {
        top: 96px;
    }
    
    body > a[href='/tools']:not([href='/xsx']) {
        top: 128px;
    }
    
    body > a[href='/login']:not([href='/xsx']) {
        top: 160px;
    }
    
    body > a[href='/signUp']:not([href='/xsx']) {
        top: 192px;
    }
    
    body > a[href='/comment']:not([href='/xsx']) {
        top: 224px;
    }
    
    body > a[href='/xsx'] {
        width: 40px;
        height: 32px;
    }
    
    .text, .code {
        padding: 12px 15px;
        margin: 12px auto;
    }
    
    .text {
        font-size: 13px;
        text-indent: 1.5em;
    }
    
    .code {
        font-size: 11px;
    }
    
    img {
        max-width: 100%;
        margin: 15px auto;
    }
}

/* 添加平滑滚动效果 */
html {
    scroll-behavior: smooth;
}

/* 代码块悬停效果 */
.code:hover {
    transform: translateY(-2px);
    transition: transform 0.3s ease;
    border-left-color: #2ecc71;
}

/* 文本内容悬停效果 */
.text:hover {
    transform: translateY(-2px);
    transition: transform 0.3s ease;
}

/* ========= 移动端折叠/展开按钮样式 ========= */
.nav-toggle-btn {
    display: none;
    position: fixed;
    top: 5px;
    left: 10px;
    z-index: 1002;
    width: 44px;
    height: 44px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.nav-toggle-btn:hover {
    background: #2c3e50;
    transform: scale(1.02);
}

/* 移动端显示按钮 */
@media (max-width: 768px) {
    .nav-toggle-btn {
        display: block;
    }
}

/* 小屏手机适配 */
@media (max-width: 480px) {
    .nav-toggle-btn {
        width: 38px;
        height: 38px;
        font-size: 24px;
        top: 3px;
        left: 8px;
    }
}

/* ========= 移动端折叠/展开功能（默认展开，可收缩） ========= */
@media (max-width: 768px) {
    /* 导航栏默认展开状态 */
    body > a:not([href='/xsx']) {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
    }
    
    /* 收缩状态：点击按钮后隐藏 */
    body.nav-collapsed > a:not([href='/xsx']) {
        transform: translateX(-100%);
        opacity: 0;
        visibility: hidden;
    }
}

/* ========= 桌面端：鼠标放在"文章"上时展开显示"随笔"链接 ========= */
@media (min-width: 769px) {
    /* 默认隐藏随笔导航项 */
    body > a[href='/essay'] {
        display: none !important;
        opacity: 0;
        visibility: hidden;
        position: fixed;
        top: 38px;
        left: 20%;
        width: 8%;
        min-width: 60px;
        background-color: rgba(52, 73, 94, 0.98);
        backdrop-filter: blur(12px);
        border-radius: 0 0 8px 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        height: 40px;
        line-height: 40px;
        padding: 0 6px;
        font-size: 0.75rem;
        text-align: center;
        z-index: 999;
        transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
        transform: translateY(-10px);
        pointer-events: none;
    }
    
    /* 当鼠标悬浮在"文章"链接上时，显示"随笔"链接 */
    body > a[href='/article']:hover ~ a[href='/essay'],
    body > a[href='/article']:hover + a[href='/essay'] {
        display: inline-block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
    }
    
    /* 当鼠标移动到"随笔"链接上时，保持展开状态 */
    body > a[href='/essay']:hover {
        display: inline-block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
        background-color: #e67e22;
    }
    
    /* 文章链接悬浮时改变背景色 */
    body > a[href='/article']:hover {
        background-color: #e67e22;
    }
    
    /* 随笔链接悬停效果 */
    body > a[href='/essay']:hover {
        background-color: #e67e22 !important;
        transform: translateY(2px);
    }
}

/* 动画 */
@keyframes essayDropdownIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
