/*
  Chatbot Styles - Wirausaha Polimedia
  - Warna utama: ungu #7b2cbf dan putih
  - Desain elegan, minimalis, sudut membulat, bayangan lembut
  - Animasi slide-in saat muncul
  - Responsif untuk desktop & mobile
*/

:root {
  --pmw-primary: #7b2cbf;
  --pmw-primary-dark: #6a22ac;
  --pmw-bg: #ffffff;
  --pmw-muted: #f6f6fb;
  --pmw-text: #2a2a2a;
  --pmw-border: #e8e8f0;
}

/* Floating Toggle Button */
#pmw-chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  background: var(--pmw-primary);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(123, 44, 191, 0.35);
  cursor: pointer;
  z-index: 9998;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
#pmw-chat-toggle:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 32px rgba(123, 44, 191, 0.45);
  background: var(--pmw-primary-dark);
}

/* Chat Panel Container */
#pmw-chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 360px;
  max-height: 70vh;
  background: var(--pmw-bg);
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(16, 20, 40, 0.18);
  display: none; /* hidden by default */
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  transform: translate(20px, 20px) scale(0.98);
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1), opacity 0.35s ease;
  pointer-events: none !important;
}
#pmw-chat-container.open {
  display: flex;
  pointer-events: auto !important;
  flex-direction: column;
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

/* Header */
.pmw-chat-header {
  background: linear-gradient(135deg, var(--pmw-primary), #8e4cd9);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pmw-chat-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.pmw-chat-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

/* Messages area */
.pmw-chat-messages {
  background: var(--pmw-muted);
  padding: 14px;
  overflow-y: auto;
  height: 100%;
}
.pmw-message {
  max-width: 85%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.45;
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
  animation: pmwFadeIn .2s ease;
}
.pmw-message.user {
  margin-left: auto;
  background: var(--pmw-primary);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.pmw-message.bot {
  margin-right: auto;
  background: #fff;
  color: var(--pmw-text);
  border: 1px solid var(--pmw-border);
  border-bottom-left-radius: 6px;
}

/* Typing indicator */
.pmw-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--pmw-border);
  border-radius: 12px;
  padding: 8px 10px;
}
.pmw-typing .dot {
  width: 6px;
  height: 6px;
  background: #b0a7c1;
  border-radius: 50%;
  animation: pmwBounce 1.4s infinite ease-in-out;
}
.pmw-typing .dot:nth-child(2) { animation-delay: .2s; }
.pmw-typing .dot:nth-child(3) { animation-delay: .4s; }

@keyframes pmwBounce {
  0%, 60%, 100% { transform: translateY(0) }
  30% { transform: translateY(-5px) }
}
@keyframes pmwFadeIn {
  from { opacity: 0; transform: translateY(6px) }
  to { opacity: 1; transform: translateY(0) }
}

/* Input area */
.pmw-chat-inputbar {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border-top: 1px solid var(--pmw-border);
}
#pmw-chat-input {
  flex: 1;
  border: 1px solid var(--pmw-border);
  border-radius: 20px;
  padding: 10px 12px;
  outline: none;
  font-size: 14px;
}
#pmw-chat-send {
  min-width: 44px;
  border: none;
  border-radius: 20px;
  background: var(--pmw-primary);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
  transition: background .25s ease;
}
#pmw-chat-send:hover { background: var(--pmw-primary-dark); }

/* Responsive */
@media (max-width: 480px) {
  #pmw-chat-container {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
    max-height: 70vh;
    border-radius: 14px;
  }
  #pmw-chat-toggle {
    right: 12px;
    bottom: 12px;
    width: 56px;
    height: 56px;
    font-size: 22px;
  }
}

/* === New WM Chatbot Styles (bottom-right, larger, simple) === */
.wm-chatbot {
  position: fixed;
  right: 25px;   /* ikuti permintaan jarak 25px */
  bottom: 90px;  /* panel muncul di atas tombol; tombol sendiri 25px dari tepi */
  z-index: 10000;
}
.wm-chatbot__toggle {
  position: fixed;      /* tombol mengambang tersendiri */
  right: 25px;
  bottom: 56px;         /* dinaikkan sedikit lagi */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 20px 26px;   /* diperbesar sedikit lagi */
  border-radius: 9999px;   /* bentuk kapsul */
  border: none;
  background: #8B5DFF;     /* ungu sesuai permintaan */
  color: #fff;             /* teks putih */
  font-weight: 700;
  font-size: 18px;       /* teks sedikit lebih besar lagi */
  box-shadow: 0 12px 28px rgba(139,93,255,.35); /* bayangan lembut */
  cursor: pointer;
  z-index: 10001;          /* di atas panel */
  pointer-events: auto;
}
.wm-chatbot__toggle i { font-size: 22px; line-height: 1; }
.wm-chatbot__toggle:hover { background: #7a4ae6; }
.wm-chatbot.open .wm-chatbot__toggle { display: none; } /* sembunyikan saat panel terbuka */
.wm-chatbot__badge { font-size: 15px; }
.wm-chatbot__panel {
  width: 440px;
  max-width: calc(100vw - 32px);
  height: 520px; /* tinggi normal */
  max-height: 75vh;
  background: #fff;
  border: 1px solid #ece9f3;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(16,20,40,.18);
  overflow: hidden;
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none !important;
  transition: opacity .28s ease, transform .28s ease;
  display: flex;               /* jadikan kolom */
  flex-direction: column;      /* header > content > form */
}
.wm-chatbot.open .wm-chatbot__panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto !important;
}
.wm-chatbot:not(.open) .wm-chatbot__panel {
    display: none !important;
}

.wm-chatbot__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #7b2cbf, #8e4cd9);
  color: #fff;
}
.wm-chatbot__brand { display: flex; align-items: center; gap: 10px; }
.wm-chatbot__logo {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.2);
  font-weight: 700;
}
.wm-chatbot__title { font-size: 16px; font-weight: 700; margin: 0; }
.wm-chatbot__subtitle { font-size: 12px; opacity: .9; margin-top: 2px; }
.wm-chatbot__close {
  background: transparent; border: none; color: #fff; font-size: 18px; cursor: pointer;
}
.wm-chatbot__content { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.wm-chatbot__messages {
  flex: 1 1 auto; overflow-y: auto; background: #f7f6fb; padding: 16px; min-height: 0;
}
.wm-chatbot__suggestions { padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 8px; background: #fff; border-top: 1px solid #eee9f7; max-height: 120px; overflow-y: auto; }
.wm-chip {
  padding: 8px 12px; border-radius: 16px; background: #efe7fa; color: #5a2a9d; font-size: 13px; cursor: pointer; border: 1px solid #e1d6f5;
}
.wm-chip:hover { background: #e7ddf8; }
.wm-chatbot__form {
  display: flex;
  gap: 10px;
  padding: 10px 10px;
  border-top: 1px solid #ece9f3;
  background: #fff;
  position: sticky;     /* selalu terlihat di bawah */
  bottom: 0;
  z-index: 2;
  align-items: center;
}
.wm-chatbot__input {
  flex: 1 1 auto;
  border: 1px solid #e5e1f0;
  border-radius: 22px;
  padding: 12px 14px;
  outline: none;
  font-size: 15px;
  min-width: 0; /* biar tidak overflow saat tombol fixed width */
}
.wm-chatbot__send {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #7b2cbf;
  color: #fff;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(123,44,191,.35);
}
.wm-bubble { max-width: 85%; margin-bottom: 12px; padding: 12px 14px; border-radius: 16px; font-size: 15px; line-height: 1.5; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.wm-bubble.user { margin-left: auto; background: #7b2cbf; color: #fff; border-bottom-right-radius: 6px; }
.wm-bubble.bot { margin-right: auto; background: #fff; color: #2a2a2a; border: 1px solid #ece9f3; border-bottom-left-radius: 6px; }

@media (max-width: 480px) {
  .wm-chatbot { right: 16px; bottom: 84px; }
  .wm-chatbot__panel { width: calc(100vw - 24px); height: 70vh; }
  .wm-chatbot__toggle { right: 16px; bottom: 30px; padding: 18px 22px; font-size: 17px; }
}
