/* TopologyPageEnhanced.module.css - Enhanced topology page styles */

.container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 52px); /* Subtract navbar height */
  width: 100%;
  background: var(--bg-primary, #1a1a1a);
  overflow: hidden;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.bottomPanel {
  background: rgba(20, 20, 20, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(51, 51, 51, 0.5);
  transition: all 0.3s ease;
  position: relative;
  height: 100px;
  overflow: hidden;
}

.bottomPanel.collapsed {
  height: 0;
  border-top: none;
}

.bottomToggle {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 48px;
  height: 24px;
  background: rgba(20, 20, 20, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(51, 51, 51, 0.5);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  color: var(--text-secondary, #888);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
}

.bottomToggle:hover {
  background: rgba(34, 34, 34, 0.9);
  color: var(--text-primary, #e8e8e8);
  height: 28px;
  top: -28px;
}

.bottomPanelContent {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  height: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.flowContainer {
  flex: 1;
  position: relative;
  background: linear-gradient(
    135deg,
    var(--flow-bg-gradient-start, #0f0f0f) 0%,
    var(--flow-bg-gradient-mid, #1a1a1a) 50%,
    var(--flow-bg-gradient-end, #0f0f0f) 100%
  );
}

.layoutToolbar {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 8;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(10, 12, 10, 0.78);
  border: 1px solid rgba(118, 185, 0, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.toolbarSection {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 132px;
}

.densitySection {
  min-width: 360px;
}

.toolbarLabel {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(174, 186, 174, 0.9);
}

.toolbarRow {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbarValue {
  color: #dbe2d3;
  font-size: 12px;
  font-weight: 600;
  min-width: 44px;
}

.modeSwitch {
  display: flex;
  gap: 4px;
}

.densitySummary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 440px;
}

.densitySummaryItem {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(118, 185, 0, 0.1);
  border: 1px solid rgba(118, 185, 0, 0.14);
}

.densitySummaryValue {
  color: #f4f8ee;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.densitySummaryLabel {
  color: rgba(219, 226, 211, 0.78);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.modeBtn,
.toolBtn {
  border: 1px solid rgba(118, 185, 0, 0.28);
  background: rgba(26, 30, 25, 0.84);
  color: #dbe2d3;
  font-size: 11px;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modeBtn:hover,
.toolBtn:hover {
  border-color: rgba(118, 185, 0, 0.7);
  color: #f4f8ee;
}

.modeBtnActive,
.toolBtnActive {
  background: rgba(118, 185, 0, 0.22);
  border-color: rgba(118, 185, 0, 0.85);
  color: #f4f8ee;
}

.focusSwitch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 3px 8px 3px 4px;
  border: 1px solid rgba(118, 185, 0, 0.32);
  border-radius: 999px;
  background: rgba(26, 30, 25, 0.84);
  color: rgba(219, 226, 211, 0.82);
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.focusSwitch:hover {
  border-color: rgba(118, 185, 0, 0.72);
  color: #f4f8ee;
}

.focusSwitch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(118, 185, 0, 0.2);
}

.focusSwitchOn {
  background: rgba(118, 185, 0, 0.18);
  border-color: rgba(118, 185, 0, 0.82);
  color: #f4f8ee;
}

.focusSwitchTrack {
  position: relative;
  width: 34px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(6, 8, 6, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.focusSwitchThumb {
  position: absolute;
  top: 50%;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(219, 226, 211, 0.84);
  transform: translateY(-50%);
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.focusSwitchOn .focusSwitchTrack {
  background: rgba(118, 185, 0, 0.28);
  border-color: rgba(118, 185, 0, 0.54);
}

.focusSwitchOn .focusSwitchThumb {
  background: #f4f8ee;
  transform: translate(16px, -50%);
  box-shadow: 0 0 10px rgba(118, 185, 0, 0.5);
}

.focusSwitchText {
  min-width: 18px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* ReactFlow Custom Styling */
.flowContainer :global(.react-flow) {
  background: transparent;
}

.flowContainer :global(.react-flow__pane) {
  cursor: grab;
}

.flowContainer :global(.react-flow__pane:active) {
  cursor: grabbing;
}

.flowContainer :global(.react-flow__node) {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.flowContainer :global(.react-flow__node:hover) {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.flowContainer :global(.react-flow__controls) {
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #333);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.flowContainer :global(.react-flow__controls-button) {
  background: var(--bg-secondary, #141414);
  border-bottom: 1px solid var(--border-color, #333);
  color: var(--text-primary, #e8e8e8);
}

.flowContainer :global(.react-flow__controls-button:hover) {
  background: var(--bg-hover, #222);
}

.flowContainer :global(.react-flow__controls-button svg) {
  fill: currentColor;
}

.flowContainer :global(.react-flow__minimap) {
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #333);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Edge styling */
.flowContainer :global(.react-flow__edge-path) {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flowContainer :global(.react-flow__edge.animated path) {
  stroke-dasharray: 5;
  animation: edgeFlow 0.5s linear infinite;
}

/* Highlighted edge - flowing golden glow effect */
.flowContainer :global(.react-flow__edge.animated.highlighted-edge path) {
  stroke-dasharray: 12, 4;
  stroke-width: 4px;
  animation: highlightedEdgeFlow 0.8s linear infinite;
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.9)) drop-shadow(0 0 16px rgba(255, 215, 0, 0.5));
}

/* Pulsing glow animation for highlighted edges */
.flowContainer :global(.react-flow__edge.highlighted-edge) {
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes edgeFlow {
  to {
    stroke-dashoffset: -10;
  }
}

@keyframes highlightedEdgeFlow {
  to {
    stroke-dashoffset: -16;
  }
}

@keyframes pulseGlow {
  0%, 100% {
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.8));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(255, 215, 0, 1)) drop-shadow(0 0 20px rgba(255, 200, 0, 0.6));
  }
}

.flowContainer :global(.react-flow__attribution) {
  background: var(--bg-secondary, #141414);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-secondary, #888);
}

/* Loading State */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary, #888);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color, #333);
  border-top-color: var(--accent-color, #76b900);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

.loading p {
  font-size: 1rem;
  margin: 0;
}

/* Error State */
.error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary, #888);
  padding: 2rem;
  text-align: center;
}

.errorIcon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.error p {
  font-size: 1rem;
  margin: 0 0 1.5rem 0;
  color: var(--text-primary, #e8e8e8);
}

.retryButton {
  padding: 0.75rem 1.5rem;
  background: var(--accent-color, #76b900);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.retryButton:hover {
  background: var(--accent-hover, #8ed100);
  transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 1024px) {
  .bottomPanel {
    height: 90px;
  }

  .layoutToolbar {
    top: 10px;
    right: 10px;
    gap: 6px;
    padding: 6px 8px;
  }

  .toolbarSection {
    min-width: 110px;
  }

  .densitySection {
    min-width: 300px;
  }

  .densitySummary {
    max-width: 360px;
  }

  .modeBtn,
  .toolBtn {
    font-size: 10px;
    padding: 3px 7px;
  }

}

@media (max-width: 768px) {
  .bottomPanel {
    height: 80px;
  }

  .bottomPanelContent {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 12px;
  }

  /* Hide MiniMap (preview) on mobile */
  .flowContainer :global(.react-flow__minimap) {
    display: none !important;
  }

  .layoutToolbar {
    display: none;
  }

}
