/* Stay above theme headers, sticky menus and cookie banners */
#launcher    { z-index: 2147483000 !important; }
#chat-window { z-index: 2147483001 !important; }
#toast       { z-index: 2147483002 !important; }

#launcher, #launcher *, #launcher *::before, #launcher *::after,
#chat-window, #chat-window *, #chat-window *::before, #chat-window *::after,
#toast {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#launcher, #chat-window, #toast {
  --brand: #1a6bff;
  --brand-dark: #1455d4;
  --brand-light: #e8f0ff;
  --text: #1c1c1e;
  --text-2: #6b6b6b;
  --text-3: #a0a0a0;
  --border: #ebebeb;
  font-family: 'Instrument Sans', sans-serif;
  line-height: normal;
  text-align: left;
}

/* ─── LAUNCHER ─── */
#launcher {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

#launcher > * { pointer-events: auto; }

#launcher #nudge {
  background: #fff;
  border-radius: 14px 14px 4px 14px;
  padding: 11px 15px;
  font-size: 13.5px;
  color: var(--text);
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  max-width: 220px;
  line-height: 1.45;
  cursor: pointer;
  animation: gcvlNudgeIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
  transition: opacity 0.3s, transform 0.3s;
}
#launcher #nudge.hide { 
  opacity: 0;
  transform: translateY(8px) scale(0.95);
  pointer-events: none;
  animation: none;
  opacity: 0;
}
@keyframes gcvlNudgeIn {
  from { opacity: 0; transform: translateY(12px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
#launcher #nudge-close {
  display: inline-block; margin-left: 6px;
  opacity: 0.4; font-size: 12px; vertical-align: middle; cursor: pointer;
}
#launcher #nudge-close:hover { opacity: 0.8; }

#launcher #launch-btn {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--brand);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(26,107,255,0.45), 0 1px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: visible;
}
#launcher #launch-btn::before {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.25), transparent 60%);
}
#launcher #launch-btn:hover { transform: scale(1.08); box-shadow: 0 8px 30px rgba(26,107,255,0.5); }
#launcher #launch-btn .ico { position: absolute; transition: opacity 0.2s, transform 0.25s; }
#launcher #launch-btn .ico-chat { opacity: 1; transform: scale(1); }
#launcher #launch-btn .ico-close { opacity: 0; transform: scale(0.5) rotate(-90deg); }
#launcher #launch-btn.open .ico-chat { opacity: 0; transform: scale(0.5) rotate(90deg); }
#launcher #launch-btn.open .ico-close { opacity: 1; transform: scale(1) rotate(0deg); }

#launcher #unread-badge {
  position: absolute; top: -4px; right: -4px; z-index: 1;
  width: 18px; height: 18px;
  background: #ff3b30; border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  font-size: 10px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.3s, transform 0.3s;
  font-family: 'Cabinet Grotesk', sans-serif;
}
#launcher #unread-badge.hide { opacity: 0; transform: scale(0); }

/* ─── WINDOW ─── */
#chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 400px;
  height: 685px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.14), 0 4px 16px rgba(0,0,0,0.07);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 1001;
  transform: translateY(24px) scale(0.94);
  opacity: 0; pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34,1.4,0.64,1), opacity 0.25s ease;
}
#chat-window.open { transform: translateY(0) scale(1); opacity: 1 !important; pointer-events: all; }

/* ─── HERO ─── */
#chat-window .chat-hero {
  background: linear-gradient(145deg, #1a6bff 0%, #0040c8 100%);
  padding: 22px 20px 30px;
  flex-shrink: 0; position: relative; overflow: hidden;
}
#chat-window .chat-hero::before {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,0.07);
  pointer-events: none;
}
#chat-window .chat-hero::after {
  content: ''; position: absolute; bottom: -20px; left: 30px;
  width: 100px; height: 100px; border-radius: 50%;
  background: rgba(255,255,255,0.05);
  pointer-events: none;
}
#chat-window .hero-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  position: relative; z-index: 1;
}
#chat-window .hero-brand { display: flex; align-items: center; gap: 10px; }
#chat-window .hero-avatar {
  width: 38px; height: 38px; border-radius: 50%; overflow: hidden;
  border: 2px solid rgba(255,255,255,0.35); flex-shrink: 0;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
#chat-window .hero-avatar img { width: 100%; height: 100%; object-fit: cover; max-width: none; }
#chat-window .hero-name { color: #fff; font-size: 15px; font-weight: 600; font-family: 'Cabinet Grotesk', sans-serif; }
#chat-window .hero-status { display: flex; align-items: center; gap: 5px; color: rgba(255,255,255,0.75); font-size: 11.5px; }
#chat-window .online-dot { width: 6px; height: 6px; border-radius: 50%; background: #4cd964; }
#chat-window .hero-minimize {
  background: rgba(255,255,255,0.15); border: none;
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
#chat-window .hero-minimize:hover { background: rgba(255,255,255,0.25); }

#chat-window,
#chat-window .home-panel,
#chat-window .chat-tabs,
#chat-window .chat-input-wrap,
#chat-window .msg-row.bot .bubble { background-color: #ffffff !important; }
#chat-window .chat-panel { background-color: #fafafa !important; }
#chat-window .input-row { background-color: #f4f2ee !important; }
#chat-window .input-row:focus-within { background-color: #ffffff !important; }

/* ─── TABS ─── */
#chat-window .chat-tabs {
  display: flex; background: #fff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; margin-top: -28px;
  position: relative; z-index: 2;
}
#chat-window .tab-btn {
  flex: 1; padding: 13px 8px; border: none; background: transparent;
  cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-3);
  font-family: 'Instrument Sans', sans-serif;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: color 0.15s; border-bottom: 2px solid transparent; letter-spacing: 0.01em;
  border-radius: 0; box-shadow: none; text-transform: none;
}
#chat-window .tab-btn svg { opacity: 0.5; transition: opacity 0.15s; }
#chat-window .tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
#chat-window .tab-btn.active svg { opacity: 1; }
#chat-window .tab-btn:hover { color: var(--text); }

/* ─── PANELS ─── */
#chat-window .panel { display: none; flex: 1; flex-direction: column; overflow: hidden; }
#chat-window .panel.active { display: flex; }

/* HOME */
#chat-window .home-panel { overflow-y: auto; padding: 16px; gap: 10px; background: #ffffff; }
#chat-window .home-panel::-webkit-scrollbar { width: 0; }

#chat-window .quick-action {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: 14px;
  border: 1.5px solid var(--border); cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  background: #fff;
}
#chat-window .quick-action:hover { border-color: var(--brand); box-shadow: 0 2px 12px rgba(26,107,255,0.1); transform: translateY(-1px); }
#chat-window .qa-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
#chat-window .qa-icon.blue { background: var(--brand-light); }
#chat-window .qa-icon.green { background: #e8f8ef; }
#chat-window .qa-icon.orange { background: #fff3e8; }
#chat-window .qa-text h4 { font-size: 13.5px; font-weight: 600; color: var(--text); font-family: 'Cabinet Grotesk', sans-serif; line-height: 1.3; }
#chat-window .qa-text p { font-size: 12px; color: var(--text-2); margin-top: 1px; line-height: 1.4; }
#chat-window .qa-arrow { margin-left: auto; color: var(--text-3); }
#chat-window .home-section-title { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; padding: 6px 2px 4px; }

/* CHAT */
#chat-window .chat-panel { background: #fafafa; }
#chat-window #chat-messages { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
#chat-window #chat-messages::-webkit-scrollbar { width: 3px; }
#chat-window #chat-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

#chat-window .msg-row { display: flex; gap: 8px; align-items: flex-end; }
#chat-window .msg-row.user { flex-direction: row-reverse; }
#chat-window .msg-avatar-sm { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; overflow: hidden; background: var(--brand-light); display: flex; align-items: center; justify-content: center; font-size: 14px; }
#chat-window .msg-avatar-sm img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; max-width: none; }
#chat-window .msg-group { display: flex; flex-direction: column; gap: 3px; max-width: 78%; }
#chat-window .msg-row.user .msg-group { align-items: flex-end; }

#chat-window .bubble { padding: 10px 14px; border-radius: 18px; font-size: 13.5px; line-height: 1.55; word-break: break-word; animation: gcvlBubbleIn 0.2s ease; white-space: pre-line; }
@keyframes gcvlBubbleIn { from { opacity: 0; transform: translateY(6px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
#chat-window .msg-row.bot .bubble { background: #fff; color: var(--text); border-bottom-left-radius: 5px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
#chat-window .msg-row.user .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
#chat-window .msg-time { font-size: 10.5px; color: var(--text-3); padding: 0 4px; }

#chat-window .typing-bubble { background: #fff; border-radius: 18px; border-bottom-left-radius: 5px; padding: 13px 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); display: inline-flex; gap: 5px; align-items: center; }
#chat-window .typing-bubble span { width: 7px; height: 7px; background: #c0c0c0; border-radius: 50%; animation: gcvlTypingBounce 1.2s infinite; }
#chat-window .typing-bubble span:nth-child(2) { animation-delay: 0.16s; }
#chat-window .typing-bubble span:nth-child(3) { animation-delay: 0.32s; }
@keyframes gcvlTypingBounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

#chat-window .chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 30px 20px; text-align: center; }
#chat-window .chat-empty-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--brand-light); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
#chat-window .chat-empty h3 { font-size: 15px; font-weight: 700; color: var(--text); font-family: 'Cabinet Grotesk', sans-serif; }
#chat-window .chat-empty p { font-size: 13px; color: var(--text-2); line-height: 1.5; }

#chat-window .suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; flex-shrink: 0; }
#chat-window .suggest-chip { padding: 6px 12px; border-radius: 20px; border: 1.5px solid var(--border); background: #fff; font-size: 12px; color: var(--brand); font-weight: 500; cursor: pointer; font-family: 'Instrument Sans', sans-serif; transition: border-color 0.15s, background 0.15s; }
#chat-window .suggest-chip:hover { border-color: var(--brand); background: var(--brand-light); }

#chat-window .chat-input-wrap { padding: 10px 12px 12px; background: #fff; border-top: 1px solid var(--border); flex-shrink: 0; }
#chat-window .input-row { display: flex; align-items: flex-end; gap: 8px; background: #f4f2ee; border-radius: 14px; padding: 6px 6px 6px 14px; border: 1.5px solid transparent; transition: border-color 0.15s; }
#chat-window .input-row:focus-within { border-color: var(--brand); background: #fff; }
#chat-window #chat-input { flex: 1; border: none; background: transparent; font-size: 13.5px; font-family: 'Instrument Sans', sans-serif; color: var(--text); outline: none; resize: none; max-height: 80px; min-height: 22px; line-height: 1.5; padding: 3px 0; box-shadow: none; width: auto; }
#chat-window #chat-input::placeholder { color: var(--text-3); }
#chat-window .input-actions { display: flex; align-items: center; gap: 4px; }
#chat-window #send-btn { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s, transform 0.15s; flex-shrink: 0; padding: 0; }
#chat-window #send-btn:hover { background: var(--brand-dark); transform: scale(1.05); }
#chat-window #send-btn:disabled { background: #c8d8ff; cursor: not-allowed; transform: none; }

/* ─── TOAST ─── */
#toast { position: fixed; bottom: 104px; right: 28px; background: #1c1c1e; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 13px; opacity: 0; transform: translateY(10px); transition: opacity 0.25s, transform 0.25s; pointer-events: none; z-index: 1002; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
#toast.show { opacity: 1; transform: translateY(0); }

/* ─── PHONES ─── */
@media (max-width: 480px) {
  #chat-window {
    width: calc(100vw - 16px);
    right: 8px;
    height: calc(100vh - 110px);
    max-height: none;
    bottom: 88px;
  }
  #launcher { bottom: 16px; right: 16px; }
}
