/* ── MENTORSHIP CHAT WIDGET ──
   Floating bubble that advertises the 1-on-1 journalism mentoring program.
   Scripted quick-reply chat, not a real AI — its answers come from
   GET /api/mentorship/info (admin-editable settings + FAQ), so content stays
   accurate without a code change even though nothing here is generative.
   z-index 9999: shop.html's own fixed/sticky elements top out at 999. */

#mw-bubble {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #8B1A1A;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(139, 26, 26, .35);
  z-index: 9999;
  transition: transform .15s, background .15s;
}
#mw-bubble:hover { background: #6b1111; transform: scale(1.06); }

/* Pulsing ring to catch the eye before the visitor has ever interacted —
   removed the moment they open the panel (see mentor-widget.js), and auto-
   stops after a while regardless so it never becomes a permanent distraction. */
#mw-bubble.mw-pulse { animation: mw-pulse-ring 1.8s ease-out infinite; }
@keyframes mw-pulse-ring {
  0%   { box-shadow: 0 6px 24px rgba(139, 26, 26, .35), 0 0 0 0 rgba(139, 26, 26, .45); }
  70%  { box-shadow: 0 6px 24px rgba(139, 26, 26, .35), 0 0 0 14px rgba(139, 26, 26, 0); }
  100% { box-shadow: 0 6px 24px rgba(139, 26, 26, .35), 0 0 0 0 rgba(139, 26, 26, 0); }
}

#mw-teaser {
  position: fixed;
  bottom: 90px;
  right: 22px;
  max-width: 220px;
  background: #fff;
  border: 1px solid #e8e4e4;
  border-radius: 12px;
  padding: .7rem .9rem;
  font-size: .78rem;
  font-family: 'DM Sans', Arial, sans-serif;
  color: #1a1a1a;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .14);
  z-index: 9999;
  cursor: pointer;
  animation: mw-fade-in .25s ease-out;
}
#mw-teaser .mw-teaser-close {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #faf8f8;
  border: 1px solid #e8e4e4;
  font-size: .6rem;
  cursor: pointer;
  color: #777;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Typewriter cursor while the teaser text is being typed out, character
   by character, from mentor-widget.js. */
.mw-teaser-text.mw-typing::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: .9em;
  margin-left: 2px;
  vertical-align: -1px;
  background: #8B1A1A;
  animation: mw-blink .8s step-end infinite;
}
@keyframes mw-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

#mw-panel {
  position: fixed;
  bottom: 92px;
  right: 22px;
  width: min(340px, 92vw);
  max-height: min(480px, 70vh);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .22);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'DM Sans', Arial, sans-serif;
}
#mw-panel.open { display: flex; }

.mw-head {
  background: #8B1A1A;
  color: #fff;
  padding: .9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mw-head-titlewrap { display: flex; align-items: center; gap: .55rem; }
.mw-head-ico { flex-shrink: 0; opacity: .9; }
.mw-head-title { font-family: 'Sora', Arial, sans-serif; font-size: .95rem; font-weight: 700; }
.mw-head-sub { font-size: .68rem; color: rgba(255,255,255,.7); margin-top: .1rem; }
.mw-close-btn {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: .7rem;
}

.mw-body {
  flex: 1;
  overflow-y: auto;
  padding: .9rem;
  background: #faf8f8;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.mw-msg {
  max-width: 85%;
  padding: .55rem .75rem;
  border-radius: 12px;
  font-size: .8rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.mw-msg-bot { background: #fff; border: 1px solid #e8e4e4; color: #1a1a1a; align-self: flex-start; border-bottom-left-radius: 3px; }
.mw-msg-user { background: #8B1A1A; color: #fff; align-self: flex-end; border-bottom-right-radius: 3px; }

.mw-quick-wrap { display: flex; flex-direction: column; gap: .4rem; margin-top: .2rem; }
.mw-quick-btn {
  background: #fff;
  border: 1.5px solid #d4a0a0;
  color: #8B1A1A;
  border-radius: 8px;
  padding: .5rem .7rem;
  font-size: .77rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  font-family: 'DM Sans', Arial, sans-serif;
  transition: background .15s;
}
.mw-quick-btn:hover { background: #fdf0f0; }

.mw-footer {
  padding: .8rem .9rem;
  border-top: 1px solid #e8e4e4;
  background: #fff;
}
.mw-cta-btn {
  display: block;
  width: 100%;
  text-align: center;
  background: #8B1A1A;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  padding: .65rem;
  font-size: .82rem;
  font-weight: 700;
  font-family: 'DM Sans', Arial, sans-serif;
}
.mw-cta-btn:hover { background: #6b1111; }

@keyframes mw-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
