/* ながみね歯科クリニック チャットボット ウィジェット */

#nagamine-chatbot-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  font-size: 14px;
}

/* チャットボタン */
#nagamine-chat-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b9ddd, #1a6fb0);
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 4px 16px rgba(59, 157, 221, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
  margin-left: auto;
}

#nagamine-chat-btn-label {
  color: white;
  font-size: 8px;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  letter-spacing: -0.3px;
  line-height: 1;
  pointer-events: none;
}

#nagamine-chat-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(59, 157, 221, 0.55);
}

#nagamine-chat-btn svg {
  width: 30px;
  height: 30px;
  fill: white;
}

/* バッジ（未読件数など用途で拡張可） */
#nagamine-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #e74c3c;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  display: none;
}

/* チャットウィンドウ */
#nagamine-chat-window {
  display: none;
  flex-direction: column;
  width: 360px;
  height: 520px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  margin-bottom: 12px;
  animation: nagamine-slideUp 0.25s ease-out;
}

#nagamine-chat-window.open {
  display: flex;
}

@keyframes nagamine-slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ヘッダー */
#nagamine-chat-header {
  background: linear-gradient(135deg, #3b9ddd, #1a6fb0);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#nagamine-chat-header-icon {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#nagamine-chat-header-icon svg {
  width: 22px;
  height: 22px;
  fill: white;
}

#nagamine-chat-header-info {
  flex: 1;
}

#nagamine-chat-header-title {
  color: white;
  font-weight: bold;
  font-size: 14px;
  line-height: 1.3;
}

#nagamine-chat-header-sub {
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  margin-top: 1px;
}

#nagamine-chat-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}

#nagamine-chat-close:hover {
  color: white;
  background: rgba(255, 255, 255, 0.2);
}

#nagamine-chat-close svg {
  width: 20px;
  height: 20px;
}

/* メッセージエリア */
#nagamine-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f5f8fc;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#nagamine-chat-messages::-webkit-scrollbar {
  width: 4px;
}
#nagamine-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
#nagamine-chat-messages::-webkit-scrollbar-thumb {
  background: #ccdde8;
  border-radius: 2px;
}

/* メッセージバブル */
.nagamine-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 88%;
}

.nagamine-msg.user {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.nagamine-msg.bot {
  align-self: flex-start;
}

.nagamine-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b9ddd, #1a6fb0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nagamine-msg-avatar svg {
  width: 17px;
  height: 17px;
  fill: white;
}

.nagamine-msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  line-height: 1.6;
  font-size: 13.5px;
  word-break: break-word;
  white-space: pre-wrap;
}

.nagamine-msg.bot .nagamine-msg-bubble {
  background: white;
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.nagamine-msg.user .nagamine-msg-bubble {
  background: linear-gradient(135deg, #3b9ddd, #1a6fb0);
  color: white;
  border-bottom-right-radius: 4px;
}

/* タイピングインジケーター */
.nagamine-typing-indicator {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 16px;
}

.nagamine-typing-indicator span {
  width: 7px;
  height: 7px;
  background: #3b9ddd;
  border-radius: 50%;
  animation: nagamine-typing 1.2s ease-in-out infinite;
}

.nagamine-typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}
.nagamine-typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes nagamine-typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* クイック返信ボタン */
#nagamine-quick-replies {
  padding: 8px 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nagamine-quick-btn {
  background: white;
  border: 1.5px solid #3b9ddd;
  color: #1a6fb0;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}

.nagamine-quick-btn:hover {
  background: #3b9ddd;
  color: white;
}

/* 入力エリア */
#nagamine-chat-input-area {
  padding: 12px;
  background: white;
  border-top: 1px solid #e8eef4;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

#nagamine-chat-input {
  flex: 1;
  border: 1.5px solid #d0dde8;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
  max-height: 100px;
  line-height: 1.5;
  background: #f8fafc;
}

#nagamine-chat-input:focus {
  border-color: #3b9ddd;
  background: white;
}

#nagamine-chat-input::placeholder {
  color: #aab8c5;
}

#nagamine-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b9ddd, #1a6fb0);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
}

#nagamine-chat-send:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

#nagamine-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

#nagamine-chat-send svg {
  width: 18px;
  height: 18px;
  fill: white;
  transform: translateX(1px);
}

/* WEB予約バー */
#nagamine-reserve-bar {
  background: #f0f8ff;
  border-top: 1px solid #d0e8f5;
  padding: 8px 12px;
  text-align: center;
  flex-shrink: 0;
}

#nagamine-reserve-btn {
  display: inline-block;
  background: linear-gradient(135deg, #27ae60, #1e8449);
  color: white;
  text-decoration: none;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: bold;
  transition: opacity 0.15s, transform 0.15s;
}

#nagamine-reserve-btn:hover {
  opacity: 0.9;
  transform: scale(1.03);
}

/* フッター */
#nagamine-chat-footer {
  text-align: center;
  padding: 6px 12px 8px;
  font-size: 10px;
  color: #a0b0be;
  background: white;
  border-top: 1px solid #f0f4f8;
}

/* スマホ対応 */
@media (max-width: 420px) {
  #nagamine-chatbot-widget {
    bottom: 12px;
    right: 12px;
  }

  #nagamine-chat-window {
    width: calc(100vw - 24px);
    height: calc(100vh - 100px);
    border-radius: 14px;
  }
}
