/* Build My Website — Lovable handoff; matches lab-modal / lab-inner / lab-border-glow (Artifacts, New Venture) */

#wm-build-launch-backdrop.wm-bl-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 4vh, 32px);
  background: rgba(8, 12, 29, 0.38);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}

#wm-build-launch-backdrop.wm-bl-backdrop.wm-bl-visible {
  display: flex;
}

/* Build-launch modal: scroll lives on .lab-inner so .lab-border-glow is not clipped at corners */
#wm-build-launch-modal.wm-build-launch-lab-modal.lab-modal {
  width: min(720px, 100%);
  max-width: 720px;
  height: auto;
  max-height: min(92vh, 900px);
  min-height: 0;
  margin: 0 10px;
  flex: 0 1 auto;
  overflow-x: visible;
  overflow-y: visible;
  overscroll-behavior: contain;
}

#wm-build-launch-modal.wm-build-launch-lab-modal .lab-border-glow {
  inset: 2px;
  border-radius: 18px;
}

.wm-bl-lab-wrap.lab-modal-animation-wrapper {
  width: 100%;
  max-width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
  padding-inline: clamp(12px, 3vw, 32px);
  box-sizing: border-box;
}

/* Inner panel: scroll container; glow stays on parent without corner clipping */
.wm-build-launch-inner.lab-inner {
  height: auto;
  min-height: 0;
  max-height: min(86vh, 840px);
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.wm-bl-card-inner {
  position: relative;
  z-index: 2;
  padding: 2rem 2rem 2rem;
  text-align: center;
}

.wm-bl-dismiss {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--dash-muted, #9eb1cc);
  cursor: pointer;
  transition: all 0.2s ease;
}

.wm-bl-dismiss:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--dash-text, #e7eef7);
}

.wm-bl-dismiss svg {
  width: 18px;
  height: 18px;
}

.wm-bl-lovable-mark {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.wm-bl-lovable-mark img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

/* Title — same gradient treatment as .new-venture-title */
.wm-bl-headline {
  font-family: "Montserrat", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: clamp(1.25rem, 4.5vw, 1.75rem);
  font-weight: 900;
  margin: 0 0 0.5rem 0;
  line-height: 1.1;
  letter-spacing: -0.03em;
  background: linear-gradient(
    to bottom,
    #ffffff 0%,
    #bdd3f8 32%,
    #566fa7 53%,
    #2c4782 60%,
    #495f8f 68%,
    #ffffff 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.wm-bl-subhead {
  margin: 0 0 1.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dash-muted, #9eb1cc);
}

.wm-bl-step-stack {
  text-align: left;
}

.wm-bl-step {
  display: none;
}

.wm-bl-step.wm-bl-step--active {
  display: block;
}

.wm-bl-lead {
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--dash-muted, #9eb1cc);
  text-align: center;
}

.wm-bl-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.wm-bl-step[data-wm-bl-step="1"] .wm-bl-actions {
  align-items: center;
}

.wm-bl-actions--row {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.wm-bl-actions--row .lab-button.secondary {
  flex: 1 1 auto;
  min-width: 120px;
}

/* Modal buttons: fit content width (not full-bleed) */
#wm-build-launch-modal .wm-bl-btn-full,
#wm-build-launch-modal .wm-bl-actions .lab-button,
#wm-build-launch-modal .wm-bl-error-cta .lab-button {
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
}

#wm-build-launch-modal a.lab-button.wm-bl-btn-full {
  width: fit-content;
  max-width: 100%;
}

/* Step 4: Lovable dashboard — icon-only primary */
#wm-bl-open-build.wm-bl-open-build--lovable-icon {
  min-height: 52px;
  width: fit-content;
  padding: 10px 16px;
}

#wm-bl-open-build.wm-bl-open-build--lovable-icon .wm-bl-open-build-icon {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: contain;
  margin: 0 auto;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

#wm-bl-open-build.wm-bl-open-build--lovable-icon .wm-bl-open-build-label {
  display: none !important;
}

.wm-build-launch-inner a.lab-button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wm-build-launch-inner .lab-button.secondary {
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.wm-build-launch-inner .wm-bl-actions--row .lab-button.secondary {
  width: auto;
}

/* Step 2 — Stripe Connect (tool popup handoff) */
.wm-bl-stripe-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  margin-bottom: 0.25rem;
  padding: 1rem 1rem 0.5rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-sizing: border-box;
}

.wm-bl-stripe-panel-head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  text-align: left;
}

.wm-bl-stripe-panel-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  padding: 6px;
  box-sizing: border-box;
}

.wm-bl-stripe-panel-titles {
  min-width: 0;
  flex: 1;
}

.wm-bl-stripe-panel-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.02em;
}

.wm-bl-stripe-panel-subtitle {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--dash-muted, #9eb1cc);
}

.wm-bl-stripe-callout {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(91, 130, 253, 0.28);
  background: rgba(26, 32, 56, 0.55);
  box-sizing: border-box;
}

.wm-bl-stripe-callout--incomplete {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
}

.wm-bl-stripe-callout--done {
  align-items: center;
  gap: 0.85rem;
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(16, 185, 129, 0.1);
}

.wm-bl-stripe-callout-text {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  font-weight: 500;
  color: var(--dash-muted, #c8d6ee);
  text-align: left;
}

.wm-bl-stripe-callout-done-text {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(180, 255, 200, 0.95);
  text-align: left;
}

.wm-bl-stripe-callout-spinner {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid rgba(152, 202, 255, 0.2);
  border-top-color: rgba(152, 202, 255, 0.95);
  animation: wm-bl-refine-spin 0.75s linear infinite;
}

.wm-bl-stripe-connect-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.25rem 0 0.15rem;
}

.wm-bl-stripe-connect-wrap--done {
  display: none;
}

#wm-build-launch-modal .wm-bl-stripe-connect.ai-connect-button {
  margin-left: auto;
  margin-right: auto;
}

#wm-build-launch-modal .wm-bl-stripe-connect.ai-connect-button.connected {
  cursor: default;
  transform: none;
  opacity: 0.85;
}

#wm-build-launch-modal .wm-bl-stripe-neon.neon-checkbox {
  --size: 24px;
  width: var(--size);
  height: var(--size);
  flex-shrink: 0;
  margin: 0;
  cursor: default;
  pointer-events: none;
}

.wm-bl-actions--stripe-footer {
  margin-top: 0.35rem;
  padding-top: 0.15rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  justify-content: center;
}

/* Override modal-wide lab-button horizontal auto-margins so Skip stays left of Continue in the row. */
#wm-build-launch-modal .wm-bl-actions--stripe-footer.wm-bl-actions--row .lab-button {
  margin-left: 0;
  margin-right: 0;
}

.wm-bl-actions--stripe-footer .lab-button.primary {
  min-width: 132px;
}

@media (prefers-reduced-motion: reduce) {
  .wm-bl-stripe-callout-spinner {
    animation: none;
    border-top-color: rgba(152, 202, 255, 0.85);
  }
}

.wm-bl-error-wrap {
  display: none;
  margin-top: 1rem;
}

.wm-bl-error-wrap.wm-bl-error-wrap--visible {
  display: block;
}

.wm-bl-error-wrap .wm-bl-error {
  margin-top: 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.8125rem;
  text-align: center;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.wm-bl-error-cta {
  display: none;
  margin-top: 0.75rem;
}

.wm-bl-error-wrap.wm-bl-error-wrap--with-cta .wm-bl-error-cta {
  display: block;
}

/* Step 3: illustration while generating */
.wm-bl-generate-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 0;
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  overflow: hidden;
  margin: 0;
  pointer-events: none;
  transition:
    max-height 0.5s cubic-bezier(0.33, 1, 0.68, 1),
    opacity 0.4s ease,
    transform 0.45s cubic-bezier(0.33, 1, 0.68, 1),
    margin 0.35s ease;
}

.wm-bl-step3--generating .wm-bl-generate-visual {
  max-height: 260px;
  opacity: 1;
  transform: translateY(0) scale(1);
  margin-bottom: 14px;
}

.wm-bl-generate-illustration {
  width: min(200px, 72vw);
  max-width: 220px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 32px rgba(152, 202, 255, 0.2));
}

.wm-bl-loader {
  display: block;
  margin: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  color: var(--dash-muted, #9eb1cc);
  transition:
    max-height 0.4s cubic-bezier(0.33, 1, 0.68, 1),
    opacity 0.35s ease,
    margin 0.35s ease;
}

.wm-bl-loader.wm-bl-loader--visible {
  max-height: 72px;
  opacity: 1;
  margin: 6px 0 10px;
}

.wm-bl-footnote {
  margin: 1rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  text-align: center;
  color: #6ee7b7;
}

/* Step 4: keep footer actions off the scroll edge */
.wm-bl-step[data-wm-bl-step="4"] .wm-bl-refine {
  margin-bottom: 1.25rem;
}

.wm-bl-step[data-wm-bl-step="4"] .wm-bl-actions {
  margin-top: 0.5rem;
  padding-bottom: 0.35rem;
}

/* Step 4 — post-build refinement panel */
/* Stretch on cross-axis so children are full card width (align-items:center shrinks phases to button width). */
.wm-bl-refine {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  margin-bottom: 1rem;
  text-align: left;
}

/* Strong hide: some UA/extension styles can weaken [hidden] on flex descendants; phases/output use this in JS. */
#wm-build-launch-modal .wm-bl--hidden {
  display: none !important;
}

.wm-bl-refine-phase {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.wm-bl-refine-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
}

.wm-bl-refine-hint {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--dash-muted, #9eb1cc);
  text-align: center;
}

/* While generating: fade primary controls (output + fetch loader stay visible). */
#wm-build-launch-modal .wm-bl-refine-standard .wm-bl-make-better,
#wm-build-launch-modal .wm-bl-refine-standard .wm-bl-refine-hint {
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

#wm-build-launch-modal .wm-bl-refine--gen-standard .wm-bl-refine-standard .wm-bl-make-better,
#wm-build-launch-modal .wm-bl-refine--gen-standard .wm-bl-refine-standard .wm-bl-refine-hint {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#wm-build-launch-modal .wm-bl-refine-custom .wm-bl-refine-label,
#wm-build-launch-modal .wm-bl-refine-custom .wm-bl-refine-textarea,
#wm-build-launch-modal .wm-bl-refine-custom #wm-bl-make-custom {
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

#wm-build-launch-modal .wm-bl-refine--gen-custom .wm-bl-refine-custom .wm-bl-refine-label,
#wm-build-launch-modal .wm-bl-refine--gen-custom .wm-bl-refine-custom .wm-bl-refine-textarea,
#wm-build-launch-modal .wm-bl-refine--gen-custom .wm-bl-refine-custom #wm-bl-make-custom {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  #wm-build-launch-modal .wm-bl-refine-standard .wm-bl-make-better,
  #wm-build-launch-modal .wm-bl-refine-standard .wm-bl-refine-hint,
  #wm-build-launch-modal .wm-bl-refine-custom .wm-bl-refine-label,
  #wm-build-launch-modal .wm-bl-refine-custom .wm-bl-refine-textarea,
  #wm-build-launch-modal .wm-bl-refine-custom #wm-bl-make-custom {
    transition: none;
  }
}

.wm-bl-refine-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dash-muted, #9eb1cc);
}

.wm-bl-refine-custom .wm-bl-refine-block {
  width: 100%;
  max-width: 100%;
  align-self: stretch;
}

.wm-bl-refine-standard .wm-bl-refine-block {
  width: 100%;
  max-width: 100%;
  align-self: stretch;
}

.wm-bl-refine-textarea {
  width: 100%;
  min-height: 88px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--dash-text, #e7eef7);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  resize: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.wm-bl-refine-textarea:focus {
  outline: none;
  border-color: rgba(152, 202, 255, 0.55);
  background: rgba(255, 255, 255, 0.06);
}

.lab-button.wm-bl-refine-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.85;
}

.lab-button.wm-bl-refine-loading span {
  opacity: 0.7;
}

/* Shown while standard_refine or custom_refine request is in flight */
.wm-bl-refine-fetch-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  padding: 1rem 1rem 0.25rem;
  box-sizing: border-box;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
  transition:
    opacity 0.35s ease,
    max-height 0.45s cubic-bezier(0.33, 1, 0.68, 1),
    padding 0.35s ease;
}

.wm-bl-refine-fetch-loader:not([hidden]) {
  opacity: 1;
  max-height: 120px;
  pointer-events: auto;
}

.wm-bl-refine-fetch-loader-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(152, 202, 255, 0.2);
  border-top-color: rgba(152, 202, 255, 0.95);
  animation: wm-bl-refine-spin 0.75s linear infinite;
}

@keyframes wm-bl-refine-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wm-bl-refine-fetch-loader-spinner {
    animation: none;
    border-top-color: rgba(152, 202, 255, 0.85);
  }

  .wm-bl-refine-fetch-loader:not([hidden]) {
    transition: none;
  }
}

.wm-bl-refine-fetch-loader-text {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--dash-muted, #9eb1cc);
  text-align: center;
}

.wm-bl-refine-output {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  gap: 0.5rem;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(152, 202, 255, 0.22);
  background: rgba(152, 202, 255, 0.05);
}

.wm-bl-refine-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wm-bl-refine-output-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dash-muted, #9eb1cc);
}

.wm-bl-copy-btn {
  appearance: none;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--dash-text, #e7eef7);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.wm-bl-copy-btn svg {
  display: block;
}

/* Exactly one icon visible: copy by default, tick only after successful copy */
.wm-bl-copy-btn .wm-bl-copy-tick {
  display: none;
}

.wm-bl-copy-btn.wm-bl-copy-btn--success .wm-bl-copy-icon {
  display: none;
}

.wm-bl-copy-btn.wm-bl-copy-btn--success .wm-bl-copy-tick {
  display: block;
}

.wm-bl-copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
}

.wm-bl-copy-btn.wm-bl-copy-btn--success {
  background: rgba(110, 231, 183, 0.18);
  border-color: rgba(110, 231, 183, 0.45);
  color: #6ee7b7;
}

.wm-bl-refine-prompt {
  width: 100%;
  min-height: 160px;
  max-height: 280px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 12, 29, 0.45);
  color: var(--dash-text, #e7eef7);
  font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: none;
  white-space: pre-wrap;
  box-sizing: border-box;
}

.wm-bl-refine-meta {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--dash-muted, #9eb1cc);
}

@media (max-width: 768px) {
  /* Full viewport on small screens (this modal’s ID rules override global .lab-modal mobile). */
  #wm-build-launch-backdrop.wm-bl-backdrop {
    padding: 0;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .wm-bl-lab-wrap.lab-modal-animation-wrapper {
    flex: 1 1 auto;
    align-self: stretch;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    margin: 0;
    padding-inline: 0;
  }

  #wm-build-launch-modal.wm-build-launch-lab-modal.lab-modal {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
    height: 100vh;
    max-height: 100vh;
    min-height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100dvh;
    flex: 1 1 auto;
  }

  #wm-build-launch-modal .lab-border-glow {
    display: none;
  }

  .wm-build-launch-inner.lab-inner {
    border: none;
    max-height: none;
    flex: 1 1 auto;
    min-height: 0;
  }

  .wm-bl-card-inner {
    padding: 1.75rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  }
}
