/* 
字幕核对工具 - 样式表
提供现代化的 UI 设计和良好的用户体验
*/

/* 全局样式重置和基础设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', '微软雅黑', 
                 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 40px;
    text-align: center;
}

.header h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 300;
}

/* 文件控制区域 */
.file-controls {
    padding: 25px 40px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.file-control-group {
    margin-bottom: 15px;
}

.file-control-group:last-child {
    margin-bottom: 0;
}

.file-label {
    display: inline-block;
    width: 80px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.file-input-group {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.file-path-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: border-color 0.3s;
}

.file-path-input:focus {
    outline: none;
    border-color: #667eea;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a91 100%);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #0d7a73 0%, #2dd169 100%);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* 比对选项 */
.compare-options {
    padding: 15px 40px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #555;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 状态栏 */
.status-bar {
    padding: 12px 40px;
    background: #fff3cd;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
    color: #856404;
}

.status-bar.success {
    background: #d4edda;
    color: #155724;
}

.status-bar.error {
    background: #f8d7da;
    color: #721c24;
}

/* 内容显示区域 */
.content-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    height: calc(100vh - 380px);
    min-height: 500px;
    overflow: hidden;
}

.file-panel {
    display: flex;
    flex-direction: column;
    border-right: 2px solid #e0e0e0;
    background: white;
    overflow: hidden;
    min-width: 0; /* 确保内容不会溢出 */
}

.file-panel:last-child {
    border-right: none;
}

.panel-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.file-name {
    font-size: 12px;
    color: #666;
    font-weight: 400;
    padding: 4px 12px;
    background: white;
    border-radius: 12px;
    border: 1px solid #ddd;
}

/* 编辑器容器 */
.editor-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
    background: #fafafa;
    min-height: 0; /* 确保 flex 子元素可以正确滚动 */
    height: 0; /* 强制 flex 子元素使用可用空间 */
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* 拖拽悬停状态 */
.editor-container.drag-over {
    background: #e8e8ff;
    border: 3px dashed #667eea;
    border-radius: 8px;
}

.editor {
    width: 100%;
    max-width: 100%;
    padding: 20px;
    font-family: 'Consolas', 'Monaco', 'Courier New', 'SimSun', 'NSimSun', monospace;
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    background: white;
    border: none;
    outline: none;
    /*white-space: pre; /* 使用 pre 保持字符对齐，不使用 pre-wrap */
    /*-wrap: normal;
    word-break: keep-all; /* 保持字符不换行 */
    box-sizing: border-box;
    /*display: block;*/
    overflow-wrap: normal;
}

.editor:focus {
    background: #ffffff;
}

/* 文本高亮样式 */
.highlight-equal {
    background: transparent;
    color: #333;
    display: inline;
    white-space: pre;
}

.highlight-different {
    background: #ffe6e6;
    color: #c00;
    padding: 0;
    border-radius: 2px;
    display: inline;
    white-space: pre;
}

.highlight-missing {
    background: #fff3cd;
    color: #856404;
    text-decoration: line-through;
    padding: 0;
    border-radius: 2px;
    display: inline;
    white-space: pre;
}

.highlight-added {
    background: #d4edda;
    color: #155724;
    padding: 0;
    border-radius: 2px;
    display: inline;
    white-space: pre;
}

/* 滚动条样式 */
.editor-container::-webkit-scrollbar,
.editor::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.editor-container::-webkit-scrollbar-track,
.editor::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.editor-container::-webkit-scrollbar-thumb,
.editor::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.editor-container::-webkit-scrollbar-thumb:hover,
.editor::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .content-area {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .file-panel {
        border-right: none;
        border-bottom: 2px solid #e0e0e0;
        min-height: 400px;
    }
    
    .file-panel:last-child {
        border-bottom: none;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .file-controls {
        padding: 20px;
    }
    
    .file-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        width: 100%;
    }
    
    .content-area {
        flex: 1;
    }
    
    .file-panel {
        min-height: 300px;
        height: auto;
    }
    
    .editor-container {
        height: 300px;
        min-height: 300px;
    }
}

/* 加载动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-panel {
    animation: fadeIn 0.3s ease-out;
}

/* 选中文本样式 */
::selection {
    background: #667eea;
    color: white;
}

::-moz-selection {
    background: #667eea;
    color: white;
}
