:root {
    --bg-color: #f5f5f5;
    --text-color: #333;
    --card-bg: #ffffff;
    --navbar-bg: rgba(255, 255, 255, 0.7);
    --navbar-scrolled-bg: rgba(255, 255, 255, 0.95);
    --hero-cover: url('/static/images/coverlight.png');
    --navbar-text: #333;
}

body.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --card-bg: #2a2a2a;
    --navbar-bg: rgba(25, 42, 86, 0.7);
    --navbar-scrolled-bg: rgba(25, 42, 86, 0.95);
    --hero-cover: url('/static/images/coverdark.png');
    --navbar-text: white;
}

/* Reset + base */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background: var(--bg-color); color: var(--text-color); -webkit-font-smoothing: antialiased; transition: background-color 0.3s ease, color 0.3s ease; }

/* 顶部导航栏 */
.navbar, .header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    right: 0;
    padding: 15px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: all 0.3s ease;
    background: var(--navbar-bg);
    backdrop-filter: blur(10px);
}

.navbar.scrolled, .header.scrolled {
    background: var(--navbar-scrolled-bg);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--navbar-text);
    text-decoration: none;
    transition: color 0.3s ease;
}

.navbar.scrolled .navbar-brand {
    color: var(--navbar-text);
}

.navbar-menu {
    display: flex;
    gap: 12px; /* reduced from 30px to make buttons closer */
    list-style: none;
    align-items: center;
}

.navbar-menu a {
    color: var(--navbar-text);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 6px 10px; /* slightly tighter padding */
    border-radius: 0;
    transition: all 0.3s ease;
    position: relative;
}

.navbar.scrolled .navbar-menu a {
    color: var(--navbar-text);
}

.navbar-menu a:hover {
    background: rgba(255, 255, 255, 0.2);
}

.navbar.scrolled .navbar-menu a:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--navbar-text);
}

/* 导航图标样式 */
.nav-icon {
    width: 24px;
    height: 24px;
    display: inline-block;
    vertical-align: middle;
    transition: transform 0.3s ease, filter 0.3s ease;
    /* 明亮模式：深灰色 */
    filter: brightness(0) saturate(100%) invert(20%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(40%) contrast(100%);
}

/* 暗色模式：浅灰色 */
body.dark-mode .nav-icon {
    filter: brightness(0) saturate(100%) invert(80%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(90%) contrast(100%);
}

.navbar-menu a:hover .nav-icon {
    transform: scale(1.1);
}

/* 主题切换按钮 */
.theme-toggle {
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 0;
    transition: all 0.3s ease;
    background: transparent;
    border: none;
    color: var(--navbar-text);
    display: flex;
    align-items: center;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.theme-toggle:hover .theme-icon {
    transform: rotate(20deg);
}

.theme-icon {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease, filter 0.3s ease;
    /* 明亮模式：深灰色 */
    filter: brightness(0) saturate(100%) invert(20%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(40%) contrast(100%);
}

/* 暗色模式：浅灰色 */
body.dark-mode .theme-icon {
    filter: brightness(0) saturate(100%) invert(80%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(90%) contrast(100%);
}

/* 文本型导航标签（用于 .nav-label）
   控制宽度、等宽字体与居中显示。将宽度设为统一的固定值以保证等宽效果。
*/
.nav-label {
    font-family: 'JetBrains Mono', Consolas, 'Courier New', monospace;
    display: inline-block;
    width: 56px;          /* ← 修改这里控制各按钮宽度 */
    text-align: center;
    font-weight: 600;
    box-sizing: border-box;
    padding: 2px 4px;
    font-size: 15px;
    color: var(--navbar-text);
}

@media (max-width: 768px) {
    .nav-label { width: 44px; font-size: 14px; }
}

/* 移动端汉堡菜单 */
.navbar-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
}

.navbar-toggle span {
    width: 25px;
    height: 3px;
    background: var(--navbar-text);
    border-radius: 0;
    transition: all 0.3s ease;
}

.navbar.scrolled .navbar-toggle span {
    background: var(--navbar-text);
}

/* Header样式（部分页面使用.header而非.navbar） */
.header .close-btn, .header .back-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0;
    color: var(--navbar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.header .close-btn:hover, .header .back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.header .title {
    margin-left: 20px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--navbar-text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Cards */
.card { background: var(--card-bg); transition: all 0.4s ease; box-shadow: 0 8px 24px rgba(0,0,0,0.08); }

/* Footer fallback small styling (most footer will use inline HTML provided) */
footer { 
    text-align: center; 
    color: inherit;
    background: #333;
    color: white;
}

/* Footer 链接样式 - 保持白色 */
footer a,
footer a:link,
footer a:visited,
footer a:hover,
footer a:active {
    color: white !important;
    text-decoration: none;
}

footer a:hover {
    opacity: 0.8;
}

/* Responsive tweaks */
@media (max-width: 768px) {
    .navbar, .header {
        padding: 15px 20px;
    }

    .navbar-toggle {
        display: flex;
    }

    .navbar-menu {
        position: fixed;
        top: 60px;
        right: -100%;
        width: 250px;
        height: calc(100vh - 60px);
        background: var(--card-bg);
        flex-direction: column;
        padding: 30px;
        gap: 16px; /* slightly reduced for mobile stacked items */
        transition: right 0.3s ease;
        box-shadow: -2px 0 20px rgba(0, 0, 0, 0.1);
    }

    .navbar-menu.active {
        right: 0;
    }

    .navbar-menu a {
        color: var(--text-color);
    }
}
