:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.language-selector select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-primary);
    font-size: 14px;
    cursor: pointer;
}

.main-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
}

.sidebar {
    background-color: var(--bg-primary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.sidebar h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.tutorial-list,
.database-list {
    list-style: none;
    margin-bottom: 30px;
}

.tutorial-list li,
.database-list li {
    padding: 10px 15px;
    margin-bottom: 5px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.tutorial-list li:hover,
.database-list li:hover {
    background-color: var(--bg-tertiary);
}

.tutorial-list li.active,
.database-list li.active {
    background-color: var(--primary-color);
    color: white;
}

.editor-section {
    background-color: var(--bg-primary);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.editor-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

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

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

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

#sqlEditor {
    height: 300px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 20px;
}

.CodeMirror {
    height: 100%;
    font-size: 14px;
}

.tutorial-content {
    background-color: var(--bg-tertiary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

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

.tutorial-content h4 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.tutorial-content p {
    margin-bottom: 10px;
    line-height: 1.8;
}

.tutorial-content pre {
    background-color: #282c34;
    color: #abb2bf;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
}

.results-section,
.schema-section {
    margin-top: 30px;
}

.results-section h3,
.schema-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.results-container {
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    padding: 20px;
    min-height: 200px;
    overflow-x: auto;
}

.results-container table {
    width: 100%;
    border-collapse: collapse;
}

.results-container th,
.results-container td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.results-container th {
    background-color: var(--bg-secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.results-container tr:hover {
    background-color: var(--bg-secondary);
}

.placeholder {
    color: var(--text-secondary);
    text-align: center;
    padding: 40px;
}

.error-message {
    color: var(--error-color);
    padding: 15px;
    background-color: #fee;
    border-radius: 6px;
    border: 1px solid #fcc;
}

.success-message {
    color: var(--success-color);
    padding: 15px;
    background-color: #d1fae5;
    border-radius: 6px;
    border: 1px solid #a7f3d0;
}

.schema-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.table-schema {
    background-color: var(--bg-tertiary);
    padding: 15px;
    border-radius: 8px;
}

.table-schema h4 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.column-info {
    font-size: 13px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border-color);
}

.column-info:last-child {
    border-bottom: none;
}

.column-name {
    font-weight: 500;
}

.column-type {
    color: var(--text-secondary);
    font-size: 12px;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
        margin-bottom: 20px;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .editor-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .editor-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    #sqlEditor {
        height: 200px;
    }
}