/* chatbot.html 専用スタイル
   元コード: web/chatbot.html:19-104（分割時点の HEAD 基準・2026-07-19） */

/* ===== ページ全体: ビューポートにきっちり収めるフレックスレイアウト ===== */
body[data-page="chatbot"] { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; margin: 0; }
body[data-page="chatbot"] > #header-mount { flex-shrink: 0; }
body[data-page="chatbot"] > .container.chat-container { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 10px 20px 12px !important; overflow: hidden; max-width: 1280px; width: 100%; box-sizing: border-box; margin: 0 auto; }
.chat-page-header { flex-shrink: 0; margin-bottom: 8px; }
.chat-page-header h1 { margin: 0; font-size: 18px; line-height: 1.3; }
.chat-page-header .muted.small { font-size: 11px; }
#mode-banner { flex-shrink: 0; }
#mode-banner .mode-banner { padding: 6px 12px; font-size: 11px; line-height: 1.5; margin-bottom: 8px; }

.chat-layout { display: grid; grid-template-columns: 1fr 340px; gap: 14px; flex: 1; min-height: 0; }
@media (max-width: 900px) {
  body[data-page="chatbot"] { height: auto; overflow: auto; }
  .chat-layout { grid-template-columns: 1fr; }
  .faq-panel { max-height: 50vh; }
}
.chat-pane, .faq-panel { display: flex; flex-direction: column; min-height: 0; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; background: var(--bg); border-radius: 10px; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.55; word-wrap: break-word; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot  { align-self: flex-start; background: var(--bg-2, #181c2e); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.system { align-self: center; font-size: 11px; color: var(--text-2); padding: 4px 12px; background: transparent; border: 1px dashed var(--border); border-radius: 999px; }
.msg .msg-meta { font-size: 10px; color: var(--text-3); margin-top: 4px; opacity: 0.7; }
.msg .msg-source { display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 4px; margin-bottom: 4px; font-weight: 600; }
.src-faq    { background: var(--gold); color: #000; }
.src-isoai  { background: var(--accent); color: #fff; }
.src-mixed  { background: linear-gradient(90deg, var(--gold), var(--accent)); color: #fff; }
.chat-input-bar { display: flex; gap: 8px; margin-top: 10px; }
.chat-input-wrap { position: relative; flex: 1; }
.chat-input-wrap textarea { width: 100%; padding: 10px 38px 10px 12px; font-size: 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); resize: none; min-height: 44px; max-height: 140px; box-sizing: border-box; }
.chat-input-clear { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--bg-2, #181c2e); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; display: none; align-items: center; justify-content: center; padding: 0; font-size: 14px; line-height: 1; z-index: 2; }
.chat-input-clear:hover { color: var(--text); border-color: var(--ng); }
.chat-input-clear.show { display: flex; }
.chat-input-hint { position: absolute; bottom: 6px; right: 12px; font-size: 10px; color: var(--text-3); pointer-events: none; opacity: 0.7; }
.chat-input-bar > button { padding: 0 22px; font-weight: 600; min-width: 90px; }
/* メッセージ削除 × */
.msg { position: relative; }
.msg-delete { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: var(--bg-3, #15192a); border: 1px solid var(--border); color: var(--text-2); font-size: 12px; cursor: pointer; opacity: 0; transition: opacity 0.15s; padding: 0; line-height: 1; display: grid; place-items: center; z-index: 3; }
.msg:hover .msg-delete { opacity: 1; }
.msg-delete:hover { color: var(--ng); border-color: var(--ng); }
.msg.system .msg-delete { display: none; }
/* モーダル × */
.modal { position: relative; }
.modal-close-x { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; background: var(--bg-2, #181c2e); border: 1px solid var(--border); color: var(--text-2); font-size: 18px; cursor: pointer; padding: 0; line-height: 1; display: grid; place-items: center; }
.modal-close-x:hover { background: var(--bg-3, #15192a); color: var(--text); border-color: var(--ng); }
/* API Key ヘルプ */
.api-key-help { background: rgba(91,140,255,0.06); border: 1px solid var(--accent); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; font-size: 12px; line-height: 1.7; }
.api-key-help ol { margin: 6px 0 0 20px; padding: 0; }
.api-key-help code { font-size: 11px; }
.typing { display: inline-flex; gap: 4px; padding: 10px 14px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-2); animation: typing 1.4s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,60%,100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.faq-panel { background: var(--bg); border-radius: 10px; border: 1px solid var(--border); padding: 12px; overflow-y: auto; }
.faq-search { width: 100%; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-2, #181c2e); color: var(--text); }
.faq-item { padding: 10px 12px; border-radius: 8px; background: var(--bg-2, #181c2e); border: 1px solid var(--border); margin-bottom: 8px; cursor: pointer; transition: border-color 0.15s; }
.faq-item:hover { border-color: var(--accent); }
.faq-q { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.faq-a { font-size: 12px; color: var(--text-2); display: none; line-height: 1.6; }
.faq-item.open .faq-a { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.faq-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.faq-tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; background: var(--bg); color: var(--text-2); }
.faq-actions { display: flex; gap: 4px; margin-top: 6px; }
.faq-actions button { padding: 3px 8px; font-size: 11px; }

.api-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; padding: 4px 10px; border-radius: 999px; }
.api-status.connected { background: rgba(74,222,128,0.12); color: var(--ok, #4ade80); border: 1px solid var(--ok, #4ade80); }
.api-status.disconnected { background: rgba(248,113,113,0.12); color: var(--ng, #f87171); border: 1px solid var(--ng, #f87171); }
.api-status .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.mode-banner { padding: 8px 12px; border-radius: 6px; font-size: 12px; }
.mode-banner.faq-only { background: rgba(240,183,58,0.08); border: 1px solid var(--gold); color: var(--text-2); }
.mode-banner.full { background: rgba(91,140,255,0.08); border: 1px solid var(--accent); color: var(--text-2); }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: none; place-items: center; z-index: 1000; }
.modal-bg.open { display: grid; }
.modal { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 22px; max-width: 540px; width: 92%; max-height: 88vh; overflow-y: auto; }
.modal h3 { margin: 0 0 12px; }
.modal label { display: block; font-size: 12px; color: var(--text-2); margin: 10px 0 4px; }
.modal input, .modal textarea, .modal select { width: 100%; padding: 8px 12px; font-size: 13px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-2, #181c2e); color: var(--text); }
.modal textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
