/* ========== 悬浮按钮 ========== */
#zke-chat-floating-btn {
    position: fixed;
    right: 18px;
    bottom: 22px;
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #4f8dff, #1d60f0);
    box-shadow: 0 10px 26px rgba(0,0,0,0.35);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
}

/* SVG 图标 */
.chat-icon {
    width: 28px;
    height: 28px;
    display: block;
}

/* ========== 聊天窗口整体 ========== */
#zke-chat-window {
    position: fixed;
    right: 18px;
    bottom: 86px;
    width: 360px;
    max-width: calc(100% - 32px);
    height: 520px;
    max-height: 80vh;
    background: #ffffff;
    color: #222;
    border-radius: 18px;
    box-shadow: 0 20px 40px rgba(15,23,42,0.40);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,Arial;
}

/* ========== 头部 ========== */
#zke-chat-header {
    padding: 10px 12px 8px;
    background: linear-gradient(135deg, #f7f9ff 0%, #eef2ff 45%, #f9fafb 100%);
    border-bottom: 1px solid #e2e4ea;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
}

#zke-chat-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

#zke-chat-avatar {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #4f8dff, #1d60f0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

#zke-chat-title-wrap {
    display: flex;
    flex-direction: column;
}

#zke-chat-title {
    font-weight: 600;
    font-size: 13px;
    color: #111827;
}

#zke-chat-subtitle {
    font-size: 11px;
    color: #6b7280;
}

#zke-chat-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.zke-chat-header-link {
    font-size: 13px;
    color: #2563eb;
    cursor: pointer;
    padding: 3px 6px;
}
.zke-chat-header-link:hover {
    background: rgba(37,99,235,0.12);
}

.zke-chat-close {
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #9ca3af;
    padding: 2px 4px;
    border-radius: 999px;
}
.zke-chat-close:hover {
    background: rgba(148,163,184,0.2);
}

/* ========== 主体区：中间内容 + 底部快捷栏 ========== */
#zke-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: 13px;
    min-height: 0;   /* 允许内部滚动 */
}

/* ------- 新会话视图 ------- */
#zke-chat-new-session {
    padding: 10px 14px 12px;
    overflow-y: auto;
    flex: 1;        /* 把中间区域撑满 */
    min-height: 0;
}

.zke-field {
    margin-bottom: 10px;
}
.zke-label {
    font-size: 12px;
    color: #4b5563;
    margin-bottom: 3px;
}
.zke-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 10px;
    border-radius: 4px;
    border: 1px solid #f5f5f7;
    font-size: 13px;
    background: #f5f5f7;
}
.zke-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37,99,235,0.15);
    background: #ffffff;
}
.zke-placeholder {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

.zke-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 4px;
    border: none;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.zke-btn-primary {
    background: #2563eb;
    color: #fff;
}
.zke-btn-primary:disabled {
    background: #93c5fd;
    cursor: default;
}

/* 历史会话 */
#zke-chat-history {
    border-top: 1px dashed #e5e7eb;
    margin-top: 10px;
    padding-top: 8px;
}
#zke-chat-history-title {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#zke-chat-history-list {
    max-height: 130px;
    overflow-y: auto;
}
.zke-history-item {
    padding: 8px 7px;
    border-radius: 5px;
    border: 1px solid #f5f5f7;
    margin-bottom: 4px;
    cursor: pointer;
    background: #f5f5f7;
}
.zke-history-item:hover {
    background: #eef2ff;
}
.zke-history-main {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
}
.zke-history-sub {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 1px;
}

/* ------- 聊天视图 ------- */
#zke-chat-conversation {
    flex: 1;
    display: none;       /* 默认隐藏，JS 切换显示 */
    flex-direction: column;
    border-top: 1px solid #e5e7eb;
    min-height: 0;
}

/* 消息区 */
#zke-chat-messages {
    flex: 1;
    padding: 10px 10px 8px;
    background: #f3f4f6;
    min-height: 0;
    overflow-y: auto;
}

/* 单条消息行 */
.zke-msg-row {
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
}

/* 对齐方式 */
.zke-msg-user {
    align-items: flex-end;
}
.zke-msg-ai {
    align-items: flex-start;
}

/* 时间信息 */
.zke-msg-meta {
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 2px;
}
.zke-msg-meta-user {
    text-align: right;
}
.zke-msg-meta-ai {
    text-align: left;
}

/* 气泡 */
.zke-msg-bubble {
    max-width: 82%;
    padding: 7px 9px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    max-height: 180px;
    overflow-y: auto;
}

/* 用户气泡（右） */
.zke-msg-bubble-user {
    background: #2563eb;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* AI 气泡（左） */
.zke-msg-bubble-ai {
    background: #ffffff;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

/* 图片消息 */
.zke-msg-bubble img {
    max-width: 220px;
    max-height: 220px;
    border-radius: 10px;
    display: block;
}

/* Typing 机器人正在输入 */
#zke-typing {
    font-size: 11px;
    color: #9ca3af;
    margin: 4px 4px 6px;
}

/* 输入区 */
#zke-chat-input-area {
    border-top: 1px solid #e5e7eb;
    padding: 8px 8px 10px;
    background: linear-gradient(180deg,#f9fafb 0%,#f3f4f6 100%);
    box-shadow: 0 -4px 10px rgba(15,23,42,0.03);
}
#zke-chat-input {
    width: 100%;
    box-sizing: border-box;
    border-radius: 12px;
    border: 1px solid #d4d7e0;
    padding: 8px 12px;
    font-size: 13px;
    resize: none;
    min-height: 40px;
    max-height: 80px;
    line-height: 1.4;
    background: #f9fafb;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
#zke-chat-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37,99,235,0.15);
    background: #ffffff;
}
#zke-chat-input-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    font-size: 11px;
    color: #9ca3af;
}

/* 工具栏左右区域 */
.zke-toolbar-left {
    display: flex;
    align-items: center;
    gap: 6px;
}
.zke-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

#zke-chat-send-btn {
    padding: 4px 12px;
    font-size: 12px;
}

/* 上传图标 */
.zke-upload-icon {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    font-size: 14px;
}
.zke-upload-icon:hover {
    border-color: #cbd5f5;
    background: #eef2ff;
    color: #2563eb;
}

/* ========== 底部横排快捷入口（简约极简版） ========== */
#zke-bottom-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px 4px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}

/* 按钮：扁平 + 文字浅灰 */
.zke-bottom-btn {
    flex: 1;
    border: none;
    padding: 6px 0 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;

}

/* SVG 容器 */
.zke-bottom-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
}

/* 统一控制 svg 颜色和大小：用 currentColor，跟随文字颜色 */
.zke-bottom-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.zke-bottom-text {
    line-height: 1.2;
}

/* hover：轻微底色 + icon + 文字一起变蓝 */
.zke-bottom-btn:hover {
    color: #2563eb;
}

.zke-bottom-btn:hover .zke-bottom-icon svg {
    transform: translateY(-1px);
}

/* 窄屏下点击区域稍大一点 */
@media (max-width: 480px) {
    .zke-bottom-btn {
        padding: 8px 0 6px;
        font-size: 12px;
    }
}

/* ========== 提现催单弹窗 ========== */
#zke-withdraw-modal {
    display: none;                /* 默认隐藏，JS 打开时设为 flex */
    position: absolute;
    inset: 0;                     /* 仅覆盖聊天窗口区域 */
    z-index: 50;                  /* 高于窗口内部其他元素即可 */
    align-items: center;
    justify-content: center;
}

#zke-withdraw-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,0.45);
}

#zke-withdraw-panel {
    position: relative;
    width: 320px;
    max-width: calc(100% - 40px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15,23,42,0.35);
    padding: 14px 14px 12px;
    display: flex;
    flex-direction: column;
    z-index: 10001;
}

.zke-withdraw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.zke-withdraw-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}
.zke-withdraw-close {
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #9ca3af;
    padding: 2px 4px;
    border-radius: 999px;
}
.zke-withdraw-close:hover {
    background: rgba(148,163,184,0.18);
}

.zke-withdraw-body {
    padding-top: 4px;
    padding-bottom: 4px;
}

.zke-withdraw-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

/* ========== 响应式：手机端 Bottom Sheet ========== */
@media (max-width: 480px) {
    #zke-chat-window {
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        height: 70vh;
        max-height: 70vh;
        border-radius: 16px 16px 0 0;
    }

    .zke-bottom-btn {
        padding: 8px 0 6px;
        font-size: 12px;
    }

    #zke-withdraw-panel {
        width: 92%;
        max-width: 92%;
    }
}