/* ============================================================
   MRZ CANADA INC. — Premium Website Chatbot
   chatbot.css
   ============================================================ */

:root {
  --cb-primary: #0A1128;
  --cb-gold: #D4AF37;
  --cb-gold-light: #F1D279;
  --cb-surface: #FCFAF7;
  --cb-bg: #F3F1ED;
  --cb-border: rgba(10, 17, 40, 0.08);
  --cb-text: #0A1128;
  --cb-muted: #4A5568;
  --cb-bubble-size: 56px;
  --cb-width: 380px;
  --cb-radius: 16px;
  --cb-shadow: 0 24px 64px rgba(0,0,0,0.2), 0 4px 16px rgba(0,0,0,0.1);
}

/* ── Launcher Bubble ── */
#mrz-chat-launcher {
  position: fixed;
  bottom: 95px;
  right: 27px;
  width: var(--cb-bubble-size);
  height: var(--cb-bubble-size);
  background: var(--cb-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(10, 17, 40, 0.2);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid var(--cb-gold);
  overflow: hidden;
}
#mrz-chat-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 32px rgba(0,0,0,0.30);
}
#mrz-chat-launcher svg { transition: opacity 0.2s; }
#mrz-chat-launcher .icon-close { display: none; }
#mrz-chat-launcher.is-open .icon-chat { display: none; }
#mrz-chat-launcher.is-open .icon-close { display: block; }

/* Notification dot */
#mrz-chat-launcher::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 11px;
  height: 11px;
  background: var(--cb-gold);
  border-radius: 50%;
  border: 2px solid white;
  animation: pulse-dot 2s infinite;
}
#mrz-chat-launcher.is-open::after { display: none; }
@keyframes pulse-dot {
  0%,100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* ── Chat Window ── */
#mrz-chat-window {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: var(--cb-width);
  max-height: 600px;
  display: flex;
  flex-direction: column;
  background: var(--cb-surface);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow);
  z-index: 9998;
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease;
}
#mrz-chat-window.is-visible {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
#mrz-chat-header {
  background: var(--cb-primary);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.chat-avatar {
  width: 38px;
  height: 38px;
  background: var(--cb-gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.85rem;
  color: white;
  font-weight: 700;
  flex-shrink: 0;
}
.chat-header-info { flex: 1; }
.chat-header-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.chat-header-status {
  font-size: 0.7rem;
  color: var(--cb-gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}
.chat-header-actions { display: flex; gap: 8px; align-items: center; }
.chat-header-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: rgba(255,255,255,0.6);
  transition: color 0.2s;
}
.chat-header-btn:hover { color: white; }

/* ── Messages Area ── */
#mrz-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--cb-bg);
  scroll-behavior: smooth;
}
#mrz-chat-messages::-webkit-scrollbar { width: 4px; }
#mrz-chat-messages::-webkit-scrollbar-track { background: transparent; }
#mrz-chat-messages::-webkit-scrollbar-thumb { background: var(--cb-border); border-radius: 2px; }

/* ── Message Bubbles ── */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: fadeUp 0.3s ease forwards;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg.bot { align-self: flex-start; }
.msg.user { align-self: flex-end; }

.msg-bubble {
  padding: 12px 16px;
  font-size: 0.875rem;
  line-height: 1.6;
  word-break: break-word;
}
.msg.bot .msg-bubble {
  background: var(--cb-surface);
  color: var(--cb-text);
  border-top-left-radius: 0;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
  border-bottom-left-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.msg.user .msg-bubble {
  background: var(--cb-primary);
  color: white;
  border-top-left-radius: 10px;
  border-top-right-radius: 0;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
}
.msg-time {
  font-size: 0.65rem;
  color: var(--cb-muted);
  margin-top: 4px;
  padding: 0 4px;
}
.msg.user .msg-time { text-align: right; }

/* ── Typing Indicator ── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: var(--cb-surface);
  border-radius: 0 10px 10px 10px;
  width: fit-content;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--cb-border);
  border-radius: 50%;
  animation: typing 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%,60%,100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ── Quick Replies / Buttons ── */
.msg-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  align-self: flex-start;
  max-width: 100%;
  animation: fadeUp 0.35s ease forwards;
}
.msg-btn {
  background: var(--cb-surface);
  border: 1.5px solid var(--cb-border);
  color: var(--cb-text);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
  line-height: 1.3;
  white-space: nowrap;
}
.msg-btn:hover {
  background: var(--cb-primary);
  color: white;
  border-color: var(--cb-primary);
}
.msg-btn.gold {
  background: var(--cb-gold);
  border-color: var(--cb-gold);
  color: white;
}
.msg-btn.gold:hover {
  background: var(--cb-gold-light);
  border-color: var(--cb-gold-light);
}
.msg-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Input Area ── */
#mrz-chat-input-area {
  background: var(--cb-surface);
  border-top: 1px solid var(--cb-border);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#mrz-chat-input {
  flex: 1;
  border: 1.5px solid var(--cb-border);
  outline: none;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--cb-bg);
  color: var(--cb-text);
  transition: border-color 0.2s;
}
#mrz-chat-input:focus { border-color: var(--cb-gold); }
#mrz-chat-input::placeholder { color: var(--cb-muted); }
#mrz-chat-send {
  width: 38px;
  height: 38px;
  background: var(--cb-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
#mrz-chat-send:hover { background: var(--cb-gold); }

/* ── Lead Capture Form ── */
.lead-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  width: 260px;
}
.lead-form input, .lead-form textarea, .lead-form select {
  border: 1.5px solid var(--cb-border);
  padding: 9px 12px;
  font-size: 0.8rem;
  font-family: inherit;
  background: var(--cb-bg);
  color: var(--cb-text);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.lead-form input:focus, .lead-form textarea:focus { border-color: var(--cb-gold); }
.lead-form textarea { resize: none; height: 64px; }
.lead-form-submit {
  background: var(--cb-gold);
  color: white;
  border: none;
  padding: 10px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: background 0.2s;
}
.lead-form-submit:hover { background: var(--cb-primary); }

/* ── CTA Buttons ── */
.cta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.cta-wa {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #25D366;
  color: white;
  border: none;
  padding: 9px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.cta-wa:hover { background: #1ebe5a; color: white; }
.cta-consult {
  background: var(--cb-primary);
  color: white;
  border: none;
  padding: 9px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.cta-consult:hover { background: var(--cb-gold); }

/* ── Footer ── */
#mrz-chat-footer {
  text-align: center;
  font-size: 0.6rem;
  color: var(--cb-muted);
  padding: 6px 12px 8px;
  background: var(--cb-surface);
  border-top: 1px solid var(--cb-border);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  #mrz-chat-window {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-height: 85vh;
    border-radius: 0;
  }
  #mrz-chat-launcher {
    bottom: 90px;
    right: 22px;
  }
}
