/* Tombol chat modern dengan animasi gradient */
#chat-button {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: linear-gradient(
    135deg,
    rgba(219, 234, 254, 0.5),
    rgba(191, 219, 254, 0.5),
    rgba(147, 197, 253, 0.5),
    rgba(59, 130, 246, 0.6)
  );
  background-size: 300% 300%;
  backdrop-filter: blur(10px);
  color: #1e40af;
  padding: 10px 18px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(147, 197, 253, 0.4);
  z-index: 9999;
  transition: all 0.3s ease;
  border: 1px solid rgba(191, 219, 254, 0.6);
  animation: gradientMove 6s ease infinite;
}

@keyframes gradientMove {
  0% {
    background-position: 0% 50%;
  }
  25% {
    background-position: 50% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  75% {
    background-position: 50% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

#chat-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(147, 197, 253, 0.5);
  animation-play-state: paused;
}

#chat-button .text-image {
  height: 32px;
  width: auto;
  object-fit: contain;
}

#chat-button .icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

#chat-button .icon img {
  width: 100%;
  height: 100%;
  display: block;
}


/* Widget chat */
#chat-widget {
  position: fixed;
  bottom: 100px;
  right: 25px;
  width: 380px;
  height: 540px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  border: 1px solid #e5e5e5;
}

#chat-header {
  background: #ffffff;
  padding: 18px 20px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

#chat-header .header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#chat-header .header-image {
  height: 28px;
  width: auto;
  object-fit: contain;
}

#chat-body {
  flex: 1;
  padding: 20px 16px;
  overflow-y: auto;
  background: linear-gradient(to bottom, #fafafac2 0%, #ffffffbe 100%);
}

#chat-body::-webkit-scrollbar {
  width: 4px;
}

#chat-body::-webkit-scrollbar-track {
  background: transparent;
}

#chat-body::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 10px;
}

#chat-body::-webkit-scrollbar-thumb:hover {
  background: #b0b0b0;
}

.msg {
  margin: 16px 0;
  max-width: 75%;
  word-wrap: break-word;
  animation: fadeIn 0.4s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg .msg-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}

.msg .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.msg .username {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  letter-spacing: 0.3px;
}

.msg .message-bubble {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.275);
  transition: all 0.2s ease;
}

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

.user {
  margin-left: auto;
  align-items: flex-end;
}

.user .msg-header {
  flex-direction: row-reverse;
}

.user .username {
  color: #1a1a1a;
}

.user .message-bubble {
  background: linear-gradient(135deg, #00067a 0%, #2d2d2d 100%);
  color: #fff;
  border-bottom-right-radius: 6px;
  margin-right: 4px;
}

.bot {
  margin-right: auto;
  align-items: flex-start;
}

.bot .username {
  color: #3b82f6;
}

.bot .message-bubble {
  background: #ffffff;
  color: #1a1a1a;
  border-bottom-left-radius: 6px;
  border: 1px solid #f0f0f0;
  margin-left: 4px;
}

#chat-input {
  padding: 18px 20px;
  border: none;
  border-top: 1px solid #f0f0f0;
  outline: none;
  font-size: 14px;
  background: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: background 0.2s ease;
}

#chat-input::placeholder {
  color: #aaa;
}

#chat-input:focus {
  background: #fafafa;
  border-top-color: #e0e0e0;
}

/* Responsif */
@media (max-width: 480px) {
  #chat-button {
    padding: 8px 14px;
  }

  #chat-button .text-image {
    height: 28px;
  }

  #chat-button .icon {
    width: 25px;
    height: 25px;
  }

  #chat-header .header-avatar {
    width: 28px;
    height: 28px;
  }

  #chat-header .header-image {
    height: 24px;
  }

  #chat-widget {
    width: calc(100vw - 30px);
    right: 15px;
    height: 75vh;
    max-height: 600px;
  }
}
