/**
 * 文本对比工具 - 样式
 * 所有选择器以 .duibi-tool 开头，隔离整站
 * 修改记录：输入区 + 结果区高度整体加大（2025-01-XX）
 */

.duibi-tool {
    width: 100%;
    /* max-width: 964px; 已删除，由父容器自然约束 */
    margin: 0 auto;
    font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    color: #333;
    box-sizing: border-box;
}
.duibi-tool * {
    box-sizing: border-box;
}

/* ===== 头部 ===== */
.duibi-tool .header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 14px 22px;
    border-radius: 10px 10px 0 0;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.duibi-tool .header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}
.duibi-tool .header h3 small {
    font-weight: 400;
    font-size: 12px;
    opacity: 0.75;
    margin-left: 10px;
}
.duibi-tool .header .badge {
    background: rgba(255, 255, 255, 0.12);
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 11px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ===== 输入区 ===== */
.duibi-tool .input-area {
    background: #f8f9fc;
    border-left: 1px solid #e9ecef;
    border-right: 1px solid #e9ecef;
    padding: 14px 18px;
}
.duibi-tool .input-row {
    display: flex;
    align-items: center;
    gap: 8px 12px;
    flex-wrap: wrap;
    padding: 4px 0;
}
.duibi-tool .input-row .label {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    min-width: 52px;
    white-space: nowrap;
}
.duibi-tool .input-row .label-base {
    color: #0f3460;
}
.duibi-tool .input-row .label-compare {
    color: #c62828;
}
.duibi-tool .input-row .file-input {
    font-size: 12px;
    padding: 2px 4px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: white;
    flex: 1;
    min-width: 120px;
}
.duibi-tool .input-row .file-input::file-selector-button {
    padding: 1px 10px;
    border: none;
    border-radius: 2px;
    background: #e9ecef;
    cursor: pointer;
    font-size: 11px;
}
.duibi-tool .input-row .file-input::file-selector-button:hover {
    background: #dee2e6;
}
.duibi-tool .input-row .fname {
    font-size: 12px;
    color: #888;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.duibi-tool .input-row .or-text {
    color: #aaa;
    font-size: 12px;
    padding: 0 2px;
}

/* ✅ 修改点 1：粘贴框高度加大（原来 34px → 80px） */
.duibi-tool .input-row .paste-textarea {
    flex: 2;
    min-width: 180px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    resize: vertical;
    background: white;
    min-height: 80px;
    max-height: 150px;
    line-height: 1.5;
}
.duibi-tool .input-row .paste-textarea:focus {
    outline: none;
    border-color: #0f3460;
}

/* ===== 工具栏 ===== */
.duibi-tool .toolbar {
    background: #f8f9fc;
    border-left: 1px solid #e9ecef;
    border-right: 1px solid #e9ecef;
    padding: 8px 18px 14px 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
}
.duibi-tool .btn-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.duibi-tool .btn {
    padding: 4px 14px;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
    white-space: nowrap;
}
.duibi-tool .btn-primary {
    background: #4CAF50;
    color: white;
}
.duibi-tool .btn-primary:hover {
    background: #388E3C;
}
.duibi-tool .btn-swap {
    background: #e0e0e0;
    color: #555;
}
.duibi-tool .btn-swap:hover {
    background: #d0d0d0;
}
.duibi-tool .btn-outline {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
}
.duibi-tool .btn-outline:hover {
    background: #f0f0f0;
}

.duibi-tool .opt-group {
    display: flex;
    align-items: center;
    gap: 6px 14px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #555;
    margin-left: auto;
}
.duibi-tool .opt-group label {
    display: flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
}
.duibi-tool .opt-group input[type="checkbox"] {
    width: 13px;
    height: 13px;
    cursor: pointer;
    accent-color: #0f3460;
}
.duibi-tool .opt-group select {
    padding: 2px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
    background: white;
}

/* ===== 统计摘要 ===== */
.duibi-tool .summary {
    padding: 8px 18px;
    background: white;
    border-left: 1px solid #e9ecef;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    align-items: center;
}
.duibi-tool .summary .stat {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 13px;
    color: #555;
}
.duibi-tool .summary .stat .num {
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    padding: 0 3px;
    border-radius: 2px;
}
.duibi-tool .summary .stat .num:hover {
    background: #f0f0f0;
}
.duibi-tool .stat-sim .num {
    color: #4CAF50;
}
.duibi-tool .stat-add .num {
    color: #2196F3;
}
.duibi-tool .stat-add .num::before {
    content: '+ ';
}
.duibi-tool .stat-del .num {
    color: #dc3545;
}
.duibi-tool .stat-del .num::before {
    content: '- ';
}
.duibi-tool .stat-mod .num {
    color: #FF9800;
}
.duibi-tool .stat-mod .num::before {
    content: '≠ ';
}
.duibi-tool .stat-total .num {
    color: #6c757d;
    cursor: default;
}
.duibi-tool .stat-total .num:hover {
    background: transparent;
}
.duibi-tool .filter-hint {
    font-size: 11px;
    color: #aaa;
    margin-left: auto;
}

/* ===== 对比容器 ===== */
/* ✅ 修改点 2：外层容器最小/最大高度加大（400→560，540→720） */
.duibi-tool .container {
    display: flex;
    gap: 0;
    background: white;
    border-left: 1px solid #e9ecef;
    border-right: 1px solid #e9ecef;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    min-height: 560px;
    max-height: 720px;
}
.duibi-tool .panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.duibi-tool .panel:first-child {
    border-right: 1px solid #e9ecef;
}
.duibi-tool .panel .ptitle {
    padding: 5px 12px;
    background: #f8f9fc;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.duibi-tool .panel .ptitle .info {
    color: #999;
    font-weight: 400;
    font-size: 11px;
}

/* ✅ 修改点 3：编辑器最小高度加大（300→460） */
.duibi-tool .panel .editor {
    flex: 1;
    padding: 6px 4px 6px 2px;
    overflow: auto;
    font-family: 'Cascadia Code', 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: #fafbfc;
    min-height: 460px;
}

/* ===== 差异行样式 ===== */
.duibi-tool .diff-line {
    display: block;
    padding: 0 4px;
    margin: 0 -2px;
    border-radius: 2px;
    transition: background 0.1s;
    cursor: pointer;
}
.duibi-tool .diff-line:hover {
    filter: brightness(0.96);
}
.duibi-tool .diff-equal {
    background-color: #ffffff;
    color: #333;
}
.duibi-tool .diff-equal .prefix {
    color: #ccc;
}
.duibi-tool .diff-insert {
    background-color: #d4edff;
    color: #0056b3;
    border-left: 3px solid #2196F3;
}
.duibi-tool .diff-insert .prefix {
    color: #2196F3;
    font-weight: 700;
}
.duibi-tool .diff-delete {
    background-color: #ffd6d6;
    color: #c62828;
    border-left: 3px solid #dc3545;
}
.duibi-tool .diff-delete .prefix {
    color: #dc3545;
    font-weight: 700;
}
.duibi-tool .diff-replace {
    background-color: #fff3cd;
    color: #e65100;
    border-left: 3px solid #FF9800;
}
.duibi-tool .diff-replace .prefix {
    color: #FF9800;
    font-weight: 700;
}
.duibi-tool .char-diff {
    background-color: #ffc107;
    color: #333;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}
.duibi-tool .line-num {
    display: inline-block;
    width: 28px;
    color: #bbb;
    font-size: 10px;
    user-select: none;
    text-align: right;
    margin-right: 6px;
    font-weight: 400;
    font-family: 'Consolas', monospace;
}
.duibi-tool .prefix {
    display: inline-block;
    width: 16px;
    text-align: center;
    font-weight: 700;
    user-select: none;
}

/* ===== 空状态 ===== */
.duibi-tool .empty-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #bbb;
    font-size: 13px;
    user-select: none;
    padding: 20px 16px;
}
.duibi-tool .empty-hint .icon {
    font-size: 32px;
    margin-bottom: 6px;
    opacity: 0.5;
}
.duibi-tool .empty-hint .sub {
    font-size: 11px;
    color: #ccc;
    margin-top: 2px;
}

/* ===== 过滤 ===== */
.duibi-tool .diff-line.filter-dimmed {
    opacity: 0.2;
}

/* ===== 跳转高亮 ===== */
@keyframes duibi-flash {
    0% {
        background-color: #ffeb3b;
    }
    100% {
        background-color: transparent;
    }
}
.duibi-tool .diff-line.jump-highlight {
    animation: duibi-flash 0.8s ease 2;
}

/* ===== 滚动条 ===== */
.duibi-tool .panel .editor::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
.duibi-tool .panel .editor::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 2px;
}
.duibi-tool .panel .editor::-webkit-scrollbar-track {
    background: #f5f5f5;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .duibi-tool .header {
        padding: 10px 14px;
    }
    .duibi-tool .header h3 {
        font-size: 16px;
    }
    .duibi-tool .header h3 small {
        font-size: 11px;
        display: block;
        margin-left: 0;
        margin-top: 2px;
    }
    .duibi-tool .input-area {
        padding: 10px 12px;
    }
    .duibi-tool .input-row {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }
    .duibi-tool .input-row .label {
        min-width: auto;
    }
    .duibi-tool .input-row .file-input {
        flex: none;
        width: 100%;
    }
    .duibi-tool .input-row .paste-textarea {
        flex: none;
        width: 100%;
        min-height: 60px; /* 移动端适当减小 */
    }
    .duibi-tool .toolbar {
        padding: 6px 12px 10px 12px;
        flex-direction: column;
        align-items: stretch;
    }
    .duibi-tool .opt-group {
        margin-left: 0;
    }
    .duibi-tool .container {
        flex-direction: column;
        max-height: none;
        min-height: 460px;
    }
    .duibi-tool .panel:first-child {
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    .duibi-tool .panel .editor {
        min-height: 200px;
        max-height: 300px;
    }
    .duibi-tool .summary {
        padding: 6px 12px;
        gap: 3px 10px;
        font-size: 12px;
    }
    .duibi-tool .summary .stat .num {
        font-size: 13px;
    }
}