/* MA Meeting Chat. Everything is scoped under .mamc */

.mamc {
  --mamc-accent: #9b6827;
  --mamc-ink: #1a1a1a;
  --mamc-soft: #f4efe8;
  --mamc-line: #e8e2da;
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 99990;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--mamc-ink);
}
.mamc--right { right: max(20px, env(safe-area-inset-right)); }
.mamc--left  { left:  max(20px, env(safe-area-inset-left)); }

.mamc *, .mamc *::before, .mamc *::after { box-sizing: border-box; }

.mamc button, .mamc a { font-family: inherit; font-size: inherit; }

/* ---------- Launcher ---------- */

.mamc .mamc-launcher {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--mamc-accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 24px -6px rgba(40, 25, 5, .45);
  transition: transform .2s ease, box-shadow .2s ease;
}
.mamc .mamc-launcher:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -6px rgba(40, 25, 5, .5); }
.mamc .mamc-launcher:focus-visible,
.mamc .mamc-chip:focus-visible,
.mamc .mamc-close:focus-visible,
.mamc .mamc-teaser button:focus-visible { outline: 3px solid #1a1a1a; outline-offset: 2px; }

.mamc .mamc-ico-x { display: none; }
.mamc.is-open .mamc-ico-chat { display: none; }
.mamc.is-open .mamc-ico-x { display: block; }

/* Soft ring to draw the eye while the pop-up is showing */
.mamc.has-teaser .mamc-launcher::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--mamc-accent);
  animation: mamc-ring 2s ease-out 3;
  pointer-events: none;
}
.mamc .mamc-launcher { position: relative; }
@keyframes mamc-ring { from { transform: scale(1); opacity: .7; } to { transform: scale(1.6); opacity: 0; } }

/* ---------- Teaser bubble ---------- */

.mamc .mamc-teaser {
  position: absolute;
  bottom: 70px;
  display: flex;
  align-items: stretch;
  max-width: 260px;
  background: #fff;
  border: 1px solid var(--mamc-line);
  border-radius: 14px;
  box-shadow: 0 10px 28px -10px rgba(40, 25, 5, .35);
  animation: mamc-pop .3s ease both;
}
.mamc--right .mamc-teaser { right: 0; }
.mamc--left  .mamc-teaser { left: 0; }
.mamc .mamc-teaser[hidden] { display: none; }

.mamc .mamc-teaser button {
  margin: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
.mamc .mamc-teaser-text { padding: 12px 6px 12px 16px; text-align: left; font-weight: 500; }
.mamc .mamc-teaser-close { padding: 0 12px; font-size: 20px; line-height: 1; color: #6b6b6b; }

@keyframes mamc-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Panel ---------- */

.mamc .mamc-panel {
  position: absolute;
  bottom: 72px;
  display: flex;
  flex-direction: column;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: min(560px, calc(100vh - 120px));
  background: #fff;
  border: 1px solid var(--mamc-line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 50px -14px rgba(40, 25, 5, .4);
  animation: mamc-pop .25s ease both;
  outline: none;
}
.mamc--right .mamc-panel { right: 0; transform-origin: bottom right; }
.mamc--left  .mamc-panel { left: 0;  transform-origin: bottom left; }
.mamc .mamc-panel[hidden] { display: none; }

.mamc .mamc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  background: var(--mamc-accent);
  color: #fff;
}
.mamc .mamc-avatar {
  position: relative;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .2);
  font-weight: 600;
}
.mamc .mamc-avatar::after {          /* online dot */
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #3ecf72;
  border: 2px solid var(--mamc-accent);
}
.mamc .mamc-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mamc .mamc-who strong { font-size: 15px; line-height: 1.3; }
.mamc .mamc-who span { font-size: 12.5px; opacity: .9; line-height: 1.3; }

.mamc .mamc-close {
  margin: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.mamc .mamc-close:hover { background: rgba(255, 255, 255, .18); }
.mamc .mamc-head .mamc-close:focus-visible { outline-color: #fff; }

/* ---------- Messages ---------- */

.mamc .mamc-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 140px;
  background: #fffdfa;
}
.mamc .mamc-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  word-wrap: break-word;
  animation: mamc-pop .25s ease both;
}
.mamc .mamc-msg--bot  { align-self: flex-start; background: var(--mamc-soft); border-bottom-left-radius: 4px; }
.mamc .mamc-msg--user { align-self: flex-end; background: var(--mamc-accent); color: #fff; border-bottom-right-radius: 4px; }

.mamc .mamc-typing { display: flex; gap: 4px; padding: 14px 16px; }
.mamc .mamc-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9a8f80;
  animation: mamc-dot 1s infinite ease-in-out;
}
.mamc .mamc-typing i:nth-child(2) { animation-delay: .15s; }
.mamc .mamc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes mamc-dot { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---------- Quick replies ---------- */

.mamc .mamc-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px 16px;
  background: #fffdfa;
}
.mamc .mamc-replies:empty { padding: 0; }

.mamc .mamc-chip {
  display: inline-block;
  margin: 0;
  padding: 8px 14px;
  border: 1.5px solid var(--mamc-accent);
  border-radius: 999px;
  background: #fff;
  color: var(--mamc-accent);
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.mamc .mamc-chip:hover { background: var(--mamc-accent); color: #fff; }
.mamc .mamc-chip--ghost { border-color: var(--mamc-line); color: #5a5a5a; font-weight: 500; }
.mamc .mamc-chip--ghost:hover { background: var(--mamc-soft); color: var(--mamc-ink); }

/* ---------- Small screens ---------- */

@media (max-width: 480px) {
  .mamc--right { right: max(14px, env(safe-area-inset-right)); }
  .mamc--left  { left:  max(14px, env(safe-area-inset-left)); }
  .mamc { bottom: max(14px, env(safe-area-inset-bottom)); }
  .mamc .mamc-panel { width: calc(100vw - 28px); max-height: calc(100vh - 110px); }
}

@media (prefers-reduced-motion: reduce) {
  .mamc *, .mamc *::before, .mamc *::after { animation: none !important; transition: none !important; }
}

/* Don't print the widget */
@media print { .mamc { display: none; } }
