/* 快速译主样式文件 */
:root {
    --primary-color: #4A90E2;      /* 主要天蓝色 */
    --primary-hover: #2E7DB8;      /* 深天蓝色 */
    --light-blue: #87CEEB;         /* 浅天蓝色 */
    --lightest-blue: #E6F3FF;      /* 最浅天蓝色 */
    --white: #FFFFFF;
    --light-gray: #F8F9FA;
    --border-gray: #E9ECEF;
    --text-gray: #6C757D;
    --text-dark: #212529;
    --danger: #DC3545;
    --warning: #FFC107;
    --success: #28A745;
    --shadow: 0 2px 10px rgba(74, 144, 226, 0.1);
    --shadow-hover: 0 4px 20px rgba(74, 144, 226, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--lightest-blue) 0%, var(--white) 100%);
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding: 20px 0;
    border-bottom: 2px solid var(--border-gray);
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: 2px 2px 4px rgba(74, 144, 226, 0.1);
}

.settings-btn, .back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
}

.settings-btn:hover, .back-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.translator-section {
    background: var(--white);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-gray);
}

.translation-controls {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 15px;
}

.model-selector label {
    font-weight: 600;
    color: var(--text-dark);
    min-width: 80px;
}

#model-select {
    flex: 1;
    max-width: 300px;
    padding: 12px 15px;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    font-size: 14px;
    background: var(--white);
    color: var(--text-dark);
    transition: border-color 0.3s ease;
}

#model-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* 语言选择器 */
.language-selector {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--lightest-blue);
    border-radius: 12px;
    border: 1px solid var(--border-gray);
}

.language-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.language-group label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

#source-language, #target-language {
    padding: 12px 15px;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    font-size: 14px;
    background: var(--white);
    color: var(--text-dark);
    transition: border-color 0.3s ease;
    width: 100%;
}

#source-language:focus, #target-language:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.language-swap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: rotate(180deg);
}

/* 翻译区域 */
.translation-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.input-section, .output-section {
    display: flex;
    flex-direction: column;
}

.input-section label, .output-section label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 10px;
    font-size: 16px;
}

#input-text {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 300px;
    transition: border-color 0.3s ease;
    background: var(--white);
}

#input-text:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.output-area {
    width: 100%;
    min-height: 300px;
    padding: 15px;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    background: var(--light-gray);
    font-size: 14px;
    line-height: 1.6;
    overflow-y: auto;
}

.placeholder {
    color: var(--text-gray);
    font-style: italic;
}

.input-controls, .output-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: flex-end;
}

/* 按钮样式 */
.primary-btn {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.secondary-btn {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: translateY(-1px);
}

.danger-btn {
    background: var(--danger);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.danger-btn:hover {
    background: #C82333;
    transform: translateY(-1px);
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-gray);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: 20px;
    font-size: 16px;
    color: var(--primary-color);
    font-weight: 600;
}

.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .translation-area {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .translator-section {
        padding: 20px;
    }
    
    .translation-controls {
        gap: 20px;
    }
    
    .model-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    #model-select {
        max-width: 100%;
    }
    
    .language-selector {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .language-group {
        flex: none;
        width: 100%;
    }
    
    .language-swap {
        order: 2;
    }
    
    .swap-btn {
        transform: rotate(90deg);
    }
    
    .swap-btn:hover {
        transform: rotate(270deg);
    }
    
    .input-controls, .output-controls {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.8rem;
    }
    
    .translator-section {
        padding: 15px;
    }
    
    #input-text, .output-area {
        min-height: 200px;
    }
    
    .primary-btn, .secondary-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* 格式优化切换开关样式 */
.format-optimize-wrapper {
    display: flex;
    align-items: center;
}

.switch-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: var(--text-gray);
    font-weight: 500;
}

.switch-input {
    display: none;
}

.switch-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border-gray);
    border-radius: 24px;
    transition: all 0.3s ease;
}

.switch-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch-input:checked + .switch-slider {
    background: var(--primary-color);
}

.switch-input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.switch-label:hover .switch-slider {
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.switch-input:checked + .switch-slider + .switch-text {
    color: var(--primary-color);
    font-weight: 600;
}

/* 危险按钮样式 */
.danger-btn {
    background-color: var(--danger) !important;
    border-color: var(--danger) !important;
    color: white !important;
}

.danger-btn:hover {
    background-color: #dc2626 !important;
    border-color: #dc2626 !important;
}