/* 聊天界面样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: white;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    /* 隐藏body的滚动条 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

body::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.chat-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    height: 100vh;
    background: white;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
}

.chat-header {
    background: white;
    color: #1a202c;
    padding: 20px 0;
    text-align: center;
    flex-shrink: 0;
}

.chat-header h2 {
    font-size: 1.2rem;
    margin-bottom: 4px;
    font-weight: 500;
    color: #2d3748;
}

.chat-header h3 {
    font-size: 0.9rem;
    color: #718096;
    font-weight: 400;
}

.chat-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    /* 隐藏滚动条但保持滚动功能 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    min-height: 0;
}

.chat-messages {
    padding: 20px 0;
}

.chat-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* 确保所有可能的滚动容器都隐藏滚动条 */
html {
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html::-webkit-scrollbar {
    display: none;
}

.donate-footer {
    padding: 40px 0 40px 0;
    margin-top: 40px;
}

.donate-iframe {
    width: 100%;
    height: 200px;
    border: none;
    display: block;
    border-radius: 12px;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    color: #718096;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    background-image: url(../loading.svg);
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    margin-bottom: 12px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 0.9rem;
    color: #a0aec0;
}

/* BotUI 样式优化 */
.botui-container {
    background: transparent !important;
    font-family: inherit !important;
}

.botui-messages-container {
    padding: 0 !important;
    background: transparent !important;
}

.botui-message {
    margin-bottom: 15px !important;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.botui-message-content {
    background: #f8f9fa !important;
    border-radius: 16px !important;
    padding: 12px 16px !important;
    box-shadow: none !important;
    border: none !important;
    max-width: 75% !important;
    color: #2d3748 !important;
}

.botui-message-content.human {
    background: #007bff !important;
    color: white !important;
    margin-left: auto !important;
    border: none !important;
}

.botui-actions-container {
    padding: 15px 0 !important;
    background: transparent !important;
}

.botui-actions-buttons {
    display: flex !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
}

.botui-actions-buttons-button {
    background: #007bff !important;
    color: white !important;
    border: none !important;
    border-radius: 20px !important;
    padding: 10px 20px !important;
    font-size: 0.9rem !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
    box-shadow: none !important;
}

.botui-actions-buttons-button:hover {
    background: #0056b3 !important;
    transform: none !important;
    box-shadow: none !important;
}

.botui-actions-text-input {
    border: none !important;
    border-radius: 20px !important;
    padding: 12px 16px !important;
    font-size: 1rem !important;
    outline: none !important;
    background: #f8f9fa !important;
    width: 100% !important;
}

.botui-actions-text-input:focus {
    background: #e9ecef !important;
    box-shadow: none !important;
}

/* 自定义滚动行为 */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-container {
        padding: 15px;
    }

    .chat-header {
        padding: 15px 0;
    }

    .chat-header h2 {
        font-size: 1.1rem;
    }

    .chat-header h3 {
        font-size: 0.85rem;
    }

.chat-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    scroll-behavior: smooth; /* 平滑滚动 */
    /* 隐藏滚动条但保持滚动功能 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    /* 移动端滚动优化 */
    -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
    overscroll-behavior: contain; /* 防止滚动链 */
}

.chat-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* 移动端特殊处理 */
@media (max-width: 768px) {
    .chat-content {
        /* 移动端更强制的滚动设置 */
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
        transform: translateZ(0); /* 启用硬件加速 */
    }
}

    .donate-iframe {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .chat-container {
        padding: 10px;
    }

    .chat-content {
        padding: 10px 0;
    }

    .botui-message-content {
        max-width: 90% !important;
    }

    .donate-iframe {
        height: 120px;
    }
}