/* PHR Wellness – Kristin Chatbot CSS v2.0 */
:root {
  --phr-teal:  #0D8FA0;
  --phr-navy:  #0D2240;
  --phr-cyan:  #14E8CC;
  --phr-gold:  #C9A84C;
  --phr-green: #22C55E;
}

/* ── Widget container ── */
#phr-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'Nunito Sans', 'Helvetica Neue', Arial, sans-serif;
}

/* ── Greeting bubble ── */
#phr-chat-bubble {
  position: absolute;
  bottom: 80px;
  right: 0;
  max-width: 260px;
  background: var(--phr-navy);
  color: white;
  padding: 12px 16px;
  border-radius: 16px 16px 4px 16px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  box-shadow: 0 8px 24px rgba(13,34,64,0.35);
  cursor: pointer;
}
#phr-chat-bubble-close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #64748B;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  padding: 0;
}

/* ── Pulse rings ── */
.phr-pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50px;
  background: rgba(13,143,160,0.35);
  animation: phrPulse 2.2s ease-out infinite;
  pointer-events: none;
}
.phr-pulse-2 { animation-delay: 0.7s; background: rgba(13,143,160,0.2); }
@keyframes phrPulse {
  0%   { transform: scale(1); opacity: 0.8; }
  70%  { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ── Trigger button ── */
#phr-chat-trigger {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--phr-teal), #0A7080);
  border: none;
  border-radius: 50px;
  padding: 6px 18px 6px 6px;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(13,143,160,0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#phr-chat-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(13,143,160,0.6);
}
#phr-chat-trigger:active { transform: scale(0.97); }

.phr-trigger-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  border: 2px solid rgba(255,255,255,0.5);
  flex-shrink: 0;
}
.phr-trigger-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-right: 4px;
}
.phr-trigger-text strong {
  color: white;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}
.phr-trigger-text span {
  color: rgba(255,255,255,0.75);
  font-size: 11px;
  line-height: 1.3;
}

/* Notification badge */
.phr-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #EF4444;
  color: white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(239,68,68,0.6);
  animation: phrBadgeBounce 1.5s ease-in-out 3s 3;
}
@keyframes phrBadgeBounce {
  0%,100% { transform: scale(1) translateY(0); }
  30%     { transform: scale(1.25) translateY(-3px); }
  60%     { transform: scale(0.9) translateY(1px); }
}

/* Online dot */
.phr-online-dot {
  position: absolute;
  bottom: 4px;
  left: 38px;
  width: 13px;
  height: 13px;
  background: var(--phr-green);
  border-radius: 50%;
  border: 2px solid white;
}

/* ── Chat window ── */
#phr-chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: min(380px, calc(100vw - 32px));
  max-height: min(580px, calc(100vh - 100px));
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(13,34,64,0.25), 0 8px 24px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
}

/* Header */
.phr-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--phr-navy), #0f3060);
  flex-shrink: 0;
}
.phr-header-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.phr-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  border: 2px solid rgba(255,255,255,0.3);
}
.phr-online-dot-sm {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  background: var(--phr-green);
  border-radius: 50%;
  border: 2px solid white;
}
.phr-header-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.phr-header-info strong {
  color: white;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}
.phr-header-info span {
  color: rgba(255,255,255,0.65);
  font-size: 11px;
  line-height: 1.3;
}
.phr-status-text {
  color: var(--phr-green) !important;
  font-weight: 700 !important;
}
.phr-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.phr-header-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.15s;
}
.phr-header-btn:hover { background: var(--phr-teal); color: white; }

/* Messages area */
#phr-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #F8F9FA;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Message bubbles */
.phr-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.phr-msg.user { flex-direction: row-reverse; }
.phr-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  flex-shrink: 0;
}
.phr-msg-bubble {
  max-width: 78%;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.phr-msg.assistant .phr-msg-bubble {
  background: white;
  color: #334155;
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.phr-msg.user .phr-msg-bubble {
  background: var(--phr-teal);
  color: white;
  border-radius: 18px 18px 4px 18px;
}

/* Typing indicator */
.phr-typing {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.phr-typing-dots {
  background: white;
  border-radius: 18px 18px 18px 4px;
  padding: 12px 16px;
  display: flex;
  gap: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.phr-typing-dot {
  width: 7px;
  height: 7px;
  background: #94A3B8;
  border-radius: 50%;
  animation: phrDotBounce 1.2s ease-in-out infinite;
}
.phr-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.phr-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes phrDotBounce {
  0%,60%,100% { transform: translateY(0); }
  30%         { transform: translateY(-5px); }
}

/* Disclaimer */
.phr-chat-disclaimer {
  padding: 6px 16px;
  font-size: 10px;
  color: #94A3B8;
  background: #F0F2F5;
  border-top: 1px solid #E2E8F0;
  text-align: center;
  flex-shrink: 0;
}
.phr-chat-disclaimer a { color: var(--phr-teal); }

/* Input row */
.phr-chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: white;
  border-top: 1px solid #E2E8F0;
  flex-shrink: 0;
}
#phr-chat-input {
  flex: 1;
  padding: 10px 16px;
  border-radius: 50px;
  border: 1.5px solid #E2E8F0;
  font-size: 13px;
  color: #334155;
  background: #F0F2F5;
  outline: none;
  transition: border-color 0.15s;
}
#phr-chat-input:focus { border-color: var(--phr-teal); background: white; }
#phr-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--phr-teal);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
#phr-chat-send:hover  { background: #0A7080; }
#phr-chat-send:active { transform: scale(0.93); }

/* Mobile responsive */
@media (max-width: 480px) {
  #phr-chat-widget { bottom: 16px; right: 12px; }
  #phr-chat-window { bottom: 72px; right: -12px; width: calc(100vw - 16px); }
  .phr-trigger-text span:last-child { display: none; }
}
