/* chat 캐스케이드 2/6 — 액션 버튼·퀵 커맨드·커맨드 자동완성·입력 영역·커맨드 pill·취소 버튼·
   + 메뉴·첨부/드래그앤드롭·비디오·화면 녹화, 그리고 채팅 모바일 오버라이드(.message/.bubble 포함).
   chat.css 바로 다음에 로드된다. 로드 순서가 곧 캐스케이드다. */

/* ===== Action Buttons ===== */
.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.action-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 150ms ease;
}

.action-btn:hover {
  background: var(--accent-pink-light);
  border-color: var(--accent-pink);
  color: var(--accent-pink);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Quick Commands ===== */
.quick-commands {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 16px 10px;
  flex-shrink: 0;
}

.quick-cmd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  min-height: 30px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-sidebar);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 150ms ease;
}

.quick-cmd:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.quick-cmd.cmd-sori {
  color: var(--agent-sori-name);
  border: 1px solid color-mix(in srgb, var(--agent-sori-name) 25%, transparent);
}
.quick-cmd.cmd-sori:hover {
  background: var(--agent-sori-bubble);
  color: var(--agent-sori-name);
}

.quick-cmd.cmd-seoyeon {
  color: var(--agent-seoyeon-name);
  border: 1px solid color-mix(in srgb, var(--agent-seoyeon-name) 25%, transparent);
}
.quick-cmd.cmd-seoyeon:hover {
  background: var(--agent-seoyeon-bubble);
  color: var(--agent-seoyeon-name);
}

.quick-cmd.cmd-jihyun {
  color: var(--agent-jihyun-name);
  border: 1px solid color-mix(in srgb, var(--agent-jihyun-name) 25%, transparent);
}
.quick-cmd.cmd-jihyun:hover {
  background: var(--agent-jihyun-bubble);
  color: var(--agent-jihyun-name);
}

.quick-cmd.cmd-all-appear {
  color: var(--accent-pink);
  border: 1px solid color-mix(in srgb, var(--accent-pink) 25%, transparent);
}
.quick-cmd.cmd-all-appear:hover {
  background: var(--accent-pink-light);
  color: var(--accent-pink);
}
.quick-cmd.cmd-all-appear.active {
  background: var(--accent-pink);
  color: var(--neutral-white);
  border-color: var(--accent-pink);
}
.quick-cmd.cmd-standby {
  color: var(--accent-pink);
  border: 1px solid color-mix(in srgb, var(--accent-pink) 25%, transparent);
}
.quick-cmd.cmd-standby:hover {
  background: var(--accent-pink-light);
  color: var(--accent-pink);
}

/* ===== Command Autocomplete Popup ===== */
.cmd-autocomplete {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12); /* token-exempt: one-off */
  z-index: 200;
  scrollbar-width: thin;
}

.cmd-ac-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 80ms ease;
  font-size: 13px;
}

.cmd-ac-item:hover,
.cmd-ac-item.selected {
  background: var(--accent-pink-light, rgba(255, 107, 138, 0.08)); /* token-exempt: one-off */
}

.cmd-ac-command {
  font-weight: 600;
  color: var(--accent-pink);
  white-space: nowrap;
  width: 110px;
  flex-shrink: 0;
}

.cmd-ac-alias {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  width: 90px;
  flex-shrink: 0;
}

.cmd-ac-desc {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  text-align: right;
}

/* 롱프레스 툴팁 */
.cmd-ac-tooltip {
  display: none;
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% + 4px);
  background: var(--bg-secondary, var(--neutral-900));
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: var(--radius-sm, 6px);
  box-shadow: 0 -2px 12px var(--overlay-scrim-20);
  z-index: 210;
  pointer-events: none;
  word-break: keep-all;
}
.cmd-ac-tooltip.visible {
  display: block;
}

@media (max-width: 767px) {
  .cmd-autocomplete {
    max-height: 200px;
  }
  .cmd-ac-item {
    padding: 10px 12px;
    font-size: 14px;
    position: relative;
  }
  .cmd-ac-command {
    width: 90px;
  }
  .cmd-ac-alias {
    width: 70px;
  }
  .cmd-ac-desc {
    font-size: 11px;
  }
}

/* ===== Input Area ===== */
.input-area {
  padding: 8px 16px 16px;
  flex-shrink: 0;
  position: relative;
}

/* 커맨드 pill 바 (입력창 위) */
.cmd-pill-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
}

.cmd-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-sidebar);
  color: var(--text-secondary);
}

.cmd-pill.pill-sori { background: var(--agent-sori-bubble); color: var(--agent-sori-name); }
.cmd-pill.pill-seoyeon { background: var(--agent-seoyeon-bubble); color: var(--agent-seoyeon-name); }
.cmd-pill.pill-jihyun { background: var(--agent-jihyun-bubble); color: var(--agent-jihyun-name); }

.cmd-pill-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.cmd-pill-remove:hover { color: var(--text-primary); }

/* 유저 버블 내 커맨드 pill */
.user-cmd-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  margin-right: 4px;
  vertical-align: middle;
  background: rgba(255,255,255,0.25); /* token-exempt: one-off */
  color: inherit;
}

.user-cmd-pill.pill-sori { background: var(--agent-sori-bubble); color: var(--agent-sori-name); }
.user-cmd-pill.pill-seoyeon { background: var(--agent-seoyeon-bubble); color: var(--agent-seoyeon-name); }
.user-cmd-pill.pill-jihyun { background: var(--agent-jihyun-bubble); color: var(--agent-jihyun-name); }

.input-wrapper {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  transition: border-color 200ms ease;
}

.input-wrapper:focus-within {
  border-color: var(--accent-pink);
}

#messageInput {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: 14px;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  background: transparent;
}

.send-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--accent-pink);
  color: var(--neutral-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 150ms ease;
}

.send-btn:hover { background: var(--rose-500); }

/* T4 Phase 5 (bigtionax-chat-followup-batch2, D04): 자기 실행 스트리밍 버블 옆 취소 버튼 —
   전송/취소 겸용 버튼(E09) 해제에 따른 대체. 원격(타인) 실행 버블에는 렌더되지 않는다.
   UI 개편: 버블과 같은 줄(.bubble-line flex)에 원형 × 버튼으로 배치해 발화에 시각적으로 귀속. */
.bubble-line {
  display: flex;
  /* 상단 고정: 스트리밍으로 버블이 아래로 자라도 × 버튼이 움직이지 않는다 */
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

/* 로딩 인디케이터("…생각하고 있어요") 옆 × — 취소의 주 사용처 */
.typing-bubble .stream-cancel-btn {
  margin-left: 6px;
}

.bubble-line .bubble {
  min-width: 0;
}

.stream-cancel-btn {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 150ms ease;
}

.stream-cancel-btn:hover {
  background: var(--accent-pink-light);
  border-color: var(--accent-pink);
  color: var(--accent-pink);
}

/* + 버튼 (더보기) */
.plus-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 150ms ease;
}
.plus-btn:hover { color: var(--accent-pink); border-color: var(--accent-pink); }
.plus-btn.active { color: var(--accent-pink); border-color: var(--accent-pink); transform: rotate(45deg); }

/* + 메뉴 팝업 */
.plus-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 12px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  min-width: 140px;
  box-shadow: 0 4px 12px var(--overlay-scrim-15);
  z-index: 100;
}
.plus-menu.show { display: block; }
.plus-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-family);
  cursor: pointer;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.plus-menu-item:hover { background: var(--border); }
.plus-menu-item svg { color: var(--text-muted); flex-shrink: 0; }
.plus-menu-item:disabled { opacity: 0.5; cursor: not-allowed; }
.plus-menu-item:disabled:hover { background: none; }

/* ===== 대화요약 전달 room picker (Phase 5, T6 bigtionax-chat-item-transfer) =====
   .input-wrapper(position:relative)에 마운트한다 — artifact-panel 팝오버 좌표
   (.ax-detail-sidepanel-actions{position:relative})는 plus-menu 독립 absolute 컨텍스트와
   앵커가 달라 재사용할 수 없다. */
.input-wrapper .item-transfer-picker {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% + 8px);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px var(--overlay-scrim-15);
  padding: 6px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
}

.input-wrapper .item-transfer-picker-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-family);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.input-wrapper .item-transfer-picker-item:hover {
  background: var(--border);
}

.input-wrapper .item-transfer-picker-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 첨부 미리보기 바 — 아래 8px로 입력창과 간격 확보 */
.attachment-preview {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.attachment-preview::-webkit-scrollbar { display: none; }

.attach-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-sidebar);
  border-radius: var(--radius-md);
  font-size: 12px;
  white-space: nowrap;
  max-width: 180px;
}
.attach-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
}
.attach-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.attach-name {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}
.attach-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.attach-remove:hover { color: var(--text-primary); }

/* 드래그앤드롭 오버레이 */
.drop-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-scrim-50);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.drop-overlay.active { display: flex; }
.drop-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--neutral-white);
  font-size: 18px;
  font-weight: 600;
  padding: 40px 60px;
  border: 2px dashed rgba(255,255,255,0.6); /* token-exempt: one-off */
  border-radius: 16px;
  background: var(--accent-pink-glow-20);
}
.drop-overlay-content svg { stroke: var(--accent-pink); }

/* 메시지 내 첨부파일 */
.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.msg-attach-img {
  display: block;
  max-width: 240px;
  border-radius: 12px;
  overflow: hidden;
}
.msg-attach-img img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}
/* 채팅 내 비디오 플레이어 */
.msg-video {
  display: block;
  max-width: 420px;
  width: 100%;
  border-radius: 12px;
  margin: 8px 0;
  background: #000; /* token-exempt: one-off */
}
.msg-attach-file {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-sidebar);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 150ms;
}
.msg-attach-file:hover { background: var(--border); }
.msg-attach-icon { font-size: 16px; }
.msg-attach-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Screen Recorder ===== */
.plus-menu-item.recording {
  color: var(--danger-flat-400);
}
.plus-menu-item.recording svg { color: var(--danger-flat-400); }

.record-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 12px;
  color: var(--danger-flat-400);
  font-weight: 500;
}
.record-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger-flat-400);
  animation: recordBlink 1s ease-in-out infinite;
}
@keyframes recordBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.record-timer { font-variant-numeric: tabular-nums; }

/* 녹화 완료 결과 카드 */
.recording-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px !important;
  background: var(--bg-sidebar) !important;
}
.recording-result-icon { font-size: 24px; }
.recording-result-info { flex: 1; }
.recording-result-title { font-weight: 600; font-size: 13px; }
.recording-result-meta { font-size: 11px; color: var(--text-muted); }
.recording-download-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--neutral-white);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 150ms;
}
.recording-download-btn:hover { background: var(--rose-500); }

/* Chat mobile */
@media (max-width: 767px) {
  .message {
    max-width: 85%;
  }

  .bubble {
    padding: 10px 14px;
  }

  .message-avatar {
    width: 28px;
    height: 28px;
  }

  .message.agent .message-avatar {
    width: 24px;
    height: 24px;
  }

  .agent-name {
    font-size: 11px;
  }

  .message.delegation .delegation-bubble {
    font-size: 12px;
    padding: 5px 10px;
  }

  .quick-commands {
    padding: 6px 12px 8px;
    gap: 6px;
  }

  .quick-cmd {
    font-size: 11px;
    padding: 5px 10px;
    min-height: 28px;
  }

  .input-area {
    padding: 6px 10px 6px;
  }

  .input-wrapper {
    padding: 6px 10px;
  }

  .input-wrapper .item-transfer-picker {
    left: 10px;
    right: 10px;
  }

  #messageInput {
    font-size: 16px; /* iOS 줌 방지 */
  }

  .action-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .chat-messages {
    padding: 12px;
  }
}

