/* ============================================================
 *  xiaolvtool 用户中心下拉面板
 *  - 与 anytocopy 同款视觉
 *  - 复用 theme.css 的 --accent / --accent-2 / --accent-grad
 *  - 桌面端 hover 展开；移动端 click 展开（.open class）
 * ============================================================ */

/* ---------- 触发器（右上角按钮） ---------- */
.user-center-trigger {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px !important;
    border-radius: 99px;
    cursor: pointer;
    transition: background-color 0.18s ease;
    color: var(--text-primary, #0F172A);
    text-decoration: none !important;
    flex-shrink: 0;          /* 触发器整体不被 navbar 父级压缩 */
}

/* 关键:让 panel 的 top:100% / right:0 正确相对本容器定位 */
.user-center-dropdown {
    position: relative !important;
}

.user-center-trigger:hover,
.user-center-dropdown.open .user-center-trigger {
    background: var(--accent-soft, #EDE9FE);
}

/* 头像（首字符 fallback） */
.uc-avatar,
.uc-avatar-lg {
    background: var(--accent-grad, linear-gradient(135deg, #7C3AED 0%, #4F46E5 100%));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    user-select: none;
}

.uc-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 13px;
}

.uc-avatar-lg {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 700;
}

/* 用户名 + 邮箱展示 */
.uc-trigger-name {
    font-size: 14px;
    font-weight: 500;
    /* 修复：用 max-width 而非 width，避免强制撑开父级
       chevron 始终可见，长邮箱截断为省略号 */
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

.uc-chevron {
    font-size: 10px;
    color: #94a3b8;
    transition: transform 0.2s ease;
    flex-shrink: 0;          /* chevron 永远不被压缩或裁切 */
    width: 12px;             /* 固定宽度保证始终可见 */
    text-align: center;
}

.user-center-dropdown.open .uc-chevron {
    transform: rotate(180deg);
}

/* ---------- 面板容器 ---------- */
/* 关键修复:透明连接桥 + 面板扩展
   鼠标从触发器向面板移动时,会穿过 10px 间隙 + 面板边缘外侧;
   这里用「容器 ::before 桥」+「面板向下偏移 + 负 margin 扩展接收区」双保险,
   确保鼠标穿越任何方向都不会离开 .user-center-dropdown 的 hover 范围。

   关键改动:
   1. ::before 高度从 14px → 320px,覆盖整个面板可能区域;
   2. ::before 宽度 = 320px(与面板等宽);
   3. 面板加一个不可见 ::after,把"面板边缘"扩展出去,鼠标在面板内部任何
      位置都不会离开 hover 状态。 */
.user-center-dropdown {
    /* 关键:让整个下拉区域成为单一 hover 上下文 */
    position: relative;
}

.user-center-dropdown::before {
    content: '';
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;             /* 与面板等宽,确保从触发器到面板之间的所有空白被覆盖 */
    min-width: 100%;          /* 如果触发器本身比 320px 宽,桥随之扩展 */
    height: 20px;             /* 覆盖 10px 间隙 + 一些缓冲 */
    background: transparent;
    z-index: 1079;
    pointer-events: auto;
    display: none;            /* 默认隐藏,hover/open 时显示 */
}

/* 面板紧贴 trigger 底部,视觉间距用 margin-top 模拟
   关键:不要用 top: calc(100% + 10px),否则面板与 trigger 之间会有 10px 间隙,
        鼠标穿过时 hover 状态丢失。用 top: 100% + margin-top: 10px 让
        ::before 桥(top: 100% 起)与面板的 hover 区域无缝衔接 */
.user-center-panel {
    position: absolute;
    top: 100%;
    margin-top: 10px !important;
    right: 0;
    width: 340px;
    max-width: calc(100vw - 24px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px -8px rgba(15, 23, 42, 0.18),
                0 4px 12px -4px rgba(124, 58, 237, 0.12);
    padding: 16px;
    z-index: 1080;
    display: none;
    border: 1px solid rgba(124, 58, 237, 0.08);
    transform-origin: top right;
    animation: uc-pop 0.16s ease;
}

/* 关键:面板扩展 ::after 接收区,把面板边缘向外延伸 8px,鼠标在面板内
   任何位置(含边缘附近)都不会离开 hover 容器 */
.user-center-panel::after {
    content: '';
    position: absolute;
    top: -10px;               /* 上方延伸覆盖间隙 */
    right: -8px;              /* 右侧延伸 8px */
    bottom: -8px;             /* 下方延伸 8px,鼠标可下移到面板外仍属 hover 范围 */
    left: -8px;               /* 左侧延伸 8px */
    z-index: -1;              /* 在面板内容之下,不影响点击 */
    pointer-events: auto;
}

/* 桌面端:hover 触发器 + 透明桥 + 面板 = 同一容器,鼠标可无缝穿越 */
@media (min-width: 992px) {
    .user-center-dropdown:hover::before,
    .user-center-dropdown:hover .user-center-panel {
        display: block;
    }
}

/* 移动端：click .open 切换 */
.user-center-dropdown.open::before,
.user-center-dropdown.open .user-center-panel {
    display: block;
}

@keyframes uc-pop {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(-4px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 面板里所有子元素的 reset（避免 Bootstrap .dropdown-menu 样式残留） */
.user-center-panel * {
    box-sizing: border-box;
}

/* ---------- 区块1: 用户信息头 ---------- */
.uc-header {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
}

.uc-id {
    flex: 1;
    min-width: 0;
}

.uc-nickname {
    font-weight: 600;
    color: var(--text-primary, #0F172A);
    font-size: 15px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uc-account {
    color: #94a3b8;
    font-size: 12px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- 区块2: 会员卡片 ---------- */
.uc-vip-card {
    background: linear-gradient(135deg, #0F172A 0%, #1E1B4B 100%);
    border-radius: 12px;
    padding: 14px;
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    color: #fff;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(124, 58, 237, 0.4);
}

/* 卡片装饰光晕 */
.uc-vip-card::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 90px;
    height: 90px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.4) 0%, transparent 70%);
    pointer-events: none;
}

.uc-vip-left {
    display: flex;
    gap: 10px;
    align-items: center;
    position: relative;
}

.uc-vip-left .fa-crown {
    color: #fbbf24;
    font-size: 18px;
    filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.4));
}

.uc-vip-tier {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
}

.uc-vip-sub {
    color: #94a3b8;
    font-size: 11px;
    margin-top: 2px;
}

.uc-vip-badge {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 99px;
    border: 1px solid rgba(251, 191, 36, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: center;
}

.uc-vip-badge .fa-star {
    font-size: 9px;
}

.uc-vip-cta {
    grid-column: 1 / -1;
    background: var(--accent-grad, linear-gradient(135deg, #7C3AED 0%, #4F46E5 100%));
    color: #fff !important;
    text-align: center;
    padding: 9px 12px;
    border-radius: 8px;
    font-weight: 600;
    margin-top: 4px;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    transition: opacity 0.18s ease, transform 0.18s ease;
    position: relative;
}

.uc-vip-cta:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    color: #fff !important;
}

.uc-vip-cta .fa-bolt {
    color: #fde68a;
}

/* ---------- 区块3: 我的权益 ---------- */
.uc-section {
    margin-top: 14px;
}

.uc-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #0F172A);
    margin-bottom: 8px;
}

.uc-section-head .fa-gift {
    color: var(--accent, #7C3AED);
    margin-right: 4px;
}

.uc-section-links a {
    color: var(--accent-2, #4F46E5);
    font-size: 12px;
    font-weight: 400;
    text-decoration: none;
    margin-left: 10px;
    transition: opacity 0.18s ease;
}

.uc-section-links a:hover {
    opacity: 0.7;
    text-decoration: underline;
}

.uc-quota-card {
    background: linear-gradient(135deg, #F5F3FF 0%, #EEF2FF 100%);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

/* 2026-08-25 tuiguang:三卡堆叠容器(视频 / AI / 图片),垂直间距 8px */
.uc-quota-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.uc-quota-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-grad, linear-gradient(135deg, #7C3AED 0%, #4F46E5 100%));
    border-radius: 10px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px -2px rgba(124, 58, 237, 0.3);
}

.uc-quota-body {
    flex: 1;
    min-width: 0;
}

.uc-quota-name {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 2px;
}

.uc-quota-number {
    line-height: 1.1;
}

.uc-num-big {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent-2, #4F46E5);
}

.uc-num-unit {
    font-size: 12px;
    color: #64748b;
    margin: 0 2px 0 4px;
}

.uc-num-period {
    font-size: 11px;
    color: #94a3b8;
}

.uc-progress {
    height: 6px;
    background: #fff;
    border-radius: 99px;
    margin: 6px 0;
    overflow: hidden;
    border: 1px solid rgba(124, 58, 237, 0.08);
}

.uc-progress-bar {
    height: 100%;
    background: var(--accent-grad, linear-gradient(135deg, #7C3AED 0%, #4F46E5 100%));
    border-radius: 99px;
    transition: width 0.3s ease;
}

/* 进度条告警态（已用 ≥ 90%） */
.uc-progress-bar.is-warn {
    background: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
}

.uc-quota-tip {
    font-size: 11px;
    color: #94a3b8;
}

/* retry link */
.uc-quota-tip a {
    color: #4F46E5;
    text-decoration: underline;
    margin-left: 4px;
    cursor: pointer;
}
.uc-quota-tip a:hover {
    color: #7C3AED;
}

/* ---------- 区块4: 任务入口（两并列卡片） ---------- */
.uc-task-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    margin-top: 14px;
    /* 兜底:防止任何子元素溢出破坏布局 */
    overflow: hidden;
}

.uc-task-card {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 8px;
    background: #F8FAFC;
    border-radius: 10px;
    text-decoration: none !important;
    color: inherit !important;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    min-width: 0;             /* 关键:允许 grid 子项收缩,防止内容撑爆 */
    overflow: hidden;         /* 兜底,防止任何视觉溢出 */
}

.uc-task-card:hover {
    border-color: rgba(124, 58, 237, 0.3);
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -4px rgba(124, 58, 237, 0.2);
    color: inherit !important;
}

.uc-task-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    flex-shrink: 0;
}

.uc-task-icon.blue {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
}

.uc-task-icon.purple {
    background: var(--accent-grad, linear-gradient(135deg, #7C3AED 0%, #4F46E5 100%));
}

.uc-task-text {
    flex: 1;
    min-width: 0;             /* 关键:文字区允许收缩触发 ellipsis */
    overflow: hidden;
}

.uc-task-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary, #0F172A);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uc-task-sub {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uc-task-card > .fa-chevron-right {
    color: #cbd5e1;
    font-size: 10px;
    flex-shrink: 0;
}

/* ---------- 区块5: 帮助与支持 ---------- */
.uc-help {
    padding-top: 12px;
    margin-top: 14px;
    border-top: 1px solid #f1f5f9;
}

.uc-section-title {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 8px;
    font-weight: 500;
}

.uc-help-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 7px 4px;
    font-size: 13px;
    color: var(--text-primary, #0F172A);
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.uc-help-item:hover {
    background: #F8FAFC;
    color: var(--accent, #7C3AED);
}

.uc-help-item i {
    color: #94a3b8;
    margin-right: 8px;
    width: 14px;
    transition: color 0.18s ease;
}

.uc-help-item:hover i {
    color: var(--accent, #7C3AED);
}

/* ---------- 区块6: 退出登录 ---------- */
.uc-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    background: transparent;
    color: #ef4444;
    border: 1px solid #fecaca;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
}

.uc-logout:hover {
    background: #fef2f2;
    border-color: #fca5a5;
}

.uc-logout i {
    font-size: 12px;
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 991.98px) {
    .user-center-panel {
        right: -8px;
        width: 300px;
    }

    .uc-trigger-name {
        display: none;
    }
}

@media (max-width: 380px) {
    .user-center-panel {
        right: -16px;
        width: calc(100vw - 32px);
        max-width: 320px;
    }
}

/* ---------- 暗色模式（可选，未来扩展） ---------- */
@media (prefers-color-scheme: dark) {
    /* 暂不实现，留作 Phase 2 */
}
