/* website/css/contact-room.css
   NIIRO Contact Room を双方向チャット化するための追加スタイル + FX。
   基本トークン(--ni-brand 等)は style.css の :root を利用。support.html でのみ読み込む。
   style.css の .niiro-* を土台に、会話ビュー/コンポーザ/状態ピル/アニメーションを足す。 */

/* ルームバー: 丹色グラデをゆっくり動かして「生きている」感じに(FX・軽量) */
.niiro-room-bar {
  position: relative;
  background:
    linear-gradient(135deg, #f2925f 0%, #ee7948 30%, var(--ni-brand) 60%, var(--ni-brand-deep) 100%);
  background-size: 220% 220%;
  animation: niiroBarShift 14s ease-in-out infinite;
}
@keyframes niiroBarShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .niiro-room-bar { animation: none; }
}

.niiro-room-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 状態ピル(新着/運営が返信済み 等) */
.niiro-room-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #fffdfa;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(4px);
  white-space: nowrap;
}
.niiro-room-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fffdfa;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  animation: niiroPulse 2s ease-out infinite;
}
@keyframes niiroPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6); }
  70%  { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .niiro-room-status::before { animation: none; }
}

/* 会話ログ: 上限高さ + スクロール(長い会話でもページを圧迫しない) */
.niiro-room-log {
  max-height: 460px;
  overflow-y: auto;
  scroll-behavior: smooth;
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(237, 109, 70, 0.06), transparent 60%),
    radial-gradient(90% 50% at 0% 100%, rgba(248, 181, 0, 0.05), transparent 55%);
}

/* メッセージのふわっと出現(FX) */
.niiro-msg {
  animation: niiroBubbleIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes niiroBubbleIn {
  from { opacity: 0; transform: translateY(9px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .niiro-msg { animation: none; }
}

/* 時刻の小さな添え字 */
.niiro-time {
  color: var(--ni-muted);
  font-size: 10px;
  font-weight: 700;
  opacity: 0.75;
}
.niiro-msg.me .niiro-msg-stack { align-items: flex-end; }

/* 「入力中…」風のドット(運営返信の取得中に出す) */
.niiro-typing {
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
  background: var(--ni-surface);
  border: 1px solid rgba(233, 228, 212, 0.8);
  border-radius: 4px 18px 18px;
  width: fit-content;
}
.niiro-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ni-brand);
  opacity: 0.5;
  animation: niiroTyping 1s ease-in-out infinite;
}
.niiro-typing span:nth-child(2) { animation-delay: 0.15s; }
.niiro-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes niiroTyping {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50%      { transform: translateY(-4px); opacity: 1; }
}

/* チャット入力欄(コンポーザ) */
.niiro-composer {
  padding: 14px 18px 18px;
  background: var(--ni-surface);
  border-top: 1px solid rgba(233, 228, 212, 0.8);
}
.niiro-composer-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.niiro-composer textarea {
  flex: 1;
  min-height: 52px;
  max-height: 180px;
  padding: 13px 14px;
  color: var(--ink);
  background: var(--ni-bg);
  border: 1.5px solid var(--ni-border);
  border-radius: 14px;
  font-size: 16px;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.niiro-composer textarea:focus {
  border-color: var(--ni-brand);
  box-shadow: 0 0 0 3px rgba(237, 109, 70, 0.14);
}
.niiro-send-btn {
  flex: none;
  min-height: 52px;
  min-width: 84px;
  padding: 0 20px;
  color: #fffdfa;
  font-weight: 900;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--ni-brand) 0%, var(--ni-brand-deep) 100%);
  box-shadow: 0 8px 20px rgba(228, 94, 50, 0.28);
  transition: transform 0.12s, box-shadow 0.2s, filter 0.2s;
}
.niiro-send-btn:hover { filter: brightness(1.05); box-shadow: 0 10px 26px rgba(228, 94, 50, 0.38); }
.niiro-send-btn:active { transform: translateY(1px) scale(0.985); }
.niiro-send-btn:disabled { opacity: 0.55; cursor: default; box-shadow: none; }

/* 送信成功時のきらめき(FX・軽量) */
.niiro-send-btn.is-sent { animation: niiroSentGlow 0.6s ease-out; }
@keyframes niiroSentGlow {
  0%   { box-shadow: 0 0 0 0 rgba(248, 181, 0, 0.55); }
  100% { box-shadow: 0 0 0 16px rgba(248, 181, 0, 0); }
}

.niiro-composer-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin-top: 12px;
}
.niiro-linkbtn {
  background: none;
  border: 0;
  padding: 4px 0;
  color: var(--ni-brand-deep);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.niiro-linkbtn.muted { color: var(--ni-muted); }

/* ビュー切替(JSが hidden 属性で出し分け) */
[data-contact-form][hidden],
[data-contact-composer][hidden] { display: none; }

@media (max-width: 620px) {
  .niiro-room-log { max-height: 60vh; }
}
