:root {
    --primary-color: #2563eb;
    --secondary-color: #1d4ed8;
    --background-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-color: #334155;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --thread-color-1: #ef4444;
    --thread-color-2: #8b5cf6;
    --thread-color-3: #f59e0b;
    --thread-color-4: #14b8a6;
    --thread-color-5: #22c55e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.5;
    font-size: 14px;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: grid;
    grid-template-columns: 40% 60%;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.input-section, .output-section {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.input-section {
    border-right: 1px solid var(--border-color);
    background-color: var(--card-bg);
}

.output-section {
    background-color: var(--background-color);
}

.section-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--card-bg);
    display: flex;
    align-items: center;
    height: 50px;
    gap: 0.75rem;
    justify-content: space-between;
}

h2 {
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
}

textarea {
    width: 100%;
    flex: 1;
    padding: 0.8rem;
    border: none;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    resize: none;
    font-size: 13px;
    line-height: 1.5;
    outline: none;
}

.button-group {
    display: flex;
    gap: 0.5rem;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
    font-weight: 500;
}

button:hover {
    background-color: var(--secondary-color);
}

#clearButton {
    background-color: #64748b;
}

#clearButton:hover {
    background-color: #475569;
}

.paste-parse-btn {
    background-color: #22c55e;
}

.paste-parse-btn:hover {
    background-color: #16a34a;
}

#sqlResults {
    padding: 0.75rem;
    overflow-y: auto;
    flex: 1;
}

.sql-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.sql-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-color);
}

.sql-header .button-group {
    display: flex;
    gap: 0.5rem;
}

.copy-btn, .copy-formatted-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 0.15rem 0.4rem;
    font-size: 0.8rem;
}

.copy-btn:hover, .copy-formatted-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.thread-tag {
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

.sql-header small {
    margin-left: 0.5rem;
    color: #64748b;
    font-size: 0.8rem;
}

.total-results {
    color: var(--primary-color);
    font-weight: 500;
}

.sql-content {
    padding: 0.75rem;
    white-space: pre-wrap;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.thread-filter-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    font-size: 0.85rem;
}

.thread-filter-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.thread-filter-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.thread-filter-content {
    background-color: var(--card-bg);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    width: 400px;
    max-width: 90%;
    display: flex;
    flex-direction: column;
}

.thread-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.thread-filter-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
}

.close-modal-btn:hover, .close-modal-btn:active {
    background: transparent;
}

.thread-actions {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
    white-space: nowrap;
}

.select-all-btn, .deselect-all-btn {
    background-color: #f1f5f9;
    color: var(--text-color);
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

.select-all-btn:hover, .deselect-all-btn:hover {
    background-color: #f8fafc;
}

.thread-tags {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    flex: 1;
    padding: 0 0.5rem;
    scrollbar-width: none; 
    -ms-overflow-style: none; 
}

.thread-tags::-webkit-scrollbar {
    display: none; 
}

.thread-tag-item {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.thread-tag-item.active {
    opacity: 1;
}

.thread-tag-item:not(.active) {
    color: inherit;
    background-color: white !important;
    border: 1px solid;
}

.copied {
    background-color: var(--success-color) !important;
    color: white !important;
    border-color: var(--success-color) !important;
}

.resizer {
    position: absolute;
    left: 40%;
    top: 0;
    bottom: 0;
    width: 5px;
    background-color: var(--border-color);
    cursor: col-resize;
    z-index: 10;
    transition: background-color 0.2s;
    user-select: none;
}

.resizer:hover, .resizer:active {
    background-color: var(--primary-color);
}

.resizing * {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

/* SQL Formatting */
.keyword {
    color: #8250df;
    font-weight: 600;
}

.function {
    color: #0550ae;
}

.table {
    color: #0969da;
}
.string {
    color: #0a3069;
}

.number {
    color: #116329;
}

.operator {
    color: #cf222e;
}

.punctuation {
    color: #24292f;
}