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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background-color: #2c3e50;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.title-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.app-logo {
    height: 40px;
    width: auto;
}

header h1 {
    font-size: 24px;
    font-weight: 500;
    margin: 0;
}

.subtitle {
    font-size: 12px;
    color: #ecf0f1;
    font-weight: 300;
    margin: 0;
}

.subtitle-link {
    color: #2ecc71;
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 600;
}

.subtitle-link:hover {
    color: #58d68d;
    text-decoration: underline;
}

.file-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.db-name {
    color: #ecf0f1;
    font-size: 14px;
    font-style: italic;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 300px;
    background-color: #34495e;
    color: white;
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid #2c3e50;
}

.sidebar h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #ecf0f1;
}

.tables-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.table-item {
    background-color: #2c3e50;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.table-item:hover {
    background-color: #1a252f;
}

.table-name {
    font-weight: bold;
    color: #3498db;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-name::before {
    content: '📋';
}

.expand-icon {
    font-size: 10px;
    transition: transform 0.2s;
    display: inline-block;
}

.table-item.expanded .expand-icon {
    transform: rotate(90deg);
}

.table-attributes {
    display: none;
    margin-top: 8px;
    padding-left: 15px;
    font-size: 13px;
    color: #bdc3c7;
}

.table-item.expanded .table-attributes {
    display: block;
}

.attribute-item {
    padding: 3px 0;
    display: flex;
    gap: 8px;
}

.attribute-name {
    color: #ecf0f1;
}

.attribute-type {
    color: #95a5a6;
    font-style: italic;
}

.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: white;
    overflow: hidden;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #ecf0f1;
    border-bottom: 1px solid #bdc3c7;
    flex-shrink: 0;
}

.editor-header h2 {
    font-size: 18px;
    color: #2c3e50;
}

.editor-buttons {
    display: flex;
    gap: 10px;
}

.editor-wrapper {
    flex: 0 0 250px;
    position: relative;
    background-color: #fafafa;
    overflow: visible;
}

.syntax-highlight {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 15px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
    pointer-events: none;
    overflow: hidden;
    line-height: 1.5;
    color: #2c3e50;
}

.syntax-highlight .keyword {
    color: #0066cc;
    font-weight: bold;
}

.syntax-highlight .string {
    color: #22863a;
    font-weight: 500;
}

.syntax-highlight .number {
    color: #d73a49;
    font-weight: 500;
}

.syntax-highlight .comment {
    color: #6a737d;
    font-style: italic;
    font-weight: 400;
}

.sql-editor {
    flex: 1;
    width: 100%;
    height: 100%;
    padding: 15px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    border: none;
    resize: none;
    outline: none;
    background-color: transparent;
    color: transparent;
    caret-color: #2c3e50;
    position: relative;
    z-index: 1;
    line-height: 1.5;
    -webkit-text-fill-color: transparent;
}

.sql-editor::selection {
    background-color: rgba(52, 152, 219, 0.3);
}

.resizer {
    height: 8px;
    background-color: #bdc3c7;
    cursor: ns-resize;
    position: relative;
    flex-shrink: 0;
    transition: background-color 0.2s;
}

.resizer:hover {
    background-color: #3498db;
}

.resizer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 3px;
    background-color: rgba(52, 73, 94, 0.3);
    border-radius: 2px;
}

.results-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-top: 2px solid #3498db;
    min-height: 0;
    overflow: hidden;
}

.results-section h2 {
    font-size: 16px;
    padding: 10px 20px;
    background-color: #ecf0f1;
    color: #2c3e50;
    border-bottom: 1px solid #bdc3c7;
    flex-shrink: 0;
}

.results-container {
    flex: 1;
    overflow: auto;
    padding: 0;
    position: relative;
    min-height: 0;
}

.placeholder {
    color: #95a5a6;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

.table-wrapper {
    overflow: auto;
    max-height: 400px;
    width: 100%;
    margin-bottom: 10px;
}

.results-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.results-table th {
    background-color: #3498db;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.results-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #ecf0f1;
    white-space: nowrap;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.results-table tr:hover {
    background-color: #f8f9fa;
}

.results-info {
    padding: 10px 15px;
    background-color: #d5f4e6;
    border-left: 4px solid #27ae60;
    color: #27ae60;
    font-size: 14px;
    flex-shrink: 0;
}

.execution-time {
    padding: 10px 15px;
    background-color: #e8f4f8;
    border-left: 4px solid #3498db;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 500;
    margin-top: 10px;
}

.query-separator {
    padding: 12px 15px;
    background-color: #34495e;
    color: white;
    border-left: 4px solid #3498db;
    margin-top: 15px;
    margin-bottom: 10px;
}

.query-separator:first-child {
    margin-top: 0;
}

.query-separator h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.error-message {
    margin: 15px;
    padding: 15px;
    background-color: #fadbd8;
    border-left: 4px solid #e74c3c;
    color: #c0392b;
    font-size: 14px;
    border-radius: 3px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2980b9;
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #229954;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #7f8c8d;
}

/* Autocomplete styling */
.autocomplete-dropdown {
    position: fixed;
    background-color: white;
    border: 1px solid #3498db;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1000;
    display: none;
    min-width: 180px;
    max-width: 250px;
    overflow: hidden;
}

.autocomplete-dropdown.active {
    display: block;
}

.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    color: #2c3e50;
    transition: background-color 0.1s;
    border-bottom: 1px solid #ecf0f1;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: #ecf0f1;
}

.autocomplete-item.selected {
    background-color: #3498db;
    color: white;
}

.autocomplete-item .keyword-text {
    font-weight: 600;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #ecf0f1;
}

::-webkit-scrollbar-thumb {
    background: #95a5a6;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #7f8c8d;
}
