/* ==================== CHATBOT WIDGET ==================== */

.chatbot-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #06b6d4, #0e7490);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.35), 0 2px 6px rgba(0,0,0,0.1);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: chatbot-pulse 3s ease-in-out infinite;
}

.chatbot-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 28px rgba(6, 182, 212, 0.45), 0 4px 8px rgba(0,0,0,0.12);
}

.chatbot-fab:active {
  transform: scale(0.95);
}

@keyframes chatbot-pulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(6, 182, 212, 0.35); }
  50% { box-shadow: 0 6px 32px rgba(6, 182, 212, 0.55); }
}

.chatbot-fab .badge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  background: #10b981;
  border-radius: 50%;
  border: 2.5px solid white;
  animation: badge-ping 2s ease-in-out infinite;
}

@keyframes badge-ping {
  0%, 80%, 100% { transform: scale(1); opacity: 1; }
  40% { transform: scale(1.15); opacity: 0.8; }
}

/* ==================== CHAT WINDOW ==================== */

.chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 380px;
  max-height: 520px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.12),
    0 8px 20px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: chatbot-slide-up 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-window.open {
  display: flex;
}

@keyframes chatbot-slide-up {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==================== HEADER ==================== */

.chatbot-header {
  background: linear-gradient(135deg, #06b6d4 0%, #0e7490 100%);
  color: white;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

/* Decorative circles */
.chatbot-header::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -20px;
  width: 100px;
  height: 100px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}

.chatbot-header::after {
  content: '';
  position: absolute;
  bottom: -40px;
  left: -10px;
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}

.chatbot-header-avatar {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.18);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.chatbot-header-info {
  position: relative;
  z-index: 1;
}

.chatbot-header-info h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.chatbot-header-info span {
  font-size: 12px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.chatbot-header-info .online-dot {
  width: 7px;
  height: 7px;
  background: #34d399;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.5);
}

.chatbot-close {
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  position: relative;
  z-index: 1;
}

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

/* ==================== MESSAGES AREA ==================== */

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  max-height: 340px;
  scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

/* ==================== MESSAGE BUBBLES ==================== */

.chat-msg {
  max-width: 82%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  animation: msg-appear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  word-wrap: break-word;
}

@keyframes msg-appear {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot {
  align-self: flex-start;
  background: white;
  color: #334155;
  border: 1px solid #e8ecf1;
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: white;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.2);
}

.chat-msg.bot a {
  color: #0891b2;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dashed rgba(8, 145, 178, 0.3);
  transition: border-color 0.2s;
}

.chat-msg.bot a:hover {
  border-bottom-color: #0891b2;
}

.chat-msg.bot b {
  color: #0f172a;
}

/* ==================== QUICK REPLIES ==================== */

.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  animation: msg-appear 0.3s ease;
}

.chat-quick-replies button {
  background: white;
  color: #0891b2;
  border: 1px solid #d1e9ef;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.chat-quick-replies button:hover {
  background: #06b6d4;
  color: white;
  border-color: #06b6d4;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(6, 182, 212, 0.2);
}

/* ==================== TYPING INDICATOR ==================== */

.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  align-self: flex-start;
  background: white;
  border: 1px solid #e8ecf1;
  border-radius: 16px;
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ==================== INPUT AREA ==================== */

.chatbot-input {
  display: flex;
  padding: 14px 14px 16px;
  gap: 10px;
  border-top: 1px solid #f1f5f9;
  background: white;
  align-items: center;
}

.chatbot-input input {
  flex: 1;
  padding: 11px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 24px;
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
  transition: all 0.2s;
  background: #f8fafc;
  color: #0f172a;
}

.chatbot-input input::placeholder {
  color: #94a3b8;
}

.chatbot-input input:focus {
  border-color: #06b6d4;
  background: white;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.chatbot-input button {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.25);
}

.chatbot-input button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.35);
}

.chatbot-input button:active {
  transform: scale(0.95);
}

/* ==================== PRODUCT DETAIL MODAL ==================== */

.product-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 1001;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.product-detail-overlay.active {
  display: flex;
}

.product-detail-modal {
  position: relative;
  background: white;
  border-radius: 24px;
  max-width: 850px;
  width: 100%;
  max-height: 90vh;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
  animation: modal-zoom 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  overflow: hidden;
}

.pd-close-x {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  color: #64748b;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.pd-close-x:hover {
  background: #e11d48;
  color: white;
  transform: rotate(90deg);
}

@keyframes modal-zoom {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.product-detail-modal .pd-image-wrapper {
  flex: 1 1 50%;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.product-detail-modal .pd-image {
  width: 100%;
  height: 100%;
  max-height: 400px;
  object-fit: contain;
}

.product-detail-modal .pd-body {
  flex: 1 1 50%;
  padding: 40px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.product-detail-modal .pd-body h2 {
  margin: 0 0 16px;
  font-size: 26px;
  color: #0f172a;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.product-detail-modal .pd-body p {
  color: #475569;
  font-size: 15.5px;
  line-height: 1.7;
  margin: 0 0 32px;
}

.product-detail-modal .pd-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.product-detail-modal .pd-actions a,
.product-detail-modal .pd-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.pd-btn-wa, .pd-btn-chat {
  flex: 1 1 0; /* Membuat lebar tombol seimbang dan tidak melebar tak wajar */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  color: white !important;
  transition: all 0.3s ease;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  white-space: nowrap; /* Mencegah teks terpotong ke bawah */
}

.pd-btn-wa {
  background: #25d366; /* Warna khas WhatsApp */
}

.pd-btn-wa:hover {
  background: #20bd5a;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.35);
}

.pd-btn-chat {
  background: #2563eb; /* Warna utama website (biru) */
}

.pd-btn-chat:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .product-detail-modal {
    flex-direction: column;
    max-height: 85vh;
    overflow-y: auto;
  }
  
  .product-detail-modal .pd-image-wrapper {
    flex: none;
    padding: 16px;
  }
  
  .product-detail-modal .pd-image {
    max-height: 200px;
  }
  
  .product-detail-modal .pd-body {
    flex: none;
    padding: 24px;
    overflow-y: visible;
  }

  .product-detail-modal .pd-actions {
    flex-direction: column;
    gap: 10px;
  }

  .product-detail-modal .pd-actions a,
  .product-detail-modal .pd-actions button {
    justify-content: center;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .chatbot-fab {
    bottom: 20px;
    right: 16px;
    width: 54px;
    height: 54px;
  }

  .chatbot-window {
    right: 10px;
    left: 10px;
    bottom: 86px;
    width: auto;
    max-height: 70vh;
    border-radius: 16px;
  }

  .chatbot-messages {
    max-height: 280px;
  }
}
