:root {
    --primary-color: #161b22;
    --secondary-color: #0d1117;
    --accent-color: #58a6ff;
    --text-color: #c9d1d9;
    --border-color: #30363d;
    --button-hover: #2c323a;
    --light-bg: #f8f9fa;
    --light-secondary: #e9ecef;
    --light-text: #343a40;
    --light-border: #dee2e6;
    --light-accent: #0d6efd;
    --light-button-hover: #e2e6ea;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--secondary-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin-bottom: 30px;
}

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

.logo-icon {
    font-size: 2rem;
    color: var(--accent-color);
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.settings {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
}

#theme-toggle {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--accent-color);
}

/* Main content */
main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* 添加自定义滚动条样式 */
#input-text::-webkit-scrollbar {
    width: 10px;
}

#input-text::-webkit-scrollbar-track {
    background: var(--primary-color);
    border-radius: 5px;
}

#input-text::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 5px;
}

#input-text::-webkit-scrollbar-thumb:hover {
    background: #75b5ff;
}

#output-text::-webkit-scrollbar {
    width: 10px;
}

#output-text::-webkit-scrollbar-track {
    background: var(--primary-color);
    border-radius: 5px;
}

#output-text::-webkit-scrollbar-thumb {
    background: #f97316; /* 橙色，与输入框的蓝色形成撞色 */
    border-radius: 5px;
}

#output-text::-webkit-scrollbar-thumb:hover {
    background: #fb923c; /* 浅橙色 */
}

/* 浅色主题下的滚动条 */
body.light-theme #input-text::-webkit-scrollbar-track {
    background: var(--light-secondary);
}

body.light-theme #input-text::-webkit-scrollbar-thumb {
    background: var(--light-accent);
}

body.light-theme #input-text::-webkit-scrollbar-thumb:hover {
    background: #3a8bfe;
}

body.light-theme #output-text::-webkit-scrollbar-track {
    background: var(--light-secondary);
}

body.light-theme #output-text::-webkit-scrollbar-thumb {
    background: #f97316;
}

body.light-theme #output-text::-webkit-scrollbar-thumb:hover {
    background: #fb923c;
}

.translator {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

.input-container, .output-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--primary-color);
}

.language-select {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
}

.language-select select {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.language-select select option {
    background-color: var(--primary-color);
    color: var(--text-color);
}

textarea {
    flex: 1;
    min-height: 250px; /* 增加最小高度 */
    padding: 15px;
    font-size: 1rem;
    line-height: 1.5;
    background-color: transparent;
    color: var(--text-color);
    border: none;
    resize: none;
    outline: none;
    position: relative;
    overflow-y: auto; /* 确保内容过多时可以滚动 */
}

.image-container {
    position: relative;
    max-width: 100%;
    margin: 10px auto;
    text-align: center;
}

.uploaded-image {
    max-width: 100%;
    max-height: 250px; /* 减小图片最大高度，留出更多空间给底部按钮 */
    border-radius: 5px;
    object-fit: contain;
}

.controls {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-top: 1px solid var(--border-color);
    position: sticky; /* 使控制栏固定在底部 */
    bottom: 0;
    background-color: var(--primary-color); /* 确保背景色与容器一致 */
    z-index: 10; /* 确保控制栏在最上层 */
    gap: 10px;
    justify-content: space-between; /* 两端对齐，将按钮分散到两侧 */
}

.left-controls, .right-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls button {
    background-color: transparent;
    color: var(--text-color);
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s;
}

/* 增大喇叭图标按钮样式 */
#play-source, #play-translation {
    font-size: 1.3rem;
    padding: 8px 12px;
    margin-right: 5px;
    background-color: rgba(88, 166, 255, 0.1);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#play-source i, #play-translation i {
    font-size: 1.5rem;
}

#play-source:hover, #play-translation:hover {
    background-color: rgba(88, 166, 255, 0.2);
}

/* 给输出区域的播放按钮使用不同的颜色 */
#play-translation {
    background-color: rgba(249, 115, 22, 0.1);
}

#play-translation:hover {
    background-color: rgba(249, 115, 22, 0.2);
}

/* 浅色主题下的播放按钮 */
body.light-theme #play-source, 
body.light-theme #play-translation {
    background-color: rgba(13, 110, 253, 0.1);
}

body.light-theme #play-source:hover, 
body.light-theme #play-translation:hover {
    background-color: rgba(13, 110, 253, 0.2);
}

body.light-theme #play-translation {
    background-color: rgba(249, 115, 22, 0.1);
}

body.light-theme #play-translation:hover {
    background-color: rgba(249, 115, 22, 0.2);
}

.controls button:hover {
    background-color: var(--button-hover);
}

.translation-controls {
    display: flex;
    justify-content: center;
    margin: 5px 0;
    gap: 10px;
}

#translate-btn, #image-translate-btn {
    background-color: var(--accent-color);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s;
}

#translate-btn:hover, #image-translate-btn:hover {
    opacity: 0.9;
}

#swap-languages {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

#swap-languages:hover {
    background-color: var(--button-hover);
}

/* Light theme */
body.light-theme {
    background-color: var(--light-bg);
    color: var(--light-text);
}

body.light-theme .input-container,
body.light-theme .output-container {
    background-color: var(--light-secondary);
    border-color: var(--light-border);
}

body.light-theme textarea {
    color: var(--light-text);
}

body.light-theme .language-select select {
    color: var(--light-text);
    border-color: var(--light-border);
}

body.light-theme .language-select select option {
    background-color: var(--light-secondary);
    color: var(--light-text);
}

body.light-theme #swap-languages {
    color: var(--light-text);
    border-color: var(--light-border);
}

body.light-theme .controls button:hover,
body.light-theme #swap-languages:hover {
    background-color: var(--light-button-hover);
}

body.light-theme .controls button {
    color: #495057; /* 更深的文本颜色 */
    border: 1px solid #ced4da; /* 添加边框增强可见度 */
}

body.light-theme #translate-btn,
body.light-theme #image-translate-btn {
    background-color: var(--light-accent);
}

body.light-theme .controls,
body.light-theme .language-select {
    border-color: var(--light-border);
}

body.light-theme .controls {
    background-color: var(--light-secondary); /* 确保浅色主题下控制栏背景色正确 */
    border-top: 1px solid #ced4da; /* 增强边框可见度 */
}

body.light-theme #upload-image-btn,
body.light-theme #clear-source,
body.light-theme #copy-translation {
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
    font-weight: 500;
}

body.light-theme #play-source,
body.light-theme #play-translation {
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}

body.light-theme #upload-image-btn:hover,
body.light-theme #clear-source:hover,
body.light-theme #copy-translation:hover,
body.light-theme #play-source:hover,
body.light-theme #play-translation:hover {
    background-color: #dee2e6;
}

/* Responsive design */
@media (min-width: 768px) {
    .translator {
        flex-direction: row;
        gap: 20px;
    }
    
    .translation-controls {
        flex-direction: column;
        margin: 0;
    }
    
    .input-container, .output-container {
        height: 450px; /* 增加容器高度 */
    }
}

/* 移动设备上的滚动条优化 */
@media (max-width: 767px) {
    #input-text::-webkit-scrollbar,
    #output-text::-webkit-scrollbar {
        width: 6px;
    }
    
    .input-container, .output-container {
        min-height: 200px; /* 增加移动设备上的最小高度 */
        margin-bottom: 15px;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .settings {
        width: 100%;
        justify-content: space-between;
    }
    
    /* 移动设备上的控制栏样式调整 */
    .controls {
        flex-wrap: wrap;
    }
    
    .left-controls, .right-controls {
        margin: 5px 0;
    }
} 