/* ═══════════════════════════════════════════════════
   GHT AI Chatbot — Clean Floating Popup Style
   Works reliably on ALL screen sizes
═══════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --ght-primary:       #1b3a6b;
  --ght-primary-light: #2552a0;
  --ght-accent:        #e8a020;
  --ght-bg:            #f0f4f8;
  --ght-white:         #ffffff;
  --ght-text:          #1a202c;
  --ght-muted:         #64748b;
  --ght-border:        #e2e8f0;
  --ght-user-bg:       #1b3a6b;
}

/* ─────────────────────────────────────────
   LAUNCHER — fixed circle, bottom-right
───────────────────────────────────────── */
#ght-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  background: linear-gradient(145deg, var(--ght-primary), var(--ght-primary-light));
  border-radius: 50%;
  box-shadow: 0 4px 20px rgba(27,58,107,0.4), 0 0 0 3px rgba(255,255,255,0.15);
  cursor: pointer;
  z-index: 2147483640;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, box-shadow .2s, opacity .2s;
  animation: ght-float 3s ease-in-out infinite;
}
#ght-launcher::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(232,160,32,0.5);
  animation: ght-ring 2.5s ease-in-out infinite;
}
#ght-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 28px rgba(27,58,107,0.5);
  animation: none;
}
#ght-launcher.ght-launcher-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.5);
}
@keyframes ght-float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-5px)} }
@keyframes ght-ring  { 0%{transform:scale(1);opacity:1} 100%{transform:scale(1.5);opacity:0} }

.ght-tech-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Notification dot */
.ght-notif-dot {
  position: absolute;
  top: 0;
  right: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid white;
  animation: ght-ping 2s ease infinite;
}
@keyframes ght-ping { 0%,100%{transform:scale(1);opacity:1} 60%{transform:scale(1.6);opacity:0} }

/* ─────────────────────────────────────────
   BUBBLE PILL
───────────────────────────────────────── */
.ght-bubble {
  position: fixed;
  bottom: 98px;
  right: 24px;
  background: linear-gradient(135deg, #e8a020, #f5b835);
  color: var(--ght-primary);
  border-radius: 20px 20px 4px 20px;
  padding: 9px 14px 9px 11px;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 4px 18px rgba(232,160,32,0.5);
  animation: ght-bubble-in .5s cubic-bezier(.34,1.56,.64,1) both;
  z-index: 2147483639;
  transition: transform .2s, box-shadow .2s;
  user-select: none;
}
.ght-bubble:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(232,160,32,0.6); }
.ght-bubble-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ght-primary); opacity: .65; flex-shrink: 0;
  animation: ght-pulse 2s ease infinite;
}
@keyframes ght-pulse { 0%,100%{opacity:.65} 50%{opacity:.25} }
.ght-bubble-arrow { font-size: 15px; font-weight: 900; flex-shrink: 0; transition: transform .2s; }
.ght-bubble:hover .ght-bubble-arrow { transform: translateX(2px); }
.ght-bubble::after {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 18px;
  border: 7px solid transparent;
  border-top-color: #f5b835;
  border-bottom: 0;
}
.ght-bubble.ght-hidden { display: none !important; }
@keyframes ght-bubble-in {
  from { opacity:0; transform:translateY(10px) scale(.9) }
  to   { opacity:1; transform:translateY(0) scale(1) }
}

/* ─────────────────────────────────────────
   CHAT WINDOW
   Desktop: fixed 380px wide, bottom-right
   Mobile:  full screen with safe margins
───────────────────────────────────────── */
#ght-window {
  position: fixed;
  z-index: 2147483641;
  background: var(--ght-white);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Hidden state */
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .3s cubic-bezier(.32,.72,0,1);

  /* ── DESKTOP layout ── */
  bottom: 100px;
  right: 24px;
  width: 360px;
  height: 500px;
  border-radius: 18px;
  box-shadow: 0 8px 40px rgba(27,58,107,0.25), 0 0 0 1px rgba(27,58,107,0.1);
  transform: translateY(20px) scale(0.96);
}
#ght-window.ght-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* ── HEADER ── */
.ght-header {
  background: linear-gradient(135deg, var(--ght-primary), var(--ght-primary-light));
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  flex-shrink: 0;
}
.ght-header-avatar {
  width: 38px; height: 38px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.2);
  overflow: hidden;
}
.ght-header-info { flex: 1; min-width: 0; }
.ght-name { font-weight: 700; font-size: 13.5px; }
.ght-sub  { font-size: 11px; opacity: .8; display: flex; align-items: center; gap: 4px; margin-top: 1px; }
.ght-online-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; flex-shrink: 0; }
.ght-close-btn {
  background: rgba(255,255,255,0.15); border: none; color: white;
  width: 28px; height: 28px; border-radius: 7px; cursor: pointer;
  font-size: 14px; display: flex; align-items: center; justify-content: center;
  transition: background .2s; flex-shrink: 0;
}
.ght-close-btn:hover { background: rgba(255,255,255,0.28); }

/* ── LEAD FORM ── scrollable content, sticky footer */
#ght-lead-form {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  background: var(--ght-bg);
}
#ght-lead-form::-webkit-scrollbar { width: 3px; }
#ght-lead-form::-webkit-scrollbar-thumb { background: var(--ght-border); border-radius: 3px; }

.ght-lead-body {
  padding: 14px 14px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.ght-lead-intro {
  background: white;
  border-radius: 10px;
  border: 1px solid var(--ght-border);
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ght-text);
  flex-shrink: 0;
}
.ght-lead-intro strong { color: var(--ght-primary); }
.ght-lead-fields {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}
.ght-lead-input {
  border: 1.5px solid var(--ght-border);
  border-radius: 9px;
  padding: 10px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--ght-text);
  outline: none;
  background: white;
  transition: border-color .2s;
  width: 100%;
  box-sizing: border-box;
  -webkit-appearance: none;
}
.ght-lead-input:focus { border-color: var(--ght-primary-light); }
.ght-lead-input::placeholder { color: var(--ght-muted); }
.ght-lead-err-row {
  font-size: 11.5px; color: #ef4444;
  background: #fef2f2; border-radius: 7px;
  padding: 7px 10px; border: 1px solid #fecaca;
  flex-shrink: 0;
}

/* Sticky footer inside lead form */
.ght-lead-footer {
  position: sticky;
  bottom: 0;
  background: var(--ght-bg);
  padding: 10px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.ght-lead-submit {
  background: linear-gradient(135deg, var(--ght-primary), var(--ght-primary-light));
  color: white; border: none; border-radius: 10px;
  padding: 13px; font-family: 'Inter', sans-serif;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: opacity .2s, transform .15s;
  box-shadow: 0 3px 12px rgba(27,58,107,0.3);
  width: 100%;
}
.ght-lead-submit:hover { opacity: .9; transform: translateY(-1px); }
.ght-lead-skip {
  text-align: center; font-size: 12px; color: var(--ght-muted);
  cursor: pointer; text-decoration: underline; padding: 2px 0;
}
.ght-lead-skip:hover { color: var(--ght-primary); }

/* ── MESSAGES ── */
.ght-msgs {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--ght-bg);
  scroll-behavior: smooth;
}
.ght-msgs::-webkit-scrollbar { width: 3px; }
.ght-msgs::-webkit-scrollbar-thumb { background: var(--ght-border); border-radius: 3px; }
.ght-msg { display: flex; gap: 6px; align-items: flex-end; animation: ght-fadeUp .2s ease both; }
@keyframes ght-fadeUp { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.ght-msg.ght-bot  { flex-direction: row; }
.ght-msg.ght-user { flex-direction: row-reverse; }
.ght-av {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; background: var(--ght-primary); color: white;
}
.ght-av.ght-user { background: #e2e8f0; font-size: 12px; }
.ght-bbl {
  max-width: 78%; padding: 9px 12px; border-radius: 14px;
  font-size: 13px; line-height: 1.55; font-family: 'Inter', sans-serif;
}
.ght-bbl.ght-bot {
  background: var(--ght-white); color: var(--ght-text);
  border: 1px solid var(--ght-border); border-bottom-left-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.ght-bbl.ght-user { background: var(--ght-user-bg); color: white; border-bottom-right-radius: 3px; }

/* Typing */
.ght-typing-wrap { display: flex; gap: 6px; align-items: flex-end; }
.ght-typing-bbl {
  background: var(--ght-white); border: 1px solid var(--ght-border);
  border-radius: 14px; border-bottom-left-radius: 3px;
  padding: 10px 13px; display: flex; gap: 4px; align-items: center;
}
.ght-typing-bbl span { width: 5px; height: 5px; border-radius: 50%; background: var(--ght-muted); animation: ght-tb 1.2s infinite; }
.ght-typing-bbl span:nth-child(2) { animation-delay: .2s; }
.ght-typing-bbl span:nth-child(3) { animation-delay: .4s; }
@keyframes ght-tb { 0%,80%,100%{transform:translateY(0);opacity:.4} 40%{transform:translateY(-4px);opacity:1} }

/* Mid-chat lead */
.ght-mid-lead { border-top: 1px solid var(--ght-border); background: linear-gradient(135deg,#f0f4ff,#fffbf0); flex-shrink: 0; animation: ght-slideUp .3s ease both; }
@keyframes ght-slideUp { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.ght-mid-lead-inner { padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.ght-mid-lead-title { font-weight: 700; font-size: 12.5px; color: var(--ght-primary); }
.ght-mid-lead-sub   { font-size: 11.5px; color: var(--ght-muted); line-height: 1.4; }
.ght-mid-field-row  { display: flex; flex-direction: column; gap: 5px; }
.ght-mid-field-row input { border: 1.5px solid var(--ght-border); border-radius: 8px; padding: 7px 10px; font-family: inherit; font-size: 12.5px; color: var(--ght-text); outline: none; background: white; transition: border-color .2s; width: 100%; }
.ght-mid-field-row input:focus { border-color: var(--ght-primary-light); }
.ght-mid-field-row input::placeholder { color: var(--ght-muted); }
.ght-mid-lead-err   { font-size: 10.5px; color: #ef4444; }
.ght-mid-lead-actions { display: flex; align-items: center; gap: 10px; }
.ght-mid-submit { background: var(--ght-primary); color: white; border: none; border-radius: 8px; padding: 7px 14px; font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer; flex-shrink: 0; }
.ght-mid-dismiss { font-size: 11px; color: var(--ght-muted); cursor: pointer; text-decoration: underline; }
.ght-mid-lead.ght-submitted .ght-mid-lead-inner { align-items: center; }
.ght-mid-success { font-size: 12.5px; color: #16a34a; font-weight: 600; text-align: center; }

/* Chips */
.ght-chips { padding: 7px 10px; background: var(--ght-white); border-top: 1px solid var(--ght-border); display: flex; flex-wrap: wrap; gap: 5px; flex-shrink: 0; }
.ght-chip { background: #fef3e2; color: #92400e; border: 1px solid #fcd34d; padding: 4px 9px; border-radius: 12px; font-size: 11px; font-weight: 500; cursor: pointer; transition: all .18s; white-space: nowrap; }
.ght-chip:hover { background: #fde68a; }

/* Input */
.ght-input-area { padding: 9px 10px; background: var(--ght-white); border-top: 1px solid var(--ght-border); display: flex; gap: 7px; align-items: flex-end; flex-shrink: 0; }
#ghtInput { flex: 1; border: 1.5px solid var(--ght-border); border-radius: 10px; padding: 9px 11px; font-family: 'Inter', sans-serif; font-size: 14px; color: var(--ght-text); resize: none; outline: none; min-height: 38px; max-height: 80px; transition: border-color .2s; background: var(--ght-bg); -webkit-appearance: none; }
#ghtInput:focus { border-color: var(--ght-primary-light); background: white; }
#ghtInput::placeholder { color: var(--ght-muted); }
.ght-send-btn { width: 38px; height: 38px; flex-shrink: 0; border-radius: 10px; background: var(--ght-primary); color: white; border: none; cursor: pointer; font-size: 15px; display: flex; align-items: center; justify-content: center; transition: background .2s; }
.ght-send-btn:hover { background: var(--ght-primary-light); }
.ght-send-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Footer */
.ght-powered { padding: 5px; text-align: center; font-size: 9.5px; color: var(--ght-muted); background: var(--ght-white); border-top: 1px solid var(--ght-border); flex-shrink: 0; }
.ght-powered a { color: var(--ght-primary); text-decoration: none; font-weight: 600; }

.ght-hidden { display: none !important; }

/* ─────────────────────────────────────────
   MOBILE — full screen popup with top margin
   leaves 80px at top so user sees the page
───────────────────────────────────────── */
@media (max-width: 600px) {
  /* Launcher — smaller, above footer */
  #ght-launcher {
    bottom: 20px;
    right: 16px;
    width: 56px;
    height: 56px;
    z-index: 2147483640;
  }
  /* Bubble pill */
  .ght-bubble {
    bottom: 86px;
    right: 16px;
    font-size: 11px;
    padding: 8px 12px 8px 10px;
    gap: 6px;
  }
  /* Chat window — full screen minus top gap */
  #ght-window {
    top: 60px;         /* leaves header visible */
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: auto;      /* fills remaining space */
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -4px 30px rgba(27,58,107,0.2);
    transform: translateY(100%); /* slides up from bottom */
  }
  #ght-window.ght-open {
    transform: translateY(0);
  }
  /* Bigger touch targets */
  .ght-lead-input {
    padding: 13px 12px;
    font-size: 16px; /* prevents iOS zoom on focus */
  }
  #ghtInput { font-size: 16px; } /* prevents iOS zoom */
  .ght-lead-submit { padding: 14px; font-size: 15px; }
  .ght-lead-skip { font-size: 13px; padding: 6px 0 4px; }
  .ght-bbl { font-size: 13.5px; }
  .ght-chip { font-size: 11.5px; padding: 5px 10px; }
}

@media (max-width: 360px) {
  #ght-window { top: 55px; }
  .ght-lead-input { padding: 12px 11px; }
}
