/* =========================================================
   ODDKIN FAQ CHATBOT STYLES
   Desktop: panel above the launcher.
   Phones: full screen.
   ========================================================= */

.okbot {
  position: fixed;
  right: 25px;
  bottom: 25px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: 'Poppins', sans-serif;
  text-align: left;
}

/* Launcher button ("Ask Oddkin anything") */
.okbot-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px 0 14px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #6c5ce7, #00d2ff);
  color: #ffffff;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
  transition: transform 0.2s;
}

.okbot-toggle:hover {
  transform: scale(1.04);
}

.okbot-spark {
  font-size: 16px;
}

.okbot-x {
  display: none;
  font-size: 16px;
}

.okbot.open .okbot-toggle {
  width: 46px;
  padding: 0;
}

.okbot.open .okbot-spark,
.okbot.open .okbot-label {
  display: none;
}

.okbot.open .okbot-x {
  display: inline;
}

/* Small bounce when the question changes */
.okbot-nudge {
  animation: okbot-nudge 0.5s ease;
}

@keyframes okbot-nudge {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.07); }
}

/* Chat window */
.okbot-window {
  position: absolute;
  right: 0;
  bottom: 60px;
  width: 360px;
  height: 520px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: #15151c;
  border: 1px solid #2a2a35;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.okbot-window[hidden] {
  display: none;
}

.okbot-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #2a2a35;
}

.okbot-avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c5ce7, #00d2ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.okbot-title strong {
  display: block;
  font-size: 15px;
  color: #ffffff;
  white-space: nowrap;
}

.okbot-title span {
  font-size: 12px;
  color: #a0a0b0;
}

.okbot-wa {
  margin-left: auto;
  background: #25d366;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}

.okbot-wa:hover {
  background: #1ebe5a;
}

.okbot-close {
  margin-left: 4px;
  background: none;
  border: none;
  color: #a0a0b0;
  font-size: 16px;
  cursor: pointer;
}

/* Messages */
.okbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.okbot-msg {
  max-width: 85%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
}

.okbot-msg.from-bot {
  align-self: flex-start;
  background: #1f1f2a;
  color: #e8e8f0;
  border-bottom-left-radius: 4px;
}

.okbot-msg.from-user {
  align-self: flex-end;
  background: #6c5ce7;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* Quick reply buttons */
.okbot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.okbot-chip {
  background: none;
  border: 1px solid #6c5ce7;
  color: #ffffff;
  padding: 7px 13px;
  border-radius: 50px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s;
}

.okbot-chip:hover {
  background: #6c5ce7;
}

/* "Typing..." dots */
.okbot-typing {
  display: flex;
  gap: 5px;
  padding: 14px 16px;
}

.okbot-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a0a0b0;
  animation: okbot-bounce 1s infinite;
}

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

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

@keyframes okbot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Typing box */
.okbot-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #2a2a35;
}

.okbot-form input {
  flex: 1;
  min-width: 0;
  background: #0b0b0f;
  border: 1px solid #2a2a35;
  border-radius: 50px;
  padding: 11px 16px;
  color: #ffffff;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
}

.okbot-form input:focus {
  outline: none;
  border-color: #6c5ce7;
}

.okbot-form button {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  background: #6c5ce7;
  color: #ffffff;
  font-size: 16px;
  cursor: pointer;
}

.okbot button:focus-visible,
.okbot a:focus-visible {
  outline: 2px solid #00d2ff;
  outline-offset: 2px;
}

/* Phones: full screen chat */
@media (max-width: 600px) {
  .okbot {
    right: 16px;
    bottom: 16px;
  }

  .okbot-toggle {
    height: 44px;
    padding: 0 16px 0 12px;
    font-size: 13px;
  }

  .okbot.open .okbot-toggle {
    display: none;
  }

  .okbot-window {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    max-height: none;
    border: none;
    border-radius: 0;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .okbot-close {
    font-size: 20px;
    padding: 6px;
  }

  /* Stop the page behind from scrolling while the chat is open */
  body.okbot-is-open {
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .okbot-toggle,
  .okbot-chip {
    transition: none;
  }

  .okbot-nudge {
    animation: none;
  }

  .okbot-typing span {
    animation: none;
    opacity: 0.7;
  }
}
