/* ==========================================================================
   智诚五八零 · AI 智能客服挂件
   页面最右侧、略高于中间的位置放一个悬浮入口，点开是聊天面板。
   颜色沿用站点深蓝主色，两套主题（深蓝 / 浅色）都能看。
   ========================================================================== */

.zc-ai-widget {
    /* JS 加载成功后才加上 zc-ai-ready，避免禁用 JS 时出现点不动的按钮 */
    display: none;
    position: relative;
    z-index: 10000;
    font-family: "Microsoft YaHei", "PingFang SC", -apple-system, "Helvetica Neue", Arial, sans-serif;
}

.zc-ai-widget.zc-ai-ready {
    display: block;
}

/* ---------- 悬浮入口 ---------- */
.zc-ai-launcher {
    position: fixed;
    right: 18px;
    top: 42%;
    transform: translateY(-50%);
    width: 66px;
    height: 66px;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #2f7bff 0%, #00c2ff 100%);
    box-shadow: 0 8px 24px rgba(0, 78, 190, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
    transition: transform .25s ease, box-shadow .25s ease, opacity .2s ease;
    z-index: 10001;
    -webkit-tap-highlight-color: transparent;
}

.zc-ai-launcher:hover {
    transform: translateY(-50%) scale(1.06);
    box-shadow: 0 12px 30px rgba(0, 78, 190, 0.45);
}

.zc-ai-launcher svg {
    margin-bottom: 1px;
}

.zc-ai-launcher-text {
    font-size: 11px;
    letter-spacing: .5px;
}

.zc-ai-launcher-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 11px;
    background: #ff5a3c;
    color: #fff;
    font-size: 11px;
    line-height: 22px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(255, 90, 60, .5);
}

.zc-ai-launcher-badge::after {
    content: "";
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    border-radius: 11px;
    background: rgba(255, 90, 60, .45);
    animation: zcAiPulse 1.8s infinite;
}

@keyframes zcAiPulse {
    0% { transform: scale(1); opacity: .8; }
    70% { transform: scale(1.9); opacity: 0; }
    100% { transform: scale(1.9); opacity: 0; }
}

/* 面板打开后收起入口的呼吸动画 */
.zc-ai-widget.zc-ai-open .zc-ai-launcher-badge::after {
    display: none;
}

/* ---------- 聊天面板 ---------- */
.zc-ai-panel {
    position: fixed;
    right: 18px;
    top: 50%;
    transform: translateY(-50%) scale(.96);
    width: 384px;
    max-width: calc(100vw - 24px);
    height: 580px;
    max-height: 78vh;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 18px 60px rgba(6, 32, 82, .28);
    border: 1px solid rgba(0, 90, 200, .12);
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, transform .22s ease, visibility .22s;
    z-index: 10002;
}

.zc-ai-widget.zc-ai-open .zc-ai-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
}

/* 头部 */
.zc-ai-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 13px;
    background: linear-gradient(135deg, #1b63d6 0%, #0e9fe0 100%);
    color: #fff;
}

.zc-ai-head-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.zc-ai-head-text {
    flex: 1 1 auto;
    min-width: 0;
}

.zc-ai-head-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.zc-ai-head-state {
    font-size: 12px;
    opacity: .9;
    margin-top: 2px;
}

.zc-ai-head-state i {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #7dffb2;
    margin-right: 5px;
    vertical-align: 1px;
}

.zc-ai-close {
    border: 0;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 26px;
    cursor: pointer;
    flex: 0 0 auto;
}

.zc-ai-close:hover {
    background: rgba(255, 255, 255, .3);
}

/* 消息区 */
.zc-ai-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 12px 6px;
    background: #f4f7fc;
    -webkit-overflow-scrolling: touch;
}

.zc-ai-body::-webkit-scrollbar {
    width: 6px;
}

.zc-ai-body::-webkit-scrollbar-thumb {
    background: rgba(0, 60, 140, .18);
    border-radius: 3px;
}

.zc-ai-msg {
    margin-bottom: 12px;
    display: flex;
}

.zc-ai-msg-bot {
    justify-content: flex-start;
}

.zc-ai-msg-user {
    justify-content: flex-end;
}

.zc-ai-bubble {
    max-width: 84%;
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.72;
    word-break: break-word;
    white-space: normal;
}

.zc-ai-msg-bot .zc-ai-bubble {
    background: #fff;
    color: #23324d;
    border: 1px solid rgba(0, 80, 180, .08);
    border-top-left-radius: 3px;
    box-shadow: 0 2px 8px rgba(20, 60, 120, .06);
}

.zc-ai-msg-user .zc-ai-bubble {
    background: linear-gradient(135deg, #2f7bff, #1a5fd6);
    color: #fff;
    border-top-right-radius: 3px;
}

.zc-ai-bubble strong {
    font-weight: 700;
}

.zc-ai-bubble code {
    background: rgba(0, 60, 140, .08);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 13px;
}

.zc-ai-msg-user .zc-ai-bubble code {
    background: rgba(255, 255, 255, .22);
}

/* 快捷问题 */
.zc-ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 2px 0 10px;
}

.zc-ai-chip {
    border: 1px solid rgba(0, 100, 210, .28);
    background: #fff;
    color: #1a5fd6;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all .18s ease;
}

.zc-ai-chip:hover {
    background: #2f7bff;
    border-color: #2f7bff;
    color: #fff;
}

/* 正在输入 */
.zc-ai-typing .zc-ai-bubble {
    padding: 12px 16px;
}

.zc-ai-typing i {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 1.5px;
    border-radius: 50%;
    background: #7d90ad;
    animation: zcAiBlink 1.2s infinite ease-in-out;
}

.zc-ai-typing i:nth-child(2) { animation-delay: .2s; }
.zc-ai-typing i:nth-child(3) { animation-delay: .4s; }

@keyframes zcAiBlink {
    0%, 80%, 100% { transform: translateY(0); opacity: .45; }
    40% { transform: translateY(-4px); opacity: 1; }
}

/* 底部 */
.zc-ai-foot {
    flex: 0 0 auto;
    background: #fff;
    border-top: 1px solid #e6ecf6;
    padding: 10px 12px 9px;
}

.zc-ai-input {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.zc-ai-quote {
    flex: 0 0 auto;
    height: 36px;
    padding: 0 13px;
    border: 0;
    border-radius: 18px;
    background: linear-gradient(135deg, #ff9f43, #ff6b35);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(255, 107, 53, .35);
}

.zc-ai-quote:hover {
    filter: brightness(1.06);
}

.zc-ai-field {
    flex: 1 1 auto;
    min-width: 0;
    height: 36px;
    max-height: 96px;
    padding: 8px 11px;
    border: 1px solid #d6e0f0;
    border-radius: 18px;
    outline: none;
    font-size: 14px;
    line-height: 1.4;
    color: #23324d;
    background: #f7f9fd;
    resize: none;
    overflow-y: auto;
    font-family: inherit;
}

.zc-ai-field:focus {
    border-color: #2f7bff;
    background: #fff;
}

.zc-ai-send {
    flex: 0 0 auto;
    height: 36px;
    padding: 0 15px;
    border: 0;
    border-radius: 18px;
    background: linear-gradient(135deg, #2f7bff, #1a5fd6);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.zc-ai-send:hover {
    filter: brightness(1.07);
}

.zc-ai-tip {
    margin-top: 8px;
    font-size: 11.5px;
    color: #8a99b3;
    text-align: center;
    line-height: 1.5;
}

.zc-ai-tip a {
    color: #1a5fd6;
    text-decoration: none;
}

/* 报价表单 */
.zc-ai-form {
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid #e2e9f5;
    border-radius: 12px;
    background: #f7f9fd;
}

.zc-ai-form-title {
    font-size: 14px;
    font-weight: 700;
    color: #23324d;
    margin-bottom: 9px;
}

.zc-ai-select,
.zc-ai-textarea {
    width: 100%;
    border: 1px solid #d6e0f0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13.5px;
    color: #23324d;
    background: #fff;
    outline: none;
    font-family: inherit;
}

.zc-ai-select {
    margin-bottom: 8px;
    height: 36px;
}

.zc-ai-textarea {
    resize: none;
    line-height: 1.6;
}

.zc-ai-select:focus,
.zc-ai-textarea:focus {
    border-color: #2f7bff;
}

.zc-ai-form-btns {
    margin-top: 9px;
    display: flex;
    gap: 8px;
}

.zc-ai-btn-primary {
    flex: 1 1 auto;
    height: 34px;
    border: 0;
    border-radius: 17px;
    background: linear-gradient(135deg, #2f7bff, #1a5fd6);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.zc-ai-btn-ghost {
    flex: 0 0 auto;
    height: 34px;
    padding: 0 16px;
    border: 1px solid #d6e0f0;
    border-radius: 17px;
    background: #fff;
    color: #5b6b85;
    font-size: 14px;
    cursor: pointer;
}

.zc-ai-btn-primary:hover {
    filter: brightness(1.07);
}

/* 报价结果卡片 */
.zc-ai-quote-card {
    margin-top: 8px;
    border: 1px solid #ffd9b8;
    background: #fff8f0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.7;
    color: #7a4a15;
}

.zc-ai-quote-card .zc-ai-quote-item {
    padding: 6px 0;
    border-bottom: 1px dashed #ffd9b8;
}

.zc-ai-quote-card .zc-ai-quote-item:last-child {
    border-bottom: 0;
}

.zc-ai-quote-card b {
    color: #e2610c;
}

/* ---------- 移动端 ---------- */
@media screen and (max-width: 768px) {
    .zc-ai-launcher {
        right: 12px;
        top: auto;
        bottom: 70px;
        transform: none;
        width: 54px;
        height: 54px;
    }

    .zc-ai-launcher:hover {
        transform: scale(1.06);
    }

    .zc-ai-launcher-text {
        font-size: 10px;
    }

    .zc-ai-launcher svg {
        width: 24px;
        height: 24px;
    }

    .zc-ai-panel {
        right: 0;
        left: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        transform: translateY(14px);
    }

    .zc-ai-widget.zc-ai-open .zc-ai-panel {
        transform: translateY(0);
    }
}
