:root {
  --primary-color: #2c3e50;
  --secondary-color: #3498db;
  --success-color: #27ae60;
  --warning-color: #f39c12;
  --danger-color: #e74c3c;
  --json-key: #881391;
  --json-string: #06411d;
  --json-number: #0969da;
  --json-boolean: #8250df;
  --json-null: #6a737d;
  --bg-light: #f8f9fa;
  --bg-dark: #343a40;
  --border-color: #dee2e6;
  --text-muted: #6c757d;
  --spacing-sm: 0.5rem;
  --spacing-md: .6rem;
  --spacing-lg: 1.5rem;
  --border-radius: 0.375rem;
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: var(--spacing-md);
  background-color: var(--bg-light);
  color: var(--primary-color);
}

#app {
  width: 100%;
  max-width: 100vw;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
  overflow-x: hidden;
}

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

#stats-container {
  display: flex;
  justify-content: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
}

.stat-card {
  background: white;
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-align: center;
  min-width: 120px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--secondary-color);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: var(--spacing-sm);
}

table {
  width: 100%;
  max-width: 100vw;
  border-collapse: collapse;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: var(--border-radius);
  overflow: hidden;
  table-layout: fixed;
}

th,
td {
  padding: var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

th {
  background: var(--bg-dark);
  color: white;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

tr:hover {
  background: var(--bg-light);
}

.url-cell {
  width: 25%;
  min-width: 200px;
  word-break: break-all;
  font-family: monospace;
  font-size: 0.875rem;
}

.text-cell {
  width: 75%;
  min-width: 300px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.models-container {
  width: 100%;
  max-width: 100%;
  padding: 0;
  overflow-x: auto;
}

.models-table {
  width: 100%;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: var(--spacing-sm);
  background: transparent;
  table-layout: fixed;
}

.models-table th {
  background: var(--secondary-color);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius);
  font-weight: 600;
  font-size: 0.875rem;
  text-align: center;
  position: static;
}
.model-header {
  background: var(--secondary-color);
  color:white;
}
.model-header a {
  color:white;
}
.models-table th.model-external {
  background-color: #8250df;
}
.model-external {
  background-color: #8250df;
  color: white;
}
.model-external a {
  color: white;
}

.models-table td {
  background: transparent;
  border: none;
  padding: 0;
  vertical-align: top;
}

.model-stats {
  background: var(--bg-light);
  padding: var(--spacing-sm);
  border-radius: var(--border-radius);
  font-size: 0.75rem;
  text-align: center;
  border: 1px solid var(--border-color);
}

.model-json {
  position: relative;
}



.json-header:hover {
  background: #495057;
}

.json-toggle {
  transition: transform 0.3s ease;
  font-size: 1.2rem;
}

.json-toggle.expanded {
  transform: rotate(90deg);
}

.json-toggle-all {
  text-align: center;
  margin-bottom: var(--spacing-sm);
}

.json-toggle-btn {
  background: var(--secondary-color);
  color: white;
  border: none;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.875rem;
  transition: background-color 0.3s ease, transform 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.json-toggle-btn:hover {
  background: #2980b9;
}

.json-toggle-btn .arrow {
  transition: transform 0.3s ease;
}

.json-toggle-btn.expanded .arrow {
  transform: rotate(90deg);
}

.json-content {
  background: #f1f1f1;
  color: #abb2bf;
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  overflow-x: auto;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
  text-align: left;
}

.json-content.expanded {
  max-height: 800px;
  opacity: 1;
  padding: var(--spacing-md);
  overflow: auto;
}

.json-content pre {
  margin: 0;
  text-align: left;
  white-space: pre;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

.json-content.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0 var(--spacing-md);
  overflow: hidden;
}

.json-key {
  color: var(--json-key);
}

.json-string {
  color: var(--json-string);
}

.json-number {
  color: var(--json-number);
}

.json-boolean {
  color: var(--json-boolean);
}

.json-null {
  color: var(--json-null);
}

.json-bracket {
  color: #5c6370;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--border-radius);
  margin: 0.125rem;
}

.badge-success {
  background: var(--success-color);
  color: white;
}

.badge-warning {
  background: var(--warning-color);
  color: white;
}

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

.badge-secondary {
  background: var(--text-muted);
  color: white;
}

.time-badge {
  font-weight: bold;
}

.time-fastest {
  color: var(--success-color);
}

.time-slowest {
  color: var(--danger-color);
}

.entity-count {
  margin: 0.125rem;
  font-size: 0.7rem;
}

.loading {
  text-align: center;
  padding: var(--spacing-lg);
  font-size: 1.2rem;
  color: var(--text-muted);
}

.error {
  text-align: center;
  padding: var(--spacing-lg);
  font-size: 1.2rem;
  color: var(--danger-color);
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: var(--border-radius);
  margin: var(--spacing-md);
}

.search-loading {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10" stroke-dasharray="31.416" stroke-dashoffset="31.416"><animate attributeName="stroke-dashoffset" dur="0.5s" to="0" repeatCount="indefinite"/></circle></svg>');
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 32px;
}

@media (max-width: 1200px) {
  .models-table {
    font-size: 0.8rem;
  }

  .models-table th {
    font-size: 0.75rem;
    padding: var(--spacing-xs) var(--spacing-sm);
  }
}

@media (max-width: 768px) {
  body {
    padding: var(--spacing-sm);
    overflow-x: hidden;
  }

  h1 {
    font-size: 1.5rem;
  }

  th,
  td {
    padding: var(--spacing-sm);
    font-size: 0.8rem;
  }

  .url-cell,
  .text-cell {
    max-width: 150px;
    word-break: break-word;
  }

  .json-content {
    font-size: 0.65rem;
  }

  #stats-container {
    gap: var(--spacing-sm);
  }

  .stat-card {
    min-width: 80px;
    padding: var(--spacing-sm);
  }

  .models-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .models-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .models-table {
    min-width: 600px;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .models-table th {
    font-size: 0.7rem;
    padding: 2px 4px;
  }
}
