.chatbot-widget {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 55;
}

.chatbot-toggle {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 20px;
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.32), transparent 32%),
    linear-gradient(142deg, #13e8ff 5%, #2cc6ff 46%, #79ff56 100%);
  color: #021018;
  box-shadow:
    0 18px 34px rgba(0, 229, 255, 0.31),
    inset 0 -6px 14px rgba(0, 0, 0, 0.15);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-radius 0.22s ease;
  position: relative;
}

.chatbot-toggle:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 24px 42px rgba(0, 229, 255, 0.39),
    inset 0 -6px 14px rgba(0, 0, 0, 0.15);
  border-radius: 18px;
}

.chatbot-toggle svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
  transition: transform 0.22s ease;
}

.chatbot-toggle-ping {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #58ff9c;
  box-shadow: 0 0 0 0 rgba(88, 255, 156, 0.6);
  animation: chatbotPulse 1.6s infinite;
}

.chatbot-panel {
  position: absolute;
  right: 0;
  bottom: 80px;
  width: min(390px, calc(100vw - 24px));
  height: min(610px, 78vh);
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(81, 218, 255, 0.25);
  background:
    radial-gradient(circle at 14% 8%, rgba(19, 232, 255, 0.18), transparent 36%),
    radial-gradient(circle at 88% 6%, rgba(126, 255, 79, 0.11), transparent 34%),
    linear-gradient(180deg, rgba(8, 14, 26, 0.98) 0%, rgba(4, 10, 19, 0.98) 100%);
  backdrop-filter: blur(14px);
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
}

.chatbot-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chatbot-panel.is-opening {
  animation: chatbotPanelOpen 0.24s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.chatbot-panel.is-closing {
  animation: chatbotPanelClose 0.2s ease-in both;
  pointer-events: none;
}

.chatbot-widget.is-open .chatbot-toggle {
  border-radius: 16px;
  transform: translateY(-1px) scale(0.98);
}

.chatbot-widget.is-open .chatbot-toggle svg {
  transform: rotate(-14deg) scale(0.96);
}

.chatbot-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(81, 218, 255, 0.18);
  background: rgba(0, 0, 0, 0.22);
}

.chatbot-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chatbot-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(135deg, #16dff9, #8aff64);
  color: #041018;
  font-family: "Orbitron", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.chatbot-header h2 {
  margin: 0;
  font-size: 0.88rem;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.04em;
  color: #f2f8ff;
}

.chatbot-subtitle {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: rgba(214, 227, 255, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chatbot-online-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: #80ff95;
  background: rgba(14, 55, 31, 0.45);
  border: 1px solid rgba(117, 255, 166, 0.28);
  border-radius: 999px;
  padding: 5px 8px;
}

.chatbot-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7eff4f;
  box-shadow: 0 0 0 0 rgba(126, 255, 79, 0.55);
  animation: chatbotPulse 1.8s infinite;
}

.chatbot-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 0;
  color: rgba(235, 242, 255, 0.95);
  font-size: 1.2rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background 0.2s ease;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.chatbot-quick-actions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(81, 218, 255, 0.16);
  scrollbar-width: thin;
}

.chatbot-chip {
  border: 1px solid rgba(81, 218, 255, 0.3);
  background: rgba(8, 20, 36, 0.7);
  color: rgba(222, 235, 255, 0.92);
  border-radius: 999px;
  font-size: 0.74rem;
  padding: 7px 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.chatbot-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(126, 255, 79, 0.5);
  background: rgba(8, 26, 44, 0.86);
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chatbot-messages::-webkit-scrollbar {
  width: 8px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(81, 218, 255, 0.28);
  border-radius: 999px;
}

.chatbot-message {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.38;
  white-space: pre-wrap;
  position: relative;
}

.chatbot-message-text {
  display: block;
}

.chatbot-message-time {
  display: block;
  margin-top: 5px;
  font-size: 0.68rem;
  letter-spacing: 0.01em;
  opacity: 0.72;
}

.chatbot-message.chatbot-message-enter {
  animation-duration: 0.28s;
  animation-timing-function: cubic-bezier(0.2, 0.85, 0.25, 1);
  animation-fill-mode: both;
}

.chatbot-message.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #e8efff;
  border-top-left-radius: 8px;
}

.chatbot-message.bot .chatbot-message-time {
  color: rgba(226, 236, 255, 0.72);
  text-align: left;
}

.chatbot-message.bot.chatbot-message-enter {
  animation-name: chatbotMsgInLeft;
}

.chatbot-message.bot::after {
  content: "";
  position: absolute;
  left: -6px;
  bottom: 6px;
  width: 12px;
  height: 12px;
  border-bottom-right-radius: 10px;
  background: rgba(255, 255, 255, 0.09);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transform-origin: right bottom;
  transform: translateX(-2px) scale(1) rotate(24deg);
}

.chatbot-message.user {
  align-self: flex-end;
  background: linear-gradient(130deg, rgba(12, 195, 220, 0.3), rgba(126, 255, 79, 0.28));
  color: #f5fcff;
  border: 1px solid rgba(81, 218, 255, 0.28);
  border-top-right-radius: 8px;
}

.chatbot-message.user .chatbot-message-time {
  color: rgba(220, 255, 246, 0.86);
  text-align: right;
}

.chatbot-message.user.chatbot-message-enter {
  animation-name: chatbotMsgInRight;
}

.chatbot-message.user::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: 6px;
  width: 12px;
  height: 12px;
  border-bottom-left-radius: 10px;
  background: rgba(51, 220, 162, 0.34);
  border-right: 1px solid rgba(81, 218, 255, 0.28);
  border-bottom: 1px solid rgba(81, 218, 255, 0.28);
  transform-origin: left bottom;
  transform: translateX(2px) scale(1) rotate(-24deg);
}

.chatbot-message.system {
  align-self: center;
  max-width: 95%;
  background: rgba(255, 157, 47, 0.12);
  border: 1px solid rgba(255, 157, 47, 0.28);
  color: #ffd9a7;
}

.chatbot-message.system .chatbot-message-time {
  color: rgba(255, 225, 186, 0.82);
  text-align: center;
}

.chatbot-message.system.chatbot-message-enter {
  animation-name: chatbotMsgInCenter;
}

.chatbot-message.bot.chatbot-message-enter,
.chatbot-message.user.chatbot-message-enter {
  animation-duration: 0.28s;
  animation-timing-function: cubic-bezier(0.2, 0.85, 0.25, 1);
  animation-fill-mode: both;
}

.chatbot-message.user.chatbot-message-enter {
  animation-name: chatbotMsgInRight;
}

.chatbot-message.bot.chatbot-message-enter::after {
  animation: chatbotTailInLeft 0.24s cubic-bezier(0.15, 0.85, 0.2, 1) both;
}

.chatbot-message.user.chatbot-message-enter::after {
  animation: chatbotTailInRight 0.24s cubic-bezier(0.15, 0.85, 0.2, 1) both;
}

.chatbot-message.typing {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 72px;
  min-height: 38px;
  padding: 10px 14px;
  border-radius: 16px;
  border-top-left-radius: 6px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.chatbot-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(238, 245, 255, 0.95);
  animation: messengerTyping 1.15s infinite ease-in-out;
}

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

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

.chatbot-form {
  padding: 10px 10px 12px;
  border-top: 1px solid rgba(81, 218, 255, 0.16);
  background: rgba(0, 0, 0, 0.25);
}

.chatbot-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(139, 155, 180, 0.34);
  border-radius: 14px;
  padding: 6px 6px 6px 12px;
  background: rgba(4, 12, 22, 0.95);
}

.chatbot-form input {
  flex: 1;
  border: 0;
  color: #ebf2ff;
  background: transparent;
  outline: none;
  font-size: 0.88rem;
}

.chatbot-form button {
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #021018;
  background: linear-gradient(135deg, #00e5ff, #7eff4f);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.chatbot-form button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

@keyframes chatbotPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(126, 255, 79, 0.55);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(126, 255, 79, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(126, 255, 79, 0);
  }
}

@keyframes messengerTyping {
  0%,
  100% {
    transform: translateY(0) scale(0.92);
    opacity: 0.4;
  }
  50% {
    transform: translateY(-5px) scale(1);
    opacity: 1;
  }
}

@keyframes chatbotPanelOpen {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes chatbotPanelClose {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
  to {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
    filter: blur(3px);
  }
}

@keyframes chatbotMsgInLeft {
  from {
    opacity: 0;
    transform: translateX(-10px) translateY(4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1);
  }
}

@keyframes chatbotMsgInRight {
  from {
    opacity: 0;
    transform: translateX(10px) translateY(4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1);
  }
}

@keyframes chatbotMsgInCenter {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes chatbotTailInLeft {
  0% {
    opacity: 0;
    transform: translateX(2px) scale(0) rotate(8deg);
  }
  65% {
    opacity: 1;
    transform: translateX(-2px) scale(1.08) rotate(26deg);
  }
  100% {
    opacity: 1;
    transform: translateX(-2px) scale(1) rotate(24deg);
  }
}

@keyframes chatbotTailInRight {
  0% {
    opacity: 0;
    transform: translateX(-2px) scale(0) rotate(-8deg);
  }
  65% {
    opacity: 1;
    transform: translateX(2px) scale(1.08) rotate(-26deg);
  }
  100% {
    opacity: 1;
    transform: translateX(2px) scale(1) rotate(-24deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-panel,
  .chatbot-panel.is-opening,
  .chatbot-panel.is-closing,
  .chatbot-message.chatbot-message-enter,
  .chatbot-message.bot.chatbot-message-enter::after,
  .chatbot-message.user.chatbot-message-enter::after,
  .chatbot-dot,
  .chatbot-online-dot,
  .chatbot-toggle-ping {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 767px) {
  .chatbot-widget {
    right: 10px;
    bottom: 84px;
  }

  .chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 18px;
  }

  .chatbot-panel {
    width: min(390px, calc(100vw - 12px));
    height: min(620px, 79vh);
    border-radius: 18px;
  }

  .chatbot-online-badge {
    display: none;
  }

  .chatbot-message {
    max-width: 92%;
  }
}
