/* ================================================================
   菜刀客在线工具页 · text-diff.html 私有样式
   需在 /css/common.css 之后加载。
   ================================================================ */

/* ---- 覆盖公共值：本页容器更宽 ---- */
.container {
    max-width: 1400px;
}

.footer {
    max-width: 1400px;
}

/* ---- 覆盖公共布局：双栏并排 ---- */
.main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* ---- 工具栏 ---- */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    align-items: center;
}

.toolbar-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.toolbar-group:not(:last-child) {
    padding-right: 15px;
    border-right: 1px solid #e5e7eb;
}

.opt-check {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    user-select: none;
}

.opt-check input {
    accent-color: #667eea;
}

/* ---- 面板：本页为等高列布局 ---- */
.panel {
    display: flex;
    flex-direction: column;
    height: 388px;
}

.panel-header {
    flex-shrink: 0;
}

.panel-header:first-child {
    border-top: none;
}

.diff-editor {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.diff-editor textarea {
    flex: 1;
    width: 100%;
    min-height: 300px;
    padding: 15px;
    border: none;
    outline: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

.status-bar {
    flex-shrink: 0;
    flex-direction: column;
    align-items: stretch;
}

.stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-label {
    color: #9ca3af;
}

.stat-value {
    font-weight: 600;
    color: #374151;
}

/* ---- 文件上传 ---- */
.file-input {
    display: none;
}

/* ---- 结果面板 ---- */
.result-panel {
    margin-top: 15px;
    height: auto;
    min-height: 300px;
}

.result-panel .panel-header {
    border-bottom: 1px solid #e5e7eb;
    justify-content: center;
}

.result-panel .panel-title {
    font-size: 18px;
    font-weight: 700;
}

.diff-content {
    min-height: 200px;
}

.diff-content .result-body {
    padding: 15px;
}

/* ---- 差异视图 ---- */
.view-box {
    overflow: auto;
    max-height: 520px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.view-box .tab-bar,
.view-box .tab {
    float: none;
}

/* 并排视图 */
.view-box {
    position: relative;
}

.diff-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

.diff-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f9fafb;
    color: #374151;
    font-weight: 600;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.diff-table td {
    padding: 6px 10px;
    vertical-align: top;
    border-bottom: 1px solid #f3f4f6;
    white-space: pre-wrap;
    word-break: break-all;
}

.diff-table td.gutter {
    width: 52px;
    min-width: 52px;
    text-align: center;
    color: #9ca3af;
    user-select: none;
    background: #fafafa;
    font-size: 12px;
    white-space: normal;
}

.diff-table td.cell {
    color: #4b5563;
}

/* 连接列：中间彩色竖条 + SVG 连线通道 */
.diff-table td.conn-col {
    width: 22px;
    min-width: 22px;
    padding: 0;
    position: relative;
    background: transparent;
}

.conn-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    transform: translateX(-50%);
    display: block;
}

.conn-del { background: #ef4444; }
.conn-ins { background: #16a34a; }
.conn-change { background: #d97706; }

/* 内容单元侧边彩色边线 */
tr.diff-del td.cell-l { border-right: 3px solid #ef4444; }
tr.diff-ins td.cell-r { border-left: 3px solid #16a34a; }
tr.diff-change td.cell-l { border-right: 3px solid #d97706; }
tr.diff-change td.cell-r { border-left: 3px solid #d97706; }

.diff-table tr.diff-del td {
    background: #fef2f2;
}

.diff-table tr.diff-del td.cell {
    color: #b91c1c;
}

.diff-table tr.diff-ins td {
    background: #f0fdf4;
}

.diff-table tr.diff-ins td.cell {
    color: #15803d;
}

.diff-table tr.diff-change td {
    background: #fefce8;
}

.diff-table tr.diff-change td.cell {
    color: #a16207;
}

.diff-table tr.diff-equal:hover td {
    background: #fafbff;
}

/* SVG 连线画布 */
.connector-svg {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 0;
}

/* 合并（行内）视图 */
.diff-inline {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.7;
}

.il {
    display: flex;
    align-items: baseline;
    white-space: pre-wrap;
    word-break: break-all;
}

.il-sym {
    width: 22px;
    flex-shrink: 0;
    text-align: center;
    font-weight: 700;
    user-select: none;
}

.il-gutter {
    width: 52px;
    flex-shrink: 0;
    text-align: right;
    padding-right: 8px;
    color: #9ca3af;
    user-select: none;
    font-size: 12px;
}

.il-code {
    flex: 1;
    padding-left: 8px;
}

.il-del {
    background: #fef2f2;
}

.il-del .il-sym {
    color: #dc2626;
}

.il-del .il-code {
    color: #b91c1c;
}

.il-ins {
    background: #f0fdf4;
}

.il-ins .il-sym {
    color: #16a34a;
}

.il-ins .il-code {
    color: #15803d;
}

.il-eq .il-code {
    color: #4b5563;
}

/* ---- 结果面板内的标签页 ---- */
.result-panel .tab-bar {
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.result-panel .tab {
    display: inline-block;
}

/* ---- 差异列表（仅列出不同行） ---- */
.diff-list {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.7;
}

.diff-list-title {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f9fafb;
    color: #374151;
    font-weight: 600;
    padding: 8px 12px;
    border-bottom: 1px solid #e5e7eb;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.dl-row {
    display: flex;
    align-items: baseline;
    padding: 4px 12px;
    border-bottom: 1px solid #f3f4f6;
    white-space: pre-wrap;
    word-break: break-all;
}

.dl-row.diff-del {
    background: #fef2f2;
}

.dl-row.diff-ins {
    background: #f0fdf4;
}

.dl-row.diff-change {
    background: #fefce8;
}

.dl-num {
    width: 34px;
    flex-shrink: 0;
    color: #9ca3af;
    text-align: center;
    user-select: none;
    font-size: 12px;
}

.dl-sym {
    width: 22px;
    flex-shrink: 0;
    text-align: center;
    font-weight: 700;
    user-select: none;
}

.dl-row.diff-del .dl-sym { color: #dc2626; }
.dl-row.diff-ins .dl-sym { color: #16a34a; }
.dl-row.diff-change .dl-sym { color: #d97706; }

.dl-pos {
    width: 150px;
    flex-shrink: 0;
    font-size: 12px;
}

.dl-row.diff-del .dl-pos, .dl-row.diff-del .dl-code { color: #b91c1c; }
.dl-row.diff-ins .dl-pos, .dl-row.diff-ins .dl-code { color: #15803d; }
.dl-row.diff-change .dl-pos { color: #a16207; }

.dl-code {
    flex: 1;
    padding-left: 8px;
}

.dl-old {
    color: #b91c1c;
}

.dl-arrow {
    color: #9ca3af;
    margin: 0 6px;
}

.dl-new {
    color: #15803d;
}
