/* UN Supply Chain Tools - WordPress Plugin Styles */

.supply-chain-app {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  color: #1f2937;
  max-width: 100%;
  margin: 0 auto;
}

.supply-chain-app * {
  box-sizing: border-box;
}

.loading-container {
  padding: 3rem;
  text-align: center;
  font-size: 1.125rem;
  color: #6b7280;
}

.filters {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.filters input,
.filters select,
.filters button {
  font-family: inherit;
  font-size: 0.875rem;
}

.filters input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  margin-bottom: 1rem;
  background: white;
}

.filters input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filters select {
  margin: 0.25rem;
  margin-right: 0.75rem;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  min-width: 150px;
}

.filters select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filters button {
  margin: 0.25rem;
  padding: 0.5rem 1rem;
  background: #6b7280;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.filters button:hover {
  background: #4b5563;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.tool-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s, transform 0.2s;
}

.tool-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.tool-card h3 {
  margin: 0 0 1rem 0;
  color: #1f2937;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
}

.tool-card .meta {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.tool-card .supply-chain-stages {
  margin: 0.75rem 0;
}

.tool-card .stage-tag {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  margin-right: 0.5rem;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.tool-card .description {
  color: #4b5563;
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 1rem 0 1.5rem 0;
}

.tool-card .link {
  display: inline-block;
  background: #2563eb;
  color: white;
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.2s;
}

.tool-card .link:hover {
  background: #1d4ed8;
  text-decoration: none;
}

.results-count {
  font-weight: 600;
  color: #374151;
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .supply-chain-app {
    padding: 1rem;
  }
  
  .filters {
    padding: 1rem;
  }
  
  .filters select {
    width: 100%;
    margin: 0.25rem 0;
    min-width: unset;
  }
  
  .tools-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .tool-card {
    padding: 1rem;
  }
}

/* Supply Chain Map Styles */
.supply-chain-map {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.supply-chain-map h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.supply-chain-map p {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1.5rem;
}

.supply-chain-stages {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: flex-start;
}

@media (min-width: 1024px) {
  .supply-chain-stages {
    flex-direction: row;
  }
}

.supply-chain-stage {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
  flex: 1;
  min-width: 0;
}

@media (min-width: 1024px) {
  .supply-chain-stage {
    flex-direction: row;
  }
}

.stage-content {
  flex: 1;
  min-width: 0;
}

.stage-header {
  text-align: center;
  margin-bottom: 1rem;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  color: white;
  font-weight: 500;
  font-size: 0.875rem;
}

.stage-badge.upstream {
  background-color: #3b82f6;
}

.stage-badge.midstream {
  background-color: #10b981;
}

.stage-badge.downstream {
  background-color: #8b5cf6;
}

.stage-tools {
  min-height: 200px;
}

.tools-grid-stage {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .tools-grid-stage {
    grid-template-columns: repeat(2, 1fr);
  }
}

.tool-node {
  cursor: pointer;
}

.tool-node-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s;
}

.tool-node-content:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: scale(1.05);
}

.tool-node-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
}

.tool-node-dot.fao { background-color: #059669; }
.tool-node-dot.ilo { background-color: #2563eb; }
.tool-node-dot.unido { background-color: #4f46e5; }
.tool-node-dot.unep { background-color: #16a34a; }
.tool-node-dot.itc { background-color: #0891b2; }
.tool-node-dot.unece { background-color: #7c3aed; }
.tool-node-dot.ohchr { background-color: #dc2626; }

.tool-node-text {
  font-size: 0.75rem;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 8rem;
}

.empty-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 8rem;
  color: #6b7280;
  font-size: 0.875rem;
  border: 2px dashed #e5e7eb;
  border-radius: 0.5rem;
}

.stage-arrow {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem 0;
}

@media (min-width: 1024px) {
  .stage-arrow {
    display: flex;
  }
}

.arrow-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: #6b7280;
}

.supply-chain-legend {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.legend-content {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.75rem;
}

.legend-organizations {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-org {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.legend-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}

.separator {
  height: 1px;
  background-color: #e5e7eb;
  margin: 2rem 0;
}

/* WordPress compatibility */
.un-supply-chain-tools-container {
  font-family: inherit;
  line-height: inherit;
  display: block;
  width: 100%;
  overflow: auto !important;
  -webkit-overflow-scrolling: touch;
  height: auto !important;
  max-height: none !important;
  position: relative !important;
}

.un-supply-chain-tools-container .supply-chain-app {
  all: initial;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  color: #1f2937;
  overflow: visible;
  height: auto;
  min-height: auto;
  position: relative;
}

/* Dark theme support for WordPress sites */
.wp-dark-mode .supply-chain-app,
body.dark .supply-chain-app {
  color: #f3f4f6;
}

.wp-dark-mode .tool-card,
body.dark .tool-card,
.wp-dark-mode .supply-chain-map,
body.dark .supply-chain-map {
  background: #1f2937;
  border-color: #374151;
  color: #f3f4f6;
}

.wp-dark-mode .tool-node-content,
body.dark .tool-node-content {
  background: #374151;
  border-color: #4b5563;
}

.wp-dark-mode .tool-node-text,
body.dark .tool-node-text {
  color: #f3f4f6;
}

.wp-dark-mode .filters,
body.dark .filters {
  background: #1f2937;
  border-color: #374151;
}

.wp-dark-mode .filters input,
.wp-dark-mode .filters select,
body.dark .filters input,
body.dark .filters select {
  background: #111827;
  border-color: #4b5563;
  color: #f3f4f6;
}