/**
 * 公共 Header 样式。
 *
 * 说明:
 * - 从前端 TheHeader.vue 的 <style scoped> 提取。
 * - 去掉了 Vue scoped 的 data 属性选择器。
 * - 所有选择器直接使用类名，无需命名空间隔离（Header 全局唯一）。
 *
 * 学习建议: 对比 TheHeader.vue 的原始 <style scoped>，
 * 注意 Vue scoped 是通过给选择器加 [data-v-xxx] 属性实现隔离的，
 * SSR 中不需要这种机制，因为 Header 是全局唯一的 HTML 结构。
 */

/* ─── Header 容器 ─── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    height: 60px;
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.95);
}

.app-header.scrolled {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

.app-header.shadow {
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(230, 232, 237, 1);
}

.app-header.scrolled.shadow {
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(230, 232, 237, 1);
}

/* ─── Logo ─── */
.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    color: #002fa8;
    flex-shrink: 0;
    text-decoration: none;
}
.header-logo img { height: 36px; }
.header-logo span {
    background: linear-gradient(90deg, #0035ba 0%, #29bbff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ─── 顶部导航 ─── */
.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 30px;
}

.header-nav-item {
    position: relative;
    padding: 8px 20px;
    font-size: 16px;
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}

.header-nav-item:hover {
    color: #002fa8;
}

.header-nav-item.active {
    color: #333;
    font-weight: 700;
}

.header-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(0, 64, 191, 1) 0%, rgba(51, 187, 255, 1) 100%);
}

.header-nav-item.external:hover {
    color: #002fa8;
}

/* ─── 右侧区域 ─── */
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}
.header-search-toggle + .header-right  { margin-left: 0; }

/* ─── 用户 / 认证 ─── */
.header-user { display: flex; align-items: center; gap: 8px; }

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #fff;
}

.user-name { font-size: 14px; color: #333; }

.header-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 14px;
    color: #fff;
    text-decoration: none;
    transition: all .25s ease-in;
    background: linear-gradient(90deg, rgba(0, 53, 186, 1) 0%, rgba(41, 187, 255, 1) 100%);
}

.header-login:hover {
    background: linear-gradient(90deg, rgba(0, 53, 186, .85) 0%, rgba(41, 187, 255, .85) 100%);
}

.header-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    text-decoration: none;
    border: 1px solid #e5e7eb;
    background: #fff;
    transition: all .25s ease-in;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header-logout:hover {
    color: rgba(0, 47, 168, 1);
}

/* ─── 搜索框（首页使用） ─── */
.header-search {
    display: flex;
    align-items: center;
    margin-left: auto;
    margin-right: 30px;
}
.header-search-form {
    display: flex;
    align-items: center;
    width: 220px;
    height: 31px;
    border: 1px solid rgba(230,232,237,1);
    border-radius: 18px;
    background: #fff;
    padding: 0 4px 0 14px;
    transition: border-color .2s;
    box-shadow: 0 2px 4px #0000000d;
}

.header-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: #333;
    background: transparent;
    min-width: 0;
}

.header-search-input:focus {
    border-color: #002fa8;
}

.header-search-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity .2s;
}
.header-search-btn .iconfont {
    font-size: 18px;
    color: #7c869a;
}

/* ─── Bell 通知区域（#bell-mount 容器） ─── */
#bell-mount {
    display: flex;
    align-items: center;
}
/* 无通知数据时隐藏容器 */
#bell-mount:empty {
    display: none;
}

/* 铃铛容器：hover 时展示下拉框 */
.bell-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* 铃铛图标 */
.bell-icon-wrap {
    transform: translateY(2px);
    position: relative;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    width: 40px;
    transition: background 0.15s;
}

.bell-icon-wrap:hover {
    background: rgba(0, 47, 168, 0.06);
}

.bell-icon {
    font-size: 24px;
    color: #555;
}

/* 红色角标 */
.bell-badge {
    position: absolute;
    top: 0;
    right: 4px;
    min-width: 16px;
    height: 16px;
    background: #ff4d4f;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    pointer-events: none;
}

/* 下拉框（默认隐藏，hover 时展示） */
.bell-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: -8px;
    width: 280px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    padding-top: 6px;
}

/* hover 桥接区域：填补铃铛与下拉框之间的间隙 */
.bell-wrapper::after {
    content: '';
    position: absolute;
    top: 100%;
    right: -8px;
    width: 280px;
    height: 6px;
}

.bell-wrapper:hover .bell-dropdown {
    display: block;
}

/* 下拉列表 */
.bell-dropdown-list {
    list-style: none;
    margin: 0;
    padding: 0 8px;
    max-height: 240px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.bell-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.bell-dropdown-item:hover {
    background: #f0f4ff;
}

.bell-dropdown-text {
    flex: 1;
    font-size: 13px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bell-dropdown-arrow {
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
}

/* 底部清空按钮 */
.bell-dropdown-footer {
    border-top: 1px solid #f0f0f0;
    padding: 8px 12px;
    text-align: right;
}

.bell-clear-btn {
    background: none;
    border: none;
    font-size: 12px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.bell-clear-btn:hover {
    color: #ff4d4f;
    background: #fff1f0;
}

/* ─── 响应式：移动端 ─── */
@media (max-width: 768px) {
    .header-nav { display: none; }
    .user-avatar { width: 24px; height: 24px; }
    .app-header { padding: 0 12px; height: 52px; }
    .header-logo { gap: 4px; font-size: 18px; }
    .header-logo img { height: 30px; }
    .header-right { gap: 10px; }
    .user-name { display: none; }
    .header-logout { padding: 4px 10px; font-size: 12px; }
    .header-login { padding: 4px 10px; font-size: 12px; }
    .header-search { max-width: 280px; }
}
