/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 整体容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

header h1 {
    color: #1240AB;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    color: #666;
    font-size: 1.1rem;
}

/* 翻译容器 */
.translation-container {
    padding: 20px;
    margin-top: 20px;
}

.translation-container.card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 语言选择器 */
.language-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    gap: 10px;
}

.language-pair {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-select {
    min-width: 150px;
}

.swap-btn {
    background-color: #1240AB !important;
    color: white !important;
    width: 48px;
    height: 48px;
    padding: 0 !important;
    border-radius: 50% !important;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn:hover {
    background-color: #0f348d !important;
}

/* 翻译框 */
.input-section, .output-section {
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.section-header h5 {
    margin: 0;
    color: #1240AB;
    font-weight: 600;
}

.translation-input {
    width: 100%;
    height: 200px;
    resize: vertical;
    font-family: inherit;
}

.translation-output {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background-color: #f9f9f9;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid #e0e0e0;
}

/* 字符计数 */
.char-count {
    font-size: 0.8rem;
    color: #666;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.primary-btn {
    background-color: #1240AB !important;
}

.primary-btn:hover {
    background-color: #0f348d !important;
}

.secondary-btn {
    background-color: #757575 !important;
}

.secondary-btn:hover {
    background-color: #616161 !important;
}

/* 页脚 */
footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px 0;
    color: #666;
    font-size: 0.9rem;
}

/* 匹配术语样式 */
.matched-terms {
    margin-top: 15px;
    padding: 10px;
    background-color: #f0f7ff;
    border-radius: 5px;
    border-left: 3px solid #1240AB;
}

.matched-terms h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 14px;
    color: #1240AB;
    font-weight: 600;
}

.terms-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.term-item {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    background-color: white;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-size: 13px;
}

.source-term {
    font-weight: 600;
    color: #1240AB;
    margin-right: 5px;
}

.term-arrow {
    color: #666;
    margin: 0 5px;
}

.target-term {
    color: #333;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .language-selector {
        flex-direction: column;
        gap: 15px;
    }
    
    .language-selector select {
        width: 100%;
        max-width: 300px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    #copy-btn, #translate-btn {
        width: 100%;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(18, 64, 171, 0.3);
    border-radius: 50%;
    border-top-color: #1240AB;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification.success {
    background-color: #4CAF50;
}

.notification.error {
    background-color: #f44336;
}

/* 聊天功能样式 */
.fixed-action-btn {
    right: 30px;
    bottom: 30px;
}

.chat-window {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 10px;
}

/* 聊天按钮 */
.chat-btn {
    position: fixed;
    right: 30px;
    bottom: 30px;
    z-index: 1000;
}

.chat-btn i {
    font-size: 24px;
}

/* 聊天窗口 */
.chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    max-height: 500px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chat-window.active {
    display: flex;
}

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

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.close-btn {
    background: none;
    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-color 0.3s ease;
}

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

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: #f9f9f9;
}

/* 消息样式 */
.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.user-message {
    align-self: flex-end;
    background-color: #1240AB;
    color: white;
    border-bottom-right-radius: 4px;
}

.assistant-message {
    align-self: flex-start;
    background-color: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

/* 聊天输入区域 */
.chat-input-container {
    padding: 15px;
    background-color: white;
    border-top: 1px solid #e0e0e0;
}

.chat-input {
    width: 100%;
    min-height: 60px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 0.95rem;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 10px;
    transition: border-color 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: #1240AB;
    box-shadow: 0 0 0 2px rgba(18, 64, 171, 0.1);
}

.chat-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.eval-btn, .send-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.eval-btn {
    background-color: #f0f0f0;
    color: #333;
}

.eval-btn:hover {
    background-color: #e0e0e0;
}

.send-btn {
    background-color: #1240AB;
    color: white;
}

.send-btn:hover {
    background-color: #0f348d;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .chat-window {
        width: 100%;
        max-width: 320px;
        margin-right: -20px;
    }
    
    .chat-btn .chat-text {
        display: none;
    }
    
    .chat-btn {
        padding: 12px;
        border-radius: 50%;
    }
}