/* =============================================================
   Z2One.ai — Muni Chatbot Widget Stylesheet
   Floating assistant widget: trigger bubble, panel, messages.
   ============================================================= */

@keyframes z2typingDot {
  0%, 60%, 100% { transform: translateY(0);   opacity: .35; }
  30%           { transform: translateY(-5px); opacity: 1;  }
}
@keyframes z2bubblePulse {
  0%, 100% { box-shadow: 0 8px 28px rgba(168,85,247,.45); }
  50%      { box-shadow: 0 8px 36px rgba(168,85,247,.75), 0 0 0 10px rgba(168,85,247,.1); }
}
@keyframes z2slideUp {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* ---------- Root ---------- */
#muni-widget {
  position: fixed;
  bottom: 24px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 14px;
  font-family: 'Inter', sans-serif;
}

/* ---------- Trigger bubble ---------- */
.z2-trigger {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  animation: z2bubblePulse 3s ease-in-out infinite;
  transition: transform .2s;
}
.z2-trigger:hover { transform: scale(1.07); }

.z2-unread {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #07070e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

/* ---------- Panel ---------- */
.z2-panel {
  width: 364px;
  height: 528px;
  max-height: calc(100vh - 110px);
  background: #090c18;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(0,0,0,.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: z2slideUp .32s cubic-bezier(.16,1,.3,1);
}
.z2-panel[hidden] { display: none; }

/* ---------- Header ---------- */
.z2-header {
  padding: 13px 14px;
  background: linear-gradient(135deg, rgba(168,85,247,.22), rgba(99,102,241,.08));
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}
.z2-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(168,85,247,.5);
}
.z2-avatar img { width: 100%; height: 100%; object-fit: cover; }
.z2-name { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; color: #fff; line-height: 1.2; }
.z2-status { display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.z2-status-dot { width: 6px; height: 6px; border-radius: 50%; background: #34d399; flex-shrink: 0; }
.z2-status span { font-size: 11px; color: rgba(255,255,255,.38); white-space: nowrap; }

.z2-hdr-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: none;
  background: none;
  color: rgba(255,255,255,.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .18s, color .18s;
  flex-shrink: 0;
}
.z2-hdr-btn:hover { background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); }

/* ---------- Messages ---------- */
.z2-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 13px 6px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.z2-msgs::-webkit-scrollbar { width: 3px; }
.z2-msgs::-webkit-scrollbar-track { background: transparent; }
.z2-msgs::-webkit-scrollbar-thumb { background: rgba(168,85,247,.3); border-radius: 2px; }

.z2-row-user { display: flex; justify-content: flex-end; margin-bottom: 8px; width: 100%; }
.z2-row-bot  { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 8px; }
.z2-row-bot-inner { display: flex; align-items: flex-end; gap: 7px; }

.z2-bubble-user {
  max-width: 83%;
  padding: 9px 13px;
  border-radius: 18px 4px 18px 18px;
  background: #7c3aed;
}
.z2-bubble-bot {
  max-width: 83%;
  padding: 9px 13px;
  border-radius: 4px 18px 18px 18px;
  background: rgba(255,255,255,.1);
}
.z2-bubble-user p, .z2-bubble-bot p {
  font-size: 13.5px;
  line-height: 1.6;
  color: #fff;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.z2-time { display: block; font-size: 10px; color: rgba(255,255,255,.3); margin-top: 4px; text-align: right; }

.z2-bot-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  margin-bottom: 1px;
}
.z2-bot-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Quick-reply chips ---------- */
.z2-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-left: 33px;
  padding-right: 4px;
}
.z2-chip {
  padding: 5px 13px;
  border: 1px solid rgba(168,85,247,.35);
  border-radius: 100px;
  background: rgba(168,85,247,.09);
  color: rgba(255,255,255,.78);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  line-height: 1.4;
  transition: background .18s, border-color .18s;
}
.z2-chip:hover { background: rgba(168,85,247,.22); border-color: rgba(168,85,247,.6); }

/* ---------- Typing indicator ---------- */
.z2-typing { display: flex; align-items: flex-end; gap: 7px; margin-bottom: 8px; }
.z2-typing-bubble {
  background: rgba(255,255,255,.1);
  border-radius: 4px 16px 16px 16px;
  padding: 11px 15px;
  display: flex;
  gap: 5px;
  align-items: center;
}
.z2-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.6); }
.z2-dot:nth-child(1) { animation: z2typingDot .9s 0s   ease-in-out infinite; }
.z2-dot:nth-child(2) { animation: z2typingDot .9s .2s  ease-in-out infinite; }
.z2-dot:nth-child(3) { animation: z2typingDot .9s .4s  ease-in-out infinite; }

/* ---------- Input bar ---------- */
.z2-input-bar {
  padding: 6px 13px 7px;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
  background: rgba(255,255,255,.012);
}
.z2-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 100px;
  padding: 5px 7px 5px 16px;
}
.z2-input {
  flex: 1;
  background: none;
  border: none;
  color: #fff;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  min-width: 0;
  letter-spacing: .01em;
}
.z2-input::placeholder { color: rgba(255,255,255,.28); }
.z2-input:focus { outline: none; }
.z2-input:disabled { opacity: .5; cursor: not-allowed; }

.z2-send {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: #a855f7;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s;
  box-shadow: 0 2px 10px rgba(168,85,247,.4);
}
.z2-send:hover { background: #9333ea; }

.z2-powered { text-align: center; margin-top: 2px; padding-top: 3px; border-top: 1px solid rgba(255,255,255,.06); }
.z2-powered span { font-size: 11px; color: rgba(255,255,255,.18); letter-spacing: .04em; font-weight: 500; }

/* ---------- Responsive (mobile) ---------- */
@media (max-width: 480px) {
  #muni-widget {
    left: 12px;
    right: 12px;
    bottom: 12px;
    align-items: stretch;
  }
  .z2-trigger { align-self: flex-end; }
  .z2-panel {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 88px);
  }
}
