/* HTML代码优化工具样式 - 简洁版 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 0; /* 去掉body的内边距 */
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 标题样式 */
h1 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
}

p {
    margin-bottom: 20px;
    text-align: center;
    color: #7f8c8d;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

/* 文件上传包装器 */
.file-upload-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.file-upload-wrapper input[type="file"] {
    flex: 1;
    width: auto;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
    transition: border-color 0.3s;
}

.file-upload-wrapper input[type="file"]:focus {
    outline: none;
    border-color: #3498db;
}

/* 优化选项样式 */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
    color: #2c3e50;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

/* 提交按钮样式 */
.btn-submit {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    width: auto;
    flex-shrink: 0;
}

.btn-submit:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.btn-submit:active {
    transform: translateY(0);
}

/* 结果区域样式 */
.result-section {
    margin-top: 30px;
    padding: 25px;
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.3s ease-in-out;
}

.result-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 22px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

/* 结果消息样式 */
#resultMessage {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 6px;
    background-color: #f8f9fa;
    border-left: 4px solid #3498db;
}

#resultMessage p {
    text-align: left;
    margin-bottom: 8px;
}

#resultMessage p:last-child {
    margin-bottom: 0;
}

#resultMessage p:first-child {
    font-weight: 600;
    color: #27ae60;
}

#resultMessage .error {
    color: #e74c3c !important;
    font-weight: 600;
}

#resultMessage p:not(:first-child) {
    color: #555;
    font-size: 14px;
}

/* 代码对比区域样式 */
.code-comparison {
    margin-top: 30px;
    padding: 0;
}

.code-comparison-container {
    display: flex;
    gap: 20px; /* 将间距从0改为20px */
    margin-top: 15px;
}

/* 代码列样式 */
.code-column {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    background-color: #ffffff;
    transition: box-shadow 0.3s;
}

.code-column:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 代码头部样式 */
.code-header {
    background-color: #3498db;
    color: white;
    padding: 12px 15px;
    font-weight: 500;
    font-size: 14px;
}

.optimized-code .code-header {
    background-color: #27ae60;
}

/* 代码包装区域 */
.code-wrapper {
    position: relative;
    height: 350px;
}

/* 行号区域 */
.line-numbers {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 50px;
    background-color: #f8f9fa;
    padding: 12px 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #666;
    text-align: right;
    overflow-y: hidden;
    border-right: 1px solid #e0e0e0;
}

/* 代码内容区域 */
.code-content {
    position: absolute;
    left: 50px;
    top: 0;
    right: 0;
    bottom: 0;
    padding: 12px 10px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    background-color: #ffffff;
    overflow-y: auto;
    white-space: pre;
    overflow-x: auto;
    color: #333;
}

/* 代码内容空状态 */
.code-content:empty::before {
    content: "请上传HTML文件以查看代码对比...";
    color: #999;
    font-style: italic;
}

/* 滚动条美化 */
.code-content::-webkit-scrollbar {
    width: 10px; /* 将滚动条宽度从8px改为10px */
}

.code-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

.code-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 下载链接样式 */
#downloadLink {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 0;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* 优化结果区域内的下载按钮样式 */
.result-section #downloadLink {
    margin-top: 20px;
    margin-bottom: 0;
}

/* 移除右侧列中下载区域的额外样式 */
.right-column .download-section {
    margin-top: 0;
    margin-bottom: 0;
}

#downloadLink a {
    display: inline-block;
    padding: 12px 30px;
    background-color: #27ae60;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.2);
    min-width: 200px;
}

#downloadLink a:hover {
    background-color: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

/* 淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
    }
    
    .checkbox-group {
        flex-direction: column;
    }
    
    .code-comparison-container {
        flex-direction: column;
    }
    
    .code-wrapper {
        height: 300px;
    }
    
    /* 文件上传和按钮在小屏幕上的响应式调整 */
    .file-upload-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .file-upload-wrapper input[type="file"],
    .file-upload-wrapper .btn-submit {
        width: 100%;
    }
}

/* 添加工具箱布局样式 */
.toolbox-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-color: #f5f5f5;
}

/* 左侧导航栏样式 */
.toolbox-sidebar {
    width: 240px;
    background-color: #2c3e50;
    color: white;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #34495e;
}

.sidebar-header h2 {
    color: white;
    margin: 0;
    text-align: left;
}

/* 工具分类样式 */
.tool-categories {
    padding: 10px 0;
}

.category {
    margin-bottom: 20px;
}

.category h3 {
    padding: 10px 20px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #95a5a6;
    font-weight: 600;
    margin: 0;
}

/* 工具列表样式 */
.tool-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tool-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.tool-item:hover {
    background-color: #34495e;
    padding-left: 22px;
}

.tool-item.active {
    background-color: #3498db;
    border-left-color: #2980b9;
}

.tool-icon {
    margin-right: 10px;
    font-size: 16px;
}

.tool-name {
    font-size: 14px;
}

/* 右侧主内容区域样式 */
.toolbox-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-header {
    padding: 15px 20px;
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* 搜索框样式 */
.search-box {
    display: flex;
    align-items: center;
    width: 300px;
}

.search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
}

.search-btn {
    padding: 8px 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.search-btn:hover {
    background-color: #2980b9;
}

/* 工具内容区域样式 - 已简化并移除内边距 */
.tool-content {
    flex: 1;
    overflow: hidden;
}

#toolFrame {
    min-height: 100%;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .toolbox-sidebar {
        width: 200px;
    }
    
    .tool-name {
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .toolbox-layout {
        flex-direction: column;
    }
    
    .toolbox-sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
    }
    
    .tool-categories {
        display: flex;
        overflow-x: auto;
        padding: 10px;
    }
    
    .category {
        margin-right: 20px;
        margin-bottom: 0;
        white-space: nowrap;
    }
    
    .main-header {
        justify-content: center;
    }
}

/* 添加左右布局样式 */
.main-layout-container {
    display: flex;
    gap: 20px; /* 确保中间间距为20px，与代码对比区域一致 */
    margin-bottom: 30px;
}

.left-column {
    flex: 1; /* 平均分配宽度 */
    min-width: 0; /* 防止内容溢出 */
    background-color: #ffffff;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.right-column {
    flex: 1; /* 平均分配宽度 */
    min-width: 0; /* 防止内容溢出 */
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 确保结果区域和下载区域在右侧列中正确显示 */
.right-column .result-section {
    margin-top: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.right-column .download-section {
    margin-top: 0;
}

/* 代码对比区域样式 */
.code-comparison {
    margin-top: 30px;
    padding: 0;
}

.code-comparison-container {
    display: flex;
    gap: 20px; /* 保持与上方左右布局一致的间距 */
    margin-top: 15px;
}

/* 代码列样式 */
.code-column {
    flex: 1; /* 与上方左右布局一致的宽度分配 */
    min-width: 0; /* 防止内容溢出 */
    border: 1px solid #e0e0e0;
    border-radius: 8px; /* 统一圆角 */
    overflow: hidden;
    background-color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* 统一阴影 */
    transition: box-shadow 0.3s;
}

.code-column:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 统一所有响应式调整 */
@media (max-width: 768px) {
    /* 上方左右布局响应式调整 */
    .main-layout-container {
        flex-direction: column;
    }
    
    .left-column,
    .right-column {
        width: 100%;
    }
    
    /* 代码对比区域响应式调整 */
    .code-comparison-container {
        flex-direction: column;
    }
}