/* Notely Swarm Rebuild - Cursor Agents Page Rebuild Animation Styles */
:root {
  --rebuild-agent-1: #22d3ee; /* Cyan */
  --rebuild-agent-2: #818cf8; /* Violet / Indigo */
  --rebuild-agent-3: #ff4371; /* Coral / Pink */
  --rebuild-agent-4: #10b981; /* Emerald */
  --rebuild-agent-5: #f59e0b; /* Amber */
  --rebuild-agent-6: #38bdf8; /* Sky */
  --rebuild-agent-7: #a855f7; /* Purple */
  --rebuild-agent-8: #ec4899; /* Fuchsia */
  --rebuild-agent-9: #14b8a6; /* Teal */
  --rebuild-agent-10: #fb923c; /* Orange */
}

/* Base overlay container */
.notely-rebuild-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 99998;
  overflow: hidden;
  will-change: opacity;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.notely-rebuild-overlay.is-finishing {
  opacity: 0;
  pointer-events: none;
}

/* Cursor Agent */
.notely-rebuild-cursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 100000;
  will-change: transform;
  transform-origin: 2px 2px;
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.55));
  transition: opacity 0.3s ease;
}

.notely-rebuild-cursor-arrow {
  display: block;
  width: 20px;
  height: 22px;
  transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Cursor Agent tiny index tag */
.notely-rebuild-cursor-tag {
  position: absolute;
  top: 13px;
  left: 13px;
  padding: 1.5px 4.5px;
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
  background: rgba(8, 12, 28, 0.85);
  border: 1px solid currentColor;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: transform 0.15s ease;
}

/* Pulsing ping at the tip */
.notely-rebuild-cursor-ping {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: notelyRebuildPing 1.35s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes notelyRebuildPing {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0.95; }
  75%, 100% { transform: translate(-50%, -50%) scale(2.6); opacity: 0; }
}

/* Motion trail particles */
.notely-rebuild-trail-dot {
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
  z-index: 99999;
  transform: translate(-50%, -50%);
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

/* Wireframe Bounding Box */
.notely-rebuild-box {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  box-sizing: border-box;
  border-radius: 8px;
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1), transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
  overflow: hidden;
}

/* Laser scanline animation */
.notely-rebuild-scanline {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, currentColor 50%, transparent 100%);
  box-shadow: 0 0 10px currentColor, 0 0 4px #ffffff;
  pointer-events: none;
  opacity: 0.85;
  animation: notelyScanlineSweep 0.55s ease-in-out infinite alternate;
}

@keyframes notelyScanlineSweep {
  0% { top: 0%; opacity: 0.95; }
  100% { top: 100%; opacity: 0.6; }
}

/* Corner HUD brackets */
.notely-rebuild-corner {
  position: absolute;
  width: 7px;
  height: 7px;
  border-style: solid;
  border-width: 0;
  pointer-events: none;
}
.notely-rebuild-corner-tl { top: -1px; left: -1px; border-top-width: 2.5px; border-left-width: 2.5px; border-top-left-radius: 5px; }
.notely-rebuild-corner-tr { top: -1px; right: -1px; border-top-width: 2.5px; border-right-width: 2.5px; border-top-right-radius: 5px; }
.notely-rebuild-corner-bl { bottom: -1px; left: -1px; border-bottom-width: 2.5px; border-left-width: 2.5px; border-bottom-left-radius: 5px; }
.notely-rebuild-corner-br { bottom: -1px; right: -1px; border-bottom-width: 2.5px; border-right-width: 2.5px; border-bottom-right-radius: 5px; }

/* Element size label badge */
.notely-rebuild-badge {
  position: absolute;
  top: -11px;
  left: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  padding: 2.5px 7px;
  border-radius: 4.5px;
  pointer-events: none;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  animation: notelyBadgePop 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 2;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.notely-rebuild-badge span.nrb-badge-tag {
  opacity: 0.75;
  font-weight: 500;
  margin-right: 4px;
  font-size: 8.5px;
  text-transform: uppercase;
}

@keyframes notelyBadgePop {
  from { transform: translateY(5px) scale(0.85); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Materialization micro-flash */
.notely-rebuild-flash {
  position: fixed;
  pointer-events: none;
  border-radius: 8px;
  z-index: 99999;
  box-sizing: border-box;
  animation: notelyElementFlash 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes notelyElementFlash {
  0% { opacity: 0.85; transform: scale(1.015); }
  100% { opacity: 0; transform: scale(1.05); }
}

/* Floating Progress Pill at Bottom */
.notely-rebuild-pill {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 999999;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 16px;
  border-radius: 9999px;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  background: rgba(10, 14, 30, 0.92);
  color: #f4f6ff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  user-select: none;
  animation: notelyPillIn 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-width: 94vw;
  box-sizing: border-box;
}

html[data-theme="light"] .notely-rebuild-pill {
  background: rgba(255, 255, 255, 0.95);
  color: #060c1c;
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

@keyframes notelyPillIn {
  from { transform: translate(-50%, 24px) scale(0.92); opacity: 0; }
  to { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

.notely-rebuild-pill.is-exiting {
  animation: notelyPillOut 0.32s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes notelyPillOut {
  from { transform: translate(-50%, 0) scale(1); opacity: 1; }
  to { transform: translate(-50%, 20px) scale(0.92); opacity: 0; }
}

/* Agent dots indicator */
.notely-rebuild-agents {
  display: flex;
  align-items: center;
  gap: 4px;
}

.notely-rebuild-dot {
  width: 7.5px;
  height: 7.5px;
  border-radius: 50%;
  display: inline-block;
  transition: transform 0.2s ease, opacity 0.2s ease;
  animation: notelyDotPulse 1.4s ease-in-out infinite;
}

.notely-rebuild-dot.is-active {
  transform: scale(1.35);
  box-shadow: 0 0 8px currentColor;
  opacity: 1 !important;
}

@keyframes notelyDotPulse {
  0%, 100% { transform: scale(1); opacity: 0.75; }
  50% { transform: scale(1.25); opacity: 1; }
}

/* Mini progress bar inside pill */
.notely-rebuild-progress-bar {
  width: 52px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

html[data-theme="light"] .notely-rebuild-progress-bar {
  background: rgba(0, 0, 0, 0.1);
}

.notely-rebuild-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22d3ee, #818cf8, #ff4371);
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Status counter */
.notely-rebuild-status {
  display: flex;
  align-items: baseline;
  gap: 3.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.notely-rebuild-status small {
  font-size: 10.5px;
  font-weight: 400;
  opacity: 0.7;
}

/* Pill buttons */
.notely-rebuild-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: inherit;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

html[data-theme="light"] .notely-rebuild-btn {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.12);
}

.notely-rebuild-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-0.5px);
}

html[data-theme="light"] .notely-rebuild-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.2);
}

.notely-rebuild-speed-btn {
  min-width: 32px;
  font-variant-numeric: tabular-nums;
}

.notely-rebuild-speed-btn.is-active {
  background: rgba(143, 232, 248, 0.22);
  border-color: #8fe8f8;
  color: #8fe8f8;
}

html[data-theme="light"] .notely-rebuild-speed-btn.is-active {
  background: rgba(31, 111, 181, 0.15);
  border-color: #1f6fb5;
  color: #1f6fb5;
}

.notely-rebuild-skip-btn {
  background: rgba(143, 232, 248, 0.14);
  border-color: rgba(143, 232, 248, 0.4);
  color: #8fe8f8;
}

html[data-theme="light"] .notely-rebuild-skip-btn {
  background: rgba(31, 111, 181, 0.1);
  border-color: rgba(31, 111, 181, 0.35);
  color: #1f6fb5;
}

.notely-rebuild-never-btn {
  background: transparent;
  border: none;
  font-size: 10px;
  font-weight: 500;
  opacity: 0.65;
  padding: 3px 6px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.notely-rebuild-never-btn:hover {
  opacity: 1;
  background: transparent;
  color: #ff4371;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .notely-rebuild-overlay,
  .notely-rebuild-pill,
  .notely-rebuild-cursor,
  .notely-rebuild-box,
  .notely-rebuild-flash {
    display: none !important;
  }
}

/* Phone adjustments */
@media (max-width: 640px) {
  .notely-rebuild-pill {
    gap: 7px;
    padding: 5px 11px;
    font-size: 11px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  }
  .notely-rebuild-progress-bar {
    width: 36px;
  }
  .notely-rebuild-btn {
    padding: 3px 8px;
    font-size: 10px;
  }
  .notely-rebuild-never-btn {
    display: none; /* Keep pill compact on small mobile screens */
  }
}


/* Final chat overrides: this stylesheet loads after workspace/spec CSS. */
.nw-assistant-window{min-height:0;overflow:hidden}
.nw-assistant-max-grid{min-height:0;min-width:0}
.nw-assistant-center{min-height:0;min-width:0}
.nw-assistant-messages{flex:1 1 0;min-height:0;min-width:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;scroll-padding-block:20px 28px;padding-bottom:28px}
.nw-assistant-message{flex:0 0 auto;min-width:0;overflow:visible}
.nw-assistant-bubble{min-width:0;overflow:visible}
.nw-assistant-actions{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:12px 0 8px;padding:2px 0 6px;opacity:1;overflow:visible}
.nw-assistant-actions button{flex:0 0 auto;min-height:36px;padding:6px 10px;font-size:11px;white-space:nowrap}
.nw-assistant-prose{font-size:14px;line-height:1.78;overflow-wrap:anywhere}
.nw-assistant-prose h2{font-size:1.18em;line-height:1.35;margin:1.25em 0 .55em}
.nw-assistant-prose h3{font-size:1.08em;line-height:1.4;margin:1.1em 0 .5em}
.nw-assistant-prose h4{font-size:1em;line-height:1.45;margin:1em 0 .45em}
.nw-assistant-prose p{margin:.55em 0}
.nw-assistant-prose ul,.nw-assistant-prose ol{padding-left:1.45em;margin:.6em 0}
.nw-assistant-prose li{margin:.3em 0}
.nw-chat-attachment{display:flex;align-items:center;gap:10px;min-width:0;max-width:min(420px,100%);margin:8px 0 2px;padding:10px 12px;border:1px solid color-mix(in srgb,currentColor 18%,transparent);border-radius:13px;background:color-mix(in srgb,var(--surface) 18%,transparent);color:inherit}
.nw-chat-attachment-icon{font-size:20px;flex:none}
.nw-chat-attachment-copy{display:flex;flex:1;min-width:0;flex-direction:column;gap:3px}
.nw-chat-attachment-copy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}
.nw-chat-attachment-copy small{font-size:10px;opacity:.75}
.nw-chat-attachment a{flex:none;color:inherit;font-size:11px;font-weight:700;text-decoration:underline}
.nw-chat-pending-files{display:flex;flex-wrap:wrap;gap:7px;padding:8px 12px 0}
.nw-chat-pending-file{display:inline-flex;align-items:center;gap:6px;padding:5px 8px;border:1px solid var(--line);border-radius:10px;background:var(--paper);color:var(--ink);font-size:11px}
.nw-chat-pending-file button{min-height:22px;padding:0 4px;border:0;background:transparent;color:var(--muted);font-size:16px}
@media(max-width:760px){.nw-assistant-prose{font-size:13.5px}.nw-assistant-actions{gap:5px}.nw-assistant-actions button{min-height:36px}.nw-chat-attachment{max-width:100%}}
