/* Reset and base layout */
body {
  margin: 0;
  font-family: sans-serif;
  background: #f0f2f5;
}

.hidden {
  display: none;
}

/* Controls Panel */
.controls {
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid #ccc;
}

.controls label {
  margin-right: 16px;
  font-weight: 500;
  font-size: 14px;
}

.slider-group,
.image-mode-group {
  margin-top: 12px;
}

/* Legend Panel */
#legendPanel {
  width: 180px;
  padding: 12px;
  border-right: 1px solid #ccc;
  background: #fff;
  border-radius: 6px;
  font-size: 14px;
}

#legendPanel h3 {
  margin-bottom: 8px;
  font-size: 15px;
  color: #333;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}

.legend-color {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid #888;
}

/* Main Layout */
.topology-wrapper {
  display: flex;
  padding: 16px;

}

/* Diagram Panel */
.diagram-panel {
  flex: 1;
  padding-left: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;
}

/* Node Grid */
#nodeGrid {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 100%;
}

/* Switch Grid Layout */
#switchGrid {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.switch-row{
display: flex;
  justify-content: center;
  gap: 10px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.node-row {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  }
/* 🧩 Cards */
.card-triplet {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.card {
  flex: 1 1 300px;
  min-width: 250px;
}

/* Card Styles */
.node-card {
  width: 220px;
  height: auto;
  background: #fff;
  border: 1px solid #ccc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-radius: 6px;
  padding-top: 2px;
  padding-bottom: 2px;
}

/* Images and Labels */
.node-image {
  width: 218px;
  height: auto;
  object-fit:  contain;
  display: block;
}

/* SVG Cable Overlay */
#connectionLines {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 0;
}

/* === Switchless Layout Enhancements === */

.diagram-panel.switchless-layout .node-row {
  flex-direction: row;
  justify-content: center;
  gap: 24px;
  margin-top: 16px;
}

.diagram-panel.switchless-layout #switchRowTop {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 16px;
}

.diagram-panel.switchless-layout #switchRowBottom {
  display: none;
}
.diagram-panel.switchless-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: visible;
  min-height: 300px; /* or auto, or dynamically set via JS */
}

.cluster-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}
.modal-content {
  background-color: white;
  width: 80%;
  height: 80%;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}
.modal-wide {
  max-width: 80vw; /* or 1400px if you want a fixed width */
}
.close-btn {
  position:absolute;
  top: 1em;
  right: 1.2em;
  font-size: 2em;
  font-weight: bold;
  background: none;
  border: none;
  color: #004e92;
  cursor: pointer;
  z-index: 10000;
  transition: transform 0.2s ease, color 0.2s ease;
}

.close-btn:hover {
  color: #ff3b3b;
  transform: scale(1.2);
}
.preview-summary {
  font-weight: normal;
  margin-bottom: 12px;
  line-height: 1.4;
}
.preview-summary strong {
  display: block;
  margin-bottom: 4px;
}
.cluster-checkboxes {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #ccc;
  padding: 8px;
}
.cluster-checkboxes label {
  display: block;
  margin-bottom: 4px;
}
.cluster-result {
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background-color: #f9f9f9;
}