:root {
  --chatbot-bg: #ffffff;
  --chatbot-ink: #07111f;
  --chatbot-muted: #587083;
  --chatbot-border: #d8e7ef;
  --chatbot-primary: #0077d9;
  --chatbot-cyan: #00aeea;
  --chatbot-teal: #1aa7a7;
  --chatbot-shadow: 0 22px 60px rgba(7, 17, 31, 0.22);
}

@keyframes chatbotPulse {
  0%,
  100% {
    box-shadow: var(--chatbot-shadow), 0 0 0 0 rgba(0, 174, 234, 0);
    transform: translateY(0);
  }

  45% {
    box-shadow: var(--chatbot-shadow), 0 0 0 10px rgba(0, 174, 234, 0.12);
    transform: translateY(-1px);
  }

  70% {
    box-shadow: var(--chatbot-shadow), 0 0 0 16px rgba(0, 174, 234, 0);
    transform: translateY(0);
  }
}

@keyframes chatbotPanelIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes chatbotMessageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chatbotTypingDot {
  0%,
  80%,
  100% {
    opacity: 0.32;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.chatbot-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 80;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--chatbot-ink);
}

.chatbot-toggle {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-cyan) 62%, var(--chatbot-teal));
  box-shadow: var(--chatbot-shadow);
  cursor: pointer;
  animation: chatbotPulse 4.8s ease-in-out infinite;
}

.chatbot-toggle svg {
  width: 28px;
  height: 28px;
}

.chatbot-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(360px, calc(100vw - 2rem));
  max-height: min(680px, calc(100vh - 7rem));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(216, 231, 239, 0.95);
  border-radius: 8px;
  background: var(--chatbot-bg);
  box-shadow: var(--chatbot-shadow);
  animation: chatbotPanelIn 180ms ease-out both;
  transform-origin: right bottom;
}

.chatbot-panel[hidden] {
  display: none;
}

.chatbot-header {
  display: grid;
  gap: 0.22rem;
  padding: 0.72rem 0.8rem 0.78rem;
  color: #fff;
  background: linear-gradient(135deg, #07111f, #084b9a);
}

.chatbot-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.chatbot-header-top strong {
  font-size: 1rem;
  line-height: 1.2;
}

.chatbot-subtitle {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.8rem;
}

.chatbot-header-notice {
  margin: 0.24rem 0 0;
  padding: 0.3rem 0.42rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.72rem;
  line-height: 1.3;
}

.chatbot-close {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}

.chatbot-close::before,
.chatbot-close::after {
  position: absolute;
  width: 13px;
  height: 2px;
  margin-left: -6px;
  margin-top: -1px;
  border-radius: 99px;
  background: currentColor;
  content: "";
}

.chatbot-close::before {
  transform: rotate(45deg);
}

.chatbot-close::after {
  transform: rotate(-45deg);
}

.chatbot-messages {
  min-height: 260px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow-y: auto;
  background:
    radial-gradient(circle at 12% 8%, rgba(0, 174, 234, 0.12), transparent 12rem),
    linear-gradient(180deg, #f7fbff, #ffffff);
}

.chatbot-message {
  max-width: 88%;
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.35;
  animation: chatbotMessageIn 160ms ease-out both;
}

.chatbot-message.bot {
  align-self: flex-start;
  border: 1px solid var(--chatbot-border);
  background: rgba(255, 255, 255, 0.9);
}

.chatbot-message.user {
  align-self: flex-end;
  color: #fff;
  background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-cyan));
}

.chatbot-message.status,
.chatbot-message.error,
.chatbot-message.notice {
  align-self: center;
  width: 100%;
  max-width: 100%;
  text-align: center;
  color: var(--chatbot-muted);
  background: transparent;
}

.chatbot-message.error {
  color: #a32222;
}

.chatbot-message.notice {
  padding: 0.48rem 0.62rem;
  border: 1px solid rgba(216, 231, 239, 0.72);
  color: #587083;
  background: rgba(247, 251, 255, 0.72);
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: left;
}

.chatbot-typing {
  min-height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
}

.chatbot-typing-dot {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-cyan));
  animation: chatbotTypingDot 1.05s ease-in-out infinite;
}

.chatbot-typing-dot:nth-child(2) {
  animation-delay: 0.14s;
}

.chatbot-typing-dot:nth-child(3) {
  animation-delay: 0.28s;
}

.chatbot-recommendation {
  display: grid;
  gap: 0.5rem;
}

.chatbot-recommendation ul {
  margin: 0;
  padding-left: 1.1rem;
}

.chatbot-recommendation strong {
  color: #084b9a;
}

.chatbot-input-area {
  display: grid;
  gap: 0.55rem;
  padding: 0.7rem;
  border-top: 1px solid var(--chatbot-border);
  background: #fff;
}

.chatbot-input,
.chatbot-select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #bdd3e2;
  border-radius: 8px;
  padding: 0.72rem 0.82rem;
  color: var(--chatbot-ink);
  background: #f7fbff;
  font: inherit;
  font-size: 0.9rem;
}

.chatbot-actions {
  display: flex;
  gap: 0.45rem;
}

.chatbot-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.chatbot-button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-cyan) 62%, var(--chatbot-teal));
}

.chatbot-button.secondary {
  border-color: var(--chatbot-border);
  background: #fff;
  color: var(--chatbot-ink);
}

.chatbot-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

@media (max-width: 620px) {
  .chatbot-widget {
    right: 0.8rem;
    bottom: 0.8rem;
  }

  .chatbot-panel {
    right: -0.15rem;
    bottom: 74px;
    width: calc(100vw - 1.3rem);
    max-height: calc(100vh - 6rem);
  }

  .chatbot-toggle {
    width: 58px;
    height: 58px;
  }

  .chatbot-message {
    padding: 0.62rem 0.72rem;
    font-size: 0.85rem;
    line-height: 1.35;
  }

  .chatbot-message.notice {
    font-size: 0.76rem;
  }

  .chatbot-header-notice {
    padding: 0.28rem 0.38rem;
    font-size: 0.72rem;
  }

  .chatbot-header {
    padding: 0.68rem 0.74rem 0.72rem;
  }

  .chatbot-close {
    width: 32px;
    height: 32px;
  }

  .chatbot-input,
  .chatbot-select,
  .chatbot-button {
    font-size: 0.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-toggle,
  .chatbot-panel,
  .chatbot-message,
  .chatbot-typing-dot {
    animation: none;
  }
}
