/* ══════════════════════════════════════════════════════════════
   Vault Guide — AI Chat Panel Styles
   Trigger: #scarlet-torch (replaces Tidio)
   ══════════════════════════════════════════════════════════════ */

/* ── Chat panel ────────────────────────────────────────────────── */
#vg-panel {
  position: fixed !important;
  bottom: 100px;
  right: 24px;
  width: 360px;
  z-index: 9999990;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  border: 1px solid rgba(212,165,116,.22);
  border-radius: 18px;
  box-shadow:
    0 28px 72px rgba(0,0,0,.88),
    0 0 0 1px rgba(255,107,53,.07),
    0 0 40px rgba(255,107,53,.04) inset;
  overflow: hidden;
  transform: translateY(16px) scale(.96);
  opacity: 0;
  pointer-events: none;
  transition: transform .24s cubic-bezier(.18,.88,.32,1.08), opacity .2s ease;
}
#vg-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* ── Header ────────────────────────────────────────────────────── */
.vg-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  background: linear-gradient(135deg, rgba(255,107,53,.1) 0%, transparent 70%);
  border-bottom: 1px solid rgba(212,165,116,.1);
  flex-shrink: 0;
}
.vg-header-icon { font-size: 1.25rem; line-height: 1; flex-shrink: 0; }
.vg-header-text { flex: 1; min-width: 0; }
.vg-title {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: .9rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -.01em;
  line-height: 1.15;
}
.vg-subtitle {
  font-size: .59rem;
  color: rgba(212,165,116,.55);
  letter-spacing: .07em;
  text-transform: uppercase;
  margin-top: 1px;
}
.vg-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 9px rgba(34,197,94,.75);
  flex-shrink: 0;
  animation: vg-pulse-dot 2.4s ease-in-out infinite;
}
@keyframes vg-pulse-dot {
  0%, 100% { box-shadow: 0 0 6px rgba(34,197,94,.5); }
  50%       { box-shadow: 0 0 14px rgba(34,197,94,.9); }
}
.vg-close {
  background: none; border: none;
  color: rgba(255,255,255,.28);
  font-size: 1.1rem; line-height: 1;
  cursor: pointer; padding: 5px;
  border-radius: 50%; flex-shrink: 0;
  transition: color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.vg-close:hover { color: rgba(255,255,255,.7); background: rgba(255,255,255,.06); }

/* ── Message list ───────────────────────────────────────────────── */
.vg-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 13px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  min-height: 200px;
  max-height: 320px;
}
.vg-msgs::-webkit-scrollbar { width: 3px; }
.vg-msgs::-webkit-scrollbar-thumb { background: rgba(212,165,116,.28); border-radius: 3px; }

/* ── Message rows ───────────────────────────────────────────────── */
.vg-msg {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  max-width: 90%;
}
.vg-msg.bot  { align-self: flex-start; }
.vg-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.vg-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b35 0%, #d4a574 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(255,107,53,.35);
}

.vg-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: .77rem;
  line-height: 1.58;
  word-break: break-word;
  font-family: 'Inter', system-ui, sans-serif;
}
.vg-msg.bot .vg-bubble {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
  color: rgba(255,255,255,.84);
  border-radius: 4px 14px 14px 14px;
}
.vg-msg.user .vg-bubble {
  background: linear-gradient(135deg, rgba(255,107,53,.2), rgba(212,165,116,.16));
  border: 1px solid rgba(212,165,116,.22);
  color: #fde8d4;
  border-radius: 14px 4px 14px 14px;
}

/* ── Typing animation ───────────────────────────────────────────── */
.vg-typing-dots {
  display: flex; gap: 4px; align-items: center;
  padding: 2px 0;
}
.vg-typing-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(212,165,116,.55);
  animation: vg-dot 1.3s ease-in-out infinite;
}
.vg-typing-dots span:nth-child(2) { animation-delay: .18s; }
.vg-typing-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes vg-dot {
  0%, 55%, 100% { opacity: .3; transform: translateY(0) scale(.9); }
  27%            { opacity: 1;  transform: translateY(-4px) scale(1.1); }
}

/* ── Input row ──────────────────────────────────────────────────── */
.vg-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,.055);
  flex-shrink: 0;
  background: rgba(0,0,0,.18);
}
#vg-input {
  flex: 1;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(212,165,116,.14);
  border-radius: 10px;
  padding: 9px 12px;
  color: #fff;
  font-size: .77rem;
  font-family: 'Inter', system-ui, sans-serif;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
#vg-input:focus {
  border-color: rgba(255,107,53,.4);
  box-shadow: 0 0 0 2px rgba(255,107,53,.09);
}
#vg-input::placeholder { color: rgba(255,255,255,.18); }
#vg-send {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff6b35 0%, #d4a574 100%);
  border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; align-self: flex-end;
  transition: opacity .18s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
#vg-send:hover  { opacity: .88; }
#vg-send:active { transform: scale(.93); }
#vg-send svg    { pointer-events: none; }

/* ── Auto-open nudge badge ─────────────────────────────────────── */
#vg-nudge {
  position: fixed;
  /* sits level with the torch cup, to the left of the torch */
  bottom: 48px;
  right: 96px; /* torch is ~84px from right edge; give 12px gap */
  background: linear-gradient(135deg, #ff6b35 0%, #b85a1a 100%);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  font-family: 'Inter', system-ui, sans-serif;
  padding: 8px 14px;
  border-radius: 22px;
  box-shadow: 0 4px 22px rgba(255,107,53,.48), 0 0 0 1px rgba(255,255,255,.1) inset;
  z-index: 9999989;
  white-space: nowrap;
  cursor: pointer;
  transform: translateX(8px) scale(.92);
  opacity: 0;
  pointer-events: none;
  transition: transform .32s cubic-bezier(.18,.88,.32,1.08), opacity .25s ease;
  -webkit-tap-highlight-color: transparent;
}
/* Arrow points right toward the torch */
#vg-nudge::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -6px;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 6px solid #b85a1a;
}
#vg-nudge.show {
  transform: translateX(0) scale(1);
  opacity: 1;
  pointer-events: auto;
  animation: vg-nudge-bob 2.4s ease-in-out 0.4s infinite;
}
@keyframes vg-nudge-bob {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-4px) scale(1); }
}
@media (max-width: 600px) {
  #vg-nudge {
    /* on mobile torch is at right:14px, scaled .82 so ~46px wide */
    bottom: 82px;
    right: 68px;
    font-size: .68rem;
    padding: 7px 12px;
  }
}

/* ── Hide the old ai_chat.php CSS-torch trigger ────────────────── */
/* #scarlet-orb duplicates the vault-guide trigger on desktop — suppress it */
#scarlet-orb, #scarlet-orb-tip { display: none !important; }

/* ── Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  #vg-panel {
    bottom: 0; right: 0; left: 0;
    width: 100%;
    max-height: 80vh;
    border-radius: 20px 20px 0 0;
    border-left: none; border-right: none; border-bottom: none;
  }
  .vg-msgs { max-height: calc(80vh - 140px); }
}
