.chat {
/* 蒙版背景 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: block;
}
/* 悬浮聊天弹窗 */
.floating-chat-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 450px;
    height: 700px;
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    animation: popupFadeIn 0.3s ease-out;
}

@keyframes popupFadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* 悬浮窗头部 - 固定不动 */
.floating-header {
    background: linear-gradient(135deg, #013E3F 0%, #013E3F 100%);
    padding: 18px 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    z-index: 10;
}

.floating-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: background 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 聊天内容区域 - 可滚动 */
.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* 聊天容器 - 可滚动区域 */
.chat-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-color: #f8fafc;
}

/* 简洁名片区域 - 可滚动，放在聊天容器内 */
.simple-card {
    background-color: white;
    padding: 20px 20px 15px;
    border-bottom: 1px solid #eef1f5;
    flex-shrink: 0;
}

.card-content {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.card-avatar {
    width: 70px;
    height: 70px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #f0f2f5;
}

.card-info {
    flex: 1;
    text-align: left;
}

.card-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 6px;
}

.card-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.card-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #5a6c7d;
}

.card-detail i {
    width: 16px;
    color: #6a89cc;
}

.card-actions {
    display: flex;
    justify-content: center;
}

.action-btn {
    background: linear-gradient(to right, #013E3F, #013E3F);
    color: white;
    border: none;
    padding: 10px 25px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 220px;
    transition: all 0.3s ease;
    box-shadow: 0 3px 8px rgba(106, 137, 204, 0.2);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(106, 137, 204, 0.3);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn i {
    font-size: 0.9rem;
}

/* 聊天区域 - 可滚动 */
.chat-area {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: #f8fafc;
    min-height: 0;
}

/* 下拉加载指示器 */
.load-more-container {
    padding: 15px 0;
    text-align: center;
    flex-shrink: 0;
}

.load-more-btn {
    background: #f0f2f5;
    border: 1px solid #e0e6ed;
    color: #5a6c7d;
    padding: 8px 20px;
    font-size: 0.85rem;
    border-radius: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.load-more-btn:hover {
    background: #e4e7ec;
}

.load-more-btn.loading-chat {
    pointer-events: none;
    opacity: 0.7;
}

.load-more-btn.loading-chat i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 消息样式 */
.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.4;
    font-size: 0.95rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.message-received {
    align-self: flex-start;
    background-color: white;
    border-top-left-radius: 5px;
    color: #333;
}

.message-sent {
    align-self: flex-end;
    background: linear-gradient(135deg, #4a69bd 0%, #6a89cc 100%);
    color: white;
    border-top-right-radius: 5px;
}

.message-time {
    font-size: 0.75rem;
    color: #95a5a6;
    margin-top: 5px;
    text-align: right;
}

/* 输入区域 */
.input-area {
    padding: 15px;
    background-color: white;
    display: flex;
    gap: 10px;
    border-top: 1px solid #eef1f5;
    flex-shrink: 0;
}

.message-input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #e0e6ed;
    border-radius: 50px;
    font-size: 0.95rem;
    outline: none;
    transition: border 0.3s;
    background-color: #f8fafc;
}

.message-input:focus {
    border-color: #6a89cc;
    background-color: white;
}

.send-btn {
    background: linear-gradient(to right, #013E3F, #013E3F);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
}

/* 交换名片模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    border-radius: 16px;
    padding: 25px;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-title {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn.confirm {
    background: linear-gradient(to right, #4a69bd, #6a89cc);
    color: white;
}

.modal-btn.cancel {
    background-color: #f0f2f5;
    color: #7f8c8d;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

.qr-display {
    width: 120px;
    height: 120px;
    margin: 0 auto 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    color: #4a69bd;
    border: 1px dashed #d0d7e2;
}

.modal-text {
    text-align: center;
    color: #5a6c7d;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .floating-chat-popup {
        width: 450px;
        height: 700px;
    }

    .main-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .floating-chat-popup {
        width: 90%;
        height: 700px;
    }

    .simple-card {
        padding: 15px 15px 12px;
    }

    .card-content {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .card-info {
        text-align: center;
    }

    .card-details {
        align-items: center;
    }

    .card-detail {
        justify-content: center;
    }
    .review-btn {
        flex: 1;
        min-width: 80px;
    }
    .action-btn {
        max-width: 100%;
    }
}
/* Message container - avatar and message aligned at top */
.message-container {
    display: flex;
    max-width: 100%;
    align-items: flex-start; /* Align avatar and message at top */
}

.message-container.received {
    align-self: flex-start;
}

.message-container.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* Message avatar */
.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 2px; /* Small top margin for better alignment */
}

/* Message content area */
.message-content {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    margin: 0 8px;
}

/* Sender name */
.message-sender {
    font-size: 0.75rem;
    color: #7f8c8d;
    margin-bottom: 3px;
    font-weight: 500;
}

.message-container.sent .message-sender {
    text-align: right;
}

/* Message bubble style */
.message {
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.4;
    font-size: 0.9rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    position: relative;
    max-width: 100%;
    word-wrap: break-word;
}

.message-received {
    background-color: white;
    border-top-left-radius: 5px;
    color: #333;
}

.message-sent {
    background: linear-gradient(135deg, #4a69bd 0%, #6a89cc 100%);
    color: white;
    border-top-right-radius: 5px;
}

.message-time {
    font-size: 0.7rem;
    color: #95a5a6;
    margin-top: 4px;
    text-align: right;
}



.review-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.review-btn {
    padding: 8px 16px;
    border: 1px solid #e0e6ed;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    background-color: #f8fafc;
    color: #5a6c7d;
    flex: 1;
    justify-content: center;
    max-width: 100px;
}

.review-btn:hover {
    background-color: #f0f2f5;
    transform: translateY(-1px);
}

.review-btn.active {
    background-color: #4a69bd;
    color: white;
    border-color: #4a69bd;
    box-shadow: 0 2px 6px rgba(74, 105, 189, 0.2);
}

.review-btn.active.pending {
    background-color: #ffd166;
    color: #8a6d1f;
    border-color: #ffd166;
    max-width: 50%;
}

.review-btn.active.approve {
    background-color: #06d6a0;
    color: #0a5c44;
    border-color: #06d6a0;
}

.review-btn.active.reject {
    background-color: #ef476f;
    color: #8a1c3a;
    border-color: #ef476f;
}

}
