/* ============================================================
   在线咨询浮动组件 · 柚鸥SEO 站（移植并适配紫色主题）
   类名统一使用 cwk- 前缀，与宿主站点样式互不干扰
   主题色：--cwk-theme #454659 → --cwk-theme2 #2E2E3D（改这两行即可换色）
   ============================================================ */
#cwk-root .cwk {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    --cwk-theme:  #454659;
    --cwk-theme2: #2E2E3D;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
    line-height: 1.5;
}
#cwk-root .cwk *, #cwk-root .cwk *::before, #cwk-root .cwk *::after { box-sizing: border-box; }

@keyframes cwkBreathe {
    0%, 100% {
        box-shadow: 0 8px 28px rgba(69, 70, 89, 0.35), 0 0 0 0 rgba(69, 70, 89, 0.28);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 12px 36px rgba(69, 70, 89, 0.5), 0 0 0 12px rgba(46, 46, 61, 0);
        transform: scale(1.06);
    }
}

#cwk-root .cwk-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #454659 0%, #2E2E3D 100%);
    color: #fff;
    box-shadow: 0 8px 28px rgba(69, 70, 89, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: cwkBreathe 2.6s ease-in-out infinite;
    position: relative;
}

#cwk-root .cwk.active .cwk-toggle { animation-play-state: paused; }
#cwk-root .cwk-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 32px rgba(69, 70, 89, 0.45);
}
#cwk-root .cwk-toggle svg {
    width: 28px;
    height: 28px;
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
#cwk-root .cwk-icon-open { opacity: 1; transform: rotate(0deg) scale(1); }
#cwk-root .cwk-icon-close { opacity: 0; transform: rotate(-90deg) scale(0.6); }
#cwk-root .cwk.active .cwk-icon-open { opacity: 0; transform: rotate(90deg) scale(0.6); }
#cwk-root .cwk.active .cwk-icon-close { opacity: 1; transform: rotate(0deg) scale(1); }

#cwk-root .cwk-panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 360px;
    max-width: calc(100vw - 48px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(16, 24, 40, 0.18);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#cwk-root .cwk.active .cwk-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

#cwk-root .cwk-header {
    padding: 18px 20px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #454659 0%, #2E2E3D 100%);
}
#cwk-root .cwk-title { font-size: 17.6px; font-weight: 700; }
#cwk-root .cwk-close {
    width: 32px; height: 32px; border-radius: 50%; border: none;
    background: rgba(255, 255, 255, 0.25); color: #fff;
    font-size: 22.4px; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
#cwk-root .cwk-close:hover { background: rgba(255, 255, 255, 0.4); }

#cwk-root .cwk-body { padding: 20px; max-height: 70vh; overflow-y: auto; }

#cwk-root .cwk-agent {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 20px; padding-bottom: 18px;
    border-bottom: 1px solid #F4F5F7;
}
#cwk-root .cwk-agent-avatar {
    width: 54px; height: 54px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
}
#cwk-root .cwk-agent-initial {
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 22.4px; font-weight: 700;
}
#cwk-root .cwk-agent-name { font-weight: 700; font-size: 16.8px; color: #101828; }
#cwk-root .cwk-agent-subtitle { font-size: 13.6px; color: #5E6880; margin-top: 2px; }

/* ---- 多顾问横排（2026-10-22：横排 3 位 + 点击切换 + 在线状态点）---- */
#cwk-root .cwk-agents {
    display: flex; justify-content: space-between; gap: 6px;
    margin-bottom: 10px;
}
#cwk-root .cwk-agent-item {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    text-align: center; cursor: pointer;
    padding: 7px 3px 5px; border-radius: 14px;
    transition: background 0.18s ease;
}
#cwk-root .cwk-agent-item:hover { background: #F6F7FB; }
#cwk-root .cwk-agent-item.active { background: #EEF0F3; }
#cwk-root .cwk-agent-item.active .cwk-agent-avatar {
    box-shadow: 0 0 0 2px #EEF0F3, 0 0 0 4px var(--cwk-theme);
}
#cwk-root .cwk-agent-item.active .cwk-agent-name { color: var(--cwk-theme); }
#cwk-root .cwk-agents .cwk-agent-avatar { width: 46px; height: 46px; }
#cwk-root .cwk-agents .cwk-agent-initial { font-size: 16.8px; }
#cwk-root .cwk-agents .cwk-agent-name {
    font-weight: 600; font-size: 12.48px; color: #101828;
    line-height: 1.25; max-width: 100%;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
#cwk-root .cwk-agent-status {
    display: flex; align-items: center; gap: 4px;
    font-size: 10.56px; color: #16a34a; line-height: 1;
}
#cwk-root .cwk-agent-status i {
    width: 6px; height: 6px; border-radius: 50%;
    background: #22c55e; display: inline-block; flex-shrink: 0;
}
#cwk-root .cwk-team-note {
    font-size: 12.48px; color: #5E6880; text-align: center;
    margin-bottom: 16px; padding-bottom: 14px;
    border-bottom: 1px solid #F4F5F7;
}

#cwk-root .cwk-methods { display: flex; flex-direction: column; gap: 10px; }
#cwk-root .cwk-method {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    padding: 12px; border-radius: 14px;
    background: #F6F7FB;
    text-decoration: none; color: inherit;
    transition: transform 0.2s ease, background 0.2s ease; cursor: pointer;
}
#cwk-root .cwk-method:hover { background: #EEF0F3; transform: translateX(-3px); }
#cwk-root .cwk-method.has-qr::after {
    content: '';
    position: absolute; left: 0; bottom: 0;
    width: 0; height: 3px;
    background: var(--cwk-theme);
    border-radius: 0 0 0 14px;
    transition: width 0.2s ease;
}
#cwk-root .cwk-method.has-qr:hover::after { width: 40%; }

#cwk-root .cwk-method-icon {
    width: 40px; height: 40px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
#cwk-root .cwk-method-icon svg { width: 22px; height: 22px; }
#cwk-root .cwk-method-content { flex: 1; min-width: 0; text-align: left; }
#cwk-root .cwk-method-label { font-size: 12px; color: #5E6880; margin-bottom: 1px; }
#cwk-root .cwk-method-value {
    font-size: 15.2px; font-weight: 600; color: #101828;
    display: flex; align-items: center; gap: 6px; min-width: 0;
}
#cwk-root .cwk-method-value .cm-text {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
/* 邮箱强制单行完整显示 */
#cwk-root .email-method .cwk-method-value { overflow: visible; }
#cwk-root .email-method .cwk-method-value .cm-text {
    white-space: nowrap; overflow: visible; text-overflow: clip; font-size: 14.08px;
}
#cwk-root .email-method .cwk-method-copy { width: 20px; height: 20px; }
#cwk-root .email-method .cwk-method-action { padding: 4px 8px; font-size: 11.2px; }

#cwk-root .cwk-method-copy {
    width: 22px; height: 22px; border: none; background: transparent;
    color: #8891A6; cursor: pointer; padding: 3px; border-radius: 5px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: color 0.2s ease, background 0.2s ease; flex-shrink: 0;
}
#cwk-root .cwk-method-copy:hover { background: #EEF0F3; color: var(--cwk-theme); }
#cwk-root .cwk-method-copy svg { width: 14px; height: 14px; }

#cwk-root .cwk-method-action {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 600; color: var(--cwk-theme);
    padding: 6px 12px; border-radius: 20px;
    background: rgba(69, 70, 89, 0.10);
    flex-shrink: 0; transition: background 0.2s ease, color 0.2s ease;
}
#cwk-root .cwk-method-action svg { width: 14px; height: 14px; }
#cwk-root .cwk-method:hover .cwk-method-action {
    background: linear-gradient(135deg, #454659 0%, #2E2E3D 100%);
    color: #fff;
}

/* 左侧悬浮二维码预览（仅桌面 hover 显示） */
#cwk-root .cwk-qr-float {
    position: absolute;
    top: 0;
    right: calc(100% + 14px);
    width: 170px;
    padding: 12px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(16, 24, 40, 0.15);
    opacity: 0;
    pointer-events: none;
    transform: translateX(10px) translateY(-50%) scale(0.95);
    transform-origin: right center;
    transition: opacity 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
    z-index: 100;
    text-align: center;
    cursor: pointer;
}
#cwk-root .cwk-qr-float:hover { box-shadow: 0 16px 48px rgba(16, 24, 40, 0.2); }
#cwk-root .cwk-qr-float.active {
    opacity: 1; pointer-events: auto;
    transform: translateX(0) translateY(-50%) scale(1);
}
#cwk-root .cwk-qr-float::after {
    content: '';
    position: absolute; right: -6px; top: 50%;
    transform: translateY(-50%);
    width: 0; height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 6px solid #fff;
}
#cwk-root .cwk-qr-float img {
    width: 100%; height: auto; border-radius: 10px;
    border: 1px solid #F4F5F7; display: block;
}
#cwk-root .cwk-qr-float p { margin: 8px 0 0; font-size: 11.2px; color: #8891A6; }

/* QR 弹窗 */
.cwk-modal {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
    font-size: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
    line-height: 1.5;
}
.cwk-modal *, .cwk-modal *::before, .cwk-modal *::after { box-sizing: border-box; }
.cwk-modal.active { opacity: 1; pointer-events: auto; }
.cwk-modal-backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, 0.55); backdrop-filter: blur(2px); }
.cwk-modal-content {
    position: relative; background: #fff; border-radius: 24px;
    padding: 28px 24px 24px; width: 100%; max-width: 360px;
    text-align: center; box-shadow: 0 24px 70px rgba(16, 24, 40, 0.25);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cwk-modal.active .cwk-modal-content { transform: scale(1); }
.cwk-modal-close {
    position: absolute; top: 14px; right: 14px;
    width: 32px; height: 32px; border-radius: 50%; border: none;
    background: #F6F7FB; color: #5E6880; font-size: 24px; line-height: 1;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}
.cwk-modal-close:hover { background: #EEF0F3; color: #101828; }
.cwk-modal-brand { margin-bottom: 14px; }
.cwk-modal-brand-icon {
    width: 64px; height: 64px; border-radius: 50%; margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
    color: #fff; box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12);
}
.cwk-modal-brand-icon svg { width: 34px; height: 34px; }
.cwk-modal-title { font-size: 20px; font-weight: 700; color: #101828; margin-bottom: 6px; }
.cwk-modal-subtitle { font-size: 14.4px; color: #5E6880; margin-bottom: 20px; line-height: 1.5; }
.cwk-modal-qr {
    width: 220px; height: 220px; margin: 0 auto 16px;
    border-radius: 18px; overflow: hidden; border: 1px solid #F4F5F7;
    background: #fff; padding: 10px; box-shadow: 0 4px 20px rgba(16, 24, 40, 0.06);
}
.cwk-modal-qr img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
.cwk-modal-hint { font-size: 13.6px; color: #8891A6; margin-bottom: 4px; }
.cwk-modal-id { font-size: 18.4px; font-weight: 700; color: #101828; margin-bottom: 20px; word-break: break-all; }
.cwk-modal-actions { display: flex; flex-direction: row; gap: 10px; }
.cwk-copy-btn, .cwk-open-btn {
    flex: 1; padding: 13px 16px; border: none; border-radius: 14px;
    font-size: 15.2px; font-weight: 600; cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease; text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.cwk-copy-btn { background: linear-gradient(135deg, #454659 0%, #2E2E3D 100%); color: #fff; box-shadow: 0 4px 14px rgba(69, 70, 89, 0.3); }
.cwk-copy-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.cwk-copy-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(69, 70, 89, 0.45); }
.cwk-open-btn { background: #F6F7FB; color: #101828; }
.cwk-open-btn:hover { background: #EEF0F3; }

/* Toast 复制提示 */
#cwk-toast {
    position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%);
    background: #101828; color: #fff; padding: 10px 20px; border-radius: 50px;
    font-size: 14.4px; z-index: 10001; opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

/* ===== 入口按钮的显隐控制 =====
   桌面：导航右侧「在线咨询」按钮（.btn-consult）
   移动（<=1024px，汉堡菜单态）：菜单里的「在线咨询」条目
   这样两端都不会挤压汉堡按钮的空间。 */
.only-desktop-cw { display: inline-flex; }
.only-mobile-cw { display: none; }
.btn-consult { white-space: nowrap; }

@media (max-width: 1024px) {
    .only-desktop-cw { display: none; }
    .only-mobile-cw {
        display: block;
        color: var(--cwk-theme);
        font-weight: 600;
    }
    .only-mobile-cw:hover,
    .only-mobile-cw:active { background: #EEF0F3; }
}

/* ===== 手机端适配 =====
   本站在 760px 以下会出现固定底部条（.mbar，高约 70px），
   浮动按钮需要整体上抬，避免被底部条压住。 */
@media (max-width: 1024px) {
    .only-desktop-cw { display: none; }
}
@media (max-width: 760px) {
    #cwk-root .cwk { right: 14px; bottom: calc(84px + env(safe-area-inset-bottom)); }
    #cwk-root .cwk-panel {
        width: calc(100vw - 28px);
        max-width: none;
        bottom: 72px;
        max-height: calc(100vh - 220px);
    }
    #cwk-root .cwk-qr-float { display: none; }  /* 手机端禁用 hover 预览，直接弹窗 */
}
@media (max-width: 480px) {
    #cwk-root .cwk-toggle { width: 54px; height: 54px; }
    #cwk-root .cwk-toggle svg { width: 24px; height: 24px; }
    .cwk-modal-content { padding: 24px 20px 20px; max-width: 320px; }
    .cwk-modal-qr { width: 190px; height: 190px; }
    .cwk-modal-actions { flex-direction: column; }
}

/* ===== 尊重系统「减少动态效果」设置 ===== */
@media (prefers-reduced-motion: reduce) {
    #cwk-root .cwk-toggle { animation: none; }
    #cwk-root .cwk-panel,
    #cwk-root .cwk-qr-float,
    .cwk-modal-content { transition: opacity 0.15s linear; }
}

/* ---- 轮播模式：进度条 + 换人淡入（rotateMode='carousel' 时才渲染进度条）---- */
#cwk-root .cwk-progress {
    height: 3px; border-radius: 99px; background: #EDEFF7;
    overflow: hidden; margin: -4px 0 10px;
}
#cwk-root .cwk-progress i {
    display: block; height: 100%; width: 0; border-radius: 99px;
    background: var(--cwk-theme, #454659);
    transition: width 0.2s linear;            /* 只做平滑，真正的进度由 JS 逐帧写 width */
    will-change: width;
}
/* 用户手动点了某位顾问后，轮播永久停止：条淡出，别让人以为卡在 100% */
#cwk-root .cwk-progress.is-off { opacity: 0.25; }
#cwk-root .cwk-progress.is-off i { transition: none; }
#cwk-root .cwk-methods.cwk-swap { animation: cwk-swap 0.34s ease both; }
@keyframes cwk-swap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* 系统开了「减少动态效果」时不要动 */
@media (prefers-reduced-motion: reduce) {
    #cwk-root .cwk-methods.cwk-swap { animation: none; }
    /* 不轮播了，进度条也就没意义，直接藏掉 */
    #cwk-root .cwk-progress { display: none; }
}
