:root {
    --primary-color: #4a6fa5;
    --secondary-color: #166088;
    --accent-color: #4fc3f7;
    --light-color: #f8f9fa;
    --dark-color: #8296ab;
    --success-color: #28a745;
    --danger-color: #dc3545;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding: 0;
    color: #333;
}

.container {
    display: flex;
    max-width: 1400px;
    margin: 20px auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: 90vh;
}

.sidebar {
    width: 250px;
    background-color: var(--dark-color);
    color: white;
    padding: 20px;
    overflow-y: auto;
}

.sidebar-actions {
    margin-bottom: 15px;
}

.main-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

h1 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 30px;
    font-size: 28px;
}

h2, h3 {
    color: var(--secondary-color);
    font-size: 20px;
    margin-top: 20px;
    margin-bottom: 10px;
}

.editor-container {
    position: relative;
    margin-bottom: 15px;
}

.editor {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    min-height: 100px;
    background-color: #f8f9fa;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    white-space: pre;
    overflow-x: auto;
}

.editor:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.2);
}

.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

button {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

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

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

button.secondary {
    background-color: #e9ecef;
    color: var(--dark-color);
}

button.secondary:hover {
    background-color: #dee2e6;
}

button.danger {
    background-color: var(--danger-color);
    color: white;
}

button.danger:hover {
    background-color: #c82333;
}

button.small {
    padding: 5px 10px;
    font-size: 13px;
}

.output-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.results {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    background-color: white;
    flex: 1;
    overflow: auto;
}

.table-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.table-item {
    padding: 8px 10px;
    margin-bottom: 5px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    justify-content: space-between;
}

.table-item:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.table-item.active {
    background-color: var(--accent-color);
    color: var(--dark-color);
}

.table-structure {
    margin-top: 10px;
    font-size: 13px;
    color: #ddd;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 4px;
    display: none;
}

.table-structure.show {
    display: block;
}

.table-structure pre {
    margin: 0;
    white-space: pre-wrap;
    font-family: 'Consolas', 'Courier New', monospace;
}

/* Stili per le tabelle dei risultati */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

th {
    background-color: var(--primary-color);
    color: white;
    padding: 10px;
    text-align: left;
}

td {
    padding: 8px 10px;
    border-bottom: 1px solid #ddd;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

tr:hover {
    background-color: #f1f1f1;
}

.message {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
}

.query-info {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 5px;
}

.tab-buttons {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
}

.tab-button {
    padding: 8px 15px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    color: var(--dark-color);
}

.tab-button.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: bold;
}

.tab-content {
    display: none;
}

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

.schema-container {
    display: flex;
    gap: 20px;
}

.schema-editor {
    flex: 2;
}

.schema-viewer {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    background-color: #f8f9fa;
    overflow-y: auto;
    max-height: 400px;
}

.table-visualization {
    margin-bottom: 20px;
    background: white;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table-visualization h4 {
    margin-top: 0;
    color: var(--primary-color);
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.table-column {
    display: flex;
    margin-bottom: 5px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
}

.column-name {
    font-weight: bold;
    min-width: 120px;
}

.column-type {
    color: var(--secondary-color);
    min-width: 80px;
}

.column-constraints {
    color: #666;
    font-style: italic;
}

.foreign-key {
    color: #d63384;
}

.primary-key {
    color: #20c997;
}
footer {
    text-align: center;
    padding: 15px;
    background-color: #f8f9fa;
    border-top: 1px solid #ddd;
    font-size: 14px;
    color: #6c757d;
}

@media (max-width: 1024px) {
    .schema-container {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 200px;
    }
}