body {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
    padding: 2rem 0;
}

.format-tool {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
}

.format-tool h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.75rem;
}

/* 历史记录按钮样式 */
.history-button {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    background: #4a90e2;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
    z-index: 10;
}

.history-button:hover {
    background: #357abd;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

/* 历史记录侧边栏样式 */
.history-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.history-sidebar.open {
    right: 0;
}

.history-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.history-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #2c3e50;
}

.history-close {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
}

.history-close:hover {
    background: #e9ecef;
    color: #333;
}

.history-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* 背景遮罩 */
.history-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.history-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 历史记录项样式 */
.history-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: #4a90e2;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.1);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.history-item-name {
    flex: 1;
}

.history-name-input {
    background: transparent;
    border: none;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.95rem;
    width: 100%;
    padding: 0.25rem 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.history-name-input:focus {
    outline: none;
    border-bottom-color: #4a90e2;
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.history-item-time {
    font-size: 0.8rem;
    color: #6c757d;
    margin-left: 1rem;
}

.history-item-config {
    margin-bottom: 0.75rem;
}

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.config-label {
    color: #6c757d;
    font-weight: 500;
}

.config-value {
    color: #2c3e50;
    font-family: monospace;
    background: rgba(74, 144, 226, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.history-item-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.history-item-actions .btn {
    font-size: 0.8rem;
    padding: 0.375rem 0.75rem;
}

/* 空状态样式 */
.history-empty {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.history-empty i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.history-empty p {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.history-loading {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.form-section {
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.input-group {
    border: none;
    border-radius: 8px;
    background: transparent;
    transition: all 0.2s;
    position: relative;
    display: flex;
}

.input-group:focus-within {
    background: #fff;
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.1);
}

.form-control {
    border: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border-radius: 8px !important;
    background: #fff;
}

.form-control:focus {
    box-shadow: none;
    border-color: #4a90e2;
}

textarea.form-control {
    font-family: monospace;
    padding-bottom: 2.5rem;
    padding-right: 2.5rem;
}

/* 设置区域样式 */
.settings-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e9ecef;
}

/* 分隔符标签样式 */
.delimiter-tags {
    margin-top: 0.75rem;
}

.delimiter-tags-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    display: block;
}

.delimiter-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.delimiter-tag {
    display: inline-flex;
    align-items: center;
    background: #4a90e2;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 16px;
    font-size: 0.875rem;
    gap: 0.5rem;
}

.delimiter-tag .delimiter-index {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.delimiter-tag .delimiter-text {
    font-family: monospace;
}

.delimiter-tag-remove {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.delimiter-tag-remove:hover {
    background: rgba(255, 255, 255, 0.2);
}

.delimiter-tag-remove i {
    font-size: 0.7rem;
}

/* 分隔符预览样式 */
.delimiter-preview {
    background: #e8f4fd;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid #b3d9f7;
}

.delimiter-preview h6 {
    font-size: 0.875rem;
    color: #2c5aa0;
    margin-bottom: 0.75rem;
}

.delimiter-item {
    margin-bottom: 0.5rem;
}

.delimiter-item .label {
    font-weight: 500;
    color: #495057;
    margin-right: 0.5rem;
}

.delimiter-item .delimiter {
    background: #4a90e2;
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.875rem;
}

.delimiter-connection {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem 0;
    padding: 0.25rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
}

.delimiter-connection .field {
    background: #6c757d;
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.delimiter-warning {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.delimiter-warning i {
    margin-right: 0.5rem;
}

/* 预览区域样式 */
.preview-order {
    background: #e8f4fd;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid #b3d9f7;
}

.preview-order h6 {
    font-size: 0.875rem;
    color: #2c5aa0;
    margin-bottom: 0.75rem;
}

.preview-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.preview-chip {
    background: #4a90e2;
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-chip .index {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.preview-chip .field {
    font-weight: 500;
}

/* 按钮样式 */
.actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn {
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: #4a90e2;
    color: white;
}

.btn-primary:hover {
    background: #357abd;
    transform: translateY(-1px);
}

.btn-outline-secondary {
    background: transparent;
    border: 1px solid #6c757d;
    color: #6c757d;
}

.btn-outline-secondary:hover {
    background: #6c757d;
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* 结果区域样式 */
.result-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.result-section h3 {
    font-size: 1.125rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.result-container {
    position: relative;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.result-container pre {
    margin: 0;
    padding: 1rem;
    font-family: monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: transparent;
    border: none;
    font-size: 0.9rem;
    line-height: 1.4;
}

.result-actions {
    padding: 0.75rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

/* 行数统计样式 */
.line-stats {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 16px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.line-stats:hover {
    color: #4a90e2;
    background: #fff;
    border-color: #4a90e2;
}

/* 添加行数统计图标 */
.line-stats::before {
    content: "\f0ce"; /* Font Awesome的表格图标 */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.8rem;
}

/* 美化滚动条 */
.result-container::-webkit-scrollbar,
.history-content::-webkit-scrollbar {
    width: 8px;
}

.result-container::-webkit-scrollbar-track,
.history-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.result-container::-webkit-scrollbar-thumb,
.history-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.result-container::-webkit-scrollbar-thumb:hover,
.history-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 字段追加规则样式 */
.field-append-section label {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.append-rule {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.append-rule select {
    width: auto;
    min-width: 80px;
}

.append-rule input {
    flex: 1;
}

.append-rule .position-select {
    width: 100px;
}

.remove-rule {
    color: #dc3545;
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.remove-rule:hover {
    color: #bb2d3b;
}

/* 复制提示样式 */
.copy-tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.copy-tooltip.show {
    opacity: 1;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .delimiter-connection {
        flex-direction: column;
        text-align: center;
    }
    
    .delimiter-tags-container {
        justify-content: flex-start;
    }

    .history-sidebar {
        width: 100%;
        right: -100%;
    }

    .history-button {
        top: 1rem;
        right: 1rem;
    }

    .format-tool {
        margin: 1rem;
        padding: 1.5rem;
    }

    .actions {
        flex-direction: column;
    }

    .actions button {
        width: 100%;
    }

    .config-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .history-item-actions {
        justify-content: center;
    }
}

/* 未命名配置的特殊样式 */
.history-item.unnamed {
    border-left: 4px solid #ffc107;
    background: rgba(255, 193, 7, 0.05);
}

.history-name-input.unnamed-input {
    color: #856404;
    font-style: italic;
    border-color: #ffc107;
}

.unnamed-hint {
    display: block;
    color: #856404;
    font-size: 11px;
    margin-top: 2px;
    font-style: italic;
}

.history-item.unnamed .history-item-header {
    background: rgba(255, 193, 7, 0.1);
} 