/* AI 自动回复 · 会话内开关（每会话一个，三态）
   2026-10-26 老板需求：在线默认不开、离线默认开，按钮可强制覆盖。
   2026-10-27 老板需求：不要在界面上浮着挡视野，改成挂进聊天输入栏的小胶囊。 */

/* 默认形态：聊天输入栏里的一颗小胶囊，跟「快捷短语」那排工具并排 */
.ai-toggle-button {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  position: static;
  width: auto;
  min-height: 32px;
  margin: 0 10.7px 0 0;
  padding: 6px 10px;
  border: 1px solid #eaeaea;
  border-radius: 18px;
  background: #fff;
  color: #666;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.16s ease, color 0.16s ease, transform 0.12s ease;
  white-space: nowrap;
}

.ai-toggle-button:active {
  transform: scale(0.96);
}

/* 兜底形态：万一找不到聊天输入栏，挂在左下角，不占右边中间 */
.ai-toggle-button.is-floating {
  position: fixed;
  left: 10px;
  bottom: 96px;
  z-index: 9990;
  margin: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
}

.ai-toggle-label {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.ai-toggle-hint {
  font-size: 9px;
  line-height: 1.2;
  opacity: 0.78;
  white-space: nowrap;
  transform: scale(0.94);
}

/* 强制开：绿 */
.ai-toggle-button.is-on {
  background: linear-gradient(160deg, #34c759 0%, #22a349 100%);
  border-color: #22a349;
  color: #fff;
}

/* 自动·离线（AI 在替你回）：浅绿 + 虚线，跟「强制」区分开 */
.ai-toggle-button.is-on.is-auto {
  background: linear-gradient(160deg, #8fe0a4 0%, #5cc47a 100%);
  border-color: #5cc47a;
  color: #0d4b22;
  outline: 2px dashed rgba(13, 75, 34, 0.28);
  outline-offset: -4px;
}

/* 强制关：灰 */
.ai-toggle-button.is-off {
  background: linear-gradient(160deg, #9a9a9a 0%, #6d6d6d 100%);
  border-color: #6d6d6d;
  color: #fff;
}

/* 自动·在线（你在，AI 让位）：浅灰 + 虚线 */
.ai-toggle-button.is-off.is-auto {
  background: linear-gradient(160deg, #e2e2e2 0%, #c8c8c8 100%);
  border-color: #c8c8c8;
  color: #4a4a4a;
  outline: 2px dashed rgba(74, 74, 74, 0.22);
  outline-offset: -4px;
}

/* 总开关没开：琥珀 */
.ai-toggle-button.is-idle {
  background: linear-gradient(160deg, #ffcf6b 0%, #f0a92a 100%);
  border-color: #f0a92a;
  color: #5a3b00;
}

.ai-toggle-button.is-busy {
  opacity: 0.62;
  pointer-events: none;
}

.ai-toggle-toast {
  position: fixed;
  left: 50%;
  bottom: 104px;
  z-index: 99999;
  transform: translateX(-50%);
  max-width: 78vw;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(38, 26, 16, 0.92);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

@media (max-width: 380px) {
  .ai-toggle-button {
    padding: 5px 8px;
    font-size: 12px;
    margin-left: 8px;
  }
  .ai-toggle-label {
    font-size: 12px;
  }
}
