/* Flyers.my Nana Assist (BETA) v1.2.0
   Modern, responsive chat UI. All styles scoped to #flyers-ai-agent. */
#flyers-ai-agent,
#flyers-ai-agent *,
#flyers-ai-agent *::before,
#flyers-ai-agent *::after { box-sizing: border-box; }

#flyers-ai-agent {
  --fmaa-blue: #4374ba;
  --fmaa-blue-deep: #173f78;
  --fmaa-navy: #15356d;
  --fmaa-green: #159953;
  --fmaa-bottom: 88px;
  position: fixed;
  right: 18px;
  left: auto;
  bottom: var(--fmaa-bottom);
  z-index: 99990;
  font-family: Inter, Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #20334f;
  -webkit-font-smoothing: antialiased;
}
#flyers-ai-agent.fmaa--left { right: auto; left: 18px; }
#flyers-ai-agent button,
#flyers-ai-agent input { font-family: inherit; }
#flyers-ai-agent button { cursor: pointer; }

/* Floating launcher – icon only, with understated depth */
#flyers-ai-agent .fmaa-trigger {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: grid !important;
  place-items: center !important;
  position: relative;
  width: 52px !important;
  height: 52px !important;
  min-width: 52px !important;
  min-height: 52px !important;
  max-width: 52px !important;
  max-height: 52px !important;
  padding: 0 !important;
  margin: 0 !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,.35) !important;
  border-radius: 18px !important;
  background: linear-gradient(140deg,#5487d0 0%,#356cad 45%,#153d7a 100%) !important;
  box-shadow: 0 12px 30px rgba(21,53,109,.25), 0 3px 8px rgba(21,53,109,.12) !important;
  line-height: 1 !important;
  transition: transform .2s ease, box-shadow .2s ease, border-radius .2s ease;
}
#flyers-ai-agent .fmaa-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 38px rgba(21,53,109,.3) !important;
}
#flyers-ai-agent .fmaa-trigger-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  line-height: 1;
  border-radius: 14px;
  background: rgba(255,255,255,.12);
}
#flyers-ai-agent .fmaa-trigger-icon svg { display: block; width: 23px; height: 23px; }
#flyers-ai-agent .fmaa-trigger-dot {
  position: absolute;
  right: 3px;
  top: 3px;
  width: 11px;
  height: 11px;
  background: #62e7a6;
  border: 2px solid #285592;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(98,231,166,.13);
}

/* Floating chat card */
#flyers-ai-agent .fmaa-panel {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(385px,calc(100vw - 24px));
  height: min(575px,calc(100dvh - var(--fmaa-bottom) - 92px));
  min-height: 280px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(210,225,244,.95);
  border-radius: 22px;
  box-shadow: 0 26px 74px rgba(15,43,83,.23), 0 6px 18px rgba(15,43,83,.09);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px) scale(.985);
  transform-origin: bottom right;
  transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
}
#flyers-ai-agent.fmaa--left .fmaa-panel { right: auto; left: 0; transform-origin: bottom left; }
#flyers-ai-agent.fmaa-open .fmaa-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header */
#flyers-ai-agent .fmaa-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 81px;
  padding: 16px;
  color: #fff;
  background: radial-gradient(circle at 80% 0%,rgba(142,196,255,.27),transparent 43%),linear-gradient(115deg,#386eb5 0%,#1b4c90 56%,#17376a 100%);
  flex: 0 0 auto;
  border: none;
}
#flyers-ai-agent .fmaa-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 15px;
  color: #fff;
  background: rgba(255,255,255,.17);
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.13);
}
#flyers-ai-agent .fmaa-heading { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 3px; }
#flyers-ai-agent .fmaa-heading strong {
  color: #fff !important;
  font-size: 16px;
  line-height: 1.22;
  font-weight: 800;
  letter-spacing: -.25px;
}
#flyers-ai-agent .fmaa-heading span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #e6f1ff;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
}
#flyers-ai-agent .fmaa-heading i {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: none;
  background: #60e2a1;
  border-radius: 50%;
}
#flyers-ai-agent .fmaa-close {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative;
  flex: 0 0 36px !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  padding: 0 !important;
  margin: 0 0 0 auto !important;
  color: #fff !important;
  background: rgba(255,255,255,.13) !important;
  border: 1px solid rgba(255,255,255,.13) !important;
  border-radius: 11px !important;
  box-shadow: none !important;
  line-height: 1 !important;
  transform: none !important;
}
#flyers-ai-agent .fmaa-close svg {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  flex: none;
  margin: 0 !important;
  padding: 0 !important;
  position: static !important;
  transform: none !important;
  stroke: currentColor !important;
}
#flyers-ai-agent .fmaa-close:hover { background: rgba(255,255,255,.24) !important; }

/* Chat content */
#flyers-ai-agent .fmaa-conversation {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 18px 16px;
  background: radial-gradient(circle at 20% 0%,#eaf3ff 0%,transparent 47%),linear-gradient(180deg,#f8fbff,#ffffff 85%);
  scrollbar-width: thin;
  scrollbar-color: #c6d5e8 transparent;
}
#flyers-ai-agent .fmaa-msg {
  display: flex;
  flex-direction: column;
  align-self: flex-start;
  gap: 5px;
  max-width: 92%;
  min-width: 0;
}
#flyers-ai-agent .fmaa-msg.is-user { align-self: flex-end; max-width: 88%; }
#flyers-ai-agent .fmaa-msg-label { padding: 0 3px; color: #7688a3; font-size: 10px; font-weight: 750; }
#flyers-ai-agent .fmaa-msg-bubble {
  padding: 12px 14px;
  color: #2a3d57;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
  background: #fff;
  border: 1px solid #e2eaf6;
  border-radius: 5px 15px 15px 15px;
  box-shadow: 0 3px 14px rgba(30,63,108,.05);
}
#flyers-ai-agent .fmaa-msg.is-user .fmaa-msg-bubble {
  background: linear-gradient(145deg,#eaf3ff,#deecff);
  border-color: #d8e8ff;
  color: #174679;
  border-radius: 15px 5px 15px 15px;
}
#flyers-ai-agent .fmaa-msg-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  gap: 6px;
  min-height: 40px;
  padding: 9px 13px;
  margin-top: 3px;
  color: #fff !important;
  background: #356ab1;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none !important;
  box-shadow: 0 4px 12px rgba(40,91,163,.15);
  transition: background .2s ease;
}
#flyers-ai-agent .fmaa-msg-link:hover { background: #204c87; color: #fff !important; }

/* Topic suggestions – readable, compact chips */
#flyers-ai-agent .fmaa-actions {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  max-height: 144px;
  overflow: auto;
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid #e8eef6;
}
#flyers-ai-agent .fmaa-actions::before {
  content: 'PILIH TOPIK';
  display: block;
  flex: 0 0 100%;
  color: #7d8ca1;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .95px;
  line-height: 1;
  margin-bottom: 1px;
}
#flyers-ai-agent .fmaa-choice {
  appearance: none !important;
  display: inline-flex !important;
  align-items: center !important;
  min-height: 34px;
  padding: 8px 11px !important;
  margin: 0 !important;
  border: 1px solid #d3e1f4 !important;
  border-radius: 999px !important;
  color: #244e86 !important;
  background: #f4f8ff !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  box-shadow: none !important;
  text-align: left;
  transition: background .15s ease,border-color .15s ease;
}
#flyers-ai-agent .fmaa-choice:hover { background: #e9f2ff !important; border-color: #7aa5df !important; }

/* Compose bar. No programmatic focus; only user tap opens mobile keyboard. */
#flyers-ai-agent .fmaa-compose {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  padding: 11px 13px 7px;
  margin: 0;
  background: #fff;
  border-top: 1px solid #edf1f8;
}
#flyers-ai-agent .fmaa-compose input {
  flex: 1;
  width: 0;
  min-width: 0;
  min-height: 44px;
  margin: 0 !important;
  padding: 10px 13px !important;
  background: #f6f9fe !important;
  color: #1b3555 !important;
  border: 1px solid #dce6f3 !important;
  border-radius: 13px !important;
  box-shadow: none !important;
  outline: none;
  font-size: 16px !important;
  line-height: 1.3 !important;
}
#flyers-ai-agent .fmaa-compose input::placeholder { color: #8595ad; opacity: 1; font-size: 13px; }
#flyers-ai-agent .fmaa-compose input:focus {
  border-color: #6295d5 !important;
  box-shadow: 0 0 0 3px rgba(67,116,186,.11) !important;
}
#flyers-ai-agent .fmaa-compose button {
  appearance: none !important;
  display: grid !important;
  place-items: center !important;
  flex: 0 0 44px;
  width: 44px !important;
  height: 44px !important;
  margin: 0 !important;
  padding: 0 !important;
  color: #fff !important;
  background: linear-gradient(135deg,#4a7fc2,#24528e) !important;
  border: 0 !important;
  border-radius: 13px !important;
  box-shadow: 0 3px 9px rgba(40,91,163,.15) !important;
}
#flyers-ai-agent .fmaa-compose button:hover { background: #214b85 !important; }
#flyers-ai-agent .fmaa-compose button svg { display: block; }

/* Honest beta note */
#flyers-ai-agent .fmaa-disclaimer {
  margin: 0 !important;
  padding: 2px 13px 12px !important;
  background: #fff;
  color: #8492a5 !important;
  font-size: 10px !important;
  line-height: 1.45 !important;
  text-align: center;
  flex: 0 0 auto;
}
#flyers-ai-agent .fmaa-disclaimer strong { font-weight: 800; color: #4b6f9e; }
#flyers-ai-agent .fmaa-sr-only { position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important; }
#flyers-ai-agent :is(button,a,input):focus-visible { outline: 2px solid #7ab5ff; outline-offset: 2px; }

@media (max-width: 600px) {
  #flyers-ai-agent { right: 12px; }
  #flyers-ai-agent.fmaa--left { right: auto; left: 12px; }
  #flyers-ai-agent .fmaa-panel {
    width: min(365px,calc(100vw - 24px));
    height: min(545px,calc(100dvh - var(--fmaa-bottom) - 83px));
    min-height: 230px;
    border-radius: 20px;
  }
  #flyers-ai-agent .fmaa-header { padding: 13px 14px; min-height: 73px; }
  #flyers-ai-agent .fmaa-avatar { flex-basis: 40px; width: 40px; height: 40px; border-radius: 13px; }
  #flyers-ai-agent .fmaa-trigger {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    max-width: 46px !important;
    max-height: 46px !important;
    border-radius: 16px !important;
  }
  #flyers-ai-agent .fmaa-trigger-icon { width: 33px; height: 33px; border-radius: 12px; }
  #flyers-ai-agent .fmaa-trigger-dot { top: 2px; right: 2px; }
  #flyers-ai-agent .fmaa-conversation { padding: 15px 13px; }
  #flyers-ai-agent .fmaa-actions { padding: 11px 12px; gap: 7px; }
  #flyers-ai-agent .fmaa-compose { padding: 9px 11px 6px; }
}
@media (max-width: 375px) {
  #flyers-ai-agent .fmaa-panel { width: calc(100vw - 24px); }
  #flyers-ai-agent .fmaa-heading strong { font-size: 14px; }
  #flyers-ai-agent .fmaa-heading span { font-size: 10px; }
  #flyers-ai-agent .fmaa-actions { max-height: 125px; }
}
@media (prefers-reduced-motion: reduce) {
  #flyers-ai-agent .fmaa-panel,
  #flyers-ai-agent .fmaa-trigger,
  #flyers-ai-agent .fmaa-choice,
  #flyers-ai-agent .fmaa-msg-link { transition: none !important; }
}

/* v1.2.0 - WhatsApp CTA & copyable design prompts */
#flyers-ai-agent .fmaa-contact {
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:7px 13px 5px; background:#fff;
  color:#60738c; font-size:11px; font-weight:600; flex:0 0 auto;
}
#flyers-ai-agent .fmaa-contact-wa {
  display:inline-flex; align-items:center; justify-content:center;
  padding:7px 10px; border-radius:9px; white-space:nowrap;
  color:#fff !important; background:#138457; text-decoration:none !important;
  font-size:11px; font-weight:750; line-height:1.3;
}
#flyers-ai-agent .fmaa-contact-wa:hover { color:#fff !important; background:#0e714a; }
#flyers-ai-agent .fmaa-prompt-wrap {
  display:flex; flex-direction:column; align-self:stretch; min-width:0;
  padding:12px; border:1px solid #d5e6f8; border-radius:15px;
  background:#f6faff; box-shadow:0 3px 14px rgba(30,63,108,.05);
}
#flyers-ai-agent .fmaa-prompt-title { color:#174679; font-weight:800; font-size:12px; margin-bottom:8px; }
#flyers-ai-agent .fmaa-prompt-text {
  margin:0; padding:10px 11px; overflow:auto; max-height:220px;
  white-space:pre-wrap; overflow-wrap:anywhere; border:1px solid #e2eaf6;
  border-radius:10px; background:#fff; color:#31455e;
  font-size:11px; font-family:inherit; line-height:1.55;
}
#flyers-ai-agent .fmaa-copy {
  display:block; align-self:stretch; min-height:39px; margin:10px 0 0 !important;
  padding:9px 12px !important; color:#fff !important; border:0 !important;
  border-radius:10px !important; background:#356ab1 !important;
  font-size:12px !important; font-weight:750 !important; box-shadow:none !important;
}
#flyers-ai-agent .fmaa-copy:hover { background:#204c87 !important; }
@media (max-width:375px) {
  #flyers-ai-agent .fmaa-contact { padding:6px 10px 4px; font-size:10px; }
  #flyers-ai-agent .fmaa-contact-wa { font-size:10px; padding:7px 9px; }
}
