/* =====================================================================
   site-chat.css — 全站在线客服气泡（替代 Tawk.to）+ 电脑端微信客服按钮
   电脑端规则以 html.is-desktop 开头，手机端以 html.is-mobile 开头。
   ===================================================================== */


/* 主题色：与阿里旅游 Logo 的绿-青渐变一致 */
:root {
    --my-chat-grad: linear-gradient(135deg, #4fcf93 0%, #14b5e2 100%);
    --my-chat-deep: linear-gradient(135deg, #1fae7a 0%, #0c9bc8 100%);
    --my-chat-link: #0b8a92;
}
/* ---------- 1. 在线客服：按钮 ---------- */
.my-chat-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 966;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    background: var(--my-chat-grad);
    color: #fff;
    font-size: 26px;
    line-height: 56px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(24, 178, 160, 0.45);
    transition: transform 0.15s, background 0.15s;
}
.my-chat-launcher:hover {
    transform: scale(1.06);
}
.my-chat-launcher.open {
    animation: none;
    background: #5b6b80;
    font-size: 22px;
}
/* 平板宽度：右下角是返回顶部按钮，客服气泡上移 */
@media (max-width: 1023px) {
    html.is-desktop .my-chat-launcher {
        bottom: 90px;
    }
    html.is-desktop .my-chat-panel {
        bottom: 156px !important;
    }
}

/* ---------- 2. 在线客服：对话面板 ---------- */
.my-chat-panel {
    position: fixed;
    right: 24px;
    bottom: 92px;
    z-index: 967;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: min(560px, calc(100vh - 120px));
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.22);
    font-size: 14px;
    color: #222;
}
.my-chat-head {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: var(--my-chat-grad);
    color: #fff;
}
.my-chat-head > div {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.my-chat-head strong {
    font-size: 15px;
}
.my-chat-head span {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 2px;
}
.my-chat-close {
    flex: none;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 18px;
    line-height: 28px;
    padding: 0;
    cursor: pointer;
}
.my-chat-log {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
    background: #f5f7fa;
    display: flex;
    flex-direction: column;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
}
.my-chat-msg {
    max-width: 86%;
    padding: 8px 11px;
    border-radius: 12px;
    line-height: 1.5;
    word-break: break-word;
    white-space: normal;
}
.my-chat-msg.bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e8ecf2;
    border-bottom-left-radius: 4px;
}
.my-chat-msg.user {
    align-self: flex-end;
    background: var(--my-chat-deep);
    color: #fff;
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}
.my-chat-line {
    display: block;
    min-height: 1em;
}
.my-chat-msg a {
    color: var(--my-chat-link);
    text-decoration: underline;
}
.my-chat-typing {
    color: #888;
    font-style: italic;
}
.my-chat-error {
    align-self: stretch;
    color: #cf1322;
    background: #fff1f0;
    border: 1px solid #ffccc7;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
}
.my-chat-suggest {
    flex: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px 0 12px;
    background: #f5f7fa;
}
.my-chat-suggest button {
    border: 1px solid #b9e8d8;
    background: #fff;
    color: var(--my-chat-link);
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
}
.my-chat-input {
    flex: none;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #eef0f3;
    background: #fff;
}
.my-chat-input textarea {
    flex: 1 1 auto;
    min-width: 0;
    resize: none;
    border: 1px solid #d9dee6;
    border-radius: 18px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.4;
    max-height: 96px;
    outline: none;
}
.my-chat-input textarea:focus {
    border-color: #1fae8a;
}
.my-chat-input button {
    flex: none;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: var(--my-chat-deep);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}
.my-chat-input button:disabled {
    background: #b4d8ce;
    cursor: default;
}

/* ---------- 3. 手机端：气泡在底部导航之上，面板占满屏幕中部 ---------- */
html.is-mobile .my-chat-launcher {
    right: 10px;
    bottom: calc(70px + env(safe-area-inset-bottom));
    width: 50px;
    height: 50px;
    line-height: 50px;
    font-size: 23px;
}
html.is-mobile body:has(.my-order-actions) .my-chat-launcher {
    bottom: calc(132px + env(safe-area-inset-bottom));
}
html.is-mobile.my-cat-open .my-chat-launcher {
    display: none;
}
html.is-mobile .my-chat-panel {
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    top: calc(8px + env(safe-area-inset-top));
    bottom: calc(64px + env(safe-area-inset-bottom));
    height: auto;
    z-index: 968;
}
html.is-mobile.my-chat-open .my-chat-launcher {
    display: none;
}
/* iPhone：输入框 16px，避免聚焦时自动放大 */
html.is-mobile .my-chat-input textarea {
    font-size: 16px;
}

/* ---------- 4. 电脑端微信客服按钮（返回顶部按钮上方，常显） ---------- */
html.is-desktop .my-m-wechat-fab {
    position: fixed;
    left: 30px;
    bottom: 86px;
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    background: #07c160;
    color: #fff;
    font-size: 22px;
    line-height: 40px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
html.is-desktop .my-m-wechat-fab:hover {
    transform: scale(1.06);
}
html.is-desktop .my-m-wechat-panel {
    position: fixed;
    left: 30px;
    bottom: 136px;
    z-index: 101;
    width: 460px;
    max-height: calc(100vh - 170px);
    overflow-y: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
    padding: 0 14px 14px 14px;
}
html.is-desktop .my-m-wechat-panel-head {
    position: sticky;
    top: 0;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 6px;
}
html.is-desktop .my-m-wechat-panel-head > i {
    color: #07c160;
    font-size: 22px;
}
html.is-desktop .my-m-wechat-close {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: #f5f5f5;
    color: #666;
    font-size: 18px;
    line-height: 28px;
    padding: 0;
    cursor: pointer;
}
html.is-desktop .my-m-wechat-tip {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}
html.is-desktop .my-m-wechat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
html.is-desktop .my-m-wechat-item {
    text-align: center;
    font-size: 12px;
    color: #333;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 8px 4px;
    cursor: pointer;
}
html.is-desktop .my-m-wechat-item img {
    width: 100%;
    max-width: 120px;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
    margin: 0 auto 4px auto;
}
html.is-desktop .my-m-wechat-zoom {
    position: fixed;
    inset: 0;
    z-index: 970;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
}
html.is-desktop .my-m-wechat-zoom-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    width: 320px;
    text-align: center;
}
html.is-desktop .my-m-wechat-zoom-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}
html.is-desktop .my-m-wechat-zoom-card img {
    display: block;
    width: 260px;
    height: 260px;
    object-fit: contain;
    margin: 0 auto;
}
html.is-desktop .my-m-wechat-zoom-tip {
    font-size: 13px;
    color: #07c160;
    margin: 10px 0 8px 0;
}
html.is-desktop .my-m-wechat-zoom-close {
    border: 0;
    background: #f5f5f5;
    border-radius: 16px;
    height: 32px;
    padding: 0 22px;
    cursor: pointer;
}

/* ---------- 5. 闪烁提示（本次访问首次打开前）+ 提示小气泡（8 秒） ---------- */
.my-chat-callout {
    position: fixed;
    right: 18px;
    bottom: 92px;
    z-index: 965;
    max-width: 220px;
    padding: 9px 13px;
    border-radius: 10px;
    background: #10806f;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
    pointer-events: none;
    white-space: nowrap;
}
.my-chat-callout::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 26px;
    border: 7px solid transparent;
    border-top-color: #10806f;
}
@media (max-width: 1023px) {
    html.is-desktop .my-chat-callout {
        bottom: 158px;
    }
}
html.is-mobile .my-chat-callout {
    right: 6px;
    bottom: calc(130px + env(safe-area-inset-bottom));
    font-size: 12.5px;
}
html.is-mobile .my-chat-callout::after {
    right: 22px;
}
html.is-mobile body:has(.my-order-actions) .my-chat-callout {
    bottom: calc(192px + env(safe-area-inset-bottom));
}
html.is-mobile.my-cat-open .my-chat-callout {
    display: none;
}
@media (prefers-reduced-motion: no-preference) {
    .my-chat-launcher.attention {
        animation: my-chat-pulse 2.4s ease-out infinite;
    }
    @keyframes my-chat-pulse {
        0% { box-shadow: 0 4px 14px rgba(24, 178, 160, 0.45), 0 0 0 0 rgba(31, 190, 140, 0.55); }
        70% { box-shadow: 0 4px 14px rgba(24, 178, 160, 0.45), 0 0 0 16px rgba(31, 190, 140, 0); }
        100% { box-shadow: 0 4px 14px rgba(24, 178, 160, 0.45), 0 0 0 0 rgba(31, 190, 140, 0); }
    }
    .my-chat-callout {
        animation: my-chat-bob 2.4s ease-in-out infinite;
    }
    @keyframes my-chat-bob {
        0%, 100% { transform: translateY(0); }
        50% { transform: translateY(-5px); }
    }
}

/* ---------- 6. 头部"人工"按钮 ---------- */
.my-chat-human {
    flex: none;
    height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.my-chat-human:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ---------- 7. 人工服务卡片：微信客服二维码 + 电话 ---------- */
.my-chat-msg .my-chat-contact {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #d7e6e1;
}
.my-chat-contact-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #333;
}
.my-chat-contact-title i {
    color: #07c160;
    font-size: 18px;
}
.my-chat-contact-tip {
    font-size: 12px;
    color: #888;
    margin: 2px 0 6px 0;
}
.my-chat-contact-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}
.my-chat-contact-grid button {
    border: 1px solid #edf0f3;
    border-radius: 8px;
    background: #fff;
    padding: 4px 2px;
    cursor: pointer;
    font-size: 11.5px;
    color: #444;
    line-height: 1.3;
}
.my-chat-contact-grid img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin-bottom: 2px;
}
.my-chat-contact-line {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 13px;
}
.my-chat-contact-line i {
    width: 14px;
    text-align: center;
    color: #1fae7a;
}
.my-chat-msg .my-chat-contact-line a {
    font-weight: 600;
}
/* 二维码放大层（盖在对话面板内） */
.my-chat-zoom {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}
.my-chat-zoom-card {
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    width: 100%;
    max-width: 300px;
    text-align: center;
}
.my-chat-zoom-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}
.my-chat-zoom-card img {
    display: block;
    width: 100%;
    max-width: 240px;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin: 0 auto;
    -webkit-touch-callout: default;
}
.my-chat-zoom-tip {
    font-size: 13px;
    color: #07c160;
    margin: 8px 0;
}
.my-chat-zoom-card button {
    border: 0;
    background: #f2f4f6;
    border-radius: 16px;
    height: 32px;
    padding: 0 22px;
    cursor: pointer;
}

/* ---------- 8. 底部署名 Designed and Powered by A Plus Studio ---------- */
.my-chat-credit {
    flex: none;
    display: block;
    padding: 0 12px 7px 12px;
    background: #fff;
    text-align: center;
    font-size: 11px;
    line-height: 1.4;
    color: #9aa3ad;
    text-decoration: none;
}
.my-chat-credit strong {
    font-weight: 600;
    color: #6b7580;
}
.my-chat-credit:hover strong {
    color: #1677ff;
    text-decoration: underline;
}
/* 署名紧贴输入框下方：输入区底部留白缩小 */
.my-chat-input {
    padding-bottom: 6px;
}

@media print {
    .my-chat-launcher,
    .my-chat-callout,
    .my-chat-panel,
    .my-m-wechat-fab {
        display: none !important;
    }
}
