/* 文件内容对比工具样式 */
.tool-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.tool-operation {
    flex: 1;
    min-width: 500px;
    width: 100%;
    overflow: hidden;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.input-group input[type="text"],
.input-group select,
.input-group textarea,
.input-group input[type="file"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

/* 文件上传区域样式 */
.file-upload-area {
    position: relative;
    margin-bottom: 10px;
}

.file-upload-area input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.upload-placeholder {
    padding: 10px;
    border: 2px dashed #ccc;
    border-radius: 4px;
    text-align: center;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.upload-placeholder:hover {
    border-color: #007bff;
    background-color: #f0f8ff;
    color: #007bff;
}

.upload-placeholder.drag-over {
    border-color: #007bff;
    background-color: #e3f2fd;
    transform: scale(1.02);
}

/* 整体工具卡片样式 */
.tool-card {
    background: #ffffff;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    width: 100%;
    overflow: hidden;
}

.tool-card h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
}

.compare-form {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.file-input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-success {
    background: #28a745;
}

.status-error {
    background: #dc3545;
}

.status-pending {
    background: #ffc107;
}

.compare-panel {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
}

.result-content {
    margin-top: -1px;
    background-color: #f8f9fa;
    border: 1px solid #444;
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow: auto; /* 允许内部内容滚动 */
    flex-grow: 1;
    width: 100%;
    max-width: 100%;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, #3c3c3c, #2c2c2c);
    color: #f8f8f2;
    padding: 10px 15px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border: 1px solid #444;
    border-bottom: none;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#compare-result {
    margin: 0;
    padding: 15px;
    background-color: #f8f9fa;
    color: #333;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    tab-size: 4;
    white-space: pre-wrap;
    direction: ltr;
    text-align: left;
    outline: none;
    border: none;
    border-radius: 0 0 8px 8px;
    min-height: 500px;
    max-height: none;
    overflow-x: auto; /* 允许水平滚动 */
    overflow-y: visible;
    word-wrap: break-word;
    word-break: break-word; /* 强制长单词换行 */
    width: 100%;
    box-sizing: border-box;
}

/* 对比区域样式 */
.compare-area {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
    overflow: hidden;
}

.compare-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
}

.compare-column textarea {
    width: 100%;
    height: 250px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 10px;
    word-wrap: break-word;
    word-break: break-word; /* 强制长单词换行 */
    overflow-wrap: break-word;
}

.compare-column label {
    font-weight: bold;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.compare-column .file-info {
    font-size: 12px;
    color: #666;
    font-weight: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 文本对比容器样式 */
.text-compare-container {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    overflow: hidden;
    flex: 1;
    height: 250px;
    width: 100%;
}

.textarea-wrapper {
    flex: 1;
    position: relative;
    overflow: auto;
    height: 250px;
    width: 100%;
}

/* 可编辑内容区域样式 */
.content-div {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
    padding: 0;
    margin: 0;
    outline: none;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
    padding-left: 45px; /* 为行号留出空间 */
    white-space: pre-wrap; /* 关键：允许预格式化文本换行 */
    overflow-wrap: break-word; /* 允许长行内容换行 */
    word-break: break-word; /* 强制长单词换行 */
    overflow-x: auto; /* 允许水平滚动 */
    overflow-y: auto; /* 允许垂直滚动 */
    box-sizing: border-box;
    min-height: 250px;
}

.content-div:focus {
    outline: none;
}

.content-div[placeholder]:empty:before {
    content: attr(placeholder);
    color: #999;
    font-style: italic;
}

/* 行号区域样式 */
.line-numbers {
    position: absolute;
    width: 40px;
    background-color: #f8f9fa;
    border-right: 1px solid #ddd;
    padding: 12px 5px;
    text-align: right;
    color: #6c757d;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
    user-select: none;
    overflow: hidden;
    margin: 0;
    height: 100%;
    overflow-y: auto;
    z-index: 1;
    white-space: pre-wrap; /* 允许行号换行 */
    word-wrap: break-word;
}

/* 差异标记样式 - 在文本框中的行标记 */
.diff-added {
    background-color: #e8f5e8; /* 浅绿色背景 */
    border-left: 3px solid #28a745; /* 绿色边框 */
    display: block;
    padding: 0 2px;
    word-wrap: break-word;
    word-break: break-word;
}

.diff-removed {
    background-color: #fdecea; /* 浅红色背景 */
    border-left: 3px solid #dc3545; /* 红色边框 */
    display: block;
    padding: 0 2px;
    word-wrap: break-word;
    word-break: break-word;
}

.diff-changed {
    background-color: #fffde7; /* 浅黄色背景 */
    border-left: 3px solid #ffc107; /* 黄色边框 */
    display: block;
    padding: 0 2px;
    word-wrap: break-word;
    word-break: break-word;
}

.diff-same {
    display: block;
    padding: 0 2px;
    word-wrap: break-word;
    word-break: break-word;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}

/* 操作指南样式 */
.guidance-panel {
    background: #f8f9fa;
    border-left: 4px solid #007bff;
    padding: 15px;
    margin-top: 15px;
    border-radius: 0 6px 6px 0;
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.guidance-panel h4 {
    margin-top: 0;
    color: #007bff;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.guidance-panel ul {
    margin-bottom: 0;
    padding-left: 20px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.guidance-panel li {
    margin-bottom: 5px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 代码显示区域样式 */
pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 15px;
    overflow: auto;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
}

.result-actions {
    margin-top: 10px;
    text-align: right;
    width: 100%;
    overflow: hidden;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .tool-container {
        flex-direction: column;
    }
    
    .tool-operation {
        min-width: 100%;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    .compare-form {
        grid-template-columns: 1fr;
    }
    
    .compare-area {
        flex-direction: column;
    }
    
    .result-actions {
        text-align: center;
    }
}