/* ============================================================
   LCC TrancePlan Chat — fully scoped under .lcc-tpc-scope
   Aggressive reset + high-specificity selectors so host
   theme CSS (Newspaper, BuddyPress, Youzify, etc.) cannot leak
   in and break the widget.
   ============================================================ */

/* ---- Scope reset --------------------------------------------------- */
.lcc-tpc-scope,
.lcc-tpc-scope *,
.lcc-tpc-scope *::before,
.lcc-tpc-scope *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: #2a3a44;
  text-align: left;
  text-transform: none;
  text-shadow: none;
  letter-spacing: normal;
  font-weight: 400;
  font-style: normal;
  vertical-align: baseline;
  list-style: none;
  text-decoration: none;
  box-shadow: none;
  float: none;
  clear: none;
  outline: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.lcc-tpc-scope button { cursor: pointer; }
.lcc-tpc-scope a { color: inherit; }

/* ---- Design tokens ------------------------------------------------- */
.lcc-tpc-scope {
  --tpc-primary: #4a8fb8;
  --tpc-primary-dark: #2f6e94;
  --tpc-accent: #7bb89c;
  --tpc-accent-dark: #5a9b7d;
  --tpc-bg: #ffffff;
  --tpc-soft: #f4f9fc;
  --tpc-text: #2a3a44;
  --tpc-muted: #6b7d88;
  --tpc-border: #e2ecf2;
  --tpc-shadow: 0 12px 36px rgba(40, 80, 110, 0.18);
  --tpc-radius: 18px;
}

/* ---- Floating launcher -------------------------------------------- */
.lcc-tpc-scope.lcc-tpc-launcher {
  position: fixed !important;
  right: 22px !important;
  bottom: 22px !important;
  width: 62px !important;
  height: 62px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, var(--tpc-primary), var(--tpc-accent)) !important;
  color: #fff !important;
  border: none !important;
  cursor: pointer !important;
  box-shadow: var(--tpc-shadow) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 999998 !important;
  transition: transform .2s ease, box-shadow .2s ease;
}
.lcc-tpc-scope.lcc-tpc-launcher:hover { transform: translateY(-2px) scale(1.04); }
.lcc-tpc-scope.lcc-tpc-launcher svg { width: 28px; height: 28px; stroke: currentColor; fill: none; }

/* Attention pulse when the proactive teaser is showing */
.lcc-tpc-scope.lcc-tpc-launcher.tpc-pulse {
  animation: tpcPulse 1.8s ease-in-out infinite;
}
@keyframes tpcPulse {
  0%   { box-shadow: var(--tpc-shadow), 0 0 0 0 rgba(74, 143, 184, .45); }
  70%  { box-shadow: var(--tpc-shadow), 0 0 0 14px rgba(74, 143, 184, 0); }
  100% { box-shadow: var(--tpc-shadow), 0 0 0 0 rgba(74, 143, 184, 0); }
}

/* ---- Proactive "receptionist" teaser bubble ----------------------- */
.lcc-tpc-scope.lcc-tpc-teaser {
  position: fixed !important;
  right: 22px !important;
  bottom: 96px !important;
  max-width: 250px !important;
  background: #fff !important;
  color: var(--tpc-text) !important;
  padding: 14px 16px !important;
  padding-right: 30px !important;
  border-radius: 16px !important;
  border: 1px solid var(--tpc-border) !important;
  box-shadow: var(--tpc-shadow) !important;
  cursor: pointer;
  z-index: 999998 !important;
  animation: tpcSlide .3s ease;
}
.lcc-tpc-scope.lcc-tpc-teaser::after {
  content: "";
  position: absolute;
  right: 26px;
  bottom: -8px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-right: 1px solid var(--tpc-border);
  border-bottom: 1px solid var(--tpc-border);
  transform: rotate(45deg);
}
.lcc-tpc-scope .tpc-teaser-text {
  font-size: 14px;
  line-height: 1.45;
  font-weight: 500;
  color: var(--tpc-text);
}
.lcc-tpc-scope .tpc-teaser-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--tpc-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}
.lcc-tpc-scope .tpc-teaser-close:hover { background: var(--tpc-soft); color: var(--tpc-text); }

@media (max-width: 480px) {
  .lcc-tpc-scope.lcc-tpc-teaser {
    right: 14px !important;
    bottom: 84px !important;
    max-width: calc(100vw - 80px) !important;
  }
}

/* ---- Floating chat window ----------------------------------------- */
.lcc-tpc-scope.lcc-tpc-window {
  position: fixed !important;
  right: 22px !important;
  bottom: 100px !important;
  width: 380px !important;
  max-width: calc(100vw - 24px) !important;
  height: 600px !important;
  max-height: calc(100vh - 120px) !important;
  background: var(--tpc-bg) !important;
  border-radius: var(--tpc-radius) !important;
  box-shadow: var(--tpc-shadow) !important;
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 999999 !important;
  border: 1px solid var(--tpc-border) !important;
}
.lcc-tpc-scope.lcc-tpc-window.open {
  display: flex !important;
  animation: tpcSlide .25s ease;
}
@keyframes tpcSlide {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Inline embed -------------------------------------------------- */
.lcc-tpc-scope.lcc-tpc-inline {
  display: flex !important;
  flex-direction: column;
  width: 100% !important;
  max-width: 760px !important;
  height: 620px;
  margin: 24px auto !important;
  background: var(--tpc-bg) !important;
  border: 1px solid var(--tpc-border) !important;
  border-radius: var(--tpc-radius) !important;
  box-shadow: var(--tpc-shadow) !important;
  overflow: hidden;
  position: relative;
}
@media (max-width: 600px) {
  .lcc-tpc-scope.lcc-tpc-inline {
    height: 78vh !important;
    border-radius: 12px !important;
  }
}

/* ---- Shared chat frame internals ---------------------------------- */
.lcc-tpc-scope .tpc-header {
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--tpc-primary), var(--tpc-accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.lcc-tpc-scope .tpc-header * { color: #fff; }
.lcc-tpc-scope .tpc-header .title    { font-size: 15px; font-weight: 600; line-height: 1.2; }
.lcc-tpc-scope .tpc-header .subtitle { font-size: 12px; opacity: .9; line-height: 1.3; margin-top: 2px; }
.lcc-tpc-scope .tpc-close {
  background: rgba(255,255,255,.18);
  border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.lcc-tpc-scope .tpc-close:hover { background: rgba(255,255,255,.3); }

/* Message list */
.lcc-tpc-scope .tpc-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 16px;
  background: var(--tpc-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lcc-tpc-scope .tpc-msg {
  max-width: 86%;
  padding: 12px 15px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.lcc-tpc-scope .tpc-msg.user {
  align-self: flex-end;
  background: var(--tpc-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}
.lcc-tpc-scope .tpc-msg.user * { color: #fff; }
.lcc-tpc-scope .tpc-msg.assistant {
  align-self: flex-start;
  background: #fff;
  color: var(--tpc-text);
  border: 1px solid var(--tpc-border);
  border-bottom-left-radius: 4px;
}

/* ---- Markdown rendering inside assistant bubbles ------------------- */
.lcc-tpc-scope .tpc-msg.assistant p {
  margin: 0 0 10px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--tpc-text);
}
.lcc-tpc-scope .tpc-msg.assistant p:last-child { margin: 0; }
.lcc-tpc-scope .tpc-msg.assistant h3,
.lcc-tpc-scope .tpc-msg.assistant h4,
.lcc-tpc-scope .tpc-msg.assistant h5 {
  margin: 14px 0 6px;
  font-weight: 700;
  color: var(--tpc-primary-dark);
  line-height: 1.3;
}
.lcc-tpc-scope .tpc-msg.assistant h3 { font-size: 16px; }
.lcc-tpc-scope .tpc-msg.assistant h4 { font-size: 15px; }
.lcc-tpc-scope .tpc-msg.assistant h5 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--tpc-muted); }
.lcc-tpc-scope .tpc-msg.assistant h3:first-child,
.lcc-tpc-scope .tpc-msg.assistant h4:first-child,
.lcc-tpc-scope .tpc-msg.assistant h5:first-child { margin-top: 0; }

.lcc-tpc-scope .tpc-msg.assistant strong { font-weight: 700; color: var(--tpc-primary-dark); }
.lcc-tpc-scope .tpc-msg.assistant em     { font-style: italic; }

.lcc-tpc-scope .tpc-msg.assistant ul,
.lcc-tpc-scope .tpc-msg.assistant ol {
  margin: 6px 0 12px;
  padding-left: 22px;
}
.lcc-tpc-scope .tpc-msg.assistant ul { list-style: disc; }
.lcc-tpc-scope .tpc-msg.assistant ol { list-style: decimal; }
.lcc-tpc-scope .tpc-msg.assistant li {
  margin: 4px 0;
  list-style: inherit;
  display: list-item;
  font-size: 14.5px;
  line-height: 1.55;
}
.lcc-tpc-scope .tpc-msg.assistant li::marker { color: var(--tpc-accent-dark); }

.lcc-tpc-scope .tpc-msg.assistant blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--tpc-accent);
  background: var(--tpc-soft);
  border-radius: 0 8px 8px 0;
  color: var(--tpc-muted);
  font-style: italic;
}
.lcc-tpc-scope .tpc-msg.assistant code {
  background: #eef4f8;
  color: var(--tpc-primary-dark);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.lcc-tpc-scope .tpc-msg.assistant a {
  color: var(--tpc-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.lcc-tpc-scope .tpc-msg.assistant a:hover { color: var(--tpc-primary-dark); }
.lcc-tpc-scope .tpc-msg.assistant hr {
  border: none;
  border-top: 1px solid var(--tpc-border);
  margin: 12px 0;
}

/* ---- Typing indicator --------------------------------------------- */
.lcc-tpc-scope .tpc-typing {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--tpc-border);
  border-radius: 14px;
  padding: 12px 14px;
  display: inline-flex;
  gap: 4px;
}
.lcc-tpc-scope .tpc-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--tpc-muted);
  display: inline-block;
  animation: tpcBlink 1.2s infinite ease-in-out;
}
.lcc-tpc-scope .tpc-typing span:nth-child(2) { animation-delay: .2s; }
.lcc-tpc-scope .tpc-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes tpcBlink {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40%          { opacity: 1;  transform: translateY(-3px); }
}

/* ---- CTA buttons (Talkspace + Book) -------------------------------- */
.lcc-tpc-scope .tpc-cta-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.lcc-tpc-scope .tpc-cta {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 11px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none !important;
  transition: transform .15s ease, box-shadow .15s ease;
  color: #fff !important;
}
.lcc-tpc-scope .tpc-cta:hover { transform: translateY(-1px); }
.lcc-tpc-scope .tpc-cta-talkspace {
  background: linear-gradient(135deg, var(--tpc-accent), var(--tpc-accent-dark));
  box-shadow: 0 4px 12px rgba(90, 155, 125, .35);
}
.lcc-tpc-scope .tpc-cta-book {
  background: linear-gradient(135deg, var(--tpc-primary), var(--tpc-primary-dark));
  box-shadow: 0 4px 12px rgba(47, 110, 148, .35);
}
.lcc-tpc-scope .tpc-cta-workshop {
  background: linear-gradient(135deg, #e0a458, #cf8a3a);
  box-shadow: 0 4px 12px rgba(207, 138, 58, .38);
}

/* ---- Starter prompt chips ----------------------------------------- */
.lcc-tpc-scope .tpc-starters {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.lcc-tpc-scope .tpc-starters .tpc-starters-label {
  font-size: 11px;
  color: var(--tpc-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 2px;
}
.lcc-tpc-scope .tpc-chip {
  display: inline-block !important;
  padding: 9px 13px;
  background: #fff;
  border: 1px solid var(--tpc-border) !important;
  border-radius: 12px;
  color: var(--tpc-primary-dark) !important;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.lcc-tpc-scope .tpc-chip:hover {
  background: var(--tpc-soft);
  border-color: var(--tpc-primary) !important;
}
.lcc-tpc-scope .tpc-chip:active { transform: scale(.99); }

/* Accented, outlined event-registration chip (always first) */
.lcc-tpc-scope a.tpc-chip.tpc-chip-event {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none !important;
  color: #b8742a !important;
  background: linear-gradient(135deg, #fff8ef, #fdf1df) !important;
  border: 2px solid #e0a458 !important;
  box-shadow: 0 3px 10px rgba(207, 138, 58, .18);
  margin-bottom: 4px;
}
.lcc-tpc-scope a.tpc-chip.tpc-chip-event:hover {
  background: linear-gradient(135deg, #fdf1df, #fbe6c8) !important;
  border-color: #cf8a3a !important;
  box-shadow: 0 5px 14px rgba(207, 138, 58, .28);
  transform: translateY(-1px);
}
.lcc-tpc-scope .tpc-chip-event-icon { font-size: 16px; line-height: 1; }

/* ---- Email capture card ------------------------------------------- */
.lcc-tpc-scope .tpc-email-card {
  align-self: stretch;
  margin-top: 4px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--tpc-border);
  border-radius: 14px;
}
.lcc-tpc-scope .tpc-email-card label {
  display: block;
  font-size: 12px;
  color: var(--tpc-muted);
  margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.lcc-tpc-scope .tpc-email-card .row { display: flex; gap: 8px; }
.lcc-tpc-scope .tpc-email-card input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--tpc-border) !important;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fff;
  color: var(--tpc-text);
}
.lcc-tpc-scope .tpc-email-card input:focus { border-color: var(--tpc-primary) !important; }
.lcc-tpc-scope .tpc-email-card button {
  padding: 10px 16px;
  background: var(--tpc-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}
.lcc-tpc-scope .tpc-email-card button:hover:not(:disabled) { background: var(--tpc-primary-dark); }
.lcc-tpc-scope .tpc-email-card button:disabled { opacity: .5; cursor: not-allowed; }
.lcc-tpc-scope .tpc-email-card .note {
  display: block;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--tpc-muted);
  line-height: 1.4;
}

/* ---- Input row ---------------------------------------------------- */
.lcc-tpc-scope .tpc-input-wrap {
  border-top: 1px solid var(--tpc-border);
  padding: 12px;
  background: #fff;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.lcc-tpc-scope .tpc-input-wrap textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--tpc-border) !important;
  border-radius: 12px !important;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  max-height: 120px;
  min-height: 42px;
  line-height: 1.4;
  background: #fff;
  color: var(--tpc-text);
  -webkit-appearance: none;
  appearance: none;
}
.lcc-tpc-scope .tpc-input-wrap textarea:focus { border-color: var(--tpc-primary) !important; }
.lcc-tpc-scope .tpc-send {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--tpc-primary);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  align-self: flex-end;
  flex-shrink: 0;
}
.lcc-tpc-scope .tpc-send:hover:not(:disabled) { background: var(--tpc-primary-dark); }
.lcc-tpc-scope .tpc-send:disabled { opacity: .5; cursor: not-allowed; }
.lcc-tpc-scope .tpc-send svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }

.lcc-tpc-scope .tpc-disclaimer {
  font-size: 10.5px;
  color: var(--tpc-muted);
  text-align: center;
  padding: 6px 12px 10px;
  background: #fff;
  flex-shrink: 0;
}

/* ---- Mobile floating tweaks --------------------------------------- */
@media (max-width: 480px) {
  .lcc-tpc-scope.lcc-tpc-window {
    right: 8px !important;
    left: 8px !important;
    width: auto !important;
    bottom: 88px !important;
    height: calc(100vh - 110px) !important;
  }
  .lcc-tpc-scope.lcc-tpc-launcher {
    right: 14px !important;
    bottom: 14px !important;
  }
}
