/**
 * Maeru Digital Assistant - Chatbot Styles
 * 
 * Ubah variabel CSS di bawah untuk mengubah tema warna.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --mda-primary: #0d9488;
  --mda-primary-dark: #0f766e;
  --mda-primary-light: #14b8a6;
  --mda-primary-bg: #f0fdfa;
  --mda-user-bubble: linear-gradient(135deg, #0d9488, #14b8a6);
  --mda-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  --mda-radius: 20px;
  --mda-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===== FLOATING BUTTON ===== */
.mda-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--mda-user-bubble);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(13, 148, 136, 0.4);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: mda-pulse 2s ease-out infinite;
  padding: 0;
}

.mda-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(13, 148, 136, 0.5);
}

.mda-toggle svg {
  width: 30px;
  height: 30px;
  fill: white;
  transition: transform 0.3s;
}

.mda-toggle.mda-active svg.mda-icon-chat { display: none; }
.mda-toggle:not(.mda-active) svg.mda-icon-close { display: none; }
.mda-toggle.mda-active { animation: none; }

.mda-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  border-radius: 50%;
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  animation: mda-bounce-badge 1s ease infinite;
  font-family: var(--mda-font);
}

@keyframes mda-pulse {
  0% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.4); }
  70% { box-shadow: 0 0 0 12px rgba(13, 148, 136, 0); }
  100% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0); }
}

@keyframes mda-bounce-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ===== TOOLTIP ===== */
.mda-tooltip {
  position: fixed;
  bottom: 96px;
  right: 24px;
  background: white;
  color: #1e293b;
  padding: 12px 18px;
  border-radius: 16px 16px 4px 16px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 99998;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s;
  pointer-events: none;
  max-width: 240px;
  font-family: var(--mda-font);
}

.mda-tooltip.mda-show {
  opacity: 1;
  transform: translateY(0);
}

/* ===== CHAT WINDOW ===== */
.mda-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 140px);
  background: white;
  border-radius: var(--mda-radius);
  box-shadow: var(--mda-shadow);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--mda-font);
}

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

/* ===== HEADER ===== */
.mda-header {
  background: linear-gradient(135deg, var(--mda-primary), var(--mda-primary-dark));
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.mda-header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.mda-header-info h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mda-header-info .mda-ai-badge {
  font-size: 9px;
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.mda-header-info p {
  font-size: 12px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
}

.mda-online-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  animation: mda-blink 1.5s ease infinite;
}

@keyframes mda-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.mda-header-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.mda-header-actions button {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  font-size: 14px;
}

.mda-header-actions button:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ===== MESSAGES ===== */
.mda-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  background: #f8fafb;
}

.mda-messages::-webkit-scrollbar { width: 5px; }
.mda-messages::-webkit-scrollbar-track { background: transparent; }
.mda-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.mda-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: mda-msg-in 0.3s ease forwards;
  opacity: 0;
}

.mda-msg.mda-bot { align-self: flex-start; }
.mda-msg.mda-user { align-self: flex-end; flex-direction: row-reverse; }

.mda-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.mda-msg.mda-bot .mda-msg-avatar {
  background: linear-gradient(135deg, var(--mda-primary), var(--mda-primary-light));
  color: white;
}

.mda-msg.mda-user .mda-msg-avatar {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: white;
}

.mda-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
}

.mda-msg.mda-bot .mda-bubble {
  background: white;
  color: #1e293b;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.mda-msg.mda-user .mda-bubble {
  background: var(--mda-user-bubble);
  color: white;
  border-bottom-right-radius: 4px;
}

.mda-bubble a {
  color: var(--mda-primary);
  font-weight: 600;
  text-decoration: none;
}

.mda-msg.mda-user .mda-bubble a {
  color: #e0f2fe;
}

.mda-bubble a:hover { text-decoration: underline; }

.mda-msg-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
  padding: 0 4px;
}

.mda-msg.mda-user .mda-msg-time { text-align: right; }

@keyframes mda-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== TYPING INDICATOR ===== */
.mda-typing {
  display: none;
  align-self: flex-start;
  padding: 0 8px;
}

.mda-typing.mda-show { display: flex; }

.mda-typing-dots {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

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

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

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

/* ===== QUICK REPLIES ===== */
.mda-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
  animation: mda-msg-in 0.3s ease forwards;
}

.mda-qr-btn {
  background: white;
  border: 1.5px solid var(--mda-primary);
  color: var(--mda-primary);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--mda-font);
}

.mda-qr-btn:hover {
  background: var(--mda-primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

/* ===== CONTACT CARD ===== */
.mda-contact-card {
  background: white;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  animation: mda-msg-in 0.3s ease forwards;
}

.mda-contact-card h4 {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mda-contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  margin-bottom: 6px;
  transition: background 0.2s;
  text-decoration: none;
  color: inherit;
}

.mda-contact-item:hover { background: #f1f5f9; }

.mda-contact-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.mda-contact-text { flex: 1; min-width: 0; }
.mda-contact-text .mda-label { font-size: 11px; color: #94a3b8; }
.mda-contact-text .mda-value { font-size: 13px; font-weight: 500; color: #1e293b; }

/* ===== TOUR CARDS ===== */
.mda-card-carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 0;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.mda-card-carousel::-webkit-scrollbar { height: 3px; }
.mda-card-carousel::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.mda-tour-card {
  min-width: 220px;
  background: white;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  scroll-snap-align: start;
  flex-shrink: 0;
  transition: transform 0.2s;
  cursor: pointer;
}

.mda-tour-card:hover { transform: translateY(-3px); }

.mda-tour-card-img {
  width: 100%;
  height: 120px;
  background: linear-gradient(135deg, var(--mda-primary), var(--mda-primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 32px;
}

.mda-tour-card-body { padding: 10px 12px; }
.mda-tour-card-body h4 { font-size: 13px; font-weight: 600; color: #1e293b; margin-bottom: 4px; line-height: 1.3; }
.mda-tour-card-body p { font-size: 11px; color: #64748b; margin: 0; }

.mda-tour-card-link {
  display: block;
  text-align: center;
  padding: 8px;
  background: var(--mda-primary-bg);
  color: var(--mda-primary);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border-top: 1px solid #e2e8f0;
  transition: background 0.2s;
}

.mda-tour-card-link:hover {
  background: var(--mda-primary);
  color: white;
}

/* ===== INPUT ===== */
.mda-input-area {
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: white;
  flex-shrink: 0;
}

.mda-input-area textarea {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: var(--mda-font);
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  max-height: 80px;
  line-height: 1.4;
  background: #f8fafb;
}

.mda-input-area textarea:focus {
  border-color: var(--mda-primary);
  background: white;
}

.mda-input-area textarea::placeholder { color: #94a3b8; }

.mda-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--mda-user-bubble);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.mda-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

.mda-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.mda-send-btn svg { width: 18px; height: 18px; fill: white; }

/* ===== POWERED BY ===== */
.mda-powered {
  text-align: center;
  padding: 6px;
  font-size: 10px;
  color: #94a3b8;
  background: white;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.mda-powered a {
  color: var(--mda-primary);
  text-decoration: none;
  font-weight: 500;
}

/* ===== DATE SEPARATOR ===== */
.mda-date-sep {
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  padding: 4px 0;
}

.mda-date-sep span {
  background: #f1f5f9;
  padding: 3px 12px;
  border-radius: 10px;
  font-weight: 500;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .mda-window {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .mda-toggle { bottom: 16px; right: 16px; }
  .mda-tooltip { bottom: 88px; right: 16px; }
}
