:root {
    --bg-app: #1e1e1e;
    --bg-panel: #252526;
    --bg-header: #333333;
    --bg-input: #1e1e1e;

    --border-color: #3e3e42;
    --border-focus: #007acc;

    --text-main: #cccccc;
    --text-title: #ffffff;
    --text-muted: #858585;

    --color-primary: #0e639c;
    --color-primary-hover: #1177bb;

    --color-warning: #cca700;
    --bg-warning: rgba(204, 167, 0, 0.1);
    --color-danger: #f14c4c;
    --bg-danger: rgba(241, 76, 76, 0.1);

    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'Fira Code', monospace;

    --radius: 6px;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Utilities */
.hidden {
    display: none !important;
}

.icon {
    width: 20px;
    height: 20px;
}

.icon-sm {
    width: 16px;
    height: 16px;
}

.text-warning {
    color: var(--color-warning);
}

.text-danger {
    color: var(--color-danger);
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.navbar {
    height: 50px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-title);
}

.brand h1 {
    font-size: 1rem;
    font-weight: 500;
}

.actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
}

.pane:last-child {
    border-right: none;
}

.pane-header {
    height: 40px;
    padding: 0 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-panel);
}

.pane-header h2 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* Inputs & Buttons */
.select-box {
    background: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.35rem 0.75rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.select-box:focus {
    border-color: var(--border-focus);
}

.btn {
    font-family: inherit;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

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

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-title);
}

textarea#sql-input {
    flex: 1;
    width: 100%;
    padding: 1rem;
    background: var(--bg-input);
    color: var(--text-title);
    border: none;
    resize: none;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.5;
    outline: none;
}

/* Output Pane & CodeMirror */
.cm-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.CodeMirror {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    font-family: var(--font-mono) !important;
    font-size: 14px;
    line-height: 1.5;
    background-color: var(--bg-input) !important;
}

/* Linting Error Strip */
.toolbar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 50%;
    /* Cover left pane bottom */
    z-index: 10;
}

.lint-panel {
    background: var(--bg-warning);
    border-top: 1px solid var(--color-warning);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
}

.lint-panel.danger {
    background: var(--bg-danger);
    border-top: 1px solid var(--color-danger);
}

.lint-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-title);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--color-primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

@media (max-width: 768px) {
    .workspace {
        flex-direction: column;
    }

    .toolbar {
        right: 0;
        bottom: 50%;
    }
}