/**
 * 顶部栏样式 - 极简悬浮胶囊风格
 */
.top-bar {
    position: absolute;
    top: 16px;
    left: 24px;
    /* 从左侧开始 */
    right: 24px;
    /* 结束于右侧 */
    display: flex;
    justify-content: space-between;
    /* 分布左右内容 */
    align-items: center;
    pointer-events: none;
    /* 穿透点击 */
    z-index: 5000;
}

.top-bar-left {
    pointer-events: auto;
    /* 如果需要，允许交互 */
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* 顶部栏文本按钮（帮助） */
.topbar-text-btn {
    pointer-events: auto;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.15s ease;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

.topbar-text-btn:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
}

.topbar-text-btn:active {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(0.97);
}

/* 品牌标题样式 */
.brand-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-primary);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    letter-spacing: -0.5px;
}

/* 品牌图标样式 */
.brand-icon {
    font-size: 22px;
    margin-right: 8px;
    /* filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2)); */
}

/* 品牌标题 Tooltip (自定义下方显示) */
#brandPill {
    position: relative;
}

#brandPill[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.75);
    color: var(--color-text-inverse);
    font-size: 12px;
    line-height: 1.4;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 2000;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--color-border);
}

#brandPill:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 浅色模式适配 */
:root.theme-sunrise #brandPill[data-tooltip]::after {
    background: rgba(255, 255, 255, 0.85);
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 通用胶囊样式 */

.status-pill {
    pointer-events: auto;
    /* 渐变以获得微妙的光泽 */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);

    /* 更强的模糊以达到磨砂效果 */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);

    /* 玻璃边缘的精致边框 */
    border: 1px solid rgba(125, 125, 125, 0.2);
    border-bottom: 1px solid rgba(125, 125, 125, 0.1);

    /* 内部光亮和柔和的阴影 */
    box-shadow:
        0 8px 32px 0 rgba(31, 38, 135, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);

    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 38px;
    /* 略高以显优雅 */

    /* 确保文字清晰 */
    -webkit-font-smoothing: antialiased;
    letter-spacing: 0.3px;
}

.status-pill:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.1) 100%);
    box-shadow:
        0 8px 32px 0 rgba(31, 38, 135, 0.2),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    transform: translateY(-2px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.3);
}

/* 胶囊 3 (最左侧): 时间 */
.time-pill {
    padding: 0 16px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transition: opacity 0.3s ease, transform 0.3s ease;

    /* 默认隐藏 (由JS控制在有窗口时显示) */
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
}

/* 隐藏时间状态（当桌面大钟显示时） */
/* 显示时间状态（当有窗口打开时） */
.top-bar.show-time .time-pill {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* 胶囊 2 (中间): 系统图标 */
.icon-pill {
    padding: 0 16px;
    gap: 12px;
    font-size: 14px;
    cursor: pointer;
    position: relative;
    /* 徽章锚点 */
}

/* 通知徽章 */
.notification-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    background-color: #ff3b30;
    color: var(--color-text-inverse);
    font-size: 10px;
    font-weight: 700;
    height: 16px;
    min-width: 16px;
    padding: 0 4px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--color-border);
    z-index: 10;
    pointer-events: none;
    animation: bounceIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }

    80% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.status-icon {
    font-size: 16px;
    opacity: 0.9;
    display: flex;
    align-items: center;
}

/* 胶囊 1 (最右侧): 用户 */
.user-pill {
    position: relative;
    /* 下拉菜单锚点 */
    padding: 6px 14px;
    gap: 8px;
    cursor: pointer;
}

/* 用户名文本样式 */
.user-name-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    letter-spacing: -0.2px;
}

/* 用户下拉菜单 */
.user-menu-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 200px;
    background: rgba(28, 28, 30, 0.65);
    /*深色玻璃 */
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 8px;
    display: none;
    /* 默认隐藏 */
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    animation: fadeIn 0.2s ease-out;
    z-index: 2000;
}

.user-menu-dropdown.show {
    display: flex;
}

.menu-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 4px;
}

.menu-user-name {
    color: var(--color-text-primary);
    font-weight: 600;
    font-size: 14px;
}

.menu-user-role {
    color: var(--color-text-secondary);
    font-size: 12px;
}

.menu-item {
    padding: 10px 16px;
    color: var(--color-text-primary);
    font-size: 13px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.menu-item:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
}

.menu-item.danger {
    color: #ff453a;
}

.menu-item.danger:hover {
    background: rgba(255, 69, 58, 0.15);
}

.menu-divider {
    height: 1px;
    background: var(--color-border);
    margin: 6px 8px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 浅色主题覆盖 */
:root.theme-sunrise .brand-title {
    color: rgba(0, 0, 0, 0.85);
    text-shadow: none;
}

:root.theme-sunrise .topbar-text-btn {
    color: rgba(0, 0, 0, 0.8);
}

:root.theme-sunrise .topbar-text-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: black;
}

:root.theme-sunrise .status-pill {
    /* 深色玻璃/毛玻璃效果 */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.4) 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.85);
    box-shadow:
        0 4px 12px 0 rgba(0, 0, 0, 0.05),
        inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

:root.theme-sunrise .status-pill:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.6) 100%);
    border-color: rgba(0, 0, 0, 0.15);
    transform: translateY(-2px) scale(1.02);
}

:root.theme-sunrise .user-name-text {
    color: rgba(0, 0, 0, 0.85);
}

:root.theme-sunrise .user-menu-dropdown {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

:root.theme-sunrise .menu-user-name {
    color: #111;
}

:root.theme-sunrise .menu-user-role {
    color: rgba(0, 0, 0, 0.6);
}

:root.theme-sunrise .menu-item {
    color: rgba(0, 0, 0, 0.8);
}

:root.theme-sunrise .menu-item:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #000;
}

:root.theme-sunrise .menu-divider {
    background: rgba(0, 0, 0, 0.1);
}

/* 消息下拉菜单增强 */
.message-dropdown {
    width: 320px;
    padding: 0;
    overflow: hidden;
}

.msg-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-tertiary);
}

.msg-tab {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    font-size: 13px;
    color: var(--color-text-tertiary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.msg-tab:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-hover);
}

.msg-tab.active {
    color: var(--color-text-primary);
    font-weight: 600;
}

.msg-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: #007aff;
    border-radius: 2px;
}

.badge-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #ff3b30;
    border-radius: 50%;
    margin-left: 4px;
    margin-bottom: 2px;
}

.msg-content-list {
    max-height: 300px;
    overflow-y: auto;
    min-height: 100px;
}

.msg-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
    align-items: flex-start;
    position: relative;
    /* 为绝对定位按钮准备 */
}

.msg-item:hover {
    background: var(--color-bg-hover);
}

.msg-item.unread {
    background: rgba(0, 122, 255, 0.1);
}

.msg-item.unread:hover {
    background: rgba(0, 122, 255, 0.15);
}

.msg-icon {
    font-size: 16px;
    margin-top: 2px;
}

.msg-body {
    flex: 1;
    overflow: hidden;
    padding-right: 4px;
    /* 防止内容过于贴近右侧 */
}

.msg-title {
    font-size: 13px;
    color: var(--color-text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.msg-time {
    font-size: 11px;
    color: var(--color-text-tertiary);
}

/* 消息操作按钮样式 */
.msg-actions {
    display: none;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    gap: 4px;
    z-index: 5;
    background: inherit;
    /* 继承背景，或者半透明 */
    padding-left: 8px;
    /* 增加一点间隔 */
    /* 添加一点背景遮罩效果让按钮更突出，如果是未读状态背景是蓝色的，这里继承就好 */
}

.msg-item:hover .msg-actions {
    display: flex;
}

.msg-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.msg-action-btn:hover {
    background: var(--color-primary);
    color: white;
}

.msg-action-btn.delete:hover {
    background: #ff3b30;
    color: white;
}


.msg-footer {
    padding: 10px;
    text-align: center;
    font-size: 12px;
    color: var(--color-text-secondary);
    background: var(--color-bg-tertiary);
    border-top: 1px solid var(--color-border);
}

.msg-footer:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-hover);
}

.loading-spinner {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-text {
    padding: 30px;
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: 13px;
}