/* People Purpose site-wide chat widget (assets/chat-widget.js).
   Uses the site's brand tokens from assets/styles.css + assets/pp-system.css:
   purple #330033, gold #947D59/#a98e66, linen #F7F3F1/#efe8e2, Raleway body,
   radii --pp-r (10px) / --pp-r-lg (18px). Load after those files. */

.ppc-pill,
.ppc-panel,
.ppc-panel * {
  box-sizing: border-box;
  font-family: var(--body, "Raleway", sans-serif);
}

/* ============ FLOATING PILL ============ */
.ppc-pill {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--gold, #947d59);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.3rem;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(34, 0, 34, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.ppc-pill:hover {
  background: var(--gold-bright, #a98e66);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(34, 0, 34, 0.32);
}
.ppc-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  flex: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
}
.ppc-pill[aria-expanded="true"] {
  display: none;
}

/* ============ PANEL (floating, default mode) ============ */
.ppc-panel {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 9999;
  width: min(24rem, calc(100vw - 2.2rem));
  height: min(38rem, calc(100vh - 2.2rem));
  max-height: 82vh;
  background: #fff;
  border-radius: var(--pp-r-lg, 18px);
  box-shadow: 0 24px 60px rgba(34, 0, 34, 0.32);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ppc-panel[hidden] {
  display: none;
}

/* Full-height inline mode (diagnostic.html) — part of the page, not an overlay */
.ppc-panel--full {
  position: static;
  width: 100%;
  max-width: 52rem;
  height: min(72vh, 46rem);
  margin: 0 auto;
  box-shadow: 0 20px 50px rgba(34, 0, 34, 0.14);
  border: 1px solid rgba(148, 125, 89, 0.34);
}

/* ============ HEADER ============ */
.ppc-head {
  background: var(--purple, #330033);
  color: #fff;
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: none;
}
.ppc-head b {
  font-family: var(--display, serif);
  font-weight: 400;
  font-size: 1.02rem;
}
.ppc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #7ee08a;
  box-shadow: 0 0 0 3px rgba(126, 224, 138, 0.22);
  flex: none;
}
.ppc-stage {
  margin-left: auto;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-bright, #a98e66);
}
.ppc-close {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.1rem 0.3rem;
  cursor: pointer;
  border-radius: 6px;
}
.ppc-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ============ LOG ============ */
.ppc-log {
  flex: 1 1 auto;
  padding: 1.1rem;
  overflow-y: auto;
  background: linear-gradient(180deg, #fdfbfa, var(--linen, #f7f3f1));
}
.ppc-msg {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
  align-items: flex-start;
}
.ppc-msg.me {
  flex-direction: row-reverse;
}
.ppc-av {
  flex: 0 0 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--purple, #330033);
  color: var(--gold-bright, #a98e66);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
}
.ppc-msg.me .ppc-av {
  background: var(--gold-ink, #6e5a37);
  color: #fff;
}
.ppc-bub {
  max-width: 80%;
  padding: 0.7rem 0.95rem;
  border-radius: var(--pp-r, 10px);
  font-size: 0.93rem;
  line-height: 1.55;
  background: #fff;
  border: 1px solid rgba(148, 125, 89, 0.28);
}
.ppc-msg.me .ppc-bub {
  background: var(--purple, #330033);
  color: #fff;
  border-color: transparent;
}

/* typing indicator */
.ppc-typing {
  display: inline-flex;
  gap: 4px;
  padding: 0.15rem 0;
}
.ppc-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold-ink, #6e5a37);
  opacity: 0.4;
}
@media (prefers-reduced-motion: no-preference) {
  .ppc-typing i {
    animation: ppcBounce 1.2s infinite;
  }
  .ppc-typing i:nth-child(2) {
    animation-delay: 0.18s;
  }
  .ppc-typing i:nth-child(3) {
    animation-delay: 0.36s;
  }
  @keyframes ppcBounce {
    0%, 60%, 100% { opacity: 0.4; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
  }
}

/* ============ FOOTER (chips, input, note) ============ */
.ppc-foot {
  border-top: 1px solid rgba(148, 125, 89, 0.25);
  padding: 0.9rem 1.1rem 1rem;
  background: #fff;
  flex: none;
}
.ppc-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.1rem;
}
.ppc-opts:empty {
  margin-bottom: 0;
}
.ppc-opt {
  background: var(--linen-2, #efe8e2);
  border: 1px solid rgba(148, 125, 89, 0.4);
  color: var(--ink, #241a1f);
  border-radius: 999px;
  padding: 0.48rem 0.9rem;
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.ppc-opt:hover {
  background: var(--gold, #947d59);
  color: #fff;
  border-color: var(--gold, #947d59);
}
.ppc-inputrow {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.ppc-input {
  flex: 1;
  padding: 0.58rem 0.8rem;
  border: 1px solid rgba(148, 125, 89, 0.4);
  border-radius: var(--pp-r, 10px);
  font: inherit;
  font-size: 0.9rem;
  background: var(--linen, #f7f3f1);
  color: var(--ink, #241a1f);
}
.ppc-send {
  background: var(--purple, #330033);
  color: #fff;
  border: 0;
  border-radius: var(--pp-r, 10px);
  padding: 0.58rem 1.05rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}
.ppc-send:hover {
  background: var(--purple-soft, #4a1f4a);
}
.ppc-note {
  font-size: 0.75rem;
  color: var(--text-muted, #6d635a);
  margin-top: 0.6rem;
  text-align: center;
  line-height: 1.5;
}
.ppc-restart {
  background: none;
  border: 0;
  color: var(--gold-ink, #6e5a37);
  font: inherit;
  font-size: 0.75rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

/* ============ BOOKING SUB-FORM ============ */
.ppc-book {
  min-width: 14rem;
}
.ppc-book-title {
  display: block;
  font-family: var(--display, serif);
  color: var(--gold-bright, #a98e66);
}
.ppc-book label {
  display: block;
  font-weight: 700;
  font-size: 0.78rem;
  margin: 0.55rem 0 0.2rem;
}
.ppc-book input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 7px;
  font: inherit;
  font-size: 0.86rem;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink, #241a1f);
}
.ppc-book button {
  margin-top: 0.8rem;
  width: 100%;
  background: var(--gold, #947d59);
  color: #fff;
  border: 0;
  border-radius: var(--pp-r, 10px);
  padding: 0.55rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.ppc-book button:hover {
  background: var(--gold-bright, #a98e66);
}
.ppc-book-st {
  font-size: 0.76rem;
  margin-top: 0.5rem;
  text-align: center;
  opacity: 0.85;
}

/* ============ ENTRANCE ANIMATION (skipped entirely under reduced motion) ============ */
@media (prefers-reduced-motion: no-preference) {
  .ppc-pill {
    animation: ppcPop 0.5s 0.15s cubic-bezier(0.2, 0.8, 0.25, 1.25) both;
  }
  .ppc-panel--enter {
    animation: ppcRise 0.32s cubic-bezier(0.2, 0.8, 0.3, 1) both;
  }
  @keyframes ppcPop {
    from { opacity: 0; transform: translateY(14px) scale(0.94); }
    to { opacity: 1; transform: none; }
  }
  @keyframes ppcRise {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
  }
}

/* ============ ACCESSIBILITY ============ */
.ppc-pill:focus-visible,
.ppc-close:focus-visible,
.ppc-opt:focus-visible,
.ppc-input:focus-visible,
.ppc-send:focus-visible,
.ppc-restart:focus-visible,
.ppc-book input:focus-visible,
.ppc-book button:focus-visible {
  outline: 3px solid var(--gold, #947d59);
  outline-offset: 2px;
}

/* ============ MOBILE: full-width sheet ============ */
@media (max-width: 640px) {
  .ppc-pill {
    right: 0.7rem;
    bottom: 0.7rem;
    padding: 0.75rem 1.05rem;
    font-size: 0.82rem;
  }
  .ppc-panel:not(.ppc-panel--full) {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: min(88vh, 100%);
    max-height: 88vh;
    border-radius: var(--pp-r-lg, 18px) var(--pp-r-lg, 18px) 0 0;
  }
  .ppc-panel--full {
    height: min(80vh, 40rem);
  }
}

/* ============ HERO OVERLAP GUARD (chat-widget.js toggles this class) ============
   Below 720px the fixed pill sits almost exactly on top of the homepage
   hero's own "Ask a question about your business" button. Hide the pill
   for as long as that button is in view so it stays tappable; the pill
   reappears once the hero scrolls out of view. No effect above 720px,
   where the two never overlap. */
@media (max-width: 720px) {
  .ppc-pill.ppc-pill--hero-visible {
    display: none;
  }
}
