/* Shared composer vocabulary for the homepage and the future agent sidebar. */
.prompt-composer {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1em;
  padding: 1.25em;
  color: var(--text-primary);
  box-shadow:
    0 1em 9em
      color-mix(
        in oklab,
        var(--power-primary-color) 16%,
        oklab(0.84 -0.1 -0.08 / 0.04)
      ),
    0 0.5em 2em rgb(0 0 0 / 4%),
    0 0.1em 0.3em rgb(0 0 0 / 3%);

  transition: box-shadow 180ms ease;

  &:focus-within,
  &.is-drag-over {
    box-shadow: 0 0 0 0.2em
      color-mix(in srgb, var(--power-primary-color) 25%, transparent);
  }

  &.is-drag-over {
    background: color-mix(
      in srgb,
      var(--power-primary-color) 10%,
      var(--home-surface, var(--background-main))
    );
  }
}

.prompt-input {
  display: block;
  width: 100%;
  min-height: 4em;
  height: 4.5em;
  max-height: 18em;
  margin: 0;
  resize: vertical;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1.1em;
  line-height: 1.65;
  outline: none;
  box-shadow: none;

  &::placeholder {
    color: var(--text-muted);
    opacity: 1;
  }
}

.prompt-actions,
.prompt-add-actions {
  display: flex;
  align-items: center;
  gap: 0.6em;
  min-width: 0;
}

.prompt-actions {
  justify-content: space-between;
}

.prompt-add-actions {
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85em;
}

.prompt-add,
.prompt-send,
.prompt-remove {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.6em;
  height: 2.6em;
  padding: 0;
  border-radius: 0.55em;

  .material-symbols-outlined {
    font-size: 1.5em;
  }
}

.prompt-add {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--text-primary) 10%, transparent);
}

.prompt-library {
  color: inherit;
  padding: 0.5em 0;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.prompt-send {
  background: var(--power-primary-color);
  color: var(--white);
  transition: opacity 150ms;

  &:disabled {
    opacity: 0.3;
    cursor: default;
  }

  &[aria-label='Creating workflow'] .material-symbols-outlined {
    animation: prompt-working 1s linear infinite;
  }
}

.prompt-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
  list-style: none;
  padding: 0;
  margin: 0;
}

.prompt-attachment {
  display: flex;
  align-items: center;
  gap: 0.65em;
  max-width: 19em;
  padding: 0.4em;
  border-radius: 0.7em;
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);

  &.has-error {
    outline: 1px solid var(--red-bad);
  }
}

.prompt-attachment-preview {
  width: 3em;
  height: 3em;
  flex-shrink: 0;
  border-radius: 0.4em;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--text-primary) 10%, transparent);

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.prompt-attachment-info {
  display: flex;
  flex-direction: column;
  gap: 0.25em;
  min-width: 0;

  small {
    color: var(--text-muted);
    font-size: 0.75em;
  }
}

.prompt-attachment-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.85em;
}

.prompt-remove {
  width: 1.8em;
  height: 1.8em;
  margin-left: auto;
  color: var(--text-muted);

  .material-symbols-outlined {
    font-size: 1em;
  }
}

.prompt-error {
  color: light-dark(#a13838, #f0a4a4);
  font-size: 0.85em;
  text-align: left;
  padding: 0.7em 0;
}

@keyframes prompt-working {
  to {
    transform: rotate(1turn);
  }
}

@media (prefers-reduced-motion: reduce) {
  .prompt-composer,
  .prompt-send {
    transition: none;
  }

  .prompt-send[aria-label='Creating workflow'] .material-symbols-outlined {
    animation: none;
  }
}
