/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
}

/* Layout */
.container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: 320px;
  background: #2c3e50;
  color: white;
  overflow-y: auto;
  overflow-x: hidden;
  position: fixed;
  height: 100vh;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.nav-header {
  padding: 1.5rem;
  border-bottom: 1px solid #34495e;
  background: #34495e;
  flex-shrink: 0;
}

.nav-header h2 {
  color: #ecf0f1;
  margin-bottom: 0.5rem;
  font-size: 1.4rem;
}

.nav-header p {
  color: #bdc3c7;
  font-size: 0.9rem;
}

.nav-search {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #34495e;
  flex-shrink: 0;
}

.nav-search input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #34495e;
  border-radius: 4px;
  background: #34495e;
  color: white;
  font-size: 0.9rem;
}

.nav-search input::placeholder {
  color: #bdc3c7;
}

.nav-search input:focus {
  outline: none;
  border-color: #3498db;
  background: #2c3e50;
}

.nav-content {
  padding: 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
  color: #bdc3c7;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(52, 73, 94, 0.3);
}

.nav-item:hover {
  background-color: #34495e;
  color: #3498db;
}

.nav-item.active {
  background-color: #3498db;
  color: white;
  font-weight: 500;
}

.nav-item.filtered {
  background-color: rgba(52, 152, 219, 0.1);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 320px;
  padding: 2rem;
  max-width: calc(100vw - 320px);
}

.content-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e9ecef;
}

.content-header h1 {
  color: #2c3e50;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: #6c757d;
  font-size: 1.1rem;
}

/* Overview Section */
.overview-section {
  margin-bottom: 3rem;
}

.overview-section h2 {
  color: #2c3e50;
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: bold;
  color: #3498db;
  margin-bottom: 0.5rem;
}

.stat-label {
  color: #6c757d;
  font-weight: 500;
}

.description {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.description p {
  margin-bottom: 1rem;
  color: #555;
}

/* Table Detail Section */
.table-detail {
  background: white;
  margin-bottom: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.table-header {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  padding: 1.5rem;
}

.table-header h2 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.table-meta {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.meta-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

.table-content {
  padding: 0;
}

.table-summary {
  padding: 1.5rem;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.summary-item {
  text-align: center;
}

.summary-number {
  font-size: 1.5rem;
  font-weight: bold;
  color: #3498db;
}

.summary-label {
  color: #6c757d;
  font-size: 0.9rem;
}

/* Columns Section */
.columns-section {
  padding: 1.5rem;
}

.columns-section h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.columns-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

.columns-table th,
.columns-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
}

.columns-table th {
  background: #f8f9fa;
  color: #495057;
  font-weight: 600;
  font-size: 0.9rem;
}

.columns-table tr:hover {
  background: #f8f9fa;
}

.column-name {
  font-weight: 600;
  color: #2c3e50;
  font-family: monospace;
}

.column-type {
  font-family: monospace;
  color: #495057;
  background: #f8f9fa;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-size: 0.85rem;
}

.sql-type {
  font-family: monospace;
  color: #e74c3c;
  font-weight: 500;
}

.column-flags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.flag {
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
}

.flag.pk {
  background: #e74c3c;
  color: white;
}

.flag.fk {
  background: #f39c12;
  color: white;
}

.flag.nullable {
  background: #95a5a6;
  color: white;
}

.flag.not-null {
  background: #27ae60;
  color: white;
}

/* Foreign Key Links */
.fk-link {
  color: #3498db;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.3s ease;
}

.fk-link:hover {
  color: #2980b9;
  text-decoration: underline;
}

/* Relationships Section */
.relationships-section {
  padding: 1.5rem;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
}

.relationships-section h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.relationship-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.relationship-card {
  background: white;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.relationship-card h4 {
  color: #495057;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.relationship-list {
  list-style: none;
}

.relationship-list li {
  padding: 0.25rem 0;
  font-family: monospace;
  font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    width: 280px;
    transform: translateX(-280px);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    max-width: 100vw;
    padding: 1rem;
  }

  .content-header h1 {
    font-size: 2rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-meta {
    flex-direction: column;
    gap: 0.5rem;
  }

  .columns-table {
    font-size: 0.8rem;
  }

  .columns-table th,
  .columns-table td {
    padding: 0.5rem;
  }
}

/* Loading and Empty States */
.loading {
  text-align: center;
  padding: 3rem;
  color: #6c757d;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: #6c757d;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.text-muted {
  color: #6c757d !important;
}

.highlight {
  background-color: #fff3cd !important;
  color: #856404 !important;
}

/* Breadcrumb */
.breadcrumb {
  background: #e9ecef;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.breadcrumb a {
  color: #3498db;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* Search Results */
.search-results {
  background: #d1ecf1;
  border: 1px solid #bee5eb;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #0c5460;
}

.no-results {
  text-align: center;
  padding: 2rem;
  color: #6c757d;
  font-style: italic;
}
