/* ====================================
   1. 検索バー（ショートコード用）
   ==================================== */
.nexa-ss-container {
  max-width: 640px;
  margin: 1rem auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.widget .nexa-ss-container,
.nexa-sidebar .nexa-ss-container {
  max-width: 100%;
}

.nexa-ss-input-wrap {
  display: flex;
  align-items: center;
  background: #fff;
  border: 2px solid #4361ee;
  border-radius: 8px;
  padding: 4px;
  transition: border-color 0.2s;
}

.nexa-ss-input-wrap:focus-within {
  border-color: #2d4ad8;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

.nexa-ss-icon {
  width: 20px;
  height: 20px;
  margin-left: 12px;
  color: #888;
  flex-shrink: 0;
}

.nexa-ss-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 10px 8px;
  font-size: 15px;
  background: transparent;
  color: #1a1a2e;
}

.nexa-ss-input::placeholder { color: #aaa; }

.nexa-ss-btn {
  background: #4361ee;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.nexa-ss-btn:hover { background: #2d4ad8; }
.nexa-ss-btn:disabled { background: #aaa; cursor: not-allowed; }

.widget .nexa-ss-input-wrap { flex-wrap: wrap; }
.widget .nexa-ss-btn { width: 100%; margin-top: 4px; }

/* 検索結果 */
.nexa-ss-results { margin-top: 16px; }

.nexa-ss-result-item {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: #fff;
  border: 1px solid #e8e8ed;
  border-radius: 8px;
  margin-bottom: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.nexa-ss-result-item:hover {
  border-color: #4361ee;
  box-shadow: 0 2px 8px rgba(67, 97, 238, 0.1);
}

.nexa-ss-result-thumb {
  width: 80px;
  height: 52px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f0f0f5;
}

.nexa-ss-result-body { flex: 1; min-width: 0; }

.nexa-ss-result-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0 0 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nexa-ss-result-excerpt {
  font-size: 13px;
  color: #666;
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nexa-ss-result-meta {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  font-size: 11px;
  color: #999;
}

.nexa-ss-result-category {
  background: #f0f0f5;
  padding: 1px 8px;
  border-radius: 3px;
}

.nexa-ss-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  color: #888;
  font-size: 14px;
}

.nexa-ss-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e8e8ed;
  border-top-color: #4361ee;
  border-radius: 50%;
  animation: nexa-spin 0.6s linear infinite;
}

@keyframes nexa-spin { to { transform: rotate(360deg); } }

.nexa-ss-no-results {
  text-align: center;
  padding: 24px;
  color: #888;
  font-size: 14px;
}

.nexa-ss-error {
  text-align: center;
  padding: 16px;
  color: #e74c3c;
  font-size: 14px;
  background: #fdf2f2;
  border-radius: 6px;
}

.nexa-ss-meta {
  text-align: right;
  font-size: 11px;
  color: #bbb;
  margin-top: 8px;
}

/* ====================================
   2. フローティング チャットポップアップ
   ==================================== */

/* トグルボタン（右下固定） */
.nexa-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  height: 56px;
  background: #4361ee;
  color: #fff;
  border: none;
  border-radius: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  box-shadow: 0 4px 20px rgba(67, 97, 238, 0.4);
  z-index: 99998;
  transition: background 0.2s, transform 0.2s;
  white-space: nowrap;
}

.nexa-chat-toggle:hover {
  background: #2d4ad8;
  transform: scale(1.03);
}

.nexa-chat-toggle svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  transition: transform 0.3s;
}

.nexa-chat-toggle-label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.nexa-chat-toggle.is-open {
  width: 56px;
  padding: 0;
  border-radius: 50%;
  background: #4361ee;
  box-shadow: 0 4px 20px rgba(67, 97, 238, 0.4);
}

.nexa-chat-toggle.is-open .nexa-chat-toggle-label {
  display: none;
}

.nexa-chat-toggle.is-open svg {
  transform: rotate(90deg);
}

/* ポップアップウィンドウ */
.nexa-chat-popup {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 99999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.nexa-chat-popup.is-open {
  display: flex;
  animation: nexa-popup-in 0.25s ease-out;
}

@keyframes nexa-popup-in {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* モバイル対応 */
@media (max-width: 480px) {
  .nexa-chat-popup {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 88px;
    max-height: 70vh;
  }
  .nexa-chat-toggle {
    bottom: 16px;
    right: 16px;
  }
}

/* ヘッダー */
.nexa-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: #1a1a2e;
  color: #fff;
  flex-shrink: 0;
}

.nexa-chat-avatar {
  width: 34px;
  height: 34px;
  background: #4361ee;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

.nexa-chat-header-text { flex: 1; }
.nexa-chat-header-name { font-size: 14px; font-weight: 600; }
.nexa-chat-header-status { font-size: 11px; color: rgba(255,255,255,0.6); }

.nexa-chat-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

.nexa-chat-close:hover { color: #fff; }
.nexa-chat-close svg { width: 18px; height: 18px; }

/* メッセージエリア */
.nexa-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8f9fb;
  min-height: 200px;
  max-height: 340px;
}

.nexa-chat-messages::-webkit-scrollbar { width: 5px; }
.nexa-chat-messages::-webkit-scrollbar-thumb { background: #d0d0d5; border-radius: 3px; }

/* 吹き出し */
.nexa-chat-bubble {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  word-break: break-word;
}

.nexa-chat-bubble--bot {
  align-self: flex-start;
  background: #fff;
  color: #1a1a2e;
  border: 1px solid #e8e8ed;
  border-bottom-left-radius: 4px;
}

.nexa-chat-bubble--user {
  align-self: flex-end;
  background: #1a1a2e;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* 結果カード */
.nexa-chat-card {
  display: block;
  padding: 10px 12px;
  background: #f8f9fb;
  border: 1px solid #e8e8ed;
  border-radius: 8px;
  margin-top: 6px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.nexa-chat-card:hover {
  border-color: #4361ee;
  background: #eef1ff;
}

.nexa-chat-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0 0 2px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nexa-chat-card-cat {
  font-size: 11px;
  color: #888;
}

/* 入力エリア */
.nexa-chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #e8e8ed;
  background: #fff;
  flex-shrink: 0;
}

.nexa-chat-input {
  flex: 1;
  border: 1px solid #e2e4ea;
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13.5px;
  outline: none;
  background: #f8f9fb;
  color: #1a1a2e;
  transition: border-color 0.2s;
}

.nexa-chat-input:focus { border-color: #4361ee; background: #fff; }
.nexa-chat-input::placeholder { color: #aaa; }

.nexa-chat-send {
  width: 36px;
  height: 36px;
  border: none;
  background: #1a1a2e;
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.nexa-chat-send:hover { background: #4361ee; }
.nexa-chat-send:disabled { background: #ccc; cursor: not-allowed; }
.nexa-chat-send svg { width: 16px; height: 16px; }

/* タイピングアニメーション */
.nexa-chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e8e8ed;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.nexa-chat-typing-dot {
  width: 6px;
  height: 6px;
  background: #aaa;
  border-radius: 50%;
  animation: nexa-typing 1.2s infinite;
}

.nexa-chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.nexa-chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes nexa-typing {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

.nexa-chat-search-meta {
  font-size: 10px;
  color: #bbb;
  margin-top: 4px;
}

/* おすすめ記事 */
.nexa-chat-promo {
  background: #fffbf0;
  border-color: #f0e6cc;
}

.nexa-chat-promo-label {
  font-size: 11px;
  font-weight: 700;
  color: #b8860b;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nexa-chat-promo-label::before {
  content: "\2605";
}

.nexa-chat-card--promo {
  background: #fff;
  border-color: #f0e6cc;
}

.nexa-chat-card--promo:hover {
  border-color: #b8860b;
  background: #fffdf5;
}
