@charset "UTF-8";
/* ==========================================================================
   在线咨询聊天窗
   与官网同一套设计语言：深海军蓝 × 黄铜金、宋体标题、细金线。
   仅在前台使用，独立于 front.css，便于单独调整聊天窗而不动整站样式。
   ========================================================================== */

.chat-widget {
    --chat-navy: #16264a;
    --chat-navy-ink: #0e1a30;
    --chat-brass: #8f6d3b;
    --chat-brass-deep: #6d5228;
    --chat-gold: #b8945f;
    --chat-line: #e6e1d8;
    --chat-text: #26313f;
    --chat-muted: #5f6b7c;
    --chat-paper: #fbfaf7;
    position: fixed;
    right: 26px;
    bottom: 88px;
    z-index: 880;
    font-family: inherit;
}

/* ---------- 悬浮球 ---------- */
.chat-launcher {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    color: var(--chat-gold);
    background: linear-gradient(150deg, var(--chat-navy), var(--chat-navy-ink));
    border: 1px solid rgba(184, 148, 95, .45);
    border-radius: 50%;
    box-shadow: 0 14px 34px rgba(14, 26, 48, .28);
    cursor: pointer;
    transition: transform .3s cubic-bezier(.22, .61, .36, 1), box-shadow .3s cubic-bezier(.22, .61, .36, 1);
}
.chat-launcher svg { width: 26px; height: 26px; }
.chat-launcher:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(14, 26, 48, .34); }
.chat-launcher::after {
    content: "";
    position: absolute;
    inset: -6px;
    border: 1px solid rgba(184, 148, 95, .35);
    border-radius: 50%;
    animation: chat-pulse 2.8s ease-out infinite;
}
@keyframes chat-pulse {
    0% { transform: scale(.9); opacity: .9; }
    70% { transform: scale(1.16); opacity: 0; }
    100% { opacity: 0; }
}
.chat-widget.is-open .chat-launcher { display: none; }

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    padding: 0 6px;
    font-size: 12px;
    line-height: 20px;
    color: #fff;
    text-align: center;
    background: #c0392b;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(192, 57, 43, .4);
}
.chat-badge[hidden] { display: none; }

/* ---------- 面板 ---------- */
.chat-panel {
    display: flex;
    flex-direction: column;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 120px);
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--chat-line);
    border-radius: 10px;
    box-shadow: 0 26px 60px rgba(10, 19, 34, .24);
    animation: chat-rise .3s cubic-bezier(.22, .61, .36, 1);
}
.chat-panel[hidden] { display: none; }
@keyframes chat-rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

.chat-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    color: #fff;
    background:
        radial-gradient(320px 120px at 90% 0%, rgba(184, 148, 95, .26), transparent 62%),
        linear-gradient(120deg, var(--chat-navy-ink), var(--chat-navy));
    border-bottom: 1px solid rgba(184, 148, 95, .3);
}
.chat-header-text { flex: 1 1 auto; min-width: 0; }
.chat-header-text strong {
    display: block;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
    font-size: 17px;
    letter-spacing: .1em;
}
.chat-header-text small {
    font-size: 10px;
    letter-spacing: .26em;
    color: rgba(216, 189, 139, .85);
}
.chat-header-state { flex: 0 0 auto; font-size: 12px; color: #b9c5db; }
.chat-header-state .dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 5px;
    border-radius: 50%;
    background: #7f8c9c;
}
.chat-header-state.is-online .dot { background: #4caf7d; box-shadow: 0 0 0 3px rgba(76, 175, 125, .22); }
.chat-close {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    font-size: 20px;
    line-height: 1;
    color: #b9c5db;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: color .25s;
}
.chat-close:hover { color: #fff; }

.chat-body { position: relative; flex: 1 1 auto; overflow-y: auto; background: var(--chat-paper); }

/* ---------- 咨询前确认 ---------- */
.chat-gate { padding: 26px 22px; text-align: center; }
.chat-gate-title {
    margin-bottom: 12px;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", serif;
    font-size: 17px;
    letter-spacing: .08em;
    color: var(--chat-navy);
}
.chat-gate-text {
    padding: 14px 16px;
    margin-bottom: 18px;
    font-size: 13.5px;
    line-height: 1.9;
    color: var(--chat-muted);
    text-align: left;
    background: #fff;
    border-left: 3px solid var(--chat-gold);
    border-radius: 0 6px 6px 0;
}
.chat-gate-tip { margin: 14px 0 0; font-size: 12px; color: var(--chat-muted); }

/* ---------- 消息 ---------- */
.chat-messages { padding: 18px 16px 8px; }
.chat-msg { display: flex; margin-bottom: 14px; }
.chat-msg-body { max-width: 78%; }
.chat-msg-meta { margin-bottom: 4px; font-size: 11px; color: var(--chat-muted); }
.chat-msg-text {
    padding: 10px 13px;
    font-size: 14px;
    line-height: 1.75;
    color: var(--chat-text);
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    background: #fff;
    border: 1px solid var(--chat-line);
    border-radius: 10px 10px 10px 2px;
}
.chat-msg-image img {
    display: block;
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--chat-line);
    cursor: zoom-in;
}
/* 访客自己发的消息靠右，深蓝底 */
.chat-msg.is-self { justify-content: flex-end; }
.chat-msg.is-self .chat-msg-body { text-align: right; }
.chat-msg.is-self .chat-msg-text {
    color: #fff;
    text-align: left;
    background: linear-gradient(140deg, var(--chat-navy), var(--chat-navy-ink));
    border-color: var(--chat-navy-ink);
    border-radius: 10px 10px 2px 10px;
}
.chat-msg.is-self .chat-msg-image img { margin-left: auto; }
/* 系统提示居中 */
.chat-msg.is-system { justify-content: center; }
.chat-msg.is-system .chat-msg-body { max-width: 92%; }
.chat-msg.is-system .chat-msg-text {
    padding: 7px 12px;
    font-size: 12.5px;
    color: var(--chat-muted);
    text-align: center;
    background: rgba(184, 148, 95, .1);
    border-color: transparent;
    border-radius: 20px;
}
.chat-typing { margin: 0 0 12px; font-size: 12px; color: var(--chat-muted); }

/* ---------- 留言表单 ---------- */
.chat-leave { padding: 20px 20px 24px; }
.chat-leave-tip {
    padding: 10px 12px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.8;
    color: var(--chat-muted);
    background: rgba(184, 148, 95, .1);
    border-left: 3px solid var(--chat-gold);
    border-radius: 0 6px 6px 0;
}
.chat-field { display: block; margin-bottom: 12px; }
.chat-field > span { display: block; margin-bottom: 5px; font-size: 13px; color: var(--chat-navy); }
.chat-field em { font-style: normal; color: #c0392b; }
.chat-field input,
.chat-field textarea {
    width: 100%;
    padding: 9px 11px;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--chat-text);
    background: #fff;
    border: 1px solid var(--chat-line);
    border-radius: 6px;
    resize: vertical;
    transition: border-color .25s, box-shadow .25s;
}
.chat-field input:focus,
.chat-field textarea:focus {
    outline: none;
    border-color: var(--chat-gold);
    box-shadow: 0 0 0 3px rgba(184, 148, 95, .14);
}
.chat-link {
    display: block;
    width: 100%;
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--chat-muted);
    background: none;
    border: 0;
    cursor: pointer;
}
.chat-link:hover { color: var(--chat-brass); }

/* ---------- 输入区 ---------- */
.chat-footer {
    padding: 10px 14px 12px;
    background: #fff;
    border-top: 1px solid var(--chat-line);
}
.chat-footer[hidden] { display: none; }
.chat-tools { display: flex; gap: 14px; margin-bottom: 8px; }
.chat-tool {
    padding: 0;
    font-size: 12.5px;
    color: var(--chat-muted);
    background: none;
    border: 0;
    cursor: pointer;
    transition: color .25s;
}
.chat-tool:hover { color: var(--chat-brass); }
.chat-input-row { display: flex; gap: 10px; align-items: flex-end; }
.chat-input {
    flex: 1 1 auto;
    max-height: 96px;
    padding: 9px 11px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: var(--chat-text);
    background: #fff;
    border: 1px solid var(--chat-line);
    border-radius: 6px;
    resize: none;
    transition: border-color .25s, box-shadow .25s;
}
.chat-input:focus {
    outline: none;
    border-color: var(--chat-gold);
    box-shadow: 0 0 0 3px rgba(184, 148, 95, .14);
}
.chat-send {
    flex: 0 0 auto;
    padding: 9px 18px;
    font-size: 14px;
    letter-spacing: .06em;
    color: #fff;
    background: linear-gradient(135deg, var(--chat-brass), var(--chat-brass-deep));
    border: 1px solid rgba(216, 189, 139, .5);
    border-radius: 6px;
    cursor: pointer;
    transition: transform .25s, box-shadow .25s, opacity .25s;
}
.chat-send:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(109, 82, 40, .3); }
.chat-send:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.chat-note { margin: 8px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--chat-muted); }
.chat-note.is-error { color: #c0392b; }

/* 已结束会话：输入区置灰 */
.chat-widget.is-ended .chat-footer { display: none; }
.chat-ended-tip {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--chat-muted);
    text-align: center;
    background: #fff;
    border-top: 1px solid var(--chat-line);
}

/* ---------- 全屏咨询页（/consult）---------- */
/* 页面内联版本：跟随文档流，居中并限制宽度，避免聊天区被拉得过宽 */
.chat-widget[data-mode="page"] {
    position: static;
    right: auto;
    bottom: auto;
    max-width: 780px;
    margin: 0 auto 40px;
    padding: 0 16px;
}
.chat-widget[data-mode="page"] .chat-launcher { display: none; }
.chat-widget[data-mode="page"] .chat-panel {
    width: 100%;
    height: 620px;
    max-height: none;
    box-shadow: 0 18px 44px rgba(10, 19, 34, .14);
}
.chat-widget[data-mode="page"] .chat-msg-body { max-width: 68%; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
    .chat-widget { right: 14px; bottom: 76px; }
    .chat-launcher { width: 50px; height: 50px; }
    .chat-launcher svg { width: 23px; height: 23px; }
    /* 手机端聊天窗占满屏幕，避免小屏下气泡被压缩得难以阅读 */
    .chat-panel {
        position: fixed;
        inset: 0;
        width: auto;
        height: auto;
        max-height: none;
        border: 0;
        border-radius: 0;
    }
    .chat-widget[data-mode="page"] .chat-panel { height: calc(100vh - 200px); }
    .chat-msg-body { max-width: 84%; }
}
