/* ======================================= */
/* 共享样式：footer和nav导航栏 */
/* ======================================= */

/* 桌面端导航栏样式 */
.main-nav{
    display: flex;  /* 使用 Flexbox 进行布局 */
    align-items: center;  /* 垂直居中对齐内容 */
    background: linear-gradient(135deg, 
        rgba(var(--bg-nav-rgb), 0.95) 0%, 
        rgba(var(--bg-nav-light-rgb), 0.85) 100%);
    justify-content: space-between;
    /*添加高斯模糊效果*/
    backdrop-filter: blur(16px); /* 增强模糊效果 */
    -webkit-backdrop-filter: blur(16px); /* 兼容 Safari 浏览器 */
    /*添加边缘立体感*/
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 4px 30px rgba(0, 0, 0, 0.1),
        0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.1); /* 内发光效果 */
    /*固定导航栏位于页面最上方*/
    position: fixed; /* 固定定位 */
    top: 0;
    left: 0;
    width: 100%; /* 宽度覆盖整个视口 */
    z-index: 1000; /* 确保它在所有内容之上 */
    transition: all var(--transition-normal);
}

/* 让列表水平排列 */
.nav-list {
    list-style: none; /* 移除列表默认圆点 */
    padding: 0;
    margin-right: 40px;

    display: flex; /* 启用 Flexbox */
    gap: 8px;     /* 列表项之间间隔 8px，更紧凑 */
    text-decoration: none; /* 移除链接下划线 */
    color: var(--text-primary);
}

.nav-link{
    text-decoration: none; /* 移除链接下划线 */
    color: var(--accent-primary);
    font-size: 15px;
    font-weight: 600;
    padding: 10px 18px; 
    border-radius: 8px; 
    background: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    font-family: 'Segoe UI', system-ui, sans-serif;
    letter-spacing: 0.3px;
}

.nav-link:hover {
    color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.15);
    border-color: rgba(0, 0, 0, 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.nav-link:active{
    background: rgba(0, 0, 0, 0.2);
}

.home-key-icon {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--accent-primary);
    text-decoration: none;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.home-key-icon:hover {
    color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.18);
    border-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 确保导航链接容器的布局是正确的 */
.main-nav-links {
    display: flex;
    align-items: center;
    justify-content: flex-end; /* 如果 Home-Key 链接是独立于主链接组的，可能需要调整 */
}

/* 主题切换按钮样式 */
.theme-toggle-btn {
    background: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-primary);
    font-size: 14px;
    font-weight: 600;
}

.theme-toggle-btn:hover {
    color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.15);
    border-color: rgba(0, 0, 0, 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-icon {
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

/* 默认显示月亮图标（深色模式） */
.sun-icon {
    display: none;
}

.moon-icon {
    display: inline;
}

/* 浅色模式下显示太阳图标 */
.light-mode .sun-icon {
    display: inline;
}

.light-mode .moon-icon {
    display: none;
}

/* 深色模式下显示月亮图标 */
.dark-mode .sun-icon {
    display: none;
}

.dark-mode .moon-icon {
    display: inline;
}

/* 脚注样式 */
footer {
    background-color: var(--bg-footer); /* 使用CSS变量 */
    color: var(--text-light);           /* 浅色文字 */
    padding: 40px 0;      /* 上下内边距 */
    font-size: 14px; /* 默认字号 */
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* 内部容器，用于限制宽度并居中 */
.footer-container {
    max-width: 1200px; /* 限制最大宽度，与导航栏内容宽度保持一致 */
    margin: 0 auto;    /* 居中显示 */
    padding: 0 40px;   /* 左右内边距（与导航栏一致） */

    /* 核心布局：使用 Flexbox 将各区域横向排列 */
    display: flex;
    justify-content: space-between; /* 区域之间平均分配空间 */
    flex-wrap: wrap; /* 允许在小屏幕上换行 */
    text-align: center;
}

/* 脚注区块样式 */
.footer-section {
    width: 20%; /* 每个区块占据约 20% 宽度 */
    margin-bottom: 20px; /* 底部间距 */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 版权文字更明显且一致 */
.footer-section.copyright p {
    font-size: 14px; /* 明确定义字号，避免被其他选择器覆盖 */
    margin: 6px 0;
    color: var(--text-light);
    transition: color var(--transition-normal);
}

/* 版权文本容器：确保文本居中 */
.copyright-text {
    /* 确保文本自身宽度允许它居中 */
    width: 100%;
    text-align: center; /* 确保 p 标签内的文本内容居中 */
}

/* 链接和列表样式重置 */
.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section a {
    color: var(--text-light);
    text-decoration: none;
    transition: color var(--transition-normal);
}

.footer-section a:hover {
    color: #fff; /* 悬停时高亮 */
}

/* 响应式设计 - 移动端适配 */
@media (max-width: 768px) {
    .main-nav {
        padding: 0 15px;
        height: 50px;
    }
    
    .nav-list {
        margin-right: 20px;
        gap: 15px;
    }
    
    .nav-link {
        font-size: 14px;
        padding: 8px 12px;
        /* 移动端触摸优化 */
        min-height: 44px; /* 苹果推荐的最小触摸目标尺寸 */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .home-key-icon {
        font-size: 14px;
        margin-left: 15px;
        padding: 8px 12px;
        /* 移动端触摸优化 */
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 移动端主题切换按钮样式 */
    .theme-toggle-btn {
        width: 38px;
        height: 38px;
        margin-left: 12px;
        min-height: 38px; /* 确保触摸区域足够大 */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .theme-icon {
        font-size: 17px;
    }
    
    .footer-container {
        padding: 0 20px;
        flex-direction: column;
        align-items: center;
    }
    
    .footer-section {
        width: 100%;
        margin-bottom: 30px;
    }
}

/* 超小屏幕适配 */
@media (max-width: 480px) {
    /* 移动端专用优化 */
    html {
        -webkit-text-size-adjust: 100%; /* 防止iOS Safari自动调整文字大小 */
    }
    
    body {
        -webkit-font-smoothing: antialiased; /* 字体抗锯齿 */
        -moz-osx-font-smoothing: grayscale;
    }
    
    .main-nav {
        padding: 0 10px;
        height: 50px;
    }
    
    .nav-list {
        margin-right: 5px;
        gap: 5px;
    }
    
    .nav-link {
        font-size: 13px;
        padding: 6px 8px;
        white-space: nowrap;
        /* 移动端触摸优化 */
        min-height: 44px; /* 苹果推荐的最小触摸目标尺寸 */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .home-key-icon {
        font-size: 13px;
        margin-left: 0;
        padding: 6px 8px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 移动端主题切换按钮样式 */
    .theme-toggle-btn {
        width: 35px;
        height: 35px;
        margin-left: 8px;
        min-height: 35px; /* 确保触摸区域足够大 */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .theme-icon {
        font-size: 16px;
    }
    
    .footer-container {
        padding: 40px 20px;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    
    .footer-section {
        width: 100%;
        margin-bottom: 30px;
    }
    
    .footer-section h3 {
        white-space: nowrap; /* 防止底栏标题换行 */
        font-size: 16px; /* 确保移动端标题清晰 */
        margin-bottom: 8px;
    }
    
    .footer-section.copyright {
        align-items: center;
        order: 10;
        margin-top: 20px;
    }
    
    .copyright-text {
        text-align: center;
        font-size: 12px; /* 移动端适当缩小版权文字 */
    }
    
    /* 防止移动端版权信息换行 */
    .footer-section.copyright p {
        white-space: nowrap;
    }
    
    .footer-legal-bar {
        padding: 15px 20px;
    }
    
    /* 移动端链接触摸优化 */
    .footer-section a {
        min-height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* 深色模式适配 */
body.dark-mode .main-nav {
    background-color: var(--bg-nav);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 
        0 2px 10px var(--shadow-light),
        0 1px 0 rgba(255, 255, 255, 0.15); /* 下边缘高光 */
}

body.dark-mode .nav-link:hover {
    background-color: var(--bg-hover-dark);
}

body.dark-mode .nav-link:active {
    background-color: var(--bg-active-dark);
}

body.dark-mode .home-key-icon:hover {
    background-color: var(--bg-hover-dark);
}

body.dark-mode footer {
    background-color: var(--bg-footer-dark);
}

/* 通用样式 */
.read-more-link {
    display: inline-block;
    margin-top: 10px;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: bold;
    transition: color var(--transition-normal);
}

/* 移动端通用优化 */
@media (max-width: 768px) {
    /* 防止移动端点击延迟 */
    a, button, .nav-link, .home-key-icon {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    /* 优化移动端滚动体验 */
    html {
        scroll-behavior: smooth;
    }
    
    /* 移动端字体渲染优化 */
    body {
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* 防止移动端缩放问题 */
@media (max-width: 480px) {
    /* 确保所有可点击元素都有足够的大小 */
    .nav-link, .home-key-icon, .footer-section a {
        cursor: pointer;
    }
    
    /* 移动端图片优化 */
    img {
        max-width: 100%;
        height: auto;
    }
}