/* ==========================================================================
   Servers Workbench & Topology Viewer Styles
   ========================================================================== */

.nav-mode-switcher {
  display: flex;
  padding: 10px 14px;
  background-color: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--sidebar-border);
  gap: 6px;
}

.nav-mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-sidebar-muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-mode-btn:hover {
  color: var(--text-sidebar);
  background-color: var(--bg-sidebar-hover);
}

.nav-mode-btn.active {
  color: #ffffff;
  background-color: var(--bg-sidebar-active);
  border-color: rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.nav-mode-btn .icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Workbench View Container */
.servers-workbench {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.server-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.server-summary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.server-summary-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.server-summary-card.selected {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

.server-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.server-card-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.server-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.server-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.server-card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

.server-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Ports Table & Mapping Cards */
.sub-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
}

.sub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.sub-table th {
  background: var(--bg-hover);
  padding: 8px 12px;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-default);
}

.sub-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.sub-table tr:last-child td {
  border-bottom: none;
}

/* Topology Diagram Viewer */
.topology-view-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topology-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.topology-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topology-canvas-container {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: #fafbfc;
  position: relative;
  overflow: auto;
  padding: 20px;
}

.topology-svg {
  display: block;
  min-width: 100%;
  min-height: 400px;
}

.topo-node {
  cursor: pointer;
  transition: transform 0.15s ease;
}

.topo-node rect {
  fill: #ffffff;
  stroke: var(--border-default);
  stroke-width: 1.5;
  rx: 8;
  ry: 8;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.04));
}

.topo-node:hover rect {
  stroke: var(--accent-primary);
  fill: #f0f7ff;
}

.topo-node.active rect {
  stroke: var(--accent-primary);
  stroke-width: 2.5;
  fill: #f0f7ff;
}

.topo-node.cycle rect {
  stroke: var(--danger-border);
  stroke-width: 2;
  fill: var(--danger-bg);
}

.topo-node-title {
  font-size: 13px;
  font-weight: 600;
  fill: var(--text-primary);
}

.topo-node-sub {
  font-size: 11px;
  fill: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.topo-edge {
  fill: none;
  stroke: #8b949e;
  stroke-width: 1.75;
  stroke-dasharray: 4, 4;
}

.topo-edge.highlight {
  stroke: var(--accent-primary);
  stroke-width: 2.5;
  stroke-dasharray: none;
}

.topo-edge.cycle {
  stroke: var(--danger-text);
  stroke-width: 2.5;
}

.topo-marker {
  fill: #8b949e;
}

.topo-marker.highlight {
  fill: var(--accent-primary);
}

.topo-marker.cycle {
  fill: var(--danger-text);
}

.password-reveal-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-hover);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
}

.password-text-field {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
  word-break: break-all;
}

.password-countdown-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  background-color: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
  font-weight: 600;
}

#input-new-server-password {
  height: 34px;
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

#input-new-server-password:focus {
  border-color: var(--accent);
}

/* Sidebar button styling alignment */
.sidebar-project-item.project-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  outline: none;
}

/* Traced Paths Panel Styles */
.topo-paths-panel {
  margin-top: 16px;
  background-color: var(--bg-hover);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topo-paths-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.topo-paths-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topo-paths-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.topo-paths-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.topo-paths-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
}

.topo-path-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
}

.topo-hop-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-hover);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.topo-hop-item.start-focus {
  background: var(--accent-subtle);
  border: 1px solid var(--accent-primary);
  font-weight: 600;
}

.topo-hop-arrow {
  color: var(--text-muted);
  font-weight: bold;
}

.topo-node-link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-primary);
  text-decoration: underline;
  cursor: pointer;
  font-size: 11px;
}

/* Ensure sub-table container scrolls horizontally inside small screens */
.sub-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Detail Toolbar & Header Title Wrapping */
.detail-toolbar-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
}

.detail-title-block {
  flex: 1 1 auto;
  min-width: 0;
}

.title-with-badge {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

#server-editor-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Ensure port mapping and workload tables show numbers and protocols fully */
#server-mappings-tbody td input[type="number"],
#server-ports-tbody td input[type="number"] {
  min-width: 80px;
  width: 100%;
  box-sizing: border-box;
}

#server-mappings-tbody td select,
#server-ports-tbody td select {
  min-width: 80px;
  box-sizing: border-box;
}

#server-mappings-tbody .sub-table,
.sub-table-wrap table {
  min-width: 780px;
}


