/* 简约现代样式 */
body {
    font-family: 'Microsoft YaHei', Arial, Helvetica, sans-serif;
    overflow-x: hidden; /* 防止水平滚动 */
}

/* 预加载时隐藏公告 */
.announcements-hidden .announcement-container,
.announcements-hidden .announcement-container-mobile {
    display: none !important;
}

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

/* 修复第一个导航项的对齐问题 */
.hidden.md\:flex.items-center.space-x-1.overflow-x-auto.flex-nowrap a:first-child {
    padding-left: 0;
}

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

/* 防止公告在页面加载时闪烁 */
.announcement-container, .announcement-container-mobile {
    opacity: 1;
    transition: opacity 0.1s ease;
}

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

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

.announcement-container.hidden, .announcement-container-mobile.hidden {
    height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* 下拉菜单样式 - 完全重写 */
.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: absolute;
    background-color: #fff;
    min-width: 110px; /* 增加最小宽度 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 2px;
    z-index: 20;
    margin-top: 5px; /* 减小间距 */
    border: 1px solid #e0e0e0;
    padding: 0;
    left: 50%;
    transform: translateX(-50%);
    /* 移除固定宽度，让Tailwind类生效 */
}

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

.dropdown:hover .dropdown-content,
.dropdown-content:hover {
    display: block !important;
}

/* 移除动画，防止闪动 */
@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;
}

main {
    /* 保持定位以兼容可能的相对定位布局，但不创建新的堆叠上下文，
       这样位于 main 内部的固定定位模态（如二维码/微信分享）即可
       使用更高的 z-index 正确覆盖导航栏 */
    position: relative;
    z-index: auto;
} 