/* 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;
  position: fixed;
  height: 100vh;
  z-index: 1000;
}

.nav-header {
  padding: 1.5rem;
  border-bottom: 1px solid #34495e;
  background: #34495e;
}

.nav-header h2 {
  color: #ecf0f1;
  margin-bottom: 0.5rem;
  font-size: 1.4rem;
}

.nav-header p {
  color: #bdc3c7;
  font-size: 0.9rem;
}

.nav-content {
  padding: 0;
}

.nav-item {
  border-bottom: 1px solid #34495e;
}

.nav-item > .nav-link {
  display: block;
  padding: 1rem 1.5rem;
  color: #ecf0f1;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.nav-item > .nav-link:hover {
  background-color: #34495e;
  color: #3498db;
}

.nav-item.active > .nav-link {
  background-color: #3498db;
  color: white;
}

.nav-item > .nav-link::after {
  content: "▶";
  position: absolute;
  right: 1.5rem;
  transition: transform 0.3s ease;
  font-size: 0.8rem;
}

.nav-item.expanded > .nav-link::after {
  transform: rotate(90deg);
}

.sub-nav {
  background-color: #34495e;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.nav-item.expanded .sub-nav {
  max-height: 500px;
}

.sub-nav-item {
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
  color: #bdc3c7;
  font-size: 0.9rem;
}

.sub-nav-item:hover {
  background-color: #2c3e50;
  color: #3498db;
}

.sub-nav-item.active {
  background-color: #3498db;
  color: white;
  font-weight: 500;
}

/* 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;
}

/* Content Sections */
.functional-area {
  background: white;
  margin-bottom: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.functional-area-header {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  padding: 1.5rem;
}

.functional-area-header h2 {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

.functional-area-header .description {
  background: rgba(255, 255, 255, 0.1);
  padding: 1rem;
  border-radius: 4px;
  margin-top: 1rem;
}

.functional-area-content {
  padding: 0;
}

.component-section {
  border-bottom: 1px solid #e9ecef;
}

.component-section:last-child {
  border-bottom: none;
}

.component-header {
  background: #f8f9fa;
  padding: 1.5rem;
  border-bottom: 1px solid #e9ecef;
}

.component-header h3 {
  color: #2c3e50;
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.component-meta {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.meta-item {
  background: white;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  border: 1px solid #dee2e6;
}

.component-content {
  padding: 1.5rem;
}

.field-section {
  margin-bottom: 2rem;
}

.field-section h4 {
  color: #495057;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e9ecef;
}

.fields-grid {
  display: grid;
  gap: 1rem;
}

.field-card {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 1rem;
  transition: all 0.3s ease;
}

.field-card:hover {
  border-color: #3498db;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15);
}

.field-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.field-name {
  font-weight: 600;
  color: #2c3e50;
}

.field-type {
  background: #e9ecef;
  color: #495057;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8rem;
  font-family: monospace;
}

.field-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.9rem;
}

.field-label {
  font-weight: 500;
  color: #6c757d;
}

.field-value {
  color: #495057;
}

.database-info {
  background: #e8f4f8;
  border-left: 4px solid #3498db;
  padding: 0.75rem;
  margin-top: 0.75rem;
  border-radius: 0 4px 4px 0;
}

.database-table {
  font-weight: 600;
  color: #2c3e50;
  font-family: monospace;
}

.database-column {
  color: #495057;
  font-family: monospace;
  margin-top: 0.25rem;
}

.notes {
  margin-top: 0.5rem;
  font-style: italic;
  color: #6c757d;
  font-size: 0.85rem;
}

/* 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);
  }

  .component-meta {
    flex-direction: column;
    gap: 0.5rem;
  }

  .field-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 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;
}

.badge {
  background: #3498db;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge.modal {
  background: #e74c3c;
}

.badge.sub-component {
  background: #f39c12;
}
