* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: #212529;
  color: #d4d4d4;
  padding: 20px;
  line-height: 1.5;
}

/* Layout */
.content-wrapper {
  display: flex;
  gap: 20px;
  flex-wrap: wrap; 
}

.main-content {
  flex: 1 1 600px;
  min-width: 0;
}

.sidebar {
  flex: 1 1 280px;
  background: #332701;
  margin: 0 0 16px;
  padding: 16px;
  border: 2px solid #997404;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  line-height: 1.6;
  color: #ffda6a;
}

.notes-section {
  flex: 1 1 350px;
  display: flex;
  flex-direction: column;
  min-width: 0; 
}

.notes-header {
  background: #332701;
  padding: 12px 16px;
  border: 2px solid #997404;
  border-radius: 8px 8px 0 0;
  color: #ffda6a;
  font-weight: 600;
  margin-bottom: 0;
}

.notes-wrapper {
  flex: 1;
  border: 2px solid #997404;
  border-top: none;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 15px;
}

button {
  border: none;
  padding: 0.6em 1.2em;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: 0.2s;
}

button:hover { opacity: 0.9; filter: brightness(1.1); }

.error {
  background: #5a1d1d;
  color: #f48771;
  padding: 0.8em;
  border-left: 3px solid #f14c4c;
  border-radius: 6px;
  margin: 0.5em 0;
  display: none;
}
.error:not(:empty) { display: block; }

a {
  color: #ef9aa4;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.CodeMirror {
  height: 300px;
  border-radius: 6px;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.notes-wrapper .CodeMirror {
  height: 100%;
  min-height: 250px; 
  border-radius: 0 0 6px 6px;
}

.saved-query-item {
  display: flex;
  max-width: 1200px;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #2d2d30;
  border-radius: 6px;
  margin-bottom: 8px;
}

#tablesContainer .table-button {
  font-size: large;
  padding: 10px;
  margin: 5px;
}

.saved-query-item span:nth-child(2) {
  flex: 1;
  font-family: monospace;
  font-size: 0.85rem;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-query-item button {
  padding: 4px 8px;
  font-size: 0.9rem;
}

#result {
  margin-top: 15px;
  max-height: 500px;
  overflow: auto;
  background: #252526;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
#result:empty { display: none; }

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 0.6em 1em;
  border-bottom: 1px solid #3e3e42;
}
th {
  background: #2d2d30;
  color: #4ec9b0;
  font-weight: 600;
  position: sticky;
  top: 0;
}
tr:hover { background: #2a2d2e; }
td { color: #ccc; }

.empty-state {
  text-align: center;
  padding: 3em 1em;
  color: #858585;
}

.highlight {
  color: #4ec9b0;
  font-weight: 600;
}
.highlight code {
  background: #2d2d30;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9rem;
  border: 1px solid #444;
}

.content {
  color: #d4d4d4;
  font-size: 0.95rem;
  line-height: 1.6;
}
.content code {
  background: #2d2d30;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9rem;
  border: 1px solid #444;
}

pre {
  background: #252526;
  padding: 10px;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 15px;
}

h1, h2, h3 { margin-bottom: 0.5em; }
p { margin-bottom: 1em; }

.social-links a {
  margin: 0 8px;
  font-size: 24px;
  transition: color 0.2s;
}

.social-links a:hover {
  color: #b9dbff;
}

@media (max-width: 968px) {
  .content-wrapper { flex-direction: column; }

}
@media (max-width: 600px) {
    body { padding: 10px; }
}