/* ==========================================================================
   チャットボット UI スタイル
   ロジック（js/chatbot.js）とは分離し、見た目のみを担当する
   ========================================================================== */

.chatbot {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 950;
}

.chatbot__toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-blue);
  color: var(--color-white);
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px rgba(61, 77, 224, 0.35);
  transition: transform var(--transition);
}

.chatbot__toggle:hover {
  transform: translateY(-3px) scale(1.03);
}

.chatbot__panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(340px, calc(100vw - 3rem));
  max-height: 480px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 20px 48px rgba(61, 77, 224, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chatbot__panel[hidden] {
  display: none;
}

.chatbot__header {
  background: var(--color-dark);
  color: var(--color-white);
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chatbot__title {
  font-weight: 700;
  font-size: 0.95rem;
}

.chatbot__close {
  font-size: 1rem;
  line-height: 1;
  padding: 0.2rem;
}

.chatbot__log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--color-bg-alt);
}

.chatbot__bubble {
  max-width: 85%;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.6;
  word-break: break-word;
}

.chatbot__bubble--bot {
  align-self: flex-start;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-bottom-left-radius: 4px;
}

.chatbot__bubble--user {
  align-self: flex-end;
  background: var(--color-blue);
  color: var(--color-white);
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

/* メアリーの「入力中…」インジケーター */
.chatbot__bubble--typing {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.75rem 0.9rem;
}

.chatbot__bubble--typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text);
  opacity: 0.4;
  animation: chatbot-typing 1.2s infinite ease-in-out;
}

.chatbot__bubble--typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.chatbot__bubble--typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes chatbot-typing {
  0%, 60%, 100% {
    opacity: 0.4;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.chatbot__input:disabled {
  opacity: 0.6;
}

.chatbot__form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-white);
}

.chatbot__input {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.85rem;
}

.chatbot__input:focus-visible {
  outline: 2px solid var(--color-blue);
  outline-offset: 1px;
}

.chatbot__send {
  flex-shrink: 0;
  white-space: nowrap;
  background: var(--color-blue);
  color: var(--color-white);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  transition: opacity var(--transition);
}

.chatbot__send:hover {
  opacity: 0.85;
}

@media (max-width: 480px) {
  .chatbot {
    right: 1rem;
    bottom: 1rem;
  }

  .chatbot__panel {
    bottom: 70px;
  }
}
