/* 简约现代样式 */
html {
    overflow-x: hidden; /* 防止水平滚动 */
}

body {
    font-family: 'Microsoft YaHei', Arial, Helvetica, sans-serif;
    overflow-x: hidden; /* 防止水平滚动 */
    overflow-y: auto; /* 让滚动发生在body上，确保sticky正常工作 */
    max-width: 100%;
}

/* 预加载时完全隐藏公告（用户已关闭所有公告） */
.announcements-hidden .announcement-container {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
}

.nav-item {
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

/* 公告项样式 */
.announcement-item {
    transition: all 0.3s ease;
    height: 2rem; /* 固定高度 */
}

/* 防止公告在页面加载时闪烁 */
.announcement-container {
    opacity: 1;
    transition: opacity 0.1s ease;
    height: 2rem; /* 固定高度，防止布局跳动 */
    min-height: 2rem;
}

.announcement-container.visible {
    opacity: 1;
}

.announcement-item.hidden {
    height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.announcement-container.hidden {
    height: 0 !important;
    opacity: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    min-height: 0 !important;
}

/* 下拉菜单样式 - 完全重写 */
.dropdown {
    position: relative; /* 使用相对定位，便于绝对定位的下拉菜单基于此元素 */
    display: inline-block;
}

/* 添加桥接元素，保持hover状态 */
.dropdown::after {
    content: '';
    display: block;
    position: absolute;
    height: 10px;
    width: 100%;
    bottom: -10px;
    left: 0;
}

.dropdown-content {
    display: none;
    position: fixed; /* 脱离滚动容器，避免被 overflow 裁剪 */
    background-color: #fff;
    min-width: 110px; /* 增加最小宽度 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 2px;
    z-index: 999; /* 确保在导航之上 */
    border: 1px solid #e0e0e0;
    padding: 0;
    transform: translateX(-50%);
}

/* 确保横向滚动容器不裁剪下拉菜单，禁止垂直滚动 */
.nav-track {
    overflow-y: hidden; /* 禁止垂直滚动 */
}

/* 添加顶部透明区域，确保鼠标从按钮移到下拉菜单时不会失去hover状态 */
.dropdown-content::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    width: 100%;
    height: 10px;
    background: transparent;
}

/* 交互由 JS 控制显示/隐藏，避免错误初始定位导致闪烁 */

/* 移除动画，防止闪动 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown .dropdown-item {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    white-space: normal; /* 允许文本换行 */
    transition: all 0.2s ease;
    word-break: keep-all; /* 避免单词被截断 */
    text-align: center;
    line-height: 1.5;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown .dropdown-item:last-child {
    border-bottom: none;
}

.dropdown .dropdown-item:hover {
    background-color: #f0f7ff;
    color: #2563eb;
}

/* 确保导航栏和下拉菜单在最上层 */
nav {
    position: relative;
    z-index: 10;
    /* 下拉菜单使用fixed定位，不受父容器overflow影响 */
}

main {
    /* 保持定位以兼容可能的相对定位布局，但不创建新的堆叠上下文，
       这样位于 main 内部的固定定位模态（如二维码/微信分享）即可
       使用更高的 z-index 正确覆盖导航栏 */
    position: relative;
    z-index: auto;
    /* 修复sticky失效问题：flex-grow会限制高度，导致滚动在body而非main内发生
       通过min-height让main至少占满视口，但允许内容撑开超出视口 */
    min-height: 0;
    height: auto;
} 

/* Sticky兼容性与滚动容器修正 */
/* 兼容Safari等WebKit内核浏览器的粘性定位 */
.sticky {
    position: -webkit-sticky;
}

/* 避免内容区域祖先容器的overflow裁剪影响粘性定位（仅限制在主要内容区域） */
main .max-w-7xl,
main .max-w-7xl > .flex {
    overflow: visible;
}