/* ============================================================
   Chatbot – Scalping Dojo
   Palette mirrors the main site:
     gradient: #d100b1 → #3f0099
     cream bg: #fffdf0
     pink border: #f1b6da
============================================================ */

.chat-overlay {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  pointer-events: none;
}

.chat-overlay.is-active {
  display: block;
}

/* ── Window ── */
.chat-window {
  pointer-events: auto;
  background: #fffdf0;
  border-radius: 18px;
  width: 380px;
  height: 560px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(63, 0, 153, 0.35), 0 4px 16px rgba(0, 0, 0, 0.25);
  animation: chatSlideUp 0.28s cubic-bezier(0.34, 1.3, 0.64, 1);
}

@keyframes chatSlideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ── Header ── */
.chat-header {
  background: linear-gradient(to right, #d100b1, #3f0099);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-header__info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  object-fit: cover;
  flex-shrink: 0;
}

.chat-header__title {
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
}

.chat-header__sub {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.7rem;
  margin-top: 2px;
}

.chat-header__close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  opacity: 0.75;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.chat-header__close:hover {
  opacity: 1;
}

/* ── Messages ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #d100b1;
  border-radius: 2px;
}

/* ── Bubbles ── */
.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  font-size: 0.875rem;
  line-height: 1.65;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-bubble--bot {
  align-self: flex-start;
  background: #fff;
  color: #111;
  border: 1.5px solid #f1b6da;
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 2px 8px rgba(209, 0, 177, 0.08);
}

.chat-bubble--user {
  align-self: flex-end;
  background: linear-gradient(135deg, #d100b1, #3f0099);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 2px 10px rgba(63, 0, 153, 0.3);
}

/* ── Typing indicator ── */
.chat-bubble--typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 13px 16px;
}

.chat-bubble--typing span {
  display: block;
  width: 7px;
  height: 7px;
  background: #d100b1;
  border-radius: 50%;
  animation: typingDot 1.1s ease-in-out infinite;
}

.chat-bubble--typing span:nth-child(2) {
  animation-delay: 0.18s;
}

.chat-bubble--typing span:nth-child(3) {
  animation-delay: 0.36s;
}

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

/* ── Input area ── */
.chat-input-area {
  padding: 10px 14px 14px;
  background: #fff;
  border-top: 1.5px solid #f1b6da;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  border: 1.5px solid #e0cce8;
  border-radius: 22px;
  padding: 9px 16px;
  font-size: 0.875rem;
  font-family: 'Noto Sans JP', sans-serif;
  resize: none;
  outline: none;
  background: #fffdf0;
  color: #111;
  max-height: 96px;
  overflow-y: auto;
  line-height: 1.5;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: #d100b1;
}

.chat-input::placeholder {
  color: #bba0bb;
}

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

.chat-send:hover {
  opacity: 0.85;
}

.chat-send:active {
  transform: scale(0.92);
}

.chat-send:disabled {
  opacity: 0.45;
  cursor: default;
}

.chat-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ── Mobile ── */
@media (max-width: 480px) {
  .chat-overlay {
    bottom: 0;
    right: 0;
    left: 0;
  }

  .chat-window {
    width: 100%;
    height: 82vh;
    border-radius: 18px 18px 0 0;
    animation: chatSlideUpMobile 0.3s cubic-bezier(0.34, 1.1, 0.64, 1);
  }

  @keyframes chatSlideUpMobile {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }
}
