/* ============================================================
   Phone Phoebe — Website Chat Widget
   ============================================================ */

#phoebeChat {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Bubble trigger ── */
.pc-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent, #057A55), var(--accent-2, #1D5BD8));
  box-shadow: 0 8px 28px rgba(5,122,85, 0.45), 0 2px 8px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
  position: relative;
  animation: pc-pop-in 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes pc-pop-in {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.pc-bubble:hover { transform: scale(1.1); box-shadow: 0 12px 36px rgba(5,122,85,0.55); }
.pc-bubble--open { transform: rotate(15deg) scale(0.92); }
.pc-bubble:focus-visible { outline: 3px solid var(--accent, #057A55); outline-offset: 3px; }

.pc-bubble__face { font-size: 1.6rem; line-height: 1; }

.pc-bubble__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  font-size: .7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  animation: pc-badge-pulse 2s ease-in-out infinite;
}
@keyframes pc-badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  50%       { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* ── Chat window ── */
.pc-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  max-height: 540px;
  background: var(--surface, #fff);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pc-slide-up 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
  border: 1px solid rgba(0,0,0,0.06);
}
@keyframes pc-slide-up {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ── */
.pc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--accent, #057A55), var(--accent-2, #1D5BD8));
  color: #fff;
  flex-shrink: 0;
}
.pc-header__left { display: flex; align-items: center; gap: 12px; }
.pc-avatar {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  border: 2px solid rgba(255,255,255,0.4);
}
.pc-header__name { font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }
.pc-header__status { font-size: .78rem; opacity: .9; display: flex; align-items: center; gap: 5px; margin-top: 1px; }
.pc-dot { width: 7px; height: 7px; background: var(--surface, #fff); border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,0.3); animation: pc-dot-pulse 2s ease-in-out infinite; }
@keyframes pc-dot-pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

.pc-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  flex-shrink: 0;
}
.pc-close:hover { background: rgba(255,255,255,0.35); }

/* ── Messages ── */
.pc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.pc-messages::-webkit-scrollbar { width: 4px; }
.pc-messages::-webkit-scrollbar-track { background: transparent; }
.pc-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 4px; }

.pc-msg { display: flex; gap: 8px; animation: pc-msg-in 0.25s ease-out both; }
@keyframes pc-msg-in { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

.pc-msg--user { flex-direction: row-reverse; }
.pc-msg--assistant {}

.pc-msg__avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent, #057A55), var(--accent-2, #1D5BD8));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
  margin-top: auto;
}

.pc-msg__bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: .9rem;
  line-height: 1.5;
}
.pc-msg--assistant .pc-msg__bubble {
  background: var(--bg-alt, #f3f4f6);
  color: var(--ink, #111827);
  border-bottom-left-radius: 4px;
}
.pc-msg--assistant .pc-msg__bubble a { color: var(--accent, #057A55); text-decoration: underline; }
.pc-msg--user .pc-msg__bubble {
  background: linear-gradient(135deg, var(--accent, #057A55), var(--accent-2, #1D5BD8));
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* ── Typing indicator ── */
.pc-typing {
  padding: 0 16px 12px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.pc-typing__dot {
  width: 7px;
  height: 7px;
  background: var(--accent, #057A55);
  border-radius: 50%;
  opacity: 0.6;
  animation: pc-bounce 1.2s ease-in-out infinite;
}
.pc-typing__dot:nth-child(2) { animation-delay: 0.2s; }
.pc-typing__dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pc-bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

/* ── Quick replies ── */
.pc-quick-replies {
  padding: 0 12px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pc-quick-btn {
  background: var(--surface, #fff);
  border: 1.5px solid var(--accent, #057A55);
  color: var(--accent-ink, #057A55);
  border-radius: 999px;
  padding: .38rem .9rem;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: .2s;
  white-space: nowrap;
  font-family: inherit;
}
.pc-quick-btn:hover {
  background: var(--accent, #057A55);
  color: #fff;
  box-shadow: 0 4px 12px rgba(5,122,85,0.3);
}

/* ── Input row ── */
.pc-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line, #f0f0f0);
  background: var(--surface, #fff);
  flex-shrink: 0;
}
.pc-input {
  flex: 1;
  background: var(--bg-alt, #f3f4f6);
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: .55rem .9rem;
  font-size: .9rem;
  font-family: inherit;
  color: var(--ink, #111827);
  outline: none;
  transition: .2s;
}
.pc-input:focus { border-color: var(--accent, #057A55); background: var(--surface, #fff); box-shadow: 0 0 0 3px rgba(5,122,85,0.12); }
.pc-input::placeholder { color: #9ca3af; }

.pc-send {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent, #057A55), var(--accent-2, #1D5BD8));
  border: none;
  border-radius: 10px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: .2s;
  box-shadow: 0 4px 12px rgba(5,122,85,0.35);
}
.pc-send:hover { transform: scale(1.08); box-shadow: 0 6px 16px rgba(5,122,85,0.45); }
.pc-send:active { transform: scale(0.96); }

/* ── Mobile ── */
@media (max-width: 480px) {
  #phoebeChat { bottom: 16px; right: 16px; }
  .pc-window {
    width: calc(100vw - 32px);
    right: -8px;
    bottom: 68px;
    max-height: 70vh;
    border-radius: 16px;
  }
}
