body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f4f7f9;
    color: #333;
}

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

h1, h2 {
    color: #2c3e50;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-top: 0;
}

h2 {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.options {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#dialect-select {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.editor-area {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two equal columns */
    gap: 20px;
    margin-bottom: 20px;
}

.input-section, .output-section {
    display: flex;
    flex-direction: column;
}

textarea#sql-input {
    width: 100%;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
    font-size: 0.95em;
    resize: vertical; /* Allow vertical resizing */
    min-height: 250px; /* Minimum height */
    flex-grow: 1; /* Take available vertical space */
}

.output-wrapper {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1rem;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
}

.output-wrapper pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
}

.output-wrapper code {
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
}

/* Style for the <pre> and <code> tags */
pre {
    margin: 0; /* Remove default margin */
    white-space: pre; /* Keep whitespace as is */
}

code#sql-output {
    display: block; /* Make it a block element to fill the container */
    padding: 10px;
    font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
    font-size: 0.95em;
    line-height: 1.5;
    min-height: calc(250px - 20px); /* Match wrapper min-height minus padding */
    box-sizing: border-box;
}

.controls {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px; /* Spacing between buttons */
    border-top: 1px solid #eee;
    padding-top: 20px;
}

button {
    padding: 10px 18px;
    font-size: 1em;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    background-color: #3498db;
    color: white;
    transition: background-color 0.2s ease;
    position: relative; /* For tooltip */
}

button:hover {
    background-color: #2980b9;
}

button#clear-btn {
    background-color: #e74c3c;
    margin-left: auto; /* Push clear button to the right */
}

button#clear-btn:hover {
    background-color: #c0392b;
}

button#copy-btn {
    background-color: #2ecc71;
}
button#copy-btn:hover {
    background-color: #27ae60;
}

/* Copy Feedback */
.feedback {
    margin-top: 10px;
    color: green;
    font-weight: bold;
    min-height: 1.2em; /* Prevent layout shift */
    text-align: right; /* Align with copy button */
}


/* Simple Tooltip for Copy Button */
[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 5px;
    background-color: #333;
    color: #fff;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    z-index: 10;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .editor-area {
        grid-template-columns: 1fr; /* Stack columns on smaller screens */
    }

    .controls {
        flex-direction: column;
        align-items: stretch; /* Make buttons full width */
    }

    button#clear-btn {
        margin-left: 0; /* Reset margin */
        margin-top: 10px; /* Add space when stacked */
    }

     .feedback {
        text-align: center; /* Center feedback text */
    }
}

/* 选项卡样式 */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #2ecc71;
}

.tab-btn.active {
    color: #2ecc71;
    border-bottom: 2px solid #2ecc71;
    margin-bottom: -0.5rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Diff 界面样式 */
.diff-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.diff-input-section {
    flex: 1;
}

.diff-input-section textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.diff-output-section {
    grid-column: 1 / -1;
}

.diff-output-wrapper {
    background-color: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin-top: 1rem;
}

.diff-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.diff-controls button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

#diff-btn {
    background-color: #2ecc71;
    color: white;
}

#diff-btn:hover {
    background-color: #27ae60;
}

#diff-copy-btn {
    background-color: #3498db;
    color: white;
}

#diff-copy-btn:hover {
    background-color: #2980b9;
}

#diff-clear-btn {
    background-color: #e74c3c;
    color: white;
}

#diff-clear-btn:hover {
    background-color: #c0392b;
}

/* 差异高亮样式 */
.diff-add {
    background-color: #e6f3ff;
    color: #0066cc;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 500;
}

.diff-remove {
    background-color: #ffe6e6;
    color: #cc0000;
    padding: 0 2px;
    border-radius: 2px;
    text-decoration: line-through;
    font-weight: 500;
}

.diff-unchanged {
    color: #333333;
}

/* 行号样式 */
.diff-line {
    position: relative;
    padding-left: 3.5rem;
    min-height: 2.5em;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.line-number {
    position: absolute;
    left: 0;
    width: 3rem;
    color: #666;
    text-align: right;
    padding-right: 0.5rem;
    user-select: none;
}

/* Diff 输出区域样式 */
.diff-columns {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.diff-column {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.diff-header {
    font-weight: bold;
    color: #2c3e50;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    background-color: #ffffff;
    z-index: 1;
}

.diff-line:last-child {
    border-bottom: none;
}

.line-number {
    position: absolute;
    left: 0;
    width: 3rem;
    color: #666;
    text-align: right;
    padding-right: 0.5rem;
    user-select: none;
    background-color: #f8f9fa;
}

.diff-content {
    padding: 0.25rem 0;
}

.hex-content {
    font-size: 0.85em;
    color: #666;
    padding: 0.25rem 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.hex-char {
    display: inline-block;
    min-width: 2em;
    text-align: center;
    padding: 0 0.25rem;
}

/* 调整差异高亮样式 */
.diff-add .hex-char {
    background-color: #e6f3ff;
    color: #0066cc;
    border-radius: 2px;
}

.diff-remove .hex-char {
    background-color: #ffe6e6;
    color: #cc0000;
    border-radius: 2px;
    text-decoration: line-through;
}

.diff-unchanged .hex-char {
    color: #666;
}

.diff-toggle {
    margin-bottom: 1rem;
    text-align: center;
}

.toggle-btn {
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.toggle-btn.active {
    background: #2ecc71;
    color: white;
    border-color: #2ecc71;
}

.diff-view {
    display: none;
}

.diff-view.active {
    display: block;
}

.hex-content {
    font-family: monospace;
    font-size: 0.9em;
    color: #666;
    margin-top: 0.25rem;
}

.hex-char {
    display: inline-block;
    min-width: 2em;
    text-align: center;
    margin: 0 0.1em;
    padding: 0.1em 0.2em;
    border-radius: 2px;
}

.diff-remove .hex-char {
    background-color: #ffebee;
}

.diff-add .hex-char {
    background-color: #e8f5e9;
}

.diff-unchanged .hex-char {
    background-color: #f5f5f5;
}