/* =========================================================
   星启辰航 · 右下角悬浮咨询框
   ========================================================= */
.xqch-chat {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    font-family: inherit;
    --xq-primary: #FF6A00;
    --xq-primary-2: #FF8C42;
}

/* 悬浮按钮 */
.xqch-chat-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 52px;
    padding: 0 20px 0 16px;
    border: none;
    border-radius: 26px;
    background: linear-gradient(135deg, var(--xq-primary) 0%, var(--xq-primary-2) 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255, 106, 0, .38);
    transition: transform .22s ease, box-shadow .22s ease;
}
.xqch-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(255, 106, 0, .48);
}
.xqch-chat-btn:active { transform: translateY(0); }
.xqch-chat-btn-icon {
    display: inline-flex;
    width: 22px;
    height: 22px;
}
.xqch-chat-btn-icon svg { width: 22px; height: 22px; display: block; }

/* 呼吸光圈 */
.xqch-chat-btn::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 30px;
    border: 2px solid rgba(255, 106, 0, .45);
    animation: xqchPulse 2.4s ease-out infinite;
    pointer-events: none;
}
@keyframes xqchPulse {
    0%   { transform: scale(1);    opacity: .55; }
    70%  { transform: scale(1.18); opacity: 0; }
    100% { transform: scale(1.18); opacity: 0; }
}
.xqch-chat.open .xqch-chat-btn::before { animation: none; opacity: 0; }

/* 未读小红点 */
.xqch-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #F5453D;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}
.xqch-chat.open .xqch-chat-badge,
.xqch-chat.seen .xqch-chat-badge { display: none; }

/* 对话框面板 */
.xqch-chat-panel {
    position: absolute;
    right: 0;
    bottom: 68px;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 18px 48px rgba(16, 24, 40, .18);
    overflow: hidden;
    transform-origin: bottom right;
    animation: xqchPop .22s ease;
}
.xqch-chat-panel[hidden] { display: none; }
@keyframes xqchPop {
    from { opacity: 0; transform: translateY(10px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.xqch-chat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--xq-primary) 0%, var(--xq-primary-2) 100%);
    color: #fff;
}
.xqch-chat-head strong { display: block; font-size: 15px; line-height: 1.3; }
.xqch-chat-head span { display: block; font-size: 12px; opacity: .9; margin-top: 2px; }
.xqch-chat-avatar {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .22);
    border: 1px solid rgba(255, 255, 255, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
}
.xqch-chat-head > div:nth-child(2) { flex: 1 1 auto; min-width: 0; }
.xqch-chat-close {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.xqch-chat-close:hover { background: rgba(255, 255, 255, .34); }

.xqch-chat-body { padding: 14px 16px 16px; }
.xqch-chat-tip {
    background: #FFF5EE;
    border: 1px solid #FFE0CC;
    color: #8A4B15;
    font-size: 13px;
    line-height: 1.6;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.xqch-chat-form input,
.xqch-chat-form textarea {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid #E4E7EC;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: #1D2939;
    background: #fff;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.xqch-chat-form textarea { resize: none; line-height: 1.5; }
.xqch-chat-form input:focus,
.xqch-chat-form textarea:focus {
    border-color: var(--xq-primary);
    box-shadow: 0 0 0 3px rgba(255, 106, 0, .12);
}
.xqch-chat-form input::placeholder,
.xqch-chat-form textarea::placeholder { color: #98A2B3; }

.xqch-chat-submit {
    width: 100%;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--xq-primary) 0%, var(--xq-primary-2) 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .18s ease;
}
.xqch-chat-submit:hover { opacity: .92; }
.xqch-chat-submit[disabled] { opacity: .6; cursor: not-allowed; }

.xqch-chat-foot {
    margin: 10px 0 0;
    font-size: 12px;
    color: #667085;
    text-align: center;
}
.xqch-chat-foot a { color: var(--xq-primary); text-decoration: none; }

.xqch-chat-err {
    margin: -4px 0 10px;
    font-size: 12px;
    color: #D92D20;
    min-height: 0;
}

/* 成功态 */
.xqch-chat-done { text-align: center; padding: 14px 0 6px; }
.xqch-chat-done[hidden] { display: none; }
.xqch-chat-done-icon {
    width: 46px;
    height: 46px;
    margin: 0 auto 10px;
    border-radius: 50%;
    background: #ECFDF3;
    color: #12B76A;
    font-size: 24px;
    line-height: 46px;
}
.xqch-chat-done p { margin: 0 0 4px; font-size: 14px; color: #344054; }
.xqch-chat-again {
    margin-top: 10px;
    padding: 8px 18px;
    border: 1px solid var(--xq-primary);
    border-radius: 20px;
    background: #fff;
    color: var(--xq-primary);
    font-size: 13px;
    cursor: pointer;
}
.xqch-chat-again:hover { background: #FFF5EE; }

/* 移动端 */
@media (max-width: 768px) {
    .xqch-chat { right: 16px; bottom: 16px; }
    .xqch-chat-btn { height: 46px; padding: 0 16px 0 14px; font-size: 14px; }
    .xqch-chat-panel {
        width: calc(100vw - 32px);
        right: 0;
        bottom: 60px;
    }
}
