/* =========================================================
   IJEJAK PURE PHP LIVE CHAT
========================================================= */

.live-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 164px;
  z-index: 9998;
  width: min(380px, calc(100% - 32px));
  max-height: min(650px, calc(100vh - 190px));
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  transform-origin: bottom right;
  border: 1px solid #dce6f8;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(6, 27, 73, 0.3);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    visibility 0.25s ease;
}

.live-chat-panel.open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.live-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 15px 17px;
  background: linear-gradient(135deg, #061b49, #0b5cff);
  color: #ffffff;
}

.live-chat-avatar {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  background: #ffffff;
  color: #0b5cff;
  font-size: 23px;
}

.live-chat-heading {
  min-width: 0;
  flex: 1;
}

.live-chat-heading strong {
  display: block;
  font-size: 15px;
  line-height: 1.3;
}

.live-chat-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  color: #dce9ff;
  font-size: 12px;
}

.staff-chat-status-dot,
.chat-online-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
}

.staff-chat-status-dot.offline,
.chat-online-dot.offline {
  background: #94a3b8;
}

.live-chat-avatar .chat-online-dot {
  position: absolute;
  top: 0;
  right: 0;
  width: 14px;
  height: 14px;
  border: 3px solid #ffffff;
}

.live-chat-close {
  width: 37px;
  height: 37px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.live-chat-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.live-chat-start {
  max-height: calc(100vh - 285px);
  overflow-y: auto;
  padding: 20px;
}

.live-chat-welcome {
  margin-bottom: 18px;
  padding: 15px;
  border: 1px solid #dce6f8;
  border-radius: 12px;
  background: #f5f9ff;
}

.live-chat-welcome strong {
  display: block;
  margin-bottom: 5px;
  color: #061b49;
  font-size: 15px;
}

.live-chat-welcome p {
  margin: 0;
  color: #5f6f8f;
  font-size: 13px;
}

.live-chat-field {
  margin-bottom: 13px;
}

.live-chat-field label {
  display: block;
  margin-bottom: 6px;
  color: #061b49;
  font-size: 13px;
  font-weight: 800;
}

.live-chat-field input {
  width: 100%;
  border: 1px solid #dce6f8;
  border-radius: 9px;
  padding: 11px 12px;
  background: #fbfdff;
  color: #0a1d3d;
  font: inherit;
  outline: none;
}

.live-chat-field input:focus {
  border-color: #0b5cff;
  box-shadow: 0 0 0 4px rgba(11, 92, 255, 0.09);
}

.live-chat-primary-button {
  width: 100%;
  border: 0;
  border-radius: 9px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #0b5cff, #0045cc);
  color: #ffffff;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}

.live-chat-primary-button:hover {
  background: linear-gradient(135deg, #004fdf, #0038aa);
}

.live-chat-primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.live-chat-error,
.live-chat-notice {
  margin-bottom: 13px;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 13px;
}

.live-chat-error {
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

.live-chat-notice {
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.live-chat-privacy {
  margin: 12px 0 0;
  color: #718096;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.live-chat-conversation {
  display: flex;
  height: 500px;
  max-height: calc(100vh - 270px);
  flex-direction: column;
  background: #f4f7fb;
}

.live-chat-conversation[hidden] {
  display: none;
}

.live-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 15px;
}

.chat-message {
  display: flex;
  margin-bottom: 12px;
  flex-direction: column;
}

.chat-message-text {
  max-width: 83%;
  padding: 11px 13px;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-message-time {
  margin-top: 4px;
  color: #8693a8;
  font-size: 10px;
}

.chat-message-visitor {
  align-items: flex-end;
}

.chat-message-visitor .chat-message-text {
  border-radius: 15px 4px 15px 15px;
  background: linear-gradient(135deg, #0b5cff, #0045cc);
  color: #ffffff;
}

.chat-message-visitor .chat-message-time {
  text-align: right;
}

.chat-message-staff,
.chat-message-system {
  align-items: flex-start;
}

.chat-message-staff .chat-message-text {
  border: 1px solid #dce6f8;
  border-radius: 4px 15px 15px 15px;
  background: #ffffff;
  color: #334155;
}

.chat-message-system .chat-message-text {
  max-width: 94%;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 12px;
}

.live-chat-typing {
  padding: 4px 16px 9px;
  color: #64748b;
  font-size: 12px;
}

.live-chat-typing span {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 2px;
  border-radius: 50%;
  background: #64748b;
  animation: liveChatTyping 1.2s infinite ease-in-out;
}

.live-chat-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.live-chat-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes liveChatTyping {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.live-chat-message-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  padding: 12px;
  border-top: 1px solid #dce6f8;
  background: #ffffff;
}

.live-chat-message-form textarea {
  width: 100%;
  min-height: 45px;
  max-height: 110px;
  resize: vertical;
  border: 1px solid #dce6f8;
  border-radius: 9px;
  padding: 10px 11px;
  background: #fbfdff;
  font: inherit;
  outline: none;
}

.live-chat-message-form textarea:focus {
  border-color: #0b5cff;
  box-shadow: 0 0 0 4px rgba(11, 92, 255, 0.09);
}

.live-chat-message-form button {
  align-self: end;
  min-height: 45px;
  border: 0;
  border-radius: 9px;
  padding: 0 16px;
  background: #0b5cff;
  color: #ffffff;
  font-weight: 850;
  cursor: pointer;
}

.live-chat-message-form button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.live-chat-floating-button,
.live-chat-whatsapp-button {
  position: fixed;
  right: 22px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  box-shadow: 0 16px 38px rgba(6, 27, 73, 0.3);
  cursor: pointer;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease;
}

.live-chat-floating-button:hover,
.live-chat-whatsapp-button:hover {
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 22px 46px rgba(6, 27, 73, 0.36);
}

.live-chat-floating-button {
  bottom: 92px;
  background: linear-gradient(135deg, #0b5cff, #003dbb);
}

.live-chat-whatsapp-button {
  bottom: 22px;
  background: #25d366;
}

.live-chat-floating-button svg,
.live-chat-whatsapp-button svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

.live-chat-floating-button .chat-online-dot {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 15px;
  height: 15px;
  border: 3px solid #ffffff;
}

.live-chat-button-label {
  position: absolute;
  right: 70px;
  min-width: max-content;
  border-radius: 8px;
  padding: 7px 10px;
  background: #061b49;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  visibility: hidden;
  opacity: 0;
  transition: 0.2s ease;
}

.live-chat-floating-button:hover .live-chat-button-label {
  visibility: visible;
  opacity: 1;
}

@media (max-width: 600px) {
  .live-chat-panel {
    right: 12px;
    bottom: 150px;
    width: calc(100% - 24px);
    max-height: calc(100vh - 165px);
    border-radius: 15px;
  }

  .live-chat-conversation {
    height: calc(100vh - 260px);
    max-height: none;
  }

  .live-chat-floating-button,
  .live-chat-whatsapp-button {
    right: 14px;
    width: 54px;
    height: 54px;
  }

  .live-chat-floating-button {
    bottom: 82px;
  }

  .live-chat-whatsapp-button {
    bottom: 16px;
  }

  .live-chat-button-label {
    display: none;
  }
}