/* Fluxos Inteligentes — camada visual do builder.
   A lógica do fluxo permanece no componente React; este arquivo trata somente apresentação. */

.flow-intelligent-editor {
  --flow-blue: 217 91% 60%;
  --flow-indigo: 239 84% 67%;
  --flow-emerald: 160 84% 39%;
  --flow-amber: 38 92% 50%;
  border-color: hsl(var(--border));
  box-shadow: 0 24px 80px rgb(0 0 0 / 0.34);
}

.flow-intelligent-editor button[aria-label^="Ajuda sobre"] {
  width: 1.5rem;
  height: 1.5rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.46);
  color: hsl(var(--muted-foreground));
}

.flow-intelligent-editor button[aria-label^="Ajuda sobre"]:hover,
.flow-intelligent-editor button[aria-label^="Ajuda sobre"]:focus-visible {
  border-color: hsl(var(--primary) / 0.55);
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
}

.flow-intelligent-editor input,
.flow-intelligent-editor textarea,
.flow-intelligent-editor button[role="combobox"] {
  max-width: 100%;
  border-color: hsl(var(--border));
}

.flow-intelligent-editor input:focus,
.flow-intelligent-editor textarea:focus,
.flow-intelligent-editor button[role="combobox"]:focus-visible {
  border-color: hsl(var(--primary) / 0.58);
}

.flow-mobile-steps {
  overflow-x: hidden;
}

@media (min-width: 1024px) {
  .flow-desktop-builder {
    grid-template-columns: 285px minmax(620px, 1fr);
    min-width: 905px;
    align-items: stretch;
  }

  .flow-block-palette {
    background:
      linear-gradient(180deg, hsl(var(--primary) / 0.045), transparent 22%),
      hsl(var(--muted) / 0.16);
  }

  .flow-block-palette > div:first-child {
    border-color: hsl(var(--border));
    background: hsl(var(--card) / 0.94);
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.08);
  }

  .flow-block-palette > div:last-child > div > div:first-child {
    border-radius: 0.55rem;
    padding: 0.42rem 0.55rem;
    border: 1px solid transparent;
  }

  .flow-block-palette > div:last-child > div:nth-child(1) > div:first-child {
    background: hsl(var(--flow-blue) / 0.10);
    border-color: hsl(var(--flow-blue) / 0.18);
  }

  .flow-block-palette > div:last-child > div:nth-child(2) > div:first-child {
    background: hsl(var(--flow-emerald) / 0.10);
    border-color: hsl(var(--flow-emerald) / 0.18);
  }

  .flow-block-palette > div:last-child > div:nth-child(3) > div:first-child {
    background: hsl(var(--flow-indigo) / 0.10);
    border-color: hsl(var(--flow-indigo) / 0.18);
  }

  .flow-block-palette > div:last-child > div:nth-child(4) > div:first-child {
    background: hsl(var(--flow-amber) / 0.10);
    border-color: hsl(var(--flow-amber) / 0.18);
  }

  .flow-block-palette button[type="button"] {
    min-height: 3.6rem;
    border-radius: 0.72rem;
    border-color: hsl(var(--border));
    background: hsl(var(--card));
    box-shadow: 0 1px 0 hsl(var(--border) / 0.35);
  }

  .flow-block-palette button[type="button"]:hover,
  .flow-block-palette button[type="button"]:focus-visible {
    transform: translateY(-1px);
    border-color: hsl(var(--flow-blue) / 0.45);
    background: hsl(var(--flow-blue) / 0.07);
    box-shadow: 0 8px 20px rgb(0 0 0 / 0.12);
  }
}

@media (max-width: 1023px) {
  .flow-intelligent-editor {
    width: calc(100vw - 0.75rem) !important;
    max-width: calc(100vw - 0.75rem) !important;
    max-height: calc(100dvh - 0.75rem - env(safe-area-inset-bottom)) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden;
  }

  .flow-intelligent-editor,
  .flow-intelligent-editor * {
    min-width: 0;
  }

  .flow-intelligent-editor > div:nth-of-type(1),
  .flow-intelligent-editor > div:nth-of-type(3) {
    flex-shrink: 0;
  }

  .flow-intelligent-editor > div:nth-of-type(2) {
    min-height: 0;
    flex: 1 1 auto;
    max-height: none !important;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .flow-intelligent-editor > div:nth-of-type(3) {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }

  .flow-intelligent-editor textarea,
  .flow-intelligent-editor input,
  .flow-intelligent-editor button[role="combobox"] {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .flow-intelligent-editor [data-radix-scroll-area-viewport] {
    max-width: 100%;
  }
}
