/* ═══════════════════════════════════════════
   PeakFit Chat Widget  –  chat-widget.css
   ═══════════════════════════════════════════ */

:root {
  --cw-accent:   #e8ff00;
  --cw-accent2:  #ff3d00;
  --cw-bg:       #111111;
  --cw-surface:  #1a1a1a;
  --cw-border:   #2a2a2a;
  --cw-white:    #f5f5f0;
  --cw-muted:    #888;
  --cw-user-bg:  #e8ff00;
  --cw-user-fg:  #0a0a0a;
  --cw-bot-bg:   #1e1e1e;
  --cw-radius:   14px;
  --cw-font:     'DM Sans', sans-serif;
  --cw-display:  'Bebas Neue', sans-serif;
}

/* ── Bubble ── */
#pf-chat-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 64px;
  height: 64px;
  background: var(--cw-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(232,255,0,0.35), 0 2px 8px rgba(0,0,0,0.5);
  transition: transform .2s, box-shadow .2s;
  user-select: none;
}
#pf-chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(232,255,0,0.5), 0 2px 8px rgba(0,0,0,0.5);
}
#pf-chat-bubble:active { transform: scale(0.97); }

#pf-chat-bubble svg {
  width: 30px;
  height: 30px;
  fill: #0a0a0a;
  transition: opacity .2s;
}

/* Pulse ring */
#pf-chat-bubble::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(232,255,0,0.35);
  animation: pf-pulse 2.5s ease-out infinite;
}
@keyframes pf-pulse {
  0%   { transform: scale(1);    opacity: 1; }
  70%  { transform: scale(1.3);  opacity: 0; }
  100% { transform: scale(1.3);  opacity: 0; }
}

/* Notification dot */
#pf-bubble-dot {
  position: absolute;
  top: 2px; right: 2px;
  width: 14px; height: 14px;
  background: var(--cw-accent2);
  border-radius: 50%;
  border: 2px solid var(--cw-bg);
  animation: pf-dot-pop .3s ease;
}
@keyframes pf-dot-pop {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ── Panel ── */
#pf-chat-panel {
  position: fixed;
  bottom: 108px;
  right: 28px;
  z-index: 9998;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: var(--cw-bg);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(232,255,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--cw-font);

  /* Slide-up animation */
  transform-origin: bottom right;
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), opacity .18s ease;
}
#pf-chat-panel.pf-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
#pf-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--cw-surface);
  border-bottom: 1px solid var(--cw-border);
  flex-shrink: 0;
}

.pf-header-avatar {
  width: 40px; height: 40px;
  background: var(--cw-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pf-header-avatar svg { width: 22px; height: 22px; fill: #0a0a0a; }

.pf-header-info { flex: 1; }
.pf-header-name {
  font-family: var(--cw-display);
  font-size: 16px;
  letter-spacing: 1px;
  color: var(--cw-white);
  line-height: 1;
}
.pf-header-status {
  font-size: 11px;
  color: #4caf50;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}
.pf-header-status::before {
  content: '';
  width: 6px; height: 6px;
  background: #4caf50;
  border-radius: 50%;
  display: block;
}

#pf-chat-close {
  width: 28px; height: 28px;
  background: transparent;
  border: 1px solid var(--cw-border);
  border-radius: 6px;
  color: var(--cw-muted);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
#pf-chat-close:hover { background: var(--cw-border); color: var(--cw-white); }

/* ── Messages ── */
#pf-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 300px;
  max-height: 360px;
  scroll-behavior: smooth;
}

#pf-chat-messages::-webkit-scrollbar { width: 4px; }
#pf-chat-messages::-webkit-scrollbar-track { background: transparent; }
#pf-chat-messages::-webkit-scrollbar-thumb { background: var(--cw-border); border-radius: 4px; }

/* ── Message bubbles ── */
.pf-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: pf-msg-in .2s ease;
}
@keyframes pf-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

.pf-msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
}

.pf-bot .pf-msg-bubble {
  background: var(--cw-bot-bg);
  color: var(--cw-white);
  border-bottom-left-radius: 4px;
}
.pf-user .pf-msg-bubble {
  background: var(--cw-user-bg);
  color: var(--cw-user-fg);
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.pf-msg-time {
  font-size: 10px;
  color: var(--cw-muted);
  flex-shrink: 0;
  margin-bottom: 2px;
}

/* Typing indicator */
.pf-typing-dots {
  display: flex;
  gap: 4px;
  padding: 4px 2px;
  align-items: center;
}
.pf-typing-dots span {
  width: 6px; height: 6px;
  background: var(--cw-muted);
  border-radius: 50%;
  animation: pf-dot-bounce .9s ease-in-out infinite;
}
.pf-typing-dots span:nth-child(2) { animation-delay: .15s; }
.pf-typing-dots span:nth-child(3) { animation-delay: .30s; }
@keyframes pf-dot-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%            { transform: translateY(-5px); }
}

/* ── Quick reply chips ── */
#pf-chips-area {
  padding: 8px 16px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  min-height: 0;
  transition: min-height .2s;
}

.pf-chip {
  background: transparent;
  border: 1px solid rgba(232,255,0,0.4);
  color: var(--cw-accent);
  font-family: var(--cw-font);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.pf-chip:hover {
  background: rgba(232,255,0,0.1);
  border-color: var(--cw-accent);
}

/* ── Sticky CTA bar ── */
#pf-cta-bar {
  padding: 12px 16px;
  background: var(--cw-surface);
  border-top: 1px solid var(--cw-border);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.pf-cta-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: 8px;
  font-family: var(--cw-font);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all .15s;
  border: none;
  white-space: nowrap;
}

.pf-cta-primary {
  background: var(--cw-accent);
  color: #0a0a0a;
}
.pf-cta-primary:hover { background: #d4eb00; }

.pf-cta-secondary {
  background: transparent;
  border: 1px solid var(--cw-border);
  color: var(--cw-white);
}
.pf-cta-secondary:hover { border-color: var(--cw-accent); color: var(--cw-accent); }

/* ── Input row ── */
#pf-chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--cw-border);
  flex-shrink: 0;
}

#pf-chat-input {
  flex: 1;
  background: var(--cw-surface);
  border: 1px solid var(--cw-border);
  border-radius: 24px;
  padding: 10px 16px;
  font-family: var(--cw-font);
  font-size: 14px;
  color: var(--cw-white);
  outline: none;
  transition: border-color .2s;
}
#pf-chat-input::placeholder { color: var(--cw-muted); }
#pf-chat-input:focus { border-color: rgba(232,255,0,0.5); }

.pf-icon-btn {
  width: 38px; height: 38px;
  background: var(--cw-surface);
  border: 1px solid var(--cw-border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
  font-size: 15px;
}
.pf-icon-btn:hover { background: var(--cw-border); border-color: var(--cw-accent); }

#pf-send-btn {
  width: 38px; height: 38px;
  background: var(--cw-accent);
  border: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, transform .15s;
  flex-shrink: 0;
}
#pf-send-btn:hover { background: #d4eb00; transform: scale(1.05); }
#pf-send-btn svg { width: 16px; height: 16px; fill: #0a0a0a; }

/* ── Disabled state ── */
#pf-chat-input:disabled,
#pf-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#pf-send-btn:disabled { transform: none !important; }

/* ── Large chip variant (signup route choice) ── */
.pf-chip-lg {
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  font-size: 13px;
  border-radius: 10px;
}

/* ── Mobile: full-screen panel ── */
@media (max-width: 767px) {
  #pf-chat-panel {
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
    transform-origin: center bottom;
  }
  #pf-chat-panel.pf-open {
    transform: scale(1) translateY(0);
  }
  #pf-chat-messages {
    min-height: 0;
    max-height: none;
    flex: 1;
  }
  #pf-chat-bubble {
    bottom: 20px;
    right: 20px;
  }
  #pf-chat-bubble.pf-hidden {
    display: none;
  }
}

/* ── Reset button ── */
#pf-reset-btn {
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
#pf-reset-btn:hover { background: rgba(255,255,255,0.15); color: var(--cw-white); }
