/* ---------- Layout & chrome ---------- */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', system-ui, sans-serif;
  margin: 0;
  padding: 20px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
}

.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 12px 24px;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.header h1 {
  display: none;
}

.version-info { 
  font-size: 14px; 
  color: #718096; 
  font-weight: 500;
}

.filter-section {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
}


.single-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
  justify-content: flex-start;
}

input, select, button {
  padding: 8px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: white;
}

input:focus, select:focus {
  outline: none;
  border-color: #4299e1;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

button { 
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white; 
  cursor: pointer; 
  border: none;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  font-size: 10px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

button:hover { 
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

button:active {
  transform: translateY(0);
}

button.secondary { 
  background: white;
  color: #4a5568; 
  border: 2px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

button.secondary:hover { 
  background: #f7fafc;
  border-color: #cbd5e0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* put version-info on the left and Home on the right */
.header{
  display:flex;
  align-items:center;
  justify-content: space-between; /* left + right ends */
}

/* optional: small spacing & remove underline */
.header .btn-home{
  text-decoration:none;
  margin-left: 12px;
}




.stats-inline {
  display: flex;
  gap: 12px;
  margin-left: auto;
  font-size: 11px;
  flex-wrap: wrap;
  align-items: center;
}

.stats-inline .stat-item {
  padding: 4px 8px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  font-weight: 600;
  color: #2d3748;
  font-size: 10px;
  text-align: center;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.stats-inline .stat-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ---------- Chart & legend ---------- */
#chart {
  overflow: auto;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  min-height: 80vh;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

/* When fullscreen, let chart fill the screen */
:fullscreen #chart, #chart:fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border-radius: 0;
}

#chart svg {
  display: block;
  margin: 0 auto;
  overflow: visible;
}

/* Legend */
/* Mini-node legend (text inside) */
#legend {
  display: flex;
  margin-left: auto;    
  gap: 16px;
  align-items: center;
}

#legend .legend-item {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.95);
}

/* the mini node itself */
#legend .swatch{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;                          /* <- lets text fit */
  height: 24px;
  min-width: 26px;
  border-radius: 12px;                        /* rounded like nodes */
  border: 2px solid transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  color: #1f2937;                             /* dark text like nodes */
  white-space: nowrap;
}


/* Colors match the node rectangles exactly */
#legend .swatch.staff{
  background: #f8fffe;                        /* .node.staff fill */
  border-color: #48bb78;                      /* .node.staff stroke */
}

#legend .swatch.contractor{
  background: #fffcf8;                        /* .node.contractor fill */
  border-color: #ed8936;                      /* .node.contractor stroke */
}

#legend .swatch.vacant{
  background: #fff5f5;                        /* .node.vacant fill */
  border-color: #f56565;                      /* .node.vacant stroke */
  border-width: 3px;
  border-style: dashed;                       /* dashed like vacant nodes */
}

/* Legend inside the toolbar row */
.filter-section .single-row{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
#legend{ display:flex; gap:12px; margin-right: 8px; }


/* ---------- Enhanced Nodes & links ---------- */
.node {
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}


.node:hover rect {
  stroke-width: 3px;
}

.node rect { 
  stroke: rgba(226, 232, 240, 0.8);
  stroke-width: 2px;
  rx: 16;
  ry: 16;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.1));
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.node.staff rect      { fill: #f8fffe; stroke: #48bb78; }
.node.contractor rect { fill: #fffcf8; stroke: #ed8936; }
.node.vacant rect     { 
  fill: #fff5f5; 
  stroke: #f56565; 
  stroke-width: 3px; 
  stroke-dasharray: 8,4;
}

.link { 
  fill: none; 
  stroke: #cbd5e0; 
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.3s ease;
}

.link:hover {
  stroke: #a0aec0;
  stroke-width: 3px;
}



@keyframes bounce-alert {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-4px); }
  60% { transform: translateY(-2px); }
}

/* Highlighting & filtering */
.node.highlight rect { 
  stroke: #667eea; 
  stroke-width: 4px;
  filter: drop-shadow(0 0 16px rgba(102, 126, 234, 0.5));
  animation: highlight-pulse 1s ease-in-out infinite alternate;
}

@keyframes highlight-pulse {
  from { filter: drop-shadow(0 0 16px rgba(102, 126, 234, 0.3)); }
  to { filter: drop-shadow(0 0 24px rgba(102, 126, 234, 0.7)); }
}

.node.filtered-out { 
  opacity: 0.2; 
  transform: scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced text styling within nodes */
.node foreignObject div {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

.node .name-text {
  font-weight: 700;
  font-size: 14px;
  color: #1a202c;
  line-height: 1.3;
}

.node .title-text {
  font-size: 11px;
  color: #4a5568;
  line-height: 1.3;
  font-weight: 500;
}


/* Responsive adjustments */
@media (max-width: 768px) {
  .stats {
    gap: 8px;
  }
  
  .stat-item {
    padding: 8px 12px;
    font-size: 12px;
    min-width: 60px;
  }
  
  .filter-row, .buttons-row {
    gap: 8px;
  }
  
  input, select, button {
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* Smooth scrolling for the chart container */
#chart {
  scroll-behavior: smooth;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border: 3px solid #e2e8f0;
  border-radius: 50%;
  border-top-color: #667eea;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Hide filtered items completely */
.node.filtered-out,
.link.filtered-out {
  display: none !important;
}