﻿/* ─── Guyven Chat Widget ─────────────────────────────────────────────────── */

/* Bubble button */
#guyven-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #F04E23;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(240,78,35,.45);
  transition: bottom 0.42s cubic-bezier(0.23,1,0.32,1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, box-shadow .2s;
  outline: none;
}
#guyven-chat-bubble:hover { transform: scale(1.07); box-shadow: 0 6px 28px rgba(15,52,96,.6); }
#guyven-chat-bubble svg  { width: 28px; height: 28px; fill: #fff; transition: opacity .2s; }
#guyven-chat-bubble .close-icon { display: none; }
#guyven-chat-bubble.open .chat-icon  { display: none; }
#guyven-chat-bubble.open .close-icon { display: block; }

/* Presence dot on bubble */
#guyven-chat-bubble::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border: 2px solid #fff;
  border-radius: 50%;
  animation: gc-pulse 2.5s infinite;
}
@keyframes gc-pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: .55; }
}

/* Push bubble + tooltip above sticky CTA bar when it's visible */
body.sticky-cta-open #guyven-chat-bubble { bottom: 88px; }
body.sticky-cta-open #guyven-proactive-tip { bottom: 156px; }
body.sticky-cta-open #guyven-chat-panel { bottom: 160px; }

/* Proactive tooltip */
#guyven-proactive-tip {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9997;
  max-width: 240px;
  background: #0F3460;
  color: #fff;
  font-family: Inter, sans-serif;
  font-size: 13.5px;
  line-height: 1.4;
  padding: 10px 14px;
  border-radius: 12px 12px 12px 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,.22);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
#guyven-proactive-tip.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#guyven-proactive-tip::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 18px;
  border: 4px solid transparent;
  border-top-color: #0F3460;
}

/* Chat panel */
#guyven-chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 9999;
  width: 360px;
  max-height: 540px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  font-family: Inter, sans-serif;
  overflow: hidden;
  transform: scale(.9) translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
}
#guyven-chat-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Panel header */
.gc-header {
  background: linear-gradient(110deg, #0F3460 0%, #1a3d6e 60%, #A07830 100%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.gc-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.gc-avatar img { width: 32px; height: 32px; object-fit: contain; }
.gc-agent-info { flex: 1; min-width: 0; }
.gc-agent-name { font-size: 14px; font-weight: 600; }
.gc-status {
  font-size: 11.5px;
  opacity: .8;
  display: flex;
  align-items: center;
  gap: 4px;
}
.gc-status::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  animation: gc-pulse 2.5s infinite;
}
.gc-header-actions { display: flex; gap: 4px; }
.gc-header-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color .15s, background .15s;
}
.gc-header-btn:hover { color: #fff; background: rgba(255,255,255,.15); }
.gc-header-btn svg { width: 16px; height: 16px; fill: currentColor; }

/* Messages area */
.gc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.gc-messages::-webkit-scrollbar { width: 4px; }
.gc-messages::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

/* Message bubbles */
.gc-msg {
  display: flex;
  gap: 8px;
  max-width: 85%;
}
.gc-msg.bot { align-self: flex-start; }
.gc-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.gc-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  align-self: flex-end;
}
.gc-msg-avatar img { width: 22px; height: 22px; object-fit: contain; }
.gc-bubble {
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #1e293b;
}
.gc-msg.bot .gc-bubble  { background: #f1f5f9; border-bottom-left-radius: 4px; }
.gc-msg.user .gc-bubble { background: #0F3460; color: #fff; border-bottom-right-radius: 4px; }
.gc-bubble a { color: inherit; text-decoration: underline; }
.gc-bubble strong { font-weight: 600; }

/* Typing indicator */
.gc-typing .gc-bubble {
  background: #f1f5f9;
  padding: 12px 14px;
}
.gc-dots { display: flex; gap: 4px; }
.gc-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: gc-dot-bounce .9s infinite;
}
.gc-dots span:nth-child(2) { animation-delay: .15s; }
.gc-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes gc-dot-bounce {
  0%,80%,100% { transform: translateY(0); }
  40%          { transform: translateY(-6px); }
}

/* Quick replies */
.gc-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 14px 10px;
  flex-shrink: 0;
}
.gc-qr-btn {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1.5px solid #0F3460;
  background: #fff;
  color: #0F3460;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: Inter, sans-serif;
  font-weight: 500;
}
.gc-qr-btn:hover { background: #0F3460; color: #fff; }

/* Lead capture form */
.gc-lead-form {
  padding: 12px 14px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.gc-lead-form p {
  font-size: 12.5px;
  color: #475569;
  margin: 0 0 4px;
}
.gc-lead-form input {
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: Inter, sans-serif;
  color: #1e293b;
  outline: none;
  transition: border-color .15s;
}
.gc-lead-form input:focus { border-color: #0F3460; }
.gc-lead-submit {
  background: #0F3460;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: Inter, sans-serif;
  transition: background .15s;
}
.gc-lead-submit:hover { background: #1a4a80; }

/* Input bar */
.gc-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.gc-input-bar input {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-family: Inter, sans-serif;
  outline: none;
  color: #1e293b;
  transition: border-color .15s;
}
.gc-input-bar input:focus { border-color: #0F3460; }
.gc-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #0F3460;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .15s;
}
.gc-send-btn:hover { background: #1a4a80; transform: scale(1.05); }
.gc-send-btn svg { width: 18px; height: 18px; fill: #fff; }
.gc-escalate-btn {
  font-size: 11.5px;
  color: #64748b;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 12px 8px;
  text-align: center;
  width: 100%;
  transition: color .15s;
  font-family: Inter, sans-serif;
}
.gc-escalate-btn:hover { color: #0F3460; }

/* Mobile */
@media (max-width: 420px) {
  #guyven-chat-panel { width: calc(100vw - 24px); right: 12px; bottom: 80px; }
  #guyven-chat-bubble { right: 12px; bottom: 12px; }
  #guyven-proactive-tip { right: 12px; bottom: 80px; }
}
