/* Simplified Dashboard CSS - More Compatible */

.dashboard {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}



/* Status Banner */
.status-banner {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #9ca3af;
}

.status-dot.healthy {
  background: #059669;
}

.status-text {
  font-weight: 500;
  color: #374151;
}

.model-info {
  font-size: 0.875rem;
  color: #6b7280;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 30px;
  margin-bottom: 40px;
  width: 100%;
  max-width: 100%;
}

.dashboard-grid > .card {
  min-width: 0; /* Allows flex items to shrink below their content size */
  overflow: hidden; /* Prevents content from expanding beyond card boundaries */
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.panel {
  min-height: 600px;
}

/* Cards */
.card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  overflow: hidden;
  height: 100%;
}

.card-header {
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.card-body {
  padding: 20px;
}

/* Upload Area */
.upload-area {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 20px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
}

.upload-area:hover {
  border-color: #2563eb;
  background-color: #f9fafb;
}

.upload-area.has-image {
  border-style: solid;
  border-color: #059669;
  background-color: #f9fafb;
  padding: 0;
  height: 200px;
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.upload-icon {
  font-size: 4rem;
  color: #9ca3af;
  font-weight: 300;
  line-height: 1;
}

.upload-primary {
  font-size: 1.125rem;
  font-weight: 500;
  color: #374151;
  margin: 0;
}

.upload-secondary {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

/* Settings */
.settings-section {
  margin-bottom: 25px;
}

.settings-section h4 {
  margin-bottom: 15px;
  color: #374151;
  font-size: 1rem;
  font-weight: 600;
}

/* Model Details Section */
.model-details-section {
  margin-bottom: 20px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.model-details-section h4 {
  margin-bottom: 15px;
  color: #374151;
  font-size: 1rem;
  font-weight: 600;
}

.model-details-grid {
  display: grid;
  gap: 10px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f9fafb;
  border-radius: 6px;
}

.detail-label {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

.detail-value {
  font-size: 0.875rem;
  color: #111827;
  font-weight: 600;
}

.setting-item {
  margin-bottom: 15px;
}

.setting-item label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 5px;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.slider-container input[type="range"] {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
  outline: none;
  -webkit-appearance: none;
}

.slider-value {
  font-size: 0.875rem;
  font-weight: 500;
  color: #2563eb;
  min-width: 40px;
  text-align: right;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}

.btn-primary {
  background: #2563eb;
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-primary:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

.btn-full {
  width: 100%;
  margin-bottom: 25px;
}

/* Image Containers */
.image-container {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
}

.image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.image-placeholder {
  text-align: center;
  color: #9ca3af;
}

.placeholder-icon {
  font-size: 3rem;
  margin-bottom: 10px;
  color: #d1d5db;
  font-weight: 300;
}

/* Results */
.annotated-section,
.metadata-section,
.species-section {
  margin-bottom: 20px;
}

.annotated-section h4,
.metadata-section h4,
.species-section h4 {
  margin-bottom: 15px;
  color: #374151;
  font-size: 1rem;
  font-weight: 600;
}

.metadata-grid {
  display: grid;
  gap: 8px;
}

.metadata-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: #f9fafb;
  border-radius: 6px;
}

.metadata-label {
  font-size: 0.875rem;
  color: #6b7280;
}

.metadata-value {
  font-size: 0.875rem;
  font-weight: 500;
  color: #111827;
}

.species-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.species-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.species-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #111827;
}

.species-confidence {
  font-size: 0.875rem;
  font-weight: 600;
  color: #2563eb;
}

/* Sample Images Section */
.sample-images-section {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.sample-images-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.sample-images-header h4 {
  margin: 0;
  color: #374151;
  font-size: 1rem;
  font-weight: 600;
}

.slider-controls {
  display: flex;
  gap: 8px;
}

.slider-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  color: #6b7280;
  transition: all 0.2s ease;
  user-select: none;
}

.slider-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #f8fafc;
}

.slider-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #e5e7eb;
  color: #9ca3af;
}

.slider-btn:disabled:hover {
  border-color: #e5e7eb;
  color: #9ca3af;
  background: white;
}

/* Horizontal Slider */
.sample-images-slider {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  gap: 12px;
  padding: 4px 0 8px 0;
  width: 100%;
  max-width: 100%;

  /* Hide scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sample-images-slider::-webkit-scrollbar {
  display: none;
}

.sample-image-item {
  position: relative;
  flex: 0 0 calc(50% - 6px); /* 2 images per view with gap */
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  scroll-snap-align: start;
}

.sample-image-item:hover {
  border-color: #2563eb;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.sample-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sample-image-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: white;
  padding: 6px 8px;
  font-size: 0.7rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .sample-image-item {
    flex: 0 0 calc(100% - 12px); /* 1 image per view on mobile */
    height: 100px;
  }

  .sample-image-overlay {
    font-size: 0.65rem;
    padding: 4px 6px;
  }
}

/* API Documentation Section */
.api-documentation-section {
  margin: 60px 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* Header */
.api-docs-header {
  background: #f8f9fa;
  color: #495057;
  padding: 40px;
  text-align: center;
  border-bottom: 1px solid #e9ecef;
}

.api-docs-header h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
  color: #495057;
}

.api-docs-header p {
  font-size: 1.1rem;
  opacity: 0.8;
  max-width: 600px;
  margin: 0 auto;
}

.api-docs-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* API Overview */
.api-overview {
  padding: 32px 40px;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
}

.endpoint-card {
  background: white;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.method-badge {
  background: #28a745;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.endpoint-url {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  padding: 8px 12px;
  border-radius: 4px;
  font-family: 'SFMono-Regular', 'Monaco', 'Consolas', monospace;
  font-size: 0.875rem;
  color: #495057;
  flex: 1;
  min-width: 300px;
}

.status-badge {
  background: #d4edda;
  color: #155724;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.feature-item {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 6px;
  border-left: 4px solid #6c757d;
}

.feature-title {
  font-weight: 600;
  color: #495057;
  margin-bottom: 4px;
}

.feature-description {
  font-size: 0.875rem;
  color: #6c757d;
}

/* Tabs Navigation */
.tabs-container {
  background: white;
  border-bottom: 1px solid #e9ecef;
}
  padding: 2px 6px;
  border-radius: 3px;
}

.endpoint-description {
  margin: 16px 0 0 0;
  color: #656d76;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Tabbed Interface */
.api-tabs-container {
  background: white;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 32px;
}

.tabs-nav {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid #e9ecef;
}

.tab-button {
  background: none;
  border: none;
  padding: 16px 24px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6c757d;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.2s ease;
  position: relative;
}

.tab-button:hover {
  color: #495057;
  background: #f8f9fa;
}

.tab-button.active {
  color: #495057;
  border-bottom-color: #495057;
  background: white;
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  padding: 32px 40px;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #f6f8fa;
  border-bottom: 1px solid #e1e5e9;
}

.code-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1a1a1a;
}

.copy-btn {
  background: #0969da;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.copy-btn:hover {
  background: #0860ca;
}

/* Code Blocks */
.code-section {
  margin-bottom: 32px;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #2d3748;
  color: white;
  padding: 12px 20px;
  border-radius: 6px 6px 0 0;
}

.code-title {
  font-size: 0.875rem;
  font-weight: 500;
}

.copy-button {
  background: #4a5568;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.copy-button:hover {
  background: #2d3748;
}

.copy-button.copied {
  background: #38a169;
}

.code-block {
  background: #1a202c;
  color: #e2e8f0;
  padding: 20px;
  margin: 0;
  font-family: 'SFMono-Regular', 'Monaco', 'Consolas', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  overflow-x: auto;
  border-radius: 0 0 6px 6px;
  border: 1px solid #2d3748;
  border-top: none;
}

/* Syntax Highlighting */
.code-block .keyword { color: #ff7b72; }
.code-block .string { color: #a5d6ff; }
.code-block .number { color: #79c0ff; }
.code-block .comment { color: #8b949e; font-style: italic; }
.code-block .function { color: #d2a8ff; }
.code-block .variable { color: #ffa657; }
.code-block .operator { color: #ff7b72; }
.code-block .property { color: #79c0ff; }
.code-block .class { color: #7ee787; }
.code-block .module { color: #7ee787; }
.code-block .namespace { color: #7ee787; }
.code-block .method { color: #d2a8ff; }
.code-block .flag { color: #ff7b72; }
.code-block .cmd { color: #7ee787; }

/* JSON Syntax Highlighting */
.code-block .json-key { color: #79c0ff; }
.code-block .json-string { color: #a5d6ff; }
.code-block .json-number { color: #79c0ff; }
.code-block .json-boolean { color: #ff7b72; }

/* Response Section */
.response-demo {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.response-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 16px;
}

.response-description {
  color: #6c757d;
  margin-bottom: 20px;
  line-height: 1.5;
}

.detection-summary {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.detection-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 12px 16px;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.species-name {
  font-weight: 500;
  color: #495057;
}

.confidence-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.confidence-high {
  background: #d4edda;
  color: #155724;
}

.confidence-medium {
  background: #fff3cd;
  color: #856404;
}

/* Documentation Footer */
.docs-footer {
  padding: 40px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.info-card {
  background: white;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.info-card h4 {
  font-size: 1rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 16px;
}

.info-list {
  list-style: none;
}

.info-list li {
  padding: 8px 0;
  color: #6c757d;
  font-size: 0.875rem;
  border-bottom: 1px solid #f8f9fa;
}

.info-list li:last-child {
  border-bottom: none;
}

.info-list strong {
  color: #495057;
  font-weight: 600;
}

/* Syntax highlighting */
.keyword { color: #f56565; }
.string { color: #68d391; }
.number { color: #63b3ed; }
.comment { color: #a0aec0; font-style: italic; }
.function { color: #d6bcfa; }
.variable { color: #fbb6ce; }
.operator { color: #f56565; }
.property { color: #63b3ed; }

/* Responsive Design */
@media (max-width: 768px) {
  .api-docs-header h2 {
    font-size: 1.75rem;
  }

  .api-docs-container {
    padding: 0 16px;
  }

  .api-endpoint-info {
    padding: 20px;
  }

  .endpoint-url {
    font-size: 0.8rem;
    word-break: break-all;
  }

  .api-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .api-tab {
    padding: 10px 16px;
    font-size: 0.8rem;
  }

  .code-header {
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .code-block {
    font-size: 0.75rem;
    padding: 16px;
  }

  .api-docs-info-grid {
    grid-template-columns: 1fr;
  }
}
