/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 */

/* Widget iframe 全屏填充：让 .ihark-widget 的 height:100% 有明确的父级高度可继承；
 * touch-action: manipulation 禁止双击缩放，防止移动端误触缩放变形 */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  touch-action: manipulation;
}

/* ===== iHark 访客端 widget（iframe 内聊天面板） ===== */
.ihark-widget {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: #fff;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.ihark-widget__header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: #B11E2F;
  color: #fff;
}
.ihark-widget__brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.ihark-widget__logo {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255, 255, 255, .25);
  object-fit: contain;
  display: block;
}
.ihark-widget__title { font-size: 15px; font-weight: 600; line-height: 1.2; }
.ihark-widget__status { font-size: 12px; opacity: .85; }
.ihark-widget__status--online { color: #8ff0a4; opacity: 1; }
.ihark-widget__status--offline { color: #ffd9d9; opacity: .8; }
.ihark-agent-offline {
  padding: 8px 12px; font-size: 12px; color: #8a6d3b;
  background: #fff8e6; border-bottom: 1px solid #f0e2c0;
}
.ihark-agent-offline[hidden] { display: none; }
.ihark-widget__minimize {
  margin-left: auto; width: 28px; height: 28px; flex-shrink: 0;
  border: none; background: rgba(255, 255, 255, .15); color: #fff;
  border-radius: 6px; cursor: pointer; font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.ihark-widget__minimize:hover { background: rgba(255, 255, 255, .28); }

/* 消息区：flex 撑满，内部滚动；relative 以承载输入中/新消息浮层 */
.ihark-widget__body { position: relative; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.ihark-widget__messages {
  flex: 1;
  overflow-y: auto; padding: 16px;
  background: #F7F1E3; display: flex; flex-direction: column; gap: 10px;
}

/* 单条消息 */
.ihark-msg {
  display: flex; gap: 8px; max-width: 85%;
  animation: ihark-msg-in .18s ease;
}
.ihark-msg--visitor { align-self: flex-end; flex-direction: row-reverse; }
.ihark-msg--agent { align-self: flex-start; }
.ihark-msg--system { align-self: center; max-width: 90%; }
.ihark-msg__avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: #B11E2F; color: #fff; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.ihark-msg__col { display: flex; flex-direction: column; min-width: 0; }
.ihark-msg--visitor .ihark-msg__col { align-items: flex-end; }
.ihark-msg__name { font-size: 11px; color: #8a8a8a; margin: 0 4px 2px; }
.ihark-msg__meta { font-size: 10px; color: #b0a890; margin: 2px 4px 0; }
.ihark-msg__retry {
  background: none; border: none; color: #B11E2F; cursor: pointer;
  font-size: 10px; padding: 0; text-decoration: underline;
}
.ihark-bubble {
  padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.5;
  word-break: break-word; white-space: pre-wrap;
}
.ihark-msg--visitor .ihark-bubble { background: #B11E2F; color: #fff; border-bottom-right-radius: 4px; }
.ihark-msg--agent .ihark-bubble { background: #fff; color: #1a1a1a; border: 1px solid #e7ddc9; border-bottom-left-radius: 4px; }
.ihark-msg--system { align-self: center; max-width: 90%; }
.ihark-msg--system .ihark-bubble { background: transparent; color: #8a8a8a; font-size: 12px; text-align: center; }

/* 图片 / 文件消息 */
.ihark-msg__attachment { min-width: 0; }
.ihark-msg__img { max-width: 200px; max-height: 200px; border-radius: 8px; cursor: pointer; display: block; }
.ihark-msg__file {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: #fff; border: 1px solid #e7ddc9; border-radius: 8px;
  text-decoration: none; color: #1a1a1a; max-width: 220px;
}
.ihark-msg__fileicon { font-size: 18px; flex-shrink: 0; }
.ihark-msg__filename { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ihark-msg__filesize { font-size: 11px; color: #999; flex-shrink: 0; }

/* 日期分隔 */
.ihark-day {
  text-align: center; font-size: 11px; color: #a99a86;
  margin: 8px 0 4px;
}

/* 输入中指示器（浮于消息区底部） */
.ihark-typing {
  position: absolute; left: 12px; bottom: 8px; z-index: 2;
  display: flex; align-items: center; gap: 4px;
  background: #fff; border: 1px solid #eee; border-radius: 14px;
  padding: 6px 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
.ihark-typing[hidden] { display: none; }
.ihark-typing__dot {
  width: 6px; height: 6px; border-radius: 50%; background: #bbb;
  animation: ihark-bounce 1.2s infinite;
}
.ihark-typing__dot:nth-child(2) { animation-delay: .2s; }
.ihark-typing__dot:nth-child(3) { animation-delay: .4s; }
.ihark-typing__label { font-size: 11px; color: #888; margin-left: 2px; }
@keyframes ihark-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* 新消息提示气泡（未滚到底时） */
.ihark-widget__newmsg {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 8px; z-index: 2;
  border: none; background: #B11E2F; color: #fff; border-radius: 14px;
  padding: 5px 12px; font-size: 12px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.ihark-widget__newmsg[hidden] { display: none; }

/* 预填表单 */
.ihark-prechat {
  display: flex; flex-direction: column; gap: 8px; padding: 14px;
  border-top: 1px solid #eee; background: #fafafa;
}
.ihark-prechat[hidden] { display: none; }
.ihark-prechat__title { font-size: 13px; font-weight: 600; color: #333; margin-bottom: 2px; }
.ihark-prechat__input {
  border: 1px solid #ddd; border-radius: 8px; padding: 8px 10px;
  font-size: 16px; outline: none;
}
.ihark-prechat__input:focus { border-color: #B11E2F; }
.ihark-prechat__submit {
  border: none; background: #B11E2F; color: #fff; border-radius: 8px;
  padding: 9px 16px; font-size: 14px; cursor: pointer; margin-top: 2px;
}
.ihark-prechat__submit:hover { opacity: .92; }
.ihark-prechat__skip {
  border: none; background: transparent; color: #888; border-radius: 8px;
  padding: 6px 16px; font-size: 13px; cursor: pointer; text-decoration: underline;
}
.ihark-prechat__skip:hover { color: #555; }

/* 输入栏 */
.ihark-widget__composer {
  display: flex; gap: 8px; padding: 10px; align-items: flex-end;
  border-top: 1px solid #eee; background: #fff;
}
.ihark-widget__composer[hidden] { display: none; }
.ihark-widget__attach {
  border: none; background: transparent; font-size: 18px; cursor: pointer;
  padding: 6px 4px; flex-shrink: 0; line-height: 1;
}
.ihark-widget__attach:hover { opacity: .7; }
.ihark-widget__input {
  flex: 1; border: 1px solid #ddd; border-radius: 8px; padding: 8px 10px;
  font-size: 16px; outline: none; resize: none; font-family: inherit;
  line-height: 1.4; max-height: 120px; min-height: 36px;
  box-sizing: border-box;
}
.ihark-widget__input:focus { border-color: #B11E2F; }
.ihark-widget__send {
  border: none; background: #B11E2F; color: #fff; border-radius: 8px;
  padding: 0 16px; font-size: 14px; cursor: pointer; flex-shrink: 0;
  height: 36px; box-sizing: border-box;
}
.ihark-widget__send:hover { opacity: .92; }
.ihark-widget__input:disabled,
.ihark-widget__send:disabled,
.ihark-widget__attach:disabled {
  opacity: .5; cursor: not-allowed;
}
.ihark-card-input:focus { border-color: #1677ff !important; }

/* 悬浮推荐按钮：多产品搜索结果时在输入栏上方展示可点击的产品名 chips */
.ihark-suggestions {
  display: flex; gap: 8px; padding: 8px 10px; overflow-x: auto;
  border-top: 1px solid #eee; background: #fafafa;
  scrollbar-width: thin;
}
.ihark-suggestions[hidden] { display: none; }
.ihark-suggestions::-webkit-scrollbar { height: 3px; }
.ihark-suggestions::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }
.ihark-suggestion-chip {
  flex-shrink: 0; border: 1px solid #B11E2F; background: #fff; color: #B11E2F;
  border-radius: 16px; padding: 5px 14px; font-size: 13px; cursor: pointer;
  white-space: nowrap; transition: background .15s, color .15s;
  font-family: inherit;
}
.ihark-suggestion-chip:hover { background: #B11E2F; color: #fff; }
.ihark-suggestion-chip:active { transform: scale(.96); }

@keyframes ihark-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
