/**
 * 聊天框样式
 * 右下角悬浮聊天框样式定义
 */

/* 聊天图标样式 */
.chat-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #60abd1;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: all 0.3s ease;
}

.chat-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.chat-icon svg {
    width: 30px;
    height: 30px;
    fill: white;
}

/* 聊天窗口样式 */
.chat-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 450px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
}

.chat-container.active {
    transform: translateX(0);
    opacity: 1;
}

/* 聊天窗口头部 */
.chat-header {
    background-color: #60abd1;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.chat-close {
    cursor: pointer;
    font-size: 20px;
    line-height: 20px;
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    background-color: #f5f5f5;
    scroll-behavior: smooth; /* 平滑滚动 */
    display: flex;
    flex-direction: column;
}

/* 实际的消息容器 */
#chatMessages {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 聊天链接区域 */
.chat-links {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
    flex-shrink: 0; /* 防止在滚动时被压缩 */
    top: 0;
    z-index: 1;
}

.chat-link-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    color: #333;
}

.chat-link-item:last-child {
    margin-bottom: 0;
}

.chat-link-item:hover {
    background: #f0f8ff;
    border-color: #007bff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.chat-link-item svg {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    fill: #007bff;
    transition: fill 0.3s ease;
}

.chat-link-item:hover svg {
    fill: #0056b3;
}

/* 留言框遮罩层 */
.message-form-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

/* 留言框主体 */
.message-form {
    background-color: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 留言框头部 */
.message-form-header {
    background-color: #60abd1;
    color: white;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.message-form-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
}

.message-form-close {
    cursor: pointer;
    font-size: 24px;
    line-height: 24px;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.message-form-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 留言框主体内容 */
.message-form-body {
    padding: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #60abd1;
    box-shadow: 0 0 0 3px rgba(96, 171, 209, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

/* 留言框底部 */
.message-form-footer {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-cancel,
.btn-submit {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.btn-cancel {
    background-color: #6c757d;
    color: white;
}

.btn-cancel:hover {
    background-color: #5a6268;
}

.btn-submit {
    background-color: #60abd1;
    color: white;
}

.btn-submit:hover {
    background-color: #3367d6;
}

.btn-submit:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .message-form {
        width: 95%;
        margin: 10px;
    }
    
    .message-form-body {
        padding: 20px;
    }
    
    .message-form-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    .btn-cancel,
    .btn-submit {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .btn-submit {
        margin-bottom: 0;
    }
}

.message {
    margin-bottom: 15px;
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    position: relative;
    clear: both;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-user {
    background-color: #e1f5fe;
    color: #333;
    float: right;
    border-bottom-right-radius: 5px;
}

.message-bot {
    background-color: #fff;
    color: #333;
    float: left;
    border-bottom-left-radius: 5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-content {
    display: block;
    word-break: break-word;
}

.message-time {
    font-size: 10px;
    color: #999;
    margin-top: 5px;
    display: block;
    text-align: right;
}

/* 正在输入状态指示器 */
.typing-indicator {
    padding: 10px 15px;
    display: inline-block;
    width: auto;
    min-width: 50px;
}

.typing-indicator span {
    display: inline-block;
    animation: typingDots 1.4s infinite ease-in-out;
    font-size: 16px;
    letter-spacing: 2px;
}

@keyframes typingDots {
    0%, 20% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    80%, 100% { transform: translateY(0); }
}

/* 聊天输入区域 */
.chat-input-container {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
}

.chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    outline: none;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 40px;
    overflow-y: auto;
}

.chat-send {
    background-color: #60abd1;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease;
}

.chat-send:hover {
    background-color: #3367d6;
}

.chat-send svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .chat-container {
        width: 300px;
        height: 400px;
        bottom: 80px;
        right: 10px;
    }
    
    .chat-icon {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }
    
    .chat-icon svg {
        width: 25px;
        height: 25px;
    }
}

/* 自定义弹窗样式 */
.custom-alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.custom-alert-overlay.show {
    opacity: 1;
    visibility: visible;
}

.custom-alert {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    width: 90%;
    padding: 0;
    transform: scale(0.7) translateY(-20px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.custom-alert-overlay.show .custom-alert {
    transform: scale(1) translateY(0);
}

.custom-alert-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.custom-alert-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.custom-alert-icon.success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

.custom-alert-icon.error {
    background: linear-gradient(135deg, #f44336, #d32f2f);
}

.custom-alert-icon.warning {
    background: linear-gradient(135deg, #ff9800, #f57c00);
}

.custom-alert-icon.info {
    background: linear-gradient(135deg, #2196F3, #1976D2);
}

.custom-alert-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.custom-alert-body {
    padding: 16px 24px 24px;
}

.custom-alert-message {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.custom-alert-footer {
    padding: 16px 24px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.custom-alert-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.custom-alert-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.custom-alert-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.custom-alert-btn.secondary {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.custom-alert-btn.secondary:hover {
    background: #e9e9e9;
    border-color: #ccc;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .custom-alert {
        margin: 20px;
        width: calc(100% - 40px);
    }
    
    .custom-alert-header,
    .custom-alert-body,
    .custom-alert-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
}

// ... existing code ...