/**
 * JAMS WhatsApp-style live support chat widget
 */

.jams-support {
  --jams-wa: #25d366;
  --jams-wa-dark: #1ebe57;
  --jams-wa-header: #075e54;
  --jams-wa-header-2: #128c7e;
  --jams-wa-chat: #ece5dd;
  --jams-wa-bubble: #fff;
  --jams-wa-meta: #667781;
  --jams-wa-text: #111b21;
  --jams-sc-font: var(--gacor-font, "DM Sans", sans-serif);
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99990;
  font-family: var(--jams-sc-font);
  color: var(--jams-wa-text);
}

.jams-support__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  width: min(370px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  transform-origin: bottom right;
  transform: translate3d(0, 14px, 0) scale(0.96);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    transform 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.22s ease;
}

.jams-support.is-open .jams-support__panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
}

/* ===== WhatsApp header ===== */
.jams-support__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  background: linear-gradient(180deg, var(--jams-wa-header-2), var(--jams-wa-header));
  color: #fff;
}

.jams-support__avatar {
  position: relative;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.jams-support__avatar img {
  width: 70%;
  height: auto;
  display: block;
}

.jams-support__online {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--jams-wa);
  border: 2px solid var(--jams-wa-header);
}

.jams-support__meta {
  flex: 1 1 auto;
  min-width: 0;
}

.jams-support__name {
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.jams-support__status {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
}

.jams-support__badge,
.jams-support__badge-dot {
  display: none;
}

.jams-support__close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.jams-support__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ===== Chat body (WhatsApp wallpaper) ===== */
.jams-support__body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 12px 12px;
  min-height: 260px;
  max-height: min(52vh, 390px);
  overflow-y: auto;
  background-color: var(--jams-wa-chat);
  background-image:
    radial-gradient(rgba(0, 0, 0, 0.035) 1.1px, transparent 1.1px),
    radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 18px 18px, 28px 28px;
  background-position: 0 0, 8px 10px;
}

.jams-support__scroll {
  display: contents;
}

.jams-support__intro {
  align-self: center;
  margin: 0 0 4px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
  color: var(--jams-wa-meta);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
}

.jams-support__bubble {
  position: relative;
  align-self: flex-start;
  max-width: 88%;
  margin: 0;
  padding: 8px 10px 6px;
  background: var(--jams-wa-bubble);
  border: 0;
  border-radius: 0 10px 10px 10px;
  color: var(--jams-wa-text);
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}

.jams-support__bubble::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 8px 8px 0;
  border-color: transparent #fff transparent transparent;
  filter: drop-shadow(-1px 1px 0.5px rgba(0, 0, 0, 0.06));
}

.jams-support__bubble p {
  margin: 0 0 6px;
}

.jams-support__bubble p:last-of-type {
  margin-bottom: 0;
}

.jams-support__time {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 6px;
  color: var(--jams-wa-meta);
  font-size: 11px;
  font-weight: 400;
}

.jams-support__time-wa {
  display: none;
}

.jams-support__chips-label {
  display: none;
}

.jams-support__chips {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.jams-support__chip {
  width: auto;
  max-width: 100%;
  margin: 0;
  padding: 8px 14px !important;
  border: 1px solid rgba(7, 94, 84, 0.35) !important;
  border-radius: 999px !important;
  background: #fff !important;
  background-color: #fff !important;
  color: var(--jams-wa-header) !important;
  font: inherit !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-align: left !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  line-height: 1.3 !important;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06) !important;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.jams-support__chip-kicker {
  display: none;
}

.jams-support__chip:hover,
body.jams-gacor-header .jams-support__chip:hover {
  background: var(--jams-wa-header) !important;
  background-color: var(--jams-wa-header) !important;
  border-color: var(--jams-wa-header) !important;
  color: #fff !important;
  transform: none;
}

/* ===== Compose (WhatsApp footer) ===== */
.jams-support__compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px;
  background: #f0f2f5;
  border-top: 0;
}

.jams-support__input {
  flex: 1 1 auto;
  width: 100%;
  min-height: 42px;
  max-height: 100px;
  margin: 0;
  padding: 10px 14px;
  border: 0;
  border-radius: 22px;
  background: #fff;
  color: var(--jams-wa-text);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.4;
  resize: none;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}

.jams-support__input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.35);
}

.jams-support__send,
body.jams-gacor-header .jams-support__send,
body.jams-gacor-header .jams-support button.jams-support__send,
body.jams-gacor-header .jams-support button[type="submit"].jams-support__send {
  flex: 0 0 auto;
  align-self: flex-end;
  display: inline-flex !important;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: var(--jams-wa) !important;
  background-color: var(--jams-wa) !important;
  color: #fff !important;
  font-size: 0 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.jams-support__send span {
  display: none;
}

.jams-support__send:hover,
.jams-support__send:focus,
body.jams-gacor-header .jams-support__send:hover,
body.jams-gacor-header .jams-support button.jams-support__send:hover {
  background: var(--jams-wa-dark) !important;
  background-color: var(--jams-wa-dark) !important;
  color: #fff !important;
  border: 0 !important;
}

.jams-support__send-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  margin-left: 2px;
}

.jams-support__foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px 9px;
  background: #f0f2f5;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 11px;
  color: var(--jams-wa-meta);
}

.jams-support__foot a {
  color: var(--jams-wa-header);
  font-weight: 600;
  text-decoration: none;
}

.jams-support__foot a:hover {
  text-decoration: underline;
}

/* ===== FAB ===== */
.jams-support__launcher {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.jams-support__hint {
  max-width: 160px;
  padding: 10px 12px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
  color: var(--jams-wa-text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.jams-support__hint span {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--jams-wa-meta);
}

.jams-support.is-open .jams-support__hint {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(8px);
}

.jams-support__fab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--jams-wa);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45);
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.jams-support__fab:hover {
  background: var(--jams-wa-dark);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(37, 211, 102, 0.5);
}

.jams-support.is-open .jams-support__fab {
  background: var(--jams-wa-header);
  box-shadow: 0 8px 22px rgba(7, 94, 84, 0.4);
}

.jams-support.is-open .jams-support__fab:hover {
  background: #064c44;
}

.jams-support__fab-icon {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

.jams-support__fab-close {
  display: none;
  font-size: 30px;
  line-height: 1;
  font-weight: 400;
}

.jams-support.is-open .jams-support__fab-icon {
  display: none;
}

.jams-support.is-open .jams-support__fab-close {
  display: block;
}

.jams-support__pulse {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(37, 211, 102, 0.5);
  animation: jamsSupportPulse 2.2s ease-out infinite;
  pointer-events: none;
}

.jams-support.is-open .jams-support__pulse {
  display: none;
}

@keyframes jamsSupportPulse {
  0% {
    transform: scale(0.92);
    opacity: 0.75;
  }
  70% {
    transform: scale(1.2);
    opacity: 0;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

body.jams-gacor-header #to-top {
  bottom: 100px !important;
  right: 36px !important;
}

body.jams-gacor-header .chaty-widget,
body.jams-gacor-header .chaty-widget.right-position,
body.jams-gacor-header #chaty-widget-0,
body.jams-gacor-header .chaty.chaty-widget-0,
body.jams-gacor-header .chaty {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (max-width: 999px) {
  .jams-support {
    right: 14px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .jams-support__hint {
    display: none;
  }

  .jams-support__fab {
    width: 56px;
    height: 56px;
  }

  .jams-support__panel {
    width: min(350px, calc(100vw - 22px));
  }

  body.jams-gacor-header #to-top {
    bottom: calc(140px + env(safe-area-inset-bottom, 0px)) !important;
    right: 22px !important;
  }
}

@media (max-width: 420px) {
  .jams-support__panel {
    right: -2px;
    width: calc(100vw - 18px);
    bottom: calc(100% + 12px);
    border-radius: 10px;
  }

  .jams-support__body {
    min-height: 230px;
    max-height: min(48vh, 340px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .jams-support__panel,
  .jams-support__fab,
  .jams-support__pulse,
  .jams-support__hint {
    animation: none !important;
    transition: none !important;
  }
}
