/* ==========================================================================
   SWARMLINE - AI MULTIPLAYER AUTO-BUILD ENGINE
   Laboratorio D-Gart (Art & Technology)
   ========================================================================== */

#swarmline-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  pointer-events: none;
  overflow: hidden;
}

/* Background blueprint grid during build */
.swarmline-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(to right, rgba(99, 102, 241, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(99, 102, 241, 0.07) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  opacity: 0.9;
  transition: opacity 0.6s ease;
}

.swarmline-grid.fade-out {
  opacity: 0;
}

/* Skip Indicator Pill */
.swarmline-skip-badge {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 9999px;
  color: #e2e8f0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 15px rgba(139, 92, 246, 0.35);
  cursor: pointer;
  pointer-events: auto;
  z-index: 1000000;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.swarmline-skip-badge:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(168, 85, 247, 0.6);
  transform: translateY(-2px);
}

.swarmline-skip-badge.fade-out {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

.swarmline-skip-badge kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
}

.swarmline-pulse-dot {
  width: 7px;
  height: 7px;
  background-color: #38bdf8;
  border-radius: 50%;
  animation: swarmline-pulse 1.4s infinite ease-in-out;
}

@keyframes swarmline-pulse {
  0%, 100% { transform: scale(0.9); opacity: 0.4; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 8px #38bdf8; }
}

/* Virtual Cursor */
.swarmline-cursor {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  pointer-events: none;
  z-index: 100000;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  transition: opacity 0.4s ease;
}

.swarmline-cursor svg {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
  transform-origin: 0 0;
}

.swarmline-cursor-label {
  margin-top: -3px;
  margin-left: 12px;
  padding: 3px 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  border-radius: 5px;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  transition: transform 0.25s ease;
}

/* Ambient Floating / Roaming State */
.swarmline-cursor.roaming {
  pointer-events: none;
  opacity: 0.92;
}

.swarmline-cursor.roaming .swarmline-cursor-label {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

/* Docked State (Alternate Option) */
.swarmline-dock-header {
  position: fixed;
  top: 80px;
  right: 16px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 4px 12px;
  color: #cbd5e1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100001;
  pointer-events: none;
}

.swarmline-dock-header.visible {
  opacity: 1;
  transform: translateY(0);
}

.swarmline-dock-header::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.swarmline-cursor.docked {
  pointer-events: auto;
  cursor: default;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
}

.swarmline-cursor.docked:hover .swarmline-cursor-label {
  transform: scale(1.05) translateX(-4px);
}

/* Bounding box drag animation */
.swarmline-box {
  position: absolute;
  border: 1.5px solid;
  border-radius: 6px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.03);
  pointer-events: none;
  z-index: 99990;
  transition: all 0.25s ease-out;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
}

.swarmline-box-handle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #ffffff;
  border: 1.5px solid currentColor;
  border-radius: 1px;
}
.swarmline-box-handle.tl { top: -4px; left: -4px; }
.swarmline-box-handle.tr { top: -4px; right: -4px; }
.swarmline-box-handle.bl { bottom: -4px; left: -4px; }
.swarmline-box-handle.br { bottom: -4px; right: -4px; }

.swarmline-box-dimensions {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  color: #f1f5f9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  white-space: nowrap;
}

/* Alignment Guide Lines */
.swarmline-guide-x,
.swarmline-guide-y {
  position: absolute;
  pointer-events: none;
  z-index: 99980;
}

.swarmline-guide-x {
  left: 0;
  width: 100vw;
  height: 1px;
  border-top: 1px dashed rgba(236, 72, 153, 0.6);
}

.swarmline-guide-y {
  top: 0;
  height: 100vh;
  width: 1px;
  border-left: 1px dashed rgba(56, 189, 248, 0.6);
}

/* Element visibility animation during swarm */
.swarm-hidden {
  opacity: 0 !important;
  transform: scale(0.97) translateY(8px) !important;
  filter: blur(4px) !important;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), 
              filter 0.5s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.swarm-revealed {
  opacity: 1 !important;
  transform: scale(1) translateY(0) !important;
  filter: blur(0px) !important;
}

@media (max-width: 768px) {
  .swarmline-dock-header {
    display: none !important;
  }
  .swarmline-cursor.docked {
    opacity: 0 !important;
    pointer-events: none !important;
  }
}
