.sqlite-widget {
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    background-color: #ffffff;
    padding: 0.75rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    border: 1px solid #d1d5db;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Base CodeMirror overrides */
.sqlite-widget .CodeMirror {
    line-height: 1.4;
    font-family: 'Fira Code', monospace;
    font-size: 1em;
    height: 100%;
}
.sqlite-widget-editor-wrapper {
    position: relative;
    flex-grow: 1;
    min-height: 150px;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid #d1d5db;
    box-sizing: border-box;
}

/* Headings */
.sqlite-widget-subtitle {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #4b5563;
    margin-top: 0px;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Toolbar (Top buttons) */
.sqlite-widget-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.75rem;
}

/* Generic Buttons */
.sqlite-widget-btn {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
    background-color: #ffffff;
    color: #374151;
    cursor: pointer;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}
.sqlite-widget-btn:hover {
    background-color: #f3f4f6;
}
.sqlite-widget-btn svg {
    width: 16px;
    height: 16px;
}
.sqlite-widget-btn-primary {
    background-color: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}
.sqlite-widget-btn-primary:hover {
    background-color: #1d4ed8;
}
.sqlite-widget-btn-danger {
    background-color: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
}
.sqlite-widget-btn-danger:hover {
    background-color: #b91c1c;
}
.sqlite-widget-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.sqlite-file-input {
    display: none;
}
.sqlite-db-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.5rem;
}
.sqlite-db-name svg {
    width: 16px;
    height: 16px;
}
.sqlite-db-name.dirty::after {
    content: '*';
    color: #dc2626;
}

/* Modal Styles */
.sqlite-widget-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.sqlite-widget-modal-overlay.active {
    display: flex;
}
.sqlite-widget-modal {
    background: white;
    padding: 1.5rem 2rem 2rem 2rem;
    border-radius: 0.5rem;
    width: 90%;
    max-width: 450px;
    color: #333;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
.sqlite-widget-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #1f2937;
}
.sqlite-widget-modal-warning {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #f87171;
    padding: 0.75rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    display: none;
}
.sqlite-widget-modal-warning.active {
    display: block;
}
.sqlite-widget-modal label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    display: block;
    margin-bottom: 0.25rem;
}
.sqlite-widget-modal-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    margin-bottom: 1.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    box-sizing: border-box;
}
.sqlite-widget-modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Layout */
.sqlite-widget-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
@media (min-width: 768px) {
    .sqlite-widget-main {
        grid-template-columns: 1fr auto 1fr;
        column-gap: 0;
    }
}
.sqlite-widget-section {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Drag Resizer */
.sqlite-widget-separator-drag {
    display: none;
}
@media (min-width: 768px) {
    .sqlite-widget-separator-drag {
        display: block;
        cursor: col-resize;
        width: 0.75rem; 
        height: 100%;
        align-self: stretch;
        position: relative; 
        background-color: transparent; 
    }
    .sqlite-widget-separator-drag::before {
        content: '';
        position: absolute;
        top: 50%;
        left: calc(50% - 2px); 
        transform: translateY(-50%); 
        width: 4px; 
        height: 48px; 
        background-color: #d1d5db;
        border-radius: 2px;
        transition: background-color 0.2s;
    }
    .sqlite-widget-separator-drag:hover::before {
        background-color: #9ca3af;
    }
}

/* Output Panels */
.sqlite-widget-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.sqlite-widget-tab-btn {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6b7280;
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.sqlite-widget-tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}
.sqlite-widget-panel {
    display: none;
    flex-grow: 1;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    overflow-y: auto;
    background-color: #f9fafb;
    height: 250px;
    box-sizing: border-box;
}
.sqlite-widget-panel.active {
    display: block;
}

/* Console Panel */
.sqlite-console {
    padding: 0.75rem;
    font-family: 'Fira Code', monospace;
    font-size: 1em;
    white-space: pre-wrap;
    color: #374151;
}
.sqlite-console .error { color: #dc2626; }
.sqlite-console .success { color: #16a34a; }
.sqlite-console .info { color: #2563eb; }

/* Schema Panel */
.sqlite-schema {
    padding: 0.75rem;
}
.sqlite-schema-table {
    display: flex;
    gap: 0.5em;
    margin-bottom: 1em;
}
.sqlite-schema-icon {
    flex-shrink: 0;
    color: #4b5563;
    display: flex;
    align-items: flex-start;
    padding-top: 0.1em;
}
.sqlite-schema-icon svg {
    width: 16px;
    height: 16px;
}
.sqlite-schema-details {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
}
.sqlite-schema-table-name {
    font-weight: 600;
    font-size: 1em;
    color: #1f2937;
    line-height: 1.2;
}
.sqlite-schema-columns {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9em;
    color: #4b5563;
    display: flex;
    flex-direction: column;
    gap: 0.15em;
}
.sqlite-schema-columns li {
    padding: 0;
    display: flex;
    gap: 0.5em;
    align-items: baseline;
}
.sqlite-schema-columns .type {
    color: #2563eb;
    font-family: 'Fira Code', monospace;
    font-size: 0.85em;
}

/* Results Table */
.sqlite-results-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.sqlite-table-container {
    flex-grow: 1;
    overflow: auto;
}
.sqlite-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1em;
    text-align: left;
}
.sqlite-table th {
    background-color: #f3f4f6;
    padding: 0.5em 0.75em;
    border-bottom: 1px solid #d1d5db;
    border-right: 1px solid #e5e7eb;
    font-weight: 600;
    color: #374151;
    position: sticky;
    top: 0;
}
.sqlite-table td {
    padding: 0.5em 0.75em;
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    color: #4b5563;
    white-space: nowrap;
}
.sqlite-table tbody tr:hover {
    background-color: #f9fafb;
}


/* Toolbar Additions */
.sqlite-widget-separator {
    width: 1px;
    height: 1.5rem;
    background: #d1d5db;
    margin: 0 0.5rem;
}
.sqlite-widget.hide-button-text .btn-text {
    display: none;
}
.sqlite-widget.hide-button-text .sqlite-widget-toolbar > .sqlite-widget-btn {
    padding: 0.375rem 0.5rem;
}

/* Dark Mode */
.sqlite-widget.dark-mode {
    background-color: #1f2937;
    border-color: #374151;
    color: #f9fafb;
}
.sqlite-widget.dark-mode .sqlite-widget-subtitle {
    color: #9ca3af;
}
.sqlite-widget.dark-mode .sqlite-widget-toolbar {
    border-color: #374151;
}
.sqlite-widget.dark-mode .sqlite-widget-btn {
    background-color: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}
.sqlite-widget.dark-mode .sqlite-widget-btn:hover {
    background-color: #4b5563;
}
.sqlite-widget.dark-mode .sqlite-widget-btn-primary {
    background-color: #3b82f6;
    border-color: #3b82f6;
}
.sqlite-widget.dark-mode .sqlite-widget-btn-primary:hover {
    background-color: #2563eb;
}
.sqlite-widget.dark-mode .sqlite-widget-separator {
    background: #4b5563;
}
.sqlite-widget.dark-mode .sqlite-widget-separator-drag::before {
    background-color: #4b5563;
}
.sqlite-widget.dark-mode .sqlite-widget-separator-drag:hover::before {
    background-color: #6b7280;
}
.sqlite-widget.dark-mode .sqlite-db-name {
    color: #e5e7eb;
}
.sqlite-widget.dark-mode .sqlite-widget-editor-wrapper {
    border-color: #4b5563;
}
.sqlite-widget.dark-mode .sqlite-widget-tab-btn {
    color: #9ca3af;
}
.sqlite-widget.dark-mode .sqlite-widget-tab-btn.active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}
.sqlite-widget.dark-mode .sqlite-widget-panel {
    background-color: #111827;
    border-color: #4b5563;
}
.sqlite-widget.dark-mode .sqlite-console {
    color: #e5e7eb;
}
.sqlite-widget.dark-mode .sqlite-console .error { color: #f87171; }
.sqlite-widget.dark-mode .sqlite-console .success { color: #4ade80; }
.sqlite-widget.dark-mode .sqlite-console .info { color: #60a5fa; }
.sqlite-widget.dark-mode .sqlite-schema-icon {
    color: #9ca3af;
}
.sqlite-widget.dark-mode .sqlite-schema-table-name {
    color: #f9fafb;
}
.sqlite-widget.dark-mode .sqlite-schema-columns {
    color: #d1d5db;
}
.sqlite-widget.dark-mode .sqlite-schema-columns .type {
    color: #60a5fa;
}
.sqlite-widget.dark-mode .sqlite-table th {
    background-color: #1f2937;
    color: #f9fafb;
    border-color: #374151;
}
.sqlite-widget.dark-mode .sqlite-table td {
    color: #d1d5db;
    border-color: #374151;
}
.sqlite-widget.dark-mode .sqlite-table tbody tr:hover {
    background-color: #374151;
}
.sqlite-widget.dark-mode .CodeMirror {
    background-color: #111827;
    color: #f9fafb;
}
.sqlite-widget.dark-mode .CodeMirror-gutters {
    background-color: #1f2937;
    border-right-color: #374151;
}
.sqlite-widget.dark-mode .CodeMirror-linenumber {
    color: #6b7280;
}
.sqlite-widget.dark-mode .CodeMirror-cursor {
    border-left-color: #f9fafb;
}
.sqlite-widget.dark-mode .cm-keyword { color: #c678dd; }
.sqlite-widget.dark-mode .cm-operator { color: #56b6c2; }
.sqlite-widget.dark-mode .cm-variable { color: #e06c75; }
.sqlite-widget.dark-mode .cm-string { color: #98c379; }
.sqlite-widget.dark-mode .cm-number { color: #d19a66; }
.sqlite-widget.dark-mode .cm-builtin { color: #61afef; }

