* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 0;
    border-bottom: 2px solid #e1e8ed;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 15px 20px;
    backdrop-filter: blur(10px);
}

.title {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
}

.fullscreen-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #4a90e2;
    color: #4a90e2;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.fullscreen-btn:hover {
    background: #4a90e2;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

.comparison-container {
    display: flex;
    flex: 1;
    gap: 20px;
    margin-bottom: 20px;
}

.text-panel {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    backdrop-filter: blur(10px);
}

.panel-header {
    background: linear-gradient(90deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 12px 16px;
    border-bottom: 1px solid #e1e8ed;
    font-weight: 600;
    color: #495057;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 14px;
}

/* 文件上传控件样式 */
.file-upload-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.upload-btn, .clear-file-btn {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
}

.upload-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.clear-file-btn:hover {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #dc3545;
}

.upload-icon, .clear-icon {
    font-size: 16px;
    line-height: 1;
}

/* 文件信息显示样式 */
.file-info {
    background-color: #e9ecef;
    padding: 8px 12px;
    border-top: 1px solid #dee2e6;
    font-size: 12px;
    color: #6c757d;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-name {
    font-weight: 600;
    color: #495057;
}

.file-size {
    color: #6c757d;
}

/* 拖拽上传样式 */
.text-content.drag-over {
    border: 2px dashed #007bff;
    background-color: #f8f9fa;
}

.text-content.drag-over::before {
    content: "释放文件以上传";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 10;
}

.text-area-wrapper {
    display: flex;
    flex: 1;
    position: relative;
}

.line-numbers {
    background-color: #f8f9fa;
    color: #6c757d;
    font-size: 12px;
    padding: 16px 8px 16px 16px;
    border-right: 1px solid #dee2e6;
    user-select: none;
    text-align: right;
    min-width: 40px;
    line-height: 1.8;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    overflow-y: hidden;
    flex-shrink: 0;
    position: relative;
}

.line-number {
    padding: 0 4px;
    height: 1.8em;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 12px;
    color: #6c757d;
    min-height: 1.8em;
}

.text-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.8;
    min-height: 400px;
    outline: none;
    border: none;
    resize: none;
}

.text-content:focus {
    background-color: #fafafa;
}

.comparison-controls {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
    padding: 0 15px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    padding: 20px 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(225, 232, 237, 0.5);
}

.nav-btn {
    width: 45px;
    height: 45px;
    border: 2px solid #e1e8ed;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    color: #5a6c7d;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.nav-btn:hover {
    border-color: #4a90e2;
    color: #4a90e2;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.toolbar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(225, 232, 237, 0.5);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.tool-btn {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.tool-btn:hover {
    background: linear-gradient(135deg, #357abd 0%, #2c5aa0 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
}

.tool-btn:active {
    transform: translateY(1px);
}

.stats {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    color: #5a6c7d;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(225, 232, 237, 0.5);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* 差异高亮样式 */
.diff-added {
    background-color: #e8f5e8 !important;
    border-left: 3px solid #4caf50 !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    color: #2e7d32 !important;
    font-weight: bold !important;
}

.diff-removed {
    background-color: #ffebee !important;
    border-left: 3px solid #f44336 !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    color: #d32f2f !important;
    font-weight: bold !important;
}

.diff-changed {
    background-color: #fff3e0 !important;
    border-left: 3px solid #ff9800 !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    color: #e65100 !important;
    font-weight: bold !important;
}

/* 行包装器样式 */
.line-wrapper {
    display: block;
    width: 100%;
    min-height: 1.2em;
    padding: 1px 0;
    border-radius: 2px;
    transition: all 0.2s ease;
}

/* 差异行的高亮效果 */
.text-content .diff-added,
.text-content .diff-removed,
.text-content .diff-changed {
    animation: highlightPulse 0.6s ease-in-out;
}

@keyframes highlightPulse {
    0% { 
        transform: scale(1.02);
        box-shadow: 0 0 8px rgba(0,0,0,0.1);
    }
    50% { 
        transform: scale(1.01);
        box-shadow: 0 0 4px rgba(0,0,0,0.05);
    }
    100% { 
        transform: scale(1);
        box-shadow: none;
    }
}


/* 全屏样式 */
.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: white;
    padding: 20px;
}

.fullscreen .container {
    height: 100vh;
    max-width: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .comparison-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .comparison-controls {
        flex-direction: row;
        justify-content: center;
        padding: 10px 0;
    }
    
    .toolbar {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .stats {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
}

/* 滚动条样式 */
.text-content::-webkit-scrollbar {
    width: 8px;
}

.text-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

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

.text-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 差异颜色说明样式 */
.legend {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(225, 232, 237, 0.5);
}

.legend h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
}

.legend-items {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #ddd;
}

.legend-color.diff-added {
    background-color: #e8f5e8;
    border-left-color: #4caf50;
}

.legend-color.diff-removed {
    background-color: #ffebee;
    border-left-color: #f44336;
}

.legend-color.diff-changed {
    background-color: #fff3e0;
    border-left-color: #ff9800;
}

.legend-text {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.legend-description {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: left;
}

.legend-description p {
    margin: 8px 0;
    color: #555;
    font-size: 13px;
    line-height: 1.5;
}

.legend-description strong {
    color: #2c3e50;
}

/* 拖拽区域样式 */
.text-content.drag-over {
    background-color: #e3f2fd !important;
    border: 2px dashed #2196f3 !important;
    position: relative;
}

.text-content.drag-over::after {
    content: "拖拽 .txt 文件到这里";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(33, 150, 243, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    z-index: 1000;
    pointer-events: none;
}

/* 响应式设计中的颜色说明 */
@media (max-width: 768px) {
    .legend-items {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .legend-item {
        justify-content: center;
    }
}
