/* ==========================================================================
   LiveChat AI Customer Service Widget - DigiLabs ID Assisten
   ========================================================================== */

.livechat-widget {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: #f1f5f9;
}

/* Floating Trigger Button */
.livechat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(168, 85, 247, 0.45);
  background: linear-gradient(135deg, rgba(88, 28, 135, 0.95) 0%, rgba(30, 27, 75, 0.95) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  box-shadow: 0 10px 25px -5px rgba(124, 58, 237, 0.5), 0 0 15px rgba(168, 85, 247, 0.25);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.livechat-trigger:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: rgba(192, 132, 252, 0.8);
  box-shadow: 0 15px 30px -5px rgba(124, 58, 237, 0.65), 0 0 22px rgba(168, 85, 247, 0.4);
}

.livechat-trigger__emblem {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.25) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1.5px solid rgba(234, 179, 8, 0.45);
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.25);
  overflow: visible;
}

.livechat-header__emblem {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.25) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1.5px solid rgba(234, 179, 8, 0.5);
  box-shadow: 0 0 14px rgba(234, 179, 8, 0.3);
  overflow: visible;
}

.livechat-owl-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.livechat-trigger:hover .livechat-owl-img {
  transform: scale(1.1);
  filter: drop-shadow(0 4px 12px rgba(234, 179, 8, 0.5));
}

.livechat-trigger__pulse {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #1e1b4b;
  box-shadow: 0 0 8px #10b981;
  animation: lc-pulse 2s infinite;
}

.livechat-trigger__content {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.livechat-trigger__title {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
}

.livechat-trigger__subtitle {
  font-size: 11px;
  color: #c084fc;
  font-weight: 500;
}

@keyframes lc-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Chat Popup Window */
.livechat-window {
  position: fixed;
  bottom: 86px;
  right: 24px;
  z-index: 1000;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 110px);
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(147, 51, 234, 0.35);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 25px rgba(147, 51, 234, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Header */
.livechat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(88, 28, 135, 0.9) 0%, rgba(30, 27, 75, 0.95) 100%);
  border-bottom: 1px solid rgba(168, 85, 247, 0.25);
}

.livechat-header__info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.livechat-header__online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #0f172a;
}

.livechat-header__text h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
}

.livechat-header__text span {
  font-size: 11.5px;
  color: #c084fc;
  display: flex;
  align-items: center;
  gap: 5px;
}

.livechat-header__close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.livechat-header__close:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

/* Chat Body */
.livechat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.livechat-body::-webkit-scrollbar {
  width: 5px;
}

.livechat-body::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 10px;
}

/* Messages */
.lc-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: lc-fade-in 0.2s ease;
}

@keyframes lc-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.lc-msg--bot {
  align-self: flex-start;
}

.lc-msg--user {
  align-self: flex-end;
}

.lc-msg__bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.lc-msg--bot .lc-msg__bubble {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.15);
  color: #f1f5f9;
  border-bottom-left-radius: 4px;
}

.lc-msg--user .lc-msg__bubble {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.lc-msg__bubble code {
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  color: #fde047;
}

.lc-msg__time {
  font-size: 10px;
  color: #64748b;
  margin-top: 4px;
  padding: 0 4px;
}

.lc-msg--user .lc-msg__time {
  text-align: right;
}

/* Action button inside message */
.lc-msg__action {
  margin-top: 8px;
}

.lc-msg__action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff !important;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
  transition: all 0.2s;
}

.lc-msg__action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(16, 185, 129, 0.4);
}

/* ==========================================================================
   Creative Quick Action Grid Menu (Bukan Chip AI Biasa)
   ========================================================================== */
.livechat-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.lc-quick-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.16);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  color: #f1f5f9;
  font-family: inherit;
  outline: none;
}

.lc-quick-card:hover {
  transform: translateY(-2px);
  background: rgba(88, 28, 135, 0.35);
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.25);
}

.lc-quick-card:active {
  transform: scale(0.98);
}

.lc-quick-card__icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.lc-quick-card:hover .lc-quick-card__icon {
  transform: scale(1.08);
}

.lc-quick-card__icon svg {
  width: 17px;
  height: 17px;
}

.lc-quick-card__icon--track {
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.lc-quick-card__icon--topup {
  background: rgba(234, 179, 8, 0.16);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.lc-quick-card__icon--pay {
  background: rgba(168, 85, 247, 0.16);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.lc-quick-card__icon--tg {
  background: rgba(14, 165, 233, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.35);
}

.lc-quick-card__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lc-quick-card__info strong {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.1px;
}

.lc-quick-card__info span {
  font-size: 10px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Quick Replies Dynamic Fallback */
.livechat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.lc-chip {
  padding: 6px 12px;
  border-radius: 99px;
  background: rgba(147, 51, 234, 0.16);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #d8b4fe;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.lc-chip:hover {
  background: rgba(147, 51, 234, 0.35);
  border-color: rgba(168, 85, 247, 0.6);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Typing Indicator */
.lc-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.lc-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a855f7;
  animation: lc-bounce 1.4s infinite ease-in-out both;
}

.lc-typing span:nth-child(1) { animation-delay: -0.32s; }
.lc-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes lc-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Footer / Input Bar */
.livechat-footer {
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.98);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.livechat-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 4px 6px 4px 12px;
  transition: border-color 0.2s;
}

.livechat-input-form:focus-within {
  border-color: #a855f7;
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);
}

.livechat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
}

.livechat-input::placeholder {
  color: #64748b;
}

.livechat-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #7c3aed;
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.livechat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #475569;
}

.livechat-send-btn:not(:disabled):hover {
  background: #6d28d9;
  transform: scale(1.05);
}

.livechat-send-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.livechat-footer__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  color: #64748b;
  margin-top: 6px;
  padding: 0 4px;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .livechat-trigger {
    bottom: 76px; /* Letakkan di atas .bottom-nav */
    right: 14px;
    padding: 6px 12px 6px 6px;
    gap: 8px;
  }

  .livechat-trigger__subtitle {
    display: none;
  }

  .livechat-window {
    bottom: 72px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    height: calc(100vh - 90px);
    max-height: 520px;
  }

  .livechat-quick-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
