/* 悬浮聊天按钮样式 */
/* 聊天按钮样式 - 在浮动按钮容器中 */
.floating-button.chat-button {
    background: linear-gradient(135deg, #3498db, #2ecc71);
}

.floating-button.chat-button:hover {
    background: linear-gradient(135deg, #2980b9, #27ae60);
}

.chat-button .notification {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background-color: #e74c3c;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    z-index: 10;
}

/* 聊天对话框样式 - 增加宽度 */
.chat-container {
    position: fixed;
    bottom: 240px; /* 调整位置，避免与按钮组重叠 */
    right: 20px; /* 与按钮组对齐 */
    width: 450px; /* 从350px增加到450px */
    height: 550px; /* 增加高度以容纳手机号输入框 */
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 1001; /* 提高层级，确保在主菜单栏(z-index: 1000)之上 */
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-header {
    background: linear-gradient(to right, #3498db, #2ecc71);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 手机号输入区域样式 */
.phone-input-area {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background-color: #f8f9fa;
}

.phone-input-area label {
    display: block;
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 8px;
    font-weight: 500;
}

.phone-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.phone-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
    font-size: 1rem;
    transition: border 0.3s;
}

.phone-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.phone-status {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8rem;
}

.phone-status.valid {
    color: #27ae60;
    background-color: rgba(39, 174, 96, 0.1);
}

.phone-status.invalid {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.message.received {
    align-items: flex-start;
}

.message.sent {
    align-items: flex-end;
}

.message-bubble {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
}

.received .message-bubble {
    background-color: #e9ecef;
    color: #333;
    border-bottom-left-radius: 5px;
}

.sent .message-bubble {
    background: linear-gradient(to right, #3498db, #2ecc71);
    color: white;
    border-bottom-right-radius: 5px;
}

.message-time {
    font-size: 0.7rem;
    color: #95a5a6;
    margin-top: 5px;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 0.95rem;
    transition: border 0.3s;
}

.chat-input:focus {
    border-color: #3498db;
}

.send-btn {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #3498db, #2ecc71);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, opacity 0.3s;
}

.send-btn:hover {
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-container {
        width: 90vw;
        height: 70vh; /* 增加移动端高度 */
        right: 5vw;
        bottom: 100px;
    }
}

@media (max-width: 480px) {
    .chat-container {
        width: 95vw;
        height: 80vh;
        right: 2.5vw;
    }
}
