* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

.chat-container {
    max-width: 900px;
    height: 90vh;
    margin: 5vh auto;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    overflow: hidden;
}

.chat-header {
    background-color: #1890ff;
    color: #fff;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 10px rgba(24, 144, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.human-service-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.4rem 1.2rem;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.human-service-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.human-service-btn:active {
    transform: translateY(0);
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background-color: #fafafa;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.message {
    display: flex;
    animation: fadeIn 0.3s ease;
    max-width: 80%;
}

.message.user {
    align-self: flex-end;
    flex-direction: column;
    align-items: flex-end;
}

.message.assistant {
    align-self: flex-start;
    flex-direction: column;
    align-items: flex-start;
}

.message-content {
    padding: 1rem 1.5rem;
    border-radius: 20px;
    word-wrap: break-word;
    position: relative;
    line-height: 1.5;
}

.message.user .message-content {
    background-color: #1890ff;
    color: #fff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.2);
}

.message.assistant .message-content {
    background-color: #fff;
    color: #333;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #f0f0f0;
}

.message-time {
    font-size: 0.75em;
    color: #999;
    margin-top: 0.3rem;
    line-height: 1;
}

.message.user .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.message-time-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.3rem;
}

.message-actions {
    display: flex;
    gap: 0.3rem;
}

.message-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.message-action-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.message-action-btn:active {
    transform: translateY(0);
}

/* 提示信息样式 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 20px;
    font-size: 0.9rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chat-input-container {
    padding: 1.5rem 2rem;
    background-color: #fff;
    border-top: 1px solid #f0f0f0;
}

.chat-input-wrapper {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    background-color: #f5f7fa;
    border-radius: 28px;
    padding: 0.8rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

#messageInput {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    background-color: transparent;
    font-family: inherit;
    line-height: 1.5;
    max-height: 150px;
}

#sendButton {
    background-color: #1890ff;
    color: #fff;
    border: none;
    outline: none;
    padding: 0.8rem 1.8rem;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 90px;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.3);
}

#sendButton:hover {
    background-color: #40a9ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.4);
}

#sendButton:active {
    transform: translateY(0);
}

#sendButton:disabled {
    background-color: #f0f0f0;
    color: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .chat-container {
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .chat-header {
        padding: 1rem;
    }
    
    .chat-header h1 {
        font-size: 1.2rem;
    }
    
    .human-service-btn {
        padding: 0.3rem 0.8rem;
        font-size: 0.8rem;
        border-radius: 15px;
    }
    
    .chat-messages {
        padding: 1rem;
        gap: 1rem;
    }
    
    .message {
        max-width: 90%;
    }
    
    .message-content {
        padding: 0.8rem 1.2rem;
        border-radius: 18px;
    }
    
    .chat-input-container {
        padding: 1rem;
    }
    
    .chat-input-wrapper {
        gap: 0.5rem;
        padding: 0.6rem;
    }
    
    #messageInput {
        padding: 0.8rem 1.2rem;
    }
    
    #sendButton {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        min-width: 80px;
    }
}

img{
    max-width: 100%;
    height: auto;
    cursor: pointer;
    transition: transform 0.2s ease;
}

img:hover {
    transform: scale(1.02);
}

/* 图片放大弹窗样式 */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
    border-radius: 4px;
    animation: zoomIn 0.3s ease;
}

.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

#caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    height: 150px;
    font-size: 0.9rem;
}

/* 动画效果 */
@keyframes zoomIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 加载动画效果 */
.loading {
    display: inline-flex;
    align-items: center;
    font-size: 1rem;
    color: #555;
    font-weight: 500;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 15px;
    margin-left: 12px;
    background-image: radial-gradient(circle, #7cc0ff 2px, transparent 2px);
    background-size: 8px 8px;
    background-repeat: repeat-x;
    background-position: 0 50%;
    animation: loadingDots 1s ease-in-out infinite;
}

@keyframes loadingDots {
    0% {
        background-position: 0 50%;
    }
    100% {
        background-position: 40px 50%;
    }
}

/* 脉冲效果的加载动画 */
.loading.pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}