/* ============= 全局样式 ============= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --error-color: #f56565;
    --warning-color: #ed8936;
    --bg-color: #f7fafc;
    --card-bg: #ffffff;
    --text-color: #2d3748;
    --text-light: #718096;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ============= 头部 ============= */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    text-align: center;
    padding: 40px 20px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* ============= 简介区域 ============= */
.intro-section {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.intro-column {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.intro-column h3 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    color: var(--primary-color);
}

.intro-column p {
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 10px;
    color: var(--text-light);
}

.intro-column a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.intro-column a:hover {
    text-decoration: underline;
}

.sponsor-container {
    text-align: center;
    margin-top: 10px;
}

.sponsor-img {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* ============= 主内容区域 ============= */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.left-panel,
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ============= 卡片样式 ============= */
.input-section,
.result-section,
.cache-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.input-section h2,
.result-section h2,
.cache-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-color);
    display: flex;
    align-items: center;
}

/* ============= Tab切换 ============= */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-button {
    padding: 12px 24px;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-button:hover {
    color: var(--primary-dark);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============= 表单元素 ============= */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.input-field {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    font-family: inherit;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.help-text {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 6px;
}

/* ============= 上传区域 ============= */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg-color);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.05);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.upload-text {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 5px;
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--text-light);
}

.file-info {
    margin-top: 15px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    border-left: 4px solid var(--success-color);
}

/* ============= 高级参数 ============= */
.advanced-section {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.advanced-toggle {
    width: 100%;
    padding: 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.advanced-toggle:hover {
    background: var(--border-color);
}

.toggle-icon {
    transition: transform 0.3s;
}

.advanced-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

.advanced-content {
    margin-top: 15px;
    animation: slideDown 0.3s ease-out;
}

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

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
}

/* ============= 按钮 ============= */
.translate-button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow);
    margin-top: 20px;
}

.translate-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.translate-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.button-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* ============= 旋转动画 ============= */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============= 进度条 ============= */
.progress-container {
    margin-bottom: 20px;
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
}

/* ============= 日志 ============= */
.log-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.log-header {
    padding: 12px 16px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.clear-log-button {
    padding: 4px 12px;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}

.clear-log-button:hover {
    opacity: 0.8;
}

.log-content {
    padding: 16px;
    background: #1a1a1a;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
}

.log-empty {
    color: #888;
    text-align: center;
    padding: 20px;
}

.log-entry {
    margin-bottom: 4px;
    white-space: pre-wrap;
    word-break: break-word;
}

.log-entry.error {
    color: var(--error-color);
}

.log-entry.success {
    color: var(--success-color);
}

.log-entry.warning {
    color: var(--warning-color);
}

/* ============= 下载区域 ============= */
.download-section {
    padding: 20px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 2px solid var(--success-color);
}

.download-section h3 {
    margin-bottom: 15px;
    color: var(--success-color);
}

.download-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.download-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: white;
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.download-filename {
    font-weight: 500;
    color: var(--text-color);
}

.download-button {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.download-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* ============= 缓存管理 ============= */
.cache-info {
    margin-bottom: 20px;
}

.cache-stat {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.cache-stat:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-light);
}

.stat-value {
    font-weight: 600;
    color: var(--text-color);
}

.cache-actions {
    display: flex;
    gap: 10px;
}

.cache-button {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
}

.refresh-button {
    background: var(--card-bg);
    color: var(--primary-color);
}

.refresh-button:hover {
    background: var(--primary-color);
    color: white;
}

.clear-button {
    background: var(--card-bg);
    color: var(--error-color);
}

.clear-button:hover {
    background: var(--error-color);
    color: white;
}

/* ============= 页脚 ============= */
.footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-light);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 30px;
}

.footer p {
    margin-bottom: 5px;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* ============= 响应式设计 ============= */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .intro-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 10px;
    }
    
    .input-section,
    .result-section,
    .cache-section {
        padding: 20px;
    }
}

/* ============= 滚动条样式 ============= */
.log-content::-webkit-scrollbar {
    width: 8px;
}

.log-content::-webkit-scrollbar-track {
    background: #2a2a2a;
}

.log-content::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.log-content::-webkit-scrollbar-thumb:hover {
    background: #777;
}

