/* ══════════════════════════════════════════════════════════
   NumerologyGenie Chat Widget
   Matches the cosmic-store-pro dark purple × gold theme
══════════════════════════════════════════════════════════ */

:root {
  --ngc-bg:       #12052a;
  --ngc-bg1:      #1a0a35;
  --ngc-bg2:      #200d40;
  --ngc-accent:   #c9a84c;
  --ngc-accent-l: #e8c97a;
  --ngc-lav:      #a78bfa;
  --ngc-t:        #f0e8ff;
  --ngc-t2:       #c4b0e0;
  --ngc-muted:    #8b6db0;
  --ngc-rim:      rgba(201,168,76,0.25);
  --ngc-radius:   18px;
  --ngc-shadow:   0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(201,168,76,0.15);
  --ngc-w:        360px;
  --ngc-h:        540px;
}

/* ── Widget wrapper ── */
#ngc-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Launcher bubble ── */
#ngc-launcher {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #4c1d95, #6d28d9);
  border: 1px solid rgba(201,168,76,0.35);
  color: #fff;
  border-radius: 50px;
  padding: 12px 20px 12px 14px;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(76,29,149,0.5), 0 0 0 1px rgba(201,168,76,0.2);
  transition: transform 0.25s, box-shadow 0.25s;
  position: relative;
  white-space: nowrap;
}
#ngc-launcher:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 40px rgba(76,29,149,0.6), 0 0 0 1px rgba(201,168,76,0.35);
}
.ngc-launcher-icon {
  font-size: 1.4rem;
  line-height: 1;
  transition: transform 0.3s;
}
.ngc-launcher-label {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
/* Show/hide icons */
.ngc-launcher-close { display: none; }
.ngc-launcher-active .ngc-launcher-open  { display: none; }
.ngc-launcher-active .ngc-launcher-close { display: block; }

/* Pulse dot — "online" indicator */
.ngc-launcher-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 10px; height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #4c1d95;
  animation: ngc-pulse 2s ease-in-out infinite;
}
@keyframes ngc-pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.3); opacity: 0.7; }
}

/* ── Chat panel ── */
#ngc-panel {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: var(--ngc-w);
  max-height: var(--ngc-h);
  background: var(--ngc-bg1);
  border: 1px solid var(--ngc-rim);
  border-radius: var(--ngc-radius);
  box-shadow: var(--ngc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Hidden by default */
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}
#ngc-panel.ngc-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Header ── */
.ngc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 14px;
  background: linear-gradient(135deg, #200d40, #2d1060);
  border-bottom: 1px solid rgba(201,168,76,0.15);
  flex-shrink: 0;
}
.ngc-header-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a84c, #e8c97a);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(201,168,76,0.2);
}
.ngc-header-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #f0e8ff;
}
.ngc-header-status {
  font-size: 0.72rem;
  color: var(--ngc-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.ngc-status-dot {
  width: 7px; height: 7px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  animation: ngc-pulse 2s ease-in-out infinite;
}
.ngc-close {
  margin-left: auto;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--ngc-muted);
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.ngc-close:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* ── Messages ── */
.ngc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(201,168,76,0.2) transparent;
}
.ngc-messages::-webkit-scrollbar { width: 4px; }
.ngc-messages::-webkit-scrollbar-thumb { background: rgba(201,168,76,0.2); border-radius: 2px; }

/* Message bubbles */
.ngc-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.86rem;
  line-height: 1.6;
  animation: ngc-pop 0.22s ease;
}
@keyframes ngc-pop {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.ngc-msg-bot {
  align-self: flex-start;
  background: var(--ngc-bg2);
  border: 1px solid rgba(167,139,250,0.15);
  color: var(--ngc-t2);
  border-bottom-left-radius: 4px;
}
.ngc-msg-bot a { color: var(--ngc-accent); }
.ngc-msg-bot strong { color: var(--ngc-t); }
.ngc-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #4c1d95, #6d28d9);
  color: #f0e8ff;
  border-bottom-right-radius: 4px;
  border: 1px solid rgba(201,168,76,0.15);
}

/* Typing indicator */
.ngc-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
}
.ngc-typing span {
  width: 7px; height: 7px;
  background: var(--ngc-muted);
  border-radius: 50%;
  animation: ngc-bounce 1.2s ease-in-out infinite;
}
.ngc-typing span:nth-child(2) { animation-delay: 0.2s; }
.ngc-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ngc-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-6px); }
}

/* ── Input area ── */
.ngc-input-area {
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(201,168,76,0.1);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  background: var(--ngc-bg);
}

/* Text input row */
.ngc-text-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ngc-text-input {
  flex: 1;
  background: var(--ngc-bg2);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 10px;
  color: var(--ngc-t);
  padding: 10px 13px;
  font-size: 0.86rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ngc-text-input::placeholder { color: var(--ngc-muted); }
.ngc-text-input:focus {
  border-color: rgba(201,168,76,0.5);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.1);
}
.ngc-text-input.ngc-shake {
  animation: ngc-shake 0.4s ease;
  border-color: rgba(248,113,113,0.6) !important;
}
@keyframes ngc-shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-5px); }
  40%,80% { transform: translateX(5px); }
}

/* Textarea */
.ngc-textarea-wrap { flex-direction: column; }
.ngc-textarea {
  width: 100%;
  background: var(--ngc-bg2);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 10px;
  color: var(--ngc-t);
  padding: 10px 13px;
  font-size: 0.85rem;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.ngc-textarea::placeholder { color: var(--ngc-muted); }
.ngc-textarea:focus { border-color: rgba(201,168,76,0.5); }

/* Send button */
.ngc-send-btn {
  background: linear-gradient(135deg, #c9a84c, #e8c97a);
  color: #12052a;
  border: none;
  border-radius: 10px;
  width: 40px; height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
  font-weight: 700;
}
.ngc-send-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(201,168,76,0.4); }
.ngc-send-full {
  width: 100%;
  padding: 11px 16px;
  font-size: 0.85rem;
  border-radius: 10px;
  letter-spacing: 0.02em;
  height: auto;
}

/* Choice buttons */
.ngc-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(201,168,76,0.2) transparent;
}
.ngc-choices::-webkit-scrollbar { width: 4px; }
.ngc-choice-btn {
  background: var(--ngc-bg2);
  border: 1px solid rgba(167,139,250,0.18);
  border-radius: 10px;
  color: var(--ngc-t2);
  padding: 9px 13px;
  text-align: left;
  cursor: pointer;
  font-size: 0.84rem;
  font-family: inherit;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  line-height: 1.4;
}
.ngc-choice-btn:hover {
  background: rgba(201,168,76,0.1);
  border-color: rgba(201,168,76,0.4);
  color: var(--ngc-t);
}

/* Skip button */
.ngc-skip-btn {
  background: none;
  border: none;
  color: var(--ngc-muted);
  font-size: 0.76rem;
  cursor: pointer;
  text-align: center;
  padding: 4px;
  font-family: inherit;
  text-decoration: underline;
  transition: color 0.2s;
}
.ngc-skip-btn:hover { color: var(--ngc-t2); }

/* ── Powered by ── */
.ngc-powered {
  text-align: center;
  font-size: 0.68rem;
  color: rgba(139,109,176,0.5);
  padding: 4px 0 8px;
  background: var(--ngc-bg);
}
.ngc-powered a { color: rgba(201,168,76,0.5); text-decoration: none; }
.ngc-powered a:hover { color: var(--ngc-accent); }

/* ── Mobile ── */
@media (max-width: 480px) {
  #ngc-widget {
    bottom: 14px;
    right: 12px;
    left: 12px;
  }
  #ngc-panel {
    width: 100%;
    max-height: 85vh;
    bottom: calc(100% + 10px);
    right: 0;
  }
  #ngc-launcher {
    float: right;
  }
}

/* ── Accommodate the sticky app banner on mobile ── */
@media (max-width: 768px) {
  body.csp-app-banner-visible #ngc-widget {
    bottom: 80px;
  }
}
