/* ============================================
   公共样式文件 - 统一所有页面的样式
   ============================================ */

/* --- 核心变量 --- */
:root {
    --bg-color: #ffffff;
    --text-main: #333333;
    --text-sub: #666666;
    --accent: #000000;
    --card-bg: #f9f9f9;
    --border-color: #f0f0f0;
}

/* 暗色模式变量 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-main: #e0e0e0;
        --text-sub: #a0a0a0;
        --accent: #ffffff;
        --card-bg: #2a2a2a;
        --border-color: #333333;
    }
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-main: #e0e0e0;
    --text-sub: #a0a0a0;
    --accent: #ffffff;
    --card-bg: #2a2a2a;
    --border-color: #333333;
}

/* --- 全局重置 --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { 
    scroll-behavior: smooth; 
    overflow-y: scroll;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.8;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }

/* --- 导航栏 --- */
header {
    padding: 30px 0;
    background: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

nav { 
    display: flex; 
    align-items: center; 
    gap: 20px; 
}

nav ul { 
    display: flex; 
    gap: 40px; 
}

nav a { 
    font-size: 1rem; 
    color: var(--text-sub); 
    font-weight: 500;
}

nav a:hover { 
    color: var(--accent); 
}

/* 汉堡菜单按钮 */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 101;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--text-main);
    transition: all 0.3s;
    border-radius: 2px;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* 主题切换按钮 */
.theme-toggle {
    background: transparent;
    border: 2px solid var(--text-sub);
    color: var(--text-sub);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    margin-left: 20px;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* 导航遮罩层 */
.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.nav-overlay.active {
    display: block;
}

/* --- 统一的FAB按钮样式（回到顶部、上传等） --- */
.fab-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background-color: #000;
    color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    font-size: 24px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    z-index: 999;
    border: none;
    cursor: pointer;
    padding: 0;
}

.fab-btn:hover {
    background-color: #333;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.fab-btn:active {
    transform: scale(0.95);
}

/* 暗色模式下的FAB按钮 */
@media (prefers-color-scheme: dark) {
    .fab-btn {
        background-color: #fff;
        color: #000;
    }
    .fab-btn:hover {
        background-color: #e0e0e0;
    }
}

[data-theme="dark"] .fab-btn {
    background-color: #fff;
    color: #000;
}

[data-theme="dark"] .fab-btn:hover {
    background-color: #e0e0e0;
}

/* --- 移动端适配 --- */
@media (max-width: 768px) {
    header {
        padding: 20px 0;
    }
    
    .nav-inner { 
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0 20px;
        position: relative;
    }
    
    .logo { 
        font-size: 1.2rem;
        z-index: 101;
        position: relative;
    }
    
    .logo a {
        display: block;
    }
    
    .menu-toggle {
        display: flex;
        z-index: 101;
        position: relative;
    }
    
    nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 240px;
        max-width: 75%;
        height: 100vh;
        background: var(--bg-color);
        flex-direction: column;
        align-items: flex-start;
        padding: 80px 20px 30px 20px;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
        transition: right 0.3s ease;
        z-index: 100;
        overflow-y: auto;
    }
    
    nav.active {
        right: 0;
    }
    
    /* 确保菜单打开时，logo和按钮仍然可见且不被遮挡 */
    .nav-inner {
        z-index: 102;
    }
    
    nav ul {
        flex-direction: column;
        gap: 25px;
        width: 100%;
    }
    
    nav ul li {
        width: 100%;
    }
    
    nav a {
        font-size: 1.1rem;
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid var(--border-color);
        width: 100%;
    }
    
    .theme-toggle {
        margin-top: 20px;
        margin-left: 0;
        width: 100%;
        padding: 12px;
    }
    
    .nav-overlay.active {
        display: block;
    }
    
    /* FAB按钮在移动端稍微调小 */
    .fab-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
        bottom: 20px;
        right: 20px;
    }
}

