/* ============================================
   Builder Demo V2 — Semi-Interactive Mockup
   ============================================ */

/* Window */
.builder-demo-window {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #ffffff;
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow: hidden;
}

/* ---- Header ---- */
.demo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  min-height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid #f5f5f4;
  background: #ffffff;
}

.demo-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.demo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d6d3d1;
}

.demo-dot:nth-child(1) {
  background: #fca5a5;
}
.demo-dot:nth-child(2) {
  background: #fcd34d;
}
.demo-dot:nth-child(3) {
  background: #86efac;
}

.demo-back-arrow {
  display: flex;
  align-items: center;
  margin-left: 8px;
}

.demo-title {
  font-size: 12px;
  font-weight: 600;
  color: #292524;
  margin-left: 4px;
}

.demo-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.demo-btn-ghost {
  font-size: 11px;
  font-weight: 500;
  color: #78716c;
  padding: 4px 12px;
  border: 1px solid #e7e5e4;
  border-radius: 6px;
  cursor: default;
}

.demo-btn-primary {
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  background: #292524;
  padding: 4px 14px;
  border-radius: 6px;
  cursor: default;
}

.demo-btn-signup {
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.demo-btn-signup:hover {
  background: #44403c;
}

/* ---- Body ---- */
.demo-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* ---- Floating nav ---- */
.demo-nav {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.demo-nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 10px 6px;
  border-radius: 12px;
  color: #a8a29e;
  cursor: pointer;
  border: none;
  background: transparent;
  transition:
    background 0.2s ease,
    color 0.2s ease;
  min-width: 56px;
}

.demo-nav-item span {
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
}

.demo-nav-item.active {
  background: #e7e5e4;
  color: #292524;
}

.demo-nav-item:hover:not(.active) {
  background: #f5f5f4;
  color: #78716c;
}

/* ---- Conversation area ---- */
.demo-conversation {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fafaf9;
  padding-left: 40px;
  transition: opacity 0.3s ease;
}

.demo-body.demo-panel-visible .demo-conversation {
  pointer-events: auto;
  position: relative;
}

.demo-body.demo-panel-visible .demo-conversation::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.15);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 2;
  cursor: pointer;
}

.demo-messages {
  flex: 1;
  overflow: hidden;
  padding: 20px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

/* ---- Chat input ---- */
.demo-input {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto 12px;
  padding: 6px 6px 6px 10px;
  background: #ffffff;
  border: 1px solid #e7e5e4;
  border-radius: 12px;
  max-width: 520px;
  width: calc(100% - 48px);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.demo-input.demo-input-flash {
  border-color: #a8a29e;
  box-shadow: 0 0 0 2px rgba(168, 162, 158, 0.15);
}

.demo-input-attach {
  display: flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: #a8a29e;
  cursor: default;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.demo-input:focus-within {
  border-color: #a8a29e;
  box-shadow: 0 0 0 2px rgba(168, 162, 158, 0.12);
}

.demo-input-field {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 12px;
  color: #292524;
  min-width: 0;
  padding: 4px 0;
  cursor: text;
}

.demo-input-field::placeholder {
  color: #a8a29e;
}

.demo-input-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #292524;
  border: none;
  cursor: default;
  flex-shrink: 0;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.demo-input-send.demo-send-pulse {
  animation: demo-send-pulse 0.4s ease;
}

@keyframes demo-send-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(41, 37, 36, 0.4);
  }
  40% {
    transform: scale(0.88);
    box-shadow: 0 0 0 0 rgba(41, 37, 36, 0.4);
  }
  70% {
    transform: scale(1.08);
    box-shadow: 0 0 0 6px rgba(41, 37, 36, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(41, 37, 36, 0);
  }
}

/* ============================================
   Message types
   ============================================ */

/* User message — dark bubble, right-aligned */
.demo-msg-user {
  display: flex;
  justify-content: flex-end;
}

.demo-msg-user-bubble {
  background: #292524;
  color: #ffffff;
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 88%;
}

/* Thinking toggle */
.demo-msg-thinking {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.demo-thinking-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #a8a29e;
}

.demo-thinking-toggle:hover {
  color: #78716c;
}

.demo-thinking-chevron {
  display: flex;
  align-items: center;
  transition: transform 0.2s ease;
}

.demo-msg-thinking.expanded .demo-thinking-chevron {
  transform: rotate(90deg);
}

.demo-thinking-text {
  font-size: 11px;
  font-weight: 500;
}

.demo-thinking-content {
  max-height: 0;
  overflow: hidden;
  transition:
    max-height 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    opacity 0.25s ease;
  opacity: 0;
  margin-left: 2px;
  padding-left: 12px;
  border-left: 2px solid #e7e5e4;
  position: relative;
}

.demo-msg-thinking.expanded .demo-thinking-content {
  max-height: 200px;
  opacity: 1;
}

.demo-thinking-content p {
  font-size: 12px;
  line-height: 1.6;
  color: #78716c;
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace;
  margin: 6px 0 16px;
}

.demo-thinking-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: linear-gradient(transparent, #fafaf9);
  pointer-events: none;
}

/* AI text response */
.demo-msg-text {
  font-size: 13px;
  line-height: 1.6;
  color: #292524;
  max-width: 88%;
}

/* Tools block */
.demo-msg-tools {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-left: 2px solid #e7e5e4;
  padding-left: 12px;
  margin-left: 2px;
}

.demo-tool-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 12px;
  color: #57534e;
}

.demo-tool-check {
  flex-shrink: 0;
  color: #10b981;
  display: flex;
  align-items: center;
}

/* Artifact card */
.demo-msg-artifact {
  background: #ffffff;
  border: 1px solid #e7e5e4;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 300px;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.demo-msg-artifact:hover {
  border-color: #d6d3d1;
  box-shadow:
    0px 2px 12px #3c3c3c0f,
    0px 12px 24px #3c3c3c0a;
}

.demo-artifact-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f5f5f4;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.demo-artifact-content {
  flex: 1;
  min-width: 0;
}

.demo-artifact-label {
  font-size: 12px;
  font-weight: 600;
  color: #292524;
  display: flex;
  align-items: center;
  gap: 6px;
}

.demo-artifact-arrow {
  color: #a8a29e;
  font-size: 11px;
  transition: transform 0.2s ease;
}

.demo-msg-artifact:hover .demo-artifact-arrow {
  transform: translateX(2px);
}

.demo-artifact-summary {
  font-size: 11px;
  color: #78716c;
  margin-top: 2px;
}

/* Suggestion chips */
.demo-msg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.demo-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #57534e;
  background: #ffffff;
  border: 1px solid #e7e5e4;
  border-radius: 9999px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.demo-chip:hover {
  border-color: #d6d3d1;
  background: #fafaf9;
}

.demo-chip svg {
  flex-shrink: 0;
  opacity: 0.6;
}

/* ============================================
   Artifact panel
   ============================================ */

.demo-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 55%;
  max-width: 480px;
  background: #ffffff;
  border-left: 1px solid #e7e5e4;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 20;
  display: flex;
  flex-direction: column;
}

.demo-panel.open {
  transform: translateX(0);
}

.demo-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #f5f5f4;
  min-height: 44px;
}

.demo-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: #292524;
}

.demo-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #78716c;
  transition: background 0.15s ease;
}

.demo-panel-close:hover {
  background: #f5f5f4;
}

.demo-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 14px;
  display: flex;
  flex-direction: column;
}

.demo-question-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #e7e5e4;
  background: #ffffff;
  margin-bottom: 6px;
  transition: border-color 0.15s ease;
}

.demo-question-card:hover {
  border-color: #d6d3d1;
}

.demo-card-drag {
  flex-shrink: 0;
  margin-top: 5px;
  opacity: 0.6;
}

.demo-card-body {
  flex: 1;
  min-width: 0;
}

.demo-card-chevron {
  flex-shrink: 0;
  margin-top: 4px;
}

.demo-question-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f5f5f4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #78716c;
  flex-shrink: 0;
  margin-top: 1px;
}

.demo-question-text {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  color: #292524;
  margin: 0;
}

.demo-question-type {
  font-size: 11px;
  color: #a8a29e;
  margin-top: 3px;
  display: block;
}

/* ============================================
   Entrance stagger animations
   ============================================ */

/* Default state — hidden */
[data-stagger] {
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}

/* Stagger delays */
.demo-entered [data-stagger='0'] {
  transition-delay: 0ms;
}
.demo-entered [data-stagger='1'] {
  transition-delay: 150ms;
}
.demo-entered [data-stagger='2'] {
  transition-delay: 300ms;
}
.demo-entered [data-stagger='3'] {
  transition-delay: 450ms;
}
.demo-entered [data-stagger='4'] {
  transition-delay: 600ms;
}
.demo-entered [data-stagger='5'] {
  transition-delay: 750ms;
}
.demo-entered [data-stagger='6'] {
  transition-delay: 900ms;
}

/* Entered state — visible */
.demo-entered [data-stagger] {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   Signup CTA tooltip
   ============================================ */

.demo-signup-cta {
  align-self: center;
  margin-bottom: 10px;
  transform: translateY(4px);
  opacity: 0;
  pointer-events: none;
  background: #292524;
  border-radius: 10px;
  padding: 8px 18px;
  font-size: 13px;
  color: #d6d3d1;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  white-space: nowrap;
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 5;
}

.demo-signup-cta.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.demo-signup-cta a {
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  background: #44403c;
  padding: 2px 10px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.demo-signup-cta a:hover {
  background: #57534e;
}

/* ============================================
   Panel question stagger
   ============================================ */

.demo-panel .demo-question-card {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.demo-panel.open .demo-question-card {
  opacity: 1;
  transform: translateY(0);
}

.demo-panel.open .demo-question-card:nth-child(1) {
  transition-delay: 50ms;
}
.demo-panel.open .demo-question-card:nth-child(2) {
  transition-delay: 100ms;
}
.demo-panel.open .demo-question-card:nth-child(3) {
  transition-delay: 150ms;
}
.demo-panel.open .demo-question-card:nth-child(4) {
  transition-delay: 200ms;
}
.demo-panel.open .demo-question-card:nth-child(5) {
  transition-delay: 250ms;
}
.demo-panel.open .demo-question-card:nth-child(6) {
  transition-delay: 300ms;
}
.demo-panel.open .demo-question-card:nth-child(7) {
  transition-delay: 350ms;
}
.demo-panel.open .demo-question-card:nth-child(8) {
  transition-delay: 400ms;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 640px) {
  .demo-nav {
    display: none;
  }

  .demo-conversation {
    padding-left: 0;
  }

  .demo-messages {
    padding-left: 14px;
    padding-right: 14px;
    padding-top: 14px;
  }

  .demo-input {
    margin-left: 10px;
    margin-right: 10px;
    width: auto;
  }

  .demo-attach-text {
    display: none;
  }

  .demo-panel {
    display: none;
  }

  .demo-header-left .demo-back-arrow,
  .demo-header-right .demo-btn-ghost {
    display: none;
  }

  .demo-title {
    font-size: 11px;
  }
}
