:root {
    --button-size: 40px;
    --button-gap: 20px;
    --button-color: rgba(234, 127, 185, 0.9);
    --button-hover-color: rgba(234, 127, 185, 1);
}

/* 基础按钮样式 */
.action-button {
    position: fixed;
    right: var(--button-gap);
    width: var(--button-size);
    height: var(--button-size);
    border-radius: 50%;
    background: var(--button-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
    z-index: 9000;
}

.action-button:hover {
    background: var(--button-hover-color);
    transform: scale(1.1);
}

/* 按钮位置 */
.scroll-button {
    display: none; /* 初始隐藏 */
}

html[lang^="zh"] .scroll-button {
    bottom: 90px;
}

.chat-button {
    bottom: 30px;
}

/* 调整不同语言下的按钮位置 */
html:not([lang^="zh"]) .scroll-button {
    bottom: 30px; /* 非中文版本时back-to-top位于chat按钮的位置 */
}

/* 移动端样式 */
@media (max-width: 768px) {

    html[lang^="zh"] .scroll-button {
        bottom: 120px;
    }
    /* 调整不同语言下的按钮位置 */
    html:not([lang^="zh"]) .scroll-button {
        bottom: 60px; /* 非中文版本时back-to-top位于chat按钮的位置 */
    }

    .chat-button {
        bottom: 60px;
    }
}

/* 聊天窗口容器 */
#chat-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 背景遮罩 */
.chat-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* 聊天窗口 */
.chat-modal {
    position: relative;
    background: white;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    animation: modalShow 0.3s ease;
    overflow: hidden;
}

/* 桌面端样式 */
@media (min-width: 769px) {
    .chat-modal {
        width: 380px;
        height: 600px;
        position: fixed;
        right: var(--button-gap);
        bottom: 90px;
    }
    
    /* 桌面端显示淡色遮罩，提供视觉反馈 */
    .chat-backdrop {
        background-color: rgba(0, 0, 0, 0.15);
        backdrop-filter: blur(1px);
        cursor: pointer;
    }
}

/* 移动端样式 */
@media (max-width: 768px) {
    .chat-modal {
        width: 100%;
        height: 100%;
    }
}

/* 聊天窗口关闭按钮 */
.chat-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--button-color);
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    z-index: 100000;
}

.chat-modal-close:hover {
    background: var(--button-hover-color);
}

/* 聊天内容区域 */
.chat-modal-body {
    flex: 1;
    overflow: hidden;
}

.chat-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* 隐藏状态 */
.chat-hidden {
    display: none !important;
}

/* 动画效果 */
@keyframes modalShow {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 移动端特殊处理 */
@media (max-width: 768px) {
    body.chat-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
}

/* 显示滚动按钮时的样式 */
.scroll-button.visible {
    display: flex;
}