/* ═══════════════════════════════════════════
   VINDEX PRIVATUS — CLAUDE CHATBOT WIDGET
   ═══════════════════════════════════════════ */

/* ── LAUNCHER BUTTON ── */
.vp-chat-launcher {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 1001;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1B3A5C, #0d5c6b);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(27, 58, 92, 0.5), 0 0 0 0 rgba(212, 175, 55, 0.4);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: vp-chat-pulse 3s ease-in-out infinite;
}
.vp-chat-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(27, 58, 92, 0.6);
  animation: none;
}
.vp-chat-launcher.active {
  animation: none;
  transform: scale(1);
  background: linear-gradient(135deg, #2a2b33, #1a1b21);
}
.vp-chat-launcher svg {
  width: 26px;
  height: 26px;
  fill: #D4AF37;
  transition: transform 0.3s;
}
.vp-chat-launcher.active svg {
  transform: rotate(90deg);
}

/* Override when chat launcher is inside floating-ctas stack */
.floating-ctas .vp-chat-launcher {
  position: relative;
  top: auto;
  bottom: auto;
  left: auto;
  right: auto;
  z-index: auto;
  width: 52px;
  height: 52px;
}

@keyframes vp-chat-pulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(27, 58, 92, 0.5), 0 0 0 0 rgba(212, 175, 55, 0.3); }
  50% { box-shadow: 0 4px 24px rgba(27, 58, 92, 0.5), 0 0 0 12px rgba(212, 175, 55, 0); }
}

/* ── NOTIFICATION BADGE ── */
.vp-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #e74c3c;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.55rem;
  font-weight: 600;
  color: #fff;
  border: 2px solid #06070a;
}

/* ── CHAT WINDOW ── */
.vp-chat-window {
  position: fixed;
  bottom: 6.5rem;
  left: 2rem;
  z-index: 1000;
  width: 380px;
  max-height: 520px;
  background: #0a0b0f;
  border: 1px solid rgba(27, 58, 92, 0.4);
  border-radius: 16px;
  overflow: hidden;
  display: none;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 1px rgba(212, 175, 55, 0.2);
}
.vp-chat-window.open {
  display: flex;
  animation: vp-chat-slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes vp-chat-slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── HEADER ── */
.vp-chat-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #1B3A5C, #0d5c6b);
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  flex-shrink: 0;
}
.vp-chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4AF37, #b08d57);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 700;
  font-size: 1rem;
  color: #1B3A5C;
  flex-shrink: 0;
}
.vp-chat-header-info {
  flex: 1;
  min-width: 0;
}
.vp-chat-header-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #f0eeea;
  line-height: 1.2;
}
.vp-chat-header-status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.58rem;
  color: #00E5C7;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.vp-chat-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00E5C7;
  animation: vp-status-blink 2s ease-in-out infinite;
}
@keyframes vp-status-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.vp-chat-close {
  background: none;
  border: none;
  color: #8a8b95;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}
.vp-chat-close:hover {
  color: #f0eeea;
}

/* ── MESSAGE BODY ── */
.vp-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 280px;
  max-height: 340px;
  scrollbar-width: thin;
  scrollbar-color: #2a2b33 transparent;
}
.vp-chat-body::-webkit-scrollbar { width: 4px; }
.vp-chat-body::-webkit-scrollbar-track { background: transparent; }
.vp-chat-body::-webkit-scrollbar-thumb { background: #2a2b33; border-radius: 4px; }

/* ── MESSAGES ── */
.vp-msg {
  max-width: 85%;
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  font-size: 0.82rem;
  line-height: 1.55;
  word-wrap: break-word;
  animation: vp-msg-appear 0.25s ease-out;
}
@keyframes vp-msg-appear {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.vp-msg-bot {
  align-self: flex-start;
  background: #101116;
  color: #e2e0dc;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(42, 43, 51, 0.5);
}
.vp-msg-bot a {
  color: #00E5C7;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.vp-msg-bot a:hover {
  color: #3ab8cc;
}
.vp-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(0, 229, 199, 0.15), rgba(0, 229, 199, 0.08));
  color: #f0eeea;
  border-bottom-right-radius: 4px;
  border: 1px solid rgba(0, 229, 199, 0.2);
}

/* ── TYPING INDICATOR ── */
.vp-typing {
  display: flex;
  gap: 4px;
  padding: 0.65rem 0.85rem;
  align-self: flex-start;
  background: #101116;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(42, 43, 51, 0.5);
}
.vp-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4a4b55;
  animation: vp-typing-bounce 1.4s ease-in-out infinite;
}
.vp-typing span:nth-child(2) { animation-delay: 0.2s; }
.vp-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes vp-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); background: #4a4b55; }
  30% { transform: translateY(-6px); background: #00E5C7; }
}

/* ── QUICK REPLIES ── */
.vp-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-self: flex-start;
  margin-top: 0.2rem;
  animation: vp-msg-appear 0.3s ease-out;
}
.vp-quick-btn {
  background: rgba(27, 58, 92, 0.3);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: #D4AF37;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  padding: 0.4rem 0.75rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}
.vp-quick-btn:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: #D4AF37;
  color: #f0eeea;
}

/* ── INPUT BAR ── */
.vp-chat-input-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: #06070a;
  border-top: 1px solid rgba(42, 43, 51, 0.4);
  flex-shrink: 0;
}
.vp-chat-input {
  flex: 1;
  background: #101116;
  border: 1px solid rgba(42, 43, 51, 0.5);
  border-radius: 20px;
  padding: 0.55rem 0.85rem;
  color: #f0eeea;
  font-family: 'Libre Franklin', sans-serif;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.2s;
}
.vp-chat-input::placeholder {
  color: #4a4b55;
}
.vp-chat-input:focus {
  border-color: rgba(0, 229, 199, 0.4);
}
.vp-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4AF37, #b08d57);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.vp-chat-send:hover {
  background: linear-gradient(135deg, #e0c060, #D4AF37);
  transform: scale(1.05);
}
.vp-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.vp-chat-send svg {
  width: 16px;
  height: 16px;
  fill: #1B3A5C;
}

/* ── DISCLAIMER ── */
.vp-chat-disclaimer {
  padding: 0.35rem 1rem 0.5rem;
  background: #06070a;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.52rem;
  color: #4a4b55;
  text-align: center;
  letter-spacing: 0.03em;
  line-height: 1.4;
  flex-shrink: 0;
}

/* ── LEAD CAPTURE FORM IN CHAT ── */
.vp-chat-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0;
  animation: vp-msg-appear 0.3s ease-out;
}
.vp-chat-form input {
  background: #101116;
  border: 1px solid rgba(42, 43, 51, 0.5);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  color: #f0eeea;
  font-family: 'Libre Franklin', sans-serif;
  font-size: 0.78rem;
  outline: none;
  transition: border-color 0.2s;
}
.vp-chat-form input::placeholder {
  color: #4a4b55;
}
.vp-chat-form input:focus {
  border-color: rgba(0, 229, 199, 0.4);
}
.vp-chat-form textarea {
  background: #101116;
  border: 1px solid rgba(42, 43, 51, 0.5);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  color: #f0eeea;
  font-family: 'Libre Franklin', sans-serif;
  font-size: 0.78rem;
  outline: none;
  resize: vertical;
  min-height: 50px;
  transition: border-color 0.2s;
}
.vp-chat-form textarea::placeholder {
  color: #4a4b55;
}
.vp-chat-form textarea:focus {
  border-color: rgba(0, 229, 199, 0.4);
}
.vp-chat-form-btn {
  background: linear-gradient(135deg, #D4AF37, #b08d57);
  color: #1B3A5C;
  border: none;
  border-radius: 8px;
  padding: 0.55rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}
.vp-chat-form-btn:hover {
  background: linear-gradient(135deg, #e0c060, #D4AF37);
}
.vp-chat-form-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .vp-chat-window {
    left: 0;
    right: 0;
    bottom: auto;
    top: 0;
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid rgba(27, 58, 92, 0.4);
    z-index: 9999;
    /* Push below iPhone status bar / notch */
    padding-top: env(safe-area-inset-top, 0px);
  }
  .vp-chat-body {
    max-height: 50vh;
    max-height: 50dvh;
    min-height: 200px;
  }
  .vp-chat-launcher {
    bottom: 1.25rem;
    left: 1.25rem;
    width: 48px;
    height: 48px;
  }
  .floating-ctas .vp-chat-launcher {
    top: auto;
    bottom: auto;
    left: auto;
    right: auto;
    width: 48px;
    height: 48px;
  }
  .vp-chat-launcher svg {
    width: 22px;
    height: 22px;
  }

  /* Prevent iOS auto-zoom on input focus — inputs must be >= 16px */
  .vp-chat-input {
    font-size: 16px;
    touch-action: manipulation;
  }
  .vp-chat-form input,
  .vp-chat-form textarea {
    font-size: 16px;
    touch-action: manipulation;
  }

  /* Slide down from top instead of up from bottom */
  .vp-chat-window.open {
    bottom: auto;
    top: 0;
    animation: vp-chat-slideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

@keyframes vp-chat-slideDown {
  from { opacity: 0; transform: translateY(-16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── FULL-SCREEN MOBILE (very small screens) ── */
@media (max-width: 420px) {
  .vp-chat-window {
    right: 0;
    left: 0;
    bottom: auto;
    top: 0;
    border-radius: 0;
    max-height: 100vh;
    max-height: 100dvh;
  }
  .vp-chat-body {
    max-height: 50dvh;
    flex: 1;
  }
}
