/* food_structure.css
 * Enhanced styles for Food Database Structure page
 */

/* Diagram layout */
.diagram-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 28px;
  margin-top: 2rem;
  position: relative;
}

/* Section card */
.section {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  border: 1px solid #e5e7eb;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.section:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 22px rgba(0,0,0,0.12);
}

/* Section header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 1.05rem;
  background: linear-gradient(135deg, #10b981, #34d399);
  color: #fff;
  cursor: pointer;
}

.section-header:hover {
  background: linear-gradient(135deg, #059669, #10b981);
}

.section-header .toggle-icon {
  transition: transform 0.3s ease;
}

.section.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

/* Section content */
.section-content {
  padding: 1rem 1.25rem;
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.section.collapsed .section-content {
  max-height: 0;
  padding: 0 1.25rem;
}

.stats-container {
  display: flex;
  justify-content: center;   /* centers cards horizontally */
  gap: 1.5rem;
  flex-wrap: wrap;           /* allows wrapping on smaller screens */
  margin: 0 auto;            /* ensures the container itself is centered */
  text-align: center;        /* optional, for inside text */
}


/* Field list */
.field-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.field-item {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.95rem;
  color: #374151;
  border-radius: 6px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.field-item:last-child {
  border-bottom: none;
}

.field-item:hover {
  background: #f9fafb;
  color: #059669;
  transform: translateX(4px);
}

/* Bullet */
.field-item::before {
  content: "▸";
  color: #10b981;
  position: absolute;
  left: -1rem;
  font-size: 0.8rem;
}

/* Highlighted search */
.highlight {
  background: #fde68a;
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 600;
}

/* Search box */
.search-container {
  text-align: center;
  margin-bottom: 2rem;
  position: sticky;
  top: 70px;
  z-index: 10;
  background: #f9fafb;
  padding: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.search-input {
  width: 100%;
  max-width: 420px;
  padding: 0.8rem 1.25rem;
  border: 2px solid #e5e7eb;
  border-radius: 9999px;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.search-input:focus {
  border-color: #10b981;
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

/* Expand/Collapse All */
.controls {
  text-align: center;
  margin-bottom: 1rem;
}

.control-btn {
  background: #10b981;
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.3s ease;
}

.control-btn:hover {
  background: #059669;
}

/* Stats cards */
.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.stat-card {
  background: linear-gradient(135deg, #10b981, #34d399);
  color: white;
  padding: 1.75rem;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.stat-number {
  font-size: 2.25rem;
  font-weight: bold;
  display: block;
}

.stat-label {
  font-size: 0.95rem;
  opacity: 0.9;
  margin-top: 0.25rem;
}

/* No results message */
.no-results {
  text-align: center;
  font-size: 1rem;
  color: #6b7280;
  margin-top: 1rem;
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  .diagram-container {
    grid-template-columns: 1fr;
  }
  .section-header {
    font-size: 0.95rem;
  }
}
