/* ==========================================================================
   全站悬浮咨询气泡 / Floating contact bubble
   作用域：.mm-fc  （mm = marxmake，避免与 Bootstrap / Tailwind 冲突）
   颜色跟随站点主色 #1A7AFF
   ========================================================================== */

.mm-fc,
.mm-fc * {
    box-sizing: border-box;
}

.mm-fc {
    position: fixed;
    right: 24px;
    bottom: 28px;
    z-index: 9990;
    width: 64px;
    height: 64px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
    animation: mm-fc-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.45s both;
}

/* 气泡与卡片之间的「隐形桥」：鼠标可以从气泡平滑移进卡片 */
.mm-fc::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 22px;
    pointer-events: none;
}

/* ---------- 收起状态：圆形气泡 ---------- */
.mm-fc-bubble {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(140deg, #41a0ff 0%, #1a7aff 45%, #0b56d6 100%);
    box-shadow:
        0 14px 30px -8px rgba(11, 86, 214, 0.55),
        0 4px 10px rgba(11, 86, 214, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
    color: #fff;
    text-decoration: none !important;
    outline: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.3s ease;
}

.mm-fc-bubble:hover,
.mm-fc-bubble:focus {
    color: #fff;
    text-decoration: none !important;
}

.mm-fc-bubble:focus-visible {
    box-shadow:
        0 0 0 4px rgba(26, 122, 255, 0.35),
        0 14px 30px -8px rgba(11, 86, 214, 0.55);
}

.mm-fc-bubble::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(26, 122, 255, 0.45);
    animation: mm-fc-pulse 2.6s ease-out infinite;
    pointer-events: none;
}

.mm-fc-icon {
    position: relative;
    z-index: 1;
    display: flex;
    width: 30px;
    height: 30px;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mm-fc-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* 右上角在线小绿点 */
.mm-fc-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #22c55e;
    border: 2.5px solid #fff;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
    z-index: 2;
}

/* ---------- 收起状态：左侧小标签 ---------- */
.mm-fc-label {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    padding: 9px 14px;
    border-radius: 999px;
    background: #fff;
    color: #0b56d6;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
    box-shadow:
        0 10px 24px -6px rgba(15, 50, 110, 0.25),
        0 2px 6px rgba(15, 50, 110, 0.08);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.25s ease;
}

.mm-fc-label::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -4px;
    width: 8px;
    height: 8px;
    background: #fff;
    transform: translateX(-50%) rotate(45deg);
    border-radius: 1px;
}

/* ---------- 展开卡片 ---------- */
.mm-fc-card {
    position: absolute;
    right: 0;
    bottom: calc(100% + 18px);
    width: 332px;
    max-width: calc(100vw - 28px);
    max-height: calc(100vh - 120px);
    overflow: auto;
    background: #fff;
    border-radius: 20px;
    box-shadow:
        0 30px 70px -18px rgba(8, 38, 92, 0.4),
        0 10px 24px -8px rgba(8, 38, 92, 0.14),
        0 0 0 1px rgba(15, 50, 110, 0.05);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.95);
    transform-origin: bottom right;
    pointer-events: none;
    transition: opacity 0.26s ease, transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0.26s;
}

/* 卡片顶部渐变头 */
.mm-fc-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 18px 16px;
    background:
        radial-gradient(120px 90px at 88% -10%, rgba(255, 255, 255, 0.28), transparent 70%),
        linear-gradient(140deg, #41a0ff 0%, #1a7aff 48%, #0b56d6 100%);
    color: #fff;
    overflow: hidden;
}

.mm-fc-head::after {
    content: "";
    position: absolute;
    right: -26px;
    bottom: -46px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.mm-fc-avatar {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(4px);
}

.mm-fc-avatar svg {
    width: 24px;
    height: 24px;
    display: block;
}

.mm-fc-headtext {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.mm-fc-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.5px;
}

.mm-fc-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.88);
}

.mm-fc-status i {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.22);
}

/* 关闭按钮（触屏显示） */
.mm-fc-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.mm-fc-close:hover,
.mm-fc-close:focus {
    background: rgba(255, 255, 255, 0.28);
    outline: none;
}

/* 卡片正文 */
.mm-fc-body {
    padding: 18px;
}

.mm-fc-desc {
    margin: 0 0 14px;
    color: #475569;
    font-size: 13.5px;
    line-height: 1.7;
    text-align: left;
}

.mm-fc-rows {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-bottom: 16px;
}

.mm-fc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: 12px;
    background: #f5f8fe;
    border: 1px solid #e8f0fd;
    color: #334155;
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
}

.mm-fc-row-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: #fff;
    color: #1a7aff;
    box-shadow: 0 2px 5px rgba(15, 50, 110, 0.08);
}

.mm-fc-row-icon svg {
    width: 15px;
    height: 15px;
    display: block;
}

.mm-fc-row b {
    font-weight: 600;
    color: #0f172a;
    letter-spacing: 0.2px;
}

.mm-fc-row em {
    margin-left: auto;
    padding: 2px 7px;
    border-radius: 999px;
    background: #e6f7ec;
    color: #15803d;
    font-size: 11px;
    font-style: normal;
    font-weight: 600;
    white-space: nowrap;
}

.mm-fc-row-text {
    flex: 1 1 auto;
    min-width: 0;
}

/* 邮箱链接 */
.mm-fc-mail {
    color: inherit !important;
    text-decoration: none !important;
    border-bottom: 1px dashed rgba(26, 122, 255, 0.45);
    transition: color 0.18s ease, border-color 0.18s ease;
}

.mm-fc-mail:hover,
.mm-fc-mail:focus {
    color: #1a7aff !important;
    border-bottom-color: #1a7aff;
    text-decoration: none !important;
}

.mm-fc-mail b {
    color: inherit;
}

/* 复制按钮 */
.mm-fc-copy {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: color 0.18s ease, background-color 0.18s ease;
}

.mm-fc-copy:hover,
.mm-fc-copy:focus-visible {
    background: #e8f1ff;
    color: #1a7aff;
    outline: none;
}

.mm-fc-copy svg {
    width: 14px;
    height: 14px;
    display: block;
}

.mm-fc-copy .mm-fc-copy-check {
    display: none;
    color: #16a34a;
}

.mm-fc-copy.is-copied {
    background: #e9f9ef;
    color: #16a34a;
}

.mm-fc-copy.is-copied .mm-fc-copy-icon {
    display: none;
}

.mm-fc-copy.is-copied .mm-fc-copy-check {
    display: block;
}

.mm-fc-copy::after {
    content: "已复制";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 7px);
    transform: translateX(-50%) translateY(3px);
    padding: 3px 7px;
    border-radius: 6px;
    background: #0f172a;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 2;
}

.mm-fc-copy.is-copied::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 主按钮 */
.mm-fc-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2f8bff 0%, #0b5fe0 100%);
    color: #fff !important;
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-decoration: none !important;
    box-shadow: 0 10px 20px -8px rgba(11, 95, 224, 0.6);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.mm-fc-cta:hover,
.mm-fc-cta:focus {
    color: #fff !important;
    text-decoration: none !important;
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow: 0 14px 24px -8px rgba(11, 95, 224, 0.7);
}

.mm-fc-cta svg {
    width: 15px;
    height: 15px;
    display: block;
    transition: transform 0.2s ease;
}

.mm-fc-cta:hover svg {
    transform: translateX(3px);
}

.mm-fc-tip {
    margin-top: 9px;
    color: #94a3b8;
    font-size: 11.5px;
    line-height: 1.4;
    text-align: center;
}

/* ---------- 展开状态 ---------- */
.mm-fc.is-open .mm-fc-card {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.mm-fc.is-open .mm-fc-label {
    opacity: 0;
    transform: translateX(-50%) translateY(-4px);
}

.mm-fc.is-open .mm-fc-bubble {
    transform: translateY(-2px) scale(1.03);
    box-shadow:
        0 18px 36px -8px rgba(11, 86, 214, 0.6),
        0 6px 14px rgba(11, 86, 214, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.mm-fc.is-open .mm-fc-bubble .mm-fc-icon {
    transform: scale(1.1) rotate(-5deg);
}

.mm-fc.is-open .mm-fc-close {
    display: flex;
}

/* ---------- 桌面端 ---------- */
@media (hover: hover) and (pointer: fine) {
    /* 展开时激活隐形桥，鼠标离开气泡后仍能进入卡片 */
    .mm-fc:hover::before,
    .mm-fc.is-open::before {
        pointer-events: auto;
    }

    .mm-fc-close {
        display: none !important;
    }
}

/* ---------- 动画 ---------- */
@keyframes mm-fc-enter {
    0% {
        opacity: 0;
        transform: translateY(16px) scale(0.86);
    }
    100% {
        opacity: 1;
        transform: none;
    }
}

@keyframes mm-fc-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(26, 122, 255, 0.42);
    }
    70% {
        box-shadow: 0 0 0 16px rgba(26, 122, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(26, 122, 255, 0);
    }
}

/* 触屏设备（含平板）：显示关闭按钮 */
@media (hover: none), (pointer: coarse) {
    .mm-fc-close {
        display: flex;
    }
}

/* ---------- 移动端 ---------- */
@media (max-width: 767px) {
    .mm-fc {
        right: 14px;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        width: 56px;
        height: 56px;
    }

    .mm-fc-bubble {
        width: 56px;
        height: 56px;
    }

    .mm-fc-icon {
        width: 26px;
        height: 26px;
    }

    .mm-fc-badge {
        top: 3px;
        right: 3px;
        width: 11px;
        height: 11px;
        border-width: 2px;
    }

    .mm-fc-label {
        padding: 8px 12px;
        font-size: 12.5px;
    }

    .mm-fc-card {
        bottom: calc(100% + 14px);
        width: min(332px, calc(100vw - 28px));
        border-radius: 18px;
    }

    .mm-fc-head {
        padding: 16px 16px 14px;
    }

    .mm-fc-body {
        padding: 16px;
    }

    .mm-fc-close {
        display: flex;
    }
}

/* 无障碍：减少动态效果 */
@media (prefers-reduced-motion: reduce) {
    .mm-fc {
        animation: none !important;
    }

    .mm-fc-bubble::before {
        animation: none;
    }

    .mm-fc-bubble,
    .mm-fc-card,
    .mm-fc-icon,
    .mm-fc-label,
    .mm-fc-cta,
    .mm-fc-cta svg {
        transition: none !important;
    }
}

@media print {
    .mm-fc {
        display: none !important;
    }
}
