/* ============================================================================
   public/assets/support.css — AI support widget (migration_061)
   Quora-clean: white card, #b92b27 accent, q-btn/q-input harmony.
   All selectors are prefixed tm-sp* to avoid colliding with page styles.
   ========================================================================== */

.tm-sp-bubble {
  position: fixed; right: 20px; bottom: 20px; z-index: 9998;
  width: 56px; height: 56px; border-radius: 50%;
  background: #b92b27; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(185, 43, 39, .35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.tm-sp-bubble:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(185, 43, 39, .45); }
.tm-sp-bubble svg { width: 26px; height: 26px; fill: #fff; }

.tm-sp-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 20px; height: 20px; border-radius: 10px;
  background: #fff; color: #b92b27; border: 2px solid #b92b27;
  font-size: 11px; font-weight: 700; line-height: 16px;
  text-align: center; padding: 0 4px; box-sizing: border-box;
}

.tm-sp-panel {
  position: fixed; right: 20px; bottom: 88px; z-index: 9999;
  width: 360px; max-width: calc(100vw - 24px);
  height: 520px; max-height: calc(100vh - 110px);
  background: #fff; border: 1px solid #e2e2e2; border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .14);
  display: flex; flex-direction: column; overflow: hidden;
  font-family: inherit;
}

/* The flex rule above would otherwise beat the UA's [hidden]=display:none,
   leaving the panel visible after minimise. */
.tm-sp-panel[hidden] { display: none; }

.tm-sp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid #f0f0f0; background: #fff;
}
.tm-sp-title { font-size: 14px; font-weight: 700; color: #282828; }
.tm-sp-sub { font-size: 12px; color: #8a8a8a; margin-top: 1px; }
.tm-sp-head-btns { display: flex; gap: 4px; }
.tm-sp-icon-btn {
  background: none; border: none; cursor: pointer; color: #8a8a8a;
  font-size: 16px; line-height: 1; padding: 6px; border-radius: 6px;
}
.tm-sp-icon-btn:hover { background: #f5f5f5; color: #282828; }

.tm-sp-faqs {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 10px 12px; border-bottom: 1px solid #f0f0f0; background: #fafafa;
}
.tm-sp-faqs:empty { display: none; }
.tm-sp-chip {
  background: #fff; border: 1px solid #e2e2e2; border-radius: 999px;
  font-size: 12px; color: #b92b27; cursor: pointer; padding: 5px 10px;
  transition: border-color .12s ease, background .12s ease;
}
.tm-sp-chip:hover { border-color: #b92b27; background: #fdf3f3; }

.tm-sp-thread {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px; background: #fff;
}
.tm-sp-msg { max-width: 82%; padding: 8px 12px; border-radius: 14px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.tm-sp-msg-visitor { align-self: flex-end; background: #b92b27; color: #fff; border-bottom-right-radius: 4px; }
.tm-sp-msg-ai, .tm-sp-msg-agent { align-self: flex-start; background: #f1f2f2; color: #282828; border-bottom-left-radius: 4px; }
.tm-sp-msg-system {
  align-self: center; background: none; color: #8a8a8a;
  font-size: 11.5px; font-style: italic; padding: 2px 8px; max-width: 95%; text-align: center;
}
.tm-sp-time { display: block; font-size: 10px; margin-top: 3px; opacity: .65; }
.tm-sp-tag { display: block; font-size: 10px; font-weight: 700; margin-bottom: 2px; color: #b92b27; }

.tm-sp-typing { padding: 4px 12px 8px; font-size: 12px; color: #8a8a8a; }
.tm-sp-typing .tm-sp-dots::after {
  content: ''; display: inline-block; width: 1.2em; text-align: left;
  animation: tmSpDots 1.2s steps(4, end) infinite;
}
@keyframes tmSpDots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

.tm-sp-rate {
  padding: 10px 12px; border-top: 1px solid #f0f0f0; background: #fafafa;
  text-align: center;
}
.tm-sp-rate p { margin: 0 0 6px; font-size: 13px; color: #282828; }
.tm-sp-stars { display: flex; justify-content: center; gap: 4px; }
.tm-sp-star {
  background: none; border: none; cursor: pointer; font-size: 22px;
  color: #d6d6d6; padding: 0 2px; line-height: 1;
}
.tm-sp-star:hover, .tm-sp-star.lit { color: #f6b93b; }

.tm-sp-ident { padding: 10px 12px; border-top: 1px solid #f0f0f0; background: #fafafa; }
.tm-sp-ident p { margin: 0 0 8px; font-size: 12.5px; color: #282828; }
.tm-sp-ident .q-input { margin-bottom: 6px; font-size: 13px; }
.tm-sp-ident-err { color: #b92b27; font-size: 12px; margin: 2px 0 0; display: none; }

.tm-sp-foot { border-top: 1px solid #f0f0f0; padding: 10px 12px; background: #fff; }
.tm-sp-human {
  display: block; width: 100%; margin-bottom: 8px;
  background: none; border: 1px solid #e2e2e2; border-radius: 8px;
  color: #8a8a8a; font-size: 12px; padding: 6px; cursor: pointer;
}
.tm-sp-human:hover { border-color: #b92b27; color: #b92b27; }
.tm-sp-human[disabled] { opacity: .55; cursor: default; }
.tm-sp-inputrow { display: flex; gap: 6px; }
.tm-sp-inputrow .q-input { flex: 1; font-size: 13px; }
.tm-sp-send {
  border: none; border-radius: 8px; background: #b92b27; color: #fff;
  width: 40px; cursor: pointer; font-size: 15px; flex: 0 0 auto;
}
.tm-sp-send[disabled] { opacity: .55; cursor: default; }
.tm-sp-note {
  padding: 6px 12px; font-size: 12px; color: #8a8a8a; background: #fdf8e8;
  border-top: 1px solid #f3ecd4; display: none;
}

@media (max-width: 480px) {
  .tm-sp-panel {
    right: 0; left: 0; bottom: 0; width: 100%; max-width: 100%;
    height: 78vh; max-height: 78vh; border-radius: 12px 12px 0 0;
  }
  .tm-sp-bubble { right: 14px; bottom: 14px; }
}
