/* ===== DRAGGABLE & FLOATING NODE SIMULATOR STYLES ===== */

#card-upgrade .card-inner {
  background-color: #000000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  position: relative;
  width: 100%;
  height: 100%;
  user-select: none;
}

/* White Dot Grid Overlay */
#card-upgrade .card-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  --dot-color: rgba(255, 255, 255, 0.1); /* Prominent, crisp elegant white dots matching screenshot */
  --spacing: 28px;
  --dot-size: 1.5px;
  background-image: radial-gradient(var(--dot-color) var(--dot-size), transparent var(--dot-size));
  background-size: var(--spacing) var(--spacing);
  background-position: center;
  background-repeat: repeat;
  pointer-events: none;
}

/* SVG Connection Canvas */
.nodes-svg-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Connection Line Styles (Matching Reference Screenshot) */
.connection-cable {
  fill: none;
  stroke-linecap: round;
  transition: stroke 0.3s ease;
}

.connection-cable.draft {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1.8;
  stroke-dasharray: 4 4;
}

.connection-cable.locked {
  stroke: rgba(108, 92, 231, 0.7); /* Deep neon purple flow */
  stroke-width: 2;
  stroke-dasharray: 4 4;
}

.connection-cable.locked-audio {
  stroke: rgba(57, 255, 20, 0.7); /* Deep neon acid green flow */
  stroke-width: 2;
  stroke-dasharray: 4 4;
}

.connection-cable.locked-suhail {
  stroke: rgba(255, 159, 67, 0.7); /* Deep neon signature orange flow */
  stroke-width: 2;
  stroke-dasharray: 4 4;
}

/* Flowing data pulses along cable */
.connection-cable.flow {
  /* Animation removed */
}

/* Core Board Container */
.nodes-board {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 40px;
}

/* Header */
.board-header {
  text-align: center;
  margin-bottom: 20px;
  pointer-events: none;
}

.board-header h2 {
  font-family: "Barlow Condensed", sans-serif;
  font-size: clamp(2rem, 5vw, 4.2rem);
  font-weight: 900;
  text-transform: uppercase;
  color: #ffffff;
  margin: 0 0 6px 0;
  letter-spacing: -0.5px;
}

.board-header h2 span {
  background: linear-gradient(120deg, #bd00ff, #39ff14, #00d2ff, #bd00ff);
  background-size: 300% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  display: inline-block;
  z-index: 5;
  animation: moveGradient 8s ease infinite;
}

@keyframes moveGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Floating Laboratory text bubbles (Rendered inside the text letters) */
.text-bubble {
  position: absolute;
  bottom: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2; /* Position within the background-clipped letters */
  mix-blend-mode: screen; /* Blend beautifully with the shifting text gradient */
  /* Animation removed */
}

.board-header p {
  font-family: "Host Grotesk", sans-serif;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: rgba(255, 255, 255, 0.4);
  text-transform: none;
  margin: 0;
}

/* Canvas Nodes Wrapper */
.nodes-container {
  position: relative;
  width: 100%;
  flex-grow: 1;
  min-height: 580px;
}

/* Node Card Base (Replicating Screenshot Style) */
.node-card {
  background: #141416;
  border: 1.5px solid #22242a;
  border-radius: 20px;
  padding: 22px;
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 310px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  box-sizing: border-box;
  z-index: 10;
  cursor: grab;
  transition: opacity 0.6s cubic-bezier(0.25, 0.8, 0.25, 1),
              transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1),
              border-color 0.4s ease,
              box-shadow 0.4s ease,
              left 0.1s ease,
              top 0.1s ease;
}

/* Custom enlarged widths for outcome display cards */
#node-image, #node-video {
  width: 360px;
}

/* Card Hover Animation (Lift, Scale, Neon Glow) */
.node-card:hover {
  transform: translateY(-12px) scale(1.03) !important;
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.8),
              0 0 25px rgba(189, 0, 255, 0.15); /* Sleek soft purple ambient aura */
}

/* Hidden state for progressive reveal animations */
.node-card.hidden-node {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: scale(0.85) translateY(20px) !important;
  visibility: hidden;
}

.node-card.disabled {
  opacity: 0.4;
}

.node-card.disabled .node-body,
.node-card.disabled .node-port {
  pointer-events: none;
}

/* Dragging State */
.node-card.dragging {
  animation: none !important;
  transform: scale(1.02) !important;
  z-index: 1000 !important;
  cursor: grabbing;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Node Headers */
.node-header {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 10px;
  pointer-events: none;
}

.node-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.15);
  transition: background-color 0.3s ease;
}

.node-status-dot.active {
  background-color: #39ff14;
  box-shadow: 0 0 8px #39ff14;
}

.node-status-dot.compiling {
  background-color: #bd00ff;
  box-shadow: 0 0 8px #bd00ff;
  /* Animation removed */
}

.node-header span {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.8px;
  color: rgba(255, 255, 255, 0.8);
}

.node-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.node-desc {
  font-family: "Host Grotesk", sans-serif;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.35);
  text-transform: none;
  margin: 0 0 10px 0;
  pointer-events: none;
}

/* Revolving Glowing Border Animation (Active Processing Node) */
.node-card.processing::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: 21px;
  padding: 1.5px;
  background: linear-gradient(45deg, #39ff14, #bd00ff, #39ff14, #bd00ff);
  background-size: 400%;
  /* Animation removed */
  z-index: -1;
  pointer-events: none;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.node-card.processing::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 23px;
  padding: 3px;
  background: linear-gradient(45deg, #39ff14, #bd00ff, #39ff14, #bd00ff);
  background-size: 400%;
  /* Animation removed */
  z-index: -2;
  filter: blur(8px);
  -webkit-filter: blur(8px);
  pointer-events: none;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.85;
}

/* 1. Style Selection Buttons */
.style-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.style-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px 16px;
  color: #ffffff;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 600;
  font-size: 15px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
}

.style-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.style-btn.selected {
  background: rgba(189, 0, 255, 0.12);
  border-color: #bd00ff;
  box-shadow: 0 0 15px rgba(189, 0, 255, 0.2);
}

.style-btn * {
  pointer-events: none;
}

.style-icon {
  font-size: 16px;
}

/* 2. Terminal LLM Visualizer */
.terminal-box {
  background: #09090b;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
  font-family: "Courier New", Courier, monospace;
}

.terminal-header {
  background: #111115;
  padding: 6px 12px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.terminal-header .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.terminal-header .dot.red { background-color: #ff5f56; }
.terminal-header .dot.yellow { background-color: #ffbd2e; }
.terminal-header .dot.green { background-color: #27c93f; }

.terminal-content {
  padding: 12px;
  font-size: 11px;
  min-height: 90px;
  box-sizing: border-box;
}

.terminal-prompt {
  color: #39ff14;
  margin-bottom: 6px;
  display: block;
}

.prompt-text {
  color: #c5c5c5;
  line-height: 1.4;
  margin: 0;
  text-transform: none;
  font-weight: normal;
}

/* 3. Image Outcome Node */
.image-preview-box {
  width: 100%;
  height: 180px;
  background: #09090b;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.image-preview-box img.revealed {
  opacity: 1;
}

.spinner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  background: #09090b;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.spinner-overlay.active {
  opacity: 1;
}

.dual-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid transparent;
  border-top-color: #bd00ff;
  border-bottom-color: #39ff14;
  border-radius: 50%;
  /* Animation removed */
}

/* 4. Music Node */
.music-toggle-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 20px;
  color: #ffffff;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 600;
  font-size: 15px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.music-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.music-toggle-btn.active {
  background: rgba(57, 255, 20, 0.12);
  border-color: #39ff14;
  box-shadow: 0 0 15px rgba(57, 255, 20, 0.2);
}

.waveform-box {
  width: 100%;
  height: 44px;
  background: #09090b;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 10px;
}

.waveform-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* 5. Video Node */
.video-wrapper {
  width: 100%;
  height: 180px;
  background: #09090b;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Locked Screen Overlay */
.locked-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 11, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  text-align: center;
  transition: opacity 0.5s ease;
}

.locked-overlay.unlocked {
  opacity: 0;
  pointer-events: none;
}

.lock-shield {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff5f56;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 5px rgba(255, 95, 86, 0.3));
  /* Animation removed */
}

.lock-shield svg {
  width: 18px;
  height: 18px;
}

.lock-text {
  font-family: "Host Grotesk", sans-serif;
  font-size: 10.5px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.45);
  text-transform: none;
  max-width: 230px;
  margin: 0 0 10px 0;
  font-weight: normal;
}

.lock-status-bars {
  display: flex;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.lock-status-bars span {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 95, 86, 0.08);
  color: #ff5f56;
  border: 1px solid rgba(255, 95, 86, 0.12);
}

.lock-status-bars span.linked {
  background: rgba(57, 255, 20, 0.08);
  color: #39ff14;
  border-color: rgba(57, 255, 20, 0.12);
}

/* Play button trigger */
.video-overlay-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  background: rgba(57, 255, 20, 0.15);
  border: 2px solid #39ff14;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #39ff14;
  cursor: pointer;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.3);
}

.video-overlay-play svg {
  width: 20px;
  height: 20px;
  margin-left: 2px;
}

.video-overlay-play:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: #39ff14;
  color: #000;
  box-shadow: 0 0 30px rgba(57, 255, 20, 0.5);
}

.video-overlay-play.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Iconic Port Badges (Replicating Screenshot Style) */
.node-port {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: #1a1a1e;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  position: absolute;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 100;
  box-sizing: border-box;
}

/* Expand port collision boundary for easier cursor selection */
.node-port::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  z-index: -1;
  pointer-events: auto;
}

.node-port svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.2px;
  display: block;
}

.node-port:hover {
  background-color: #222227;
  border-color: rgba(255, 255, 255, 0.4);
  color: #ffffff;
}

/* Port Overlap Positioning */
.node-port.port-in {
  left: -15px;
  top: 50%;
  transform: translateY(-50%);
}

.node-port.port-out {
  right: -15px;
  top: 50%;
  transform: translateY(-50%);
}

/* Video Port Multi-Input Custom Alignment */
.node-port.port-in-audio {
  left: -15px;
  top: 25%;
  transform: translateY(-50%);
}

.node-port.port-in-image {
  left: -15px;
  top: 50%;
  transform: translateY(-50%);
}

.node-port.port-in-suhail {
  left: -15px;
  top: 75%;
  transform: translateY(-50%);
}

.port-desc {
  position: absolute;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  pointer-events: none;
  z-index: 5;
}

.port-audio-desc {
  left: 20px;
  top: 25%;
  transform: translateY(-50%);
}

.port-image-desc {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.port-suhail-desc {
  left: 20px;
  top: 75%;
  transform: translateY(-50%);
}

/* Glow styles for active/waiting ports (Matching screenshot colored accents) */
.node-port.glow-purple {
  background-color: #1c132b;
  border-color: #bd00ff;
  color: #bd00ff;
  box-shadow: 0 0 10px rgba(189, 0, 255, 0.4), 0 0 20px rgba(189, 0, 255, 0.2);
  /* Animation removed */
}

.node-port.glow-green {
  background-color: #122416;
  border-color: #39ff14;
  color: #39ff14;
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.4), 0 0 20px rgba(57, 255, 20, 0.2);
  /* Animation removed */
}

.node-port.glow-orange {
  background-color: #2b1d13;
  border-color: #ff9f43;
  color: #ff9f43;
  box-shadow: 0 0 10px rgba(255, 159, 67, 0.4), 0 0 20px rgba(255, 159, 67, 0.2);
}

/* Mobile viewport structural updates */
@media (max-width: 768px) {
  .nodes-board {
    padding: 80px 10px 10px 10px;
  }
  .nodes-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    height: auto;
    min-height: auto;
  }
  .node-card {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    animation: none !important;
    margin-bottom: 20px;
  }
  .nodes-svg-canvas {
    display: none; /* Hide svg lines on standard stacked mobile layouts to prevent clipping */
  }
  .node-port {
    pointer-events: none; /* Auto-guide mobile workflow without manual drags */
  }
}
