/* Local import so the icon classes resolve even under styleIsolation:
 * isolated. Other components get away with this because their icons were
 * present at build time; new icon classes added later need a fresh build
 * pick-up, so we anchor the import here to be safe. */
@import "/styles/icons.wxss";

/* Fixed bottom composer — Slack/WeChat pattern.
 *
 * Region background: --color-muted (light gray in light theme, dark gray in
 * dark theme — auto-flips via the page-level token). Input background:
 * --color-bg (white / near-black). The bg contrast replaces a border.
 *
 * Padding: uniform var(--space-2) on all four sides. The default modifier
 * reserves the OS safe-area inset for plain composer usage; parents that
 * render their own bottom affordance can opt into the compact modifier.
 *
 * Single-line input that auto-grows up to max-height; Enter sends
 * (confirm-type="send"). Auto-centering of placeholder: input padding sized
 * so the content area equals line-height (26rpx × 1.4 ≈ 36rpx;
 * 64rpx − 2×14rpx padding = 36rpx). */
.composer {
  display: flex;
  flex-direction: column;
  padding: var(--space-2);
  background-color: var(--color-muted);
  box-sizing: border-box;
}

.composer--safe-area {
  padding-bottom: calc(env(safe-area-inset-bottom) + var(--space-2));
}

.composer__mention-layer {
  flex: 0 0 auto;
  margin-bottom: var(--space-2);
}

.composer__row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}

.composer__input-shell {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
}

.composer__input {
  display: block;
  flex: 1;
  width: auto;
  min-width: 0;
  min-height: 64rpx;
  max-height: 320rpx;
  padding: 14rpx 64rpx 14rpx var(--space-2);
  font-size: var(--text-base);
  color: var(--color-fg);
  background-color: var(--color-bg);
  border-radius: var(--radius-md);
  line-height: 1.4;
  box-sizing: border-box;
}

.composer__image {
  position: absolute;
  top: 50%;
  right: 12rpx;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40rpx;
  height: 40rpx;
  min-width: 40rpx;
  max-width: 40rpx;
  margin: 0;
  padding: 0;
  color: var(--color-muted-fg);
  background: transparent;
  border-radius: var(--radius-sm);
  line-height: 1;
  box-sizing: border-box;
}

.composer__image::after {
  border: 0;
}

.composer__image .icon--image {
  width: 28rpx;
  height: 28rpx;
}

.composer__image--hover {
  background: var(--color-muted);
}

.composer__image--disabled {
  opacity: 0.5;
}

.composer__image-spinner {
  width: 24rpx;
  height: 24rpx;
  border: 3rpx solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  box-sizing: border-box;
  animation: composer-image-spin 0.8s linear infinite;
}

@keyframes composer-image-spin {
  to {
    transform: rotate(360deg);
  }
}

.composer__input-placeholder {
  font-size: var(--text-base);
  color: var(--color-placeholder);
}

.composer__send {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 64rpx;
  width: 64rpx;
  height: 64rpx;
  min-width: 64rpx;
  margin: 0;
  padding: 0;
  border-radius: var(--radius-pill);
  color: var(--color-primary-fg);
  background: var(--color-primary);
  line-height: 1;
  box-sizing: border-box;
}

.composer__send::after {
  border: 0;
}

.composer__send .icon--send {
  width: 30rpx;
  height: 30rpx;
  background-color: currentColor;
}

.composer__send--hover {
  opacity: 0.8;
}

.composer__send--disabled {
  opacity: 0.35;
}
