.aichat-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    will-change: height;
    transition: height 0.3s ease;
}
.aichat-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft Yahei", sans-serif;
}

@media (min-width: 560px) {
    .aichat-container {
        width: 100%;
        max-width: 420px;
        height: calc(100vh - 40px);
        max-height: 650px;
        border-radius: 16px;
        box-shadow: 0 6px 30px rgba(0, 0, 0, 0.1);
        margin: 20px auto;
        right: 20px;
        bottom: 10px;
        left: auto;
        top: auto;
    }
}

.aichat-header {
    background-color: #409eff;
    color: white;
    padding: 14px 16px;
    padding-top: calc(14px + env(safe-area-inset-top));
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
    position: relative;
}
.aichat-header .aichat-header-close{position: absolute;right: 16px;top: 50%;transform: translateY(-50%);cursor: pointer;}

.aichat-messages {
    flex: 1;
    overflow-y: auto;
    background-color: #f9f9f9;
    scroll-behavior: smooth;
    transition: padding-bottom 0.3s ease;
}

.aichat-messages::-webkit-scrollbar {
    width: 5px;
}

.aichat-messages::-webkit-scrollbar-thumb {
    background-color: #ddd;
    border-radius: 3px;
}

.aichat-messages .aichat-head-image img{width:100%}
.aichat-messages .aichat-message-list{padding: 15px 15px 0;}

.aichat-messages .message {
    margin-bottom: 12px;
    display: flex;
    max-width: 85%;
    align-items: flex-start;
    flex-wrap: nowrap;
}

.aichat-messages .message:last-child {
    margin-bottom: 40px !important;
}

.aichat-messages .ai-message {
    align-self: flex-start;
    flex-direction: row;
}

.aichat-messages .user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
    margin-left: auto;
}

.aichat-messages .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin: 0 8px;
    background-color: #e5e9f2;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: #409eff;
    flex-shrink: 0;
    font-size: 14px;
    overflow: hidden;
}

.aichat-messages .avatar .avatar-img {
    width: 100%;
}

.aichat-messages .ai-avatar {
    background-color: #409eff;
    color: white;
}

.aichat-messages .message-time {
    font-size: 12px;
    margin-top: 3px;
    text-align: right;
}

.aichat-messages .ai-message .message-time {
    color: #999;
}

.aichat-messages .user-message .message-time {
    color: #ddd;
}

.aichat-messages .message-content {
    padding: 9px 14px;
    border-radius: 16px;
    line-height: 1.45;
    font-size: 15px;
    word-wrap: break-word;
    word-break: break-all;
}

.aichat-messages .ai-message .message-content {
    background-color: #e5e9f2;
    color: #333;
    border-top-left-radius: 4px;
}

.aichat-messages .user-message .message-content {
    background-color: #409eff;
    color: white;
    border-top-right-radius: 4px;
}

/* 企业微信卡片样式 */
.aichat-messages .wechat-card {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e8f3ff;
    margin-top: 8px;
    min-width: 180px;
}
.aichat-messages .wechat-card-header {
    background: #409eff;
    color: #fff;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
}
.aichat-messages .wechat-card-body {
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.aichat-messages .wechat-qrcode {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: #f5f7fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #409eff;
    font-size: 12px;
    overflow: hidden;
}
.aichat-messages .wechat-qrcode img {
    width: 100%;
}
.aichat-messages .wechat-card-desc {
    flex: 1;
}
.aichat-messages .wechat-card-title {
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}
.aichat-messages .wechat-card-subtitle {
    font-size: 12px;
    color: #666;
}
.aichat-messages .wechat-card-btn {
    width: 100%;
    padding: 8px 0;
    background: #e8f3ff;
    color: #409eff;
    text-align: center;
    font-size: 14px;
    border: none;
    margin-top: 0;
    cursor: pointer;
    transition: background 0.2s;
}
.aichat-messages .wechat-card-btn:hover {
    background: #d1e7ff;
}

.aichat-input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background-color: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    z-index: 100;
    max-width: 420px;
    margin: 0 auto;
    height: auto;
    min-height: 64px;
    transition: all 0.3s ease;
}

@media (min-width: 560px) {
    .aichat-input-area {
        position: relative;
        width: 100%;
        padding-bottom: 10px;
    }

    .aichat-messages {
        padding-bottom: 0 !important;
    }
}

.aichat-input-area .aichat-message-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e5e9f2;
    border-radius: 24px;
    outline: none;
    font-size: 15px;
    resize: none;
    height: 44px;
    max-height: 120px;
    min-height: 44px;
    overflow: hidden;
}

.aichat-input-area .aichat-send-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: #409eff;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.loading {
    display: flex;
    gap: 3px;
    padding: 6px 10px;
}

.loading-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #409eff;
    animation: bounce 1s infinite alternate;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    from {
        transform: translateY(2px);
    }

    to {
        transform: translateY(-2px);
    }
}

.error-message {
    color: #f56c6c;
    text-align: center;
    padding: 6px;
    font-size: 13px;
}
.aichat-button-flotbottom{
    position: fixed;
    bottom: 10px;
    z-index: 9999999;
    width: 100%;
    text-align: center;
    max-height: 100px;
}
.aichat-button-flotbottom img{max-width: 100%;}