/* akong-chat-input · Web 样式 · 用 var(--ak-*) 接 @akong/tokens */

/* normal flow · 在 ChatLayout footer 里用时 flex 自然贴底
 * 单独用 (不用 ChatLayout) 时 · 用方自己包 wrapper 加 sticky / fixed
 * 不再 position: sticky 防双重 sticky 嵌套撞 layout */
.ak-chat-input {
  display: flex;
  align-items: flex-end;
  gap: var(--ak-space-2);
  padding: var(--ak-space-2) var(--ak-space-3);
  background: var(--ak-bg-elevated);
  border-top: 1px solid var(--ak-border);
  font-family: var(--ak-font-sans);
  box-sizing: border-box;
  /* iOS 软键盘弹起补偿 (JS 动态写 --ak-kb-offset) */
  transform: translateY(calc(-1 * var(--ak-kb-offset, 0px)));
  transition: transform var(--ak-duration-fast) var(--ak-ease-out);
}

.ak-chat-input__slot {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  /* slot 内子按钮 baseline 对齐 textarea 底 */
  padding-bottom: var(--ak-space-2);
}

.ak-chat-input__field {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.ak-chat-input__textarea {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  resize: none;
  border: 0;
  outline: none;
  background: var(--ak-bg-subtle);
  color: var(--ak-fg);
  font: inherit;
  font-size: var(--ak-text-base);
  line-height: 1.4;
  padding: var(--ak-space-2) var(--ak-space-3);
  border-radius: var(--ak-radius-2xl);
  box-sizing: border-box;
  /* maxRows 通过 inline style 写 max-height · 超出滚动 */
  overflow-y: auto;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--ak-duration-fast) var(--ak-ease-out);
}

.ak-chat-input__textarea::placeholder {
  color: var(--ak-fg-subtle);
}

.ak-chat-input__textarea:focus {
  background: var(--ak-bg);
  outline: 2px solid var(--ak-border-strong);
  outline-offset: -2px;
}

.ak-chat-input__textarea:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.ak-chat-input__send {
  flex-shrink: 0;
  height: 36px;
  padding: 0 var(--ak-space-4);
  border: 0;
  border-radius: var(--ak-radius-full);
  background: var(--ak-fg);
  color: var(--ak-fg-inverse);
  font-family: inherit;
  font-size: var(--ak-text-sm);
  font-weight: var(--ak-weight-medium);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  white-space: nowrap;
  transition:
    background-color var(--ak-duration-fast) var(--ak-ease-out),
    opacity var(--ak-duration-fast) var(--ak-ease-out);
  margin-bottom: 0;
}

.ak-chat-input__send:hover:not(:disabled) {
  background: var(--ak-gray-11);
}

.ak-chat-input__send:active:not(:disabled) {
  opacity: 0.7;
}

.ak-chat-input__send:disabled,
.ak-chat-input__send[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.4;
}

.ak-chat-input__send:focus-visible {
  outline: 2px solid var(--ak-border-strong);
  outline-offset: 2px;
}
