:root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  
  /* Color palette */
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --background: #f5f7fa;
  --surface: #ffffff;
  --text-primary: #2c3e50;
  --text-secondary: #495057;
  --border-color: #e0e0e0;
  --error-color: #dc3545;
  --success-color: #28a745;
  
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--background);
  color: var(--text-primary);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

h1 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2rem;
  text-align: center;
}

h2 {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* Query Section */
.query-section {
  background: var(--surface);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
}

#query-input {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  resize: vertical;
  font-family: inherit;
  transition: border-color 0.3s;
}

#query-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.query-controls {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  align-items: center;
}

/* Buttons */
.primary-button,
.secondary-button,
.toggle-button {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.primary-button {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.secondary-button {
  background: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

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

.toggle-button {
  background: var(--text-secondary);
  color: white;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}


/* Results Section */
.results-section {
  background: var(--surface);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.sql-display {
  background: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  text-align: left;
}

.query-display {
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.sql-query {
  margin-top: 0.75rem;
}

.sql-query code {
  font-family: 'Courier New', monospace;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
  margin-top: 0.25rem;
}

.results-container {
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

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

.results-table th {
  background: #f8f9fa;
  font-weight: 600;
  position: sticky;
  top: 0;
}

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

/* Tables Section */
.tables-section {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
}

.tables-section h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.no-tables {
  color: var(--text-secondary);
  font-style: italic;
  margin: 0;
}

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 3rem;
  text-align: center;
  transition: all 0.3s;
}

.drop-zone.dragover {
  border-color: var(--primary-color);
  background: rgba(102, 126, 234, 0.05);
}

.drop-zone p {
  margin: 0 0 1rem 0;
  color: var(--text-secondary);
}

.tables-list {
  margin-top: 1rem;
}

.table-item {
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border-color);
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.table-name {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.table-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.table-columns {
  font-size: 0.813rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.column-tag {
  display: inline-block;
  background: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-right: 0.5rem;
  margin-top: 0.25rem;
  border: 1px solid var(--border-color);
}

.column-name {
  font-weight: 500;
  color: var(--text-primary);
}

.column-type {
  color: var(--primary-color);
  font-size: 0.75rem;
  margin-left: 0.25rem;
}

.remove-table-button {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.remove-table-button:hover {
  background: rgba(220, 53, 69, 0.1);
  color: var(--error-color);
}

/* Loading States */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error States */
.error-message {
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid var(--error-color);
  color: var(--error-color);
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--surface);
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  margin: 0;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.close-modal:hover {
  background: #f0f0f0;
}

.modal-body {
  padding: 1.5rem;
}

/* Sample Data Section */
.sample-data-section {
  margin-bottom: 2rem;
}

.sample-data-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.sample-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.sample-button {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: left;
}

.sample-button:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.sample-icon {
  font-size: 2rem;
}

.sample-text {
  display: flex;
  flex-direction: column;
}

.sample-text strong {
  font-size: 1rem;
  color: var(--text-primary);
}

.sample-text small {
  font-size: 0.813rem;
  color: var(--text-secondary);
}

.divider {
  text-align: center;
  margin: 2rem 0;
  color: var(--text-secondary);
  position: relative;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 45%;
  height: 1px;
  background: var(--border-color);
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}
