/* ============================
 * Vendyl Chat – Floating UI (Unified)
 * ============================ */

/* ===== Bubble (V-Chat pill) ===== */
#vendyl-chat-bubble {
  position: fixed;
  right: 24px;
  bottom: 80px; /* moved up so it clears cart */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 26px;
  background: #ffffff;
  color: #266be3;
  font-weight: 600;
  font-size: 15px;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  border-radius: 999px;
  border: 3px solid #266be3;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(38,107,227,0.18);
  z-index: 999998;
  transition: all 0.25s ease;
  white-space: nowrap;
  line-height: 1;
  min-height: 44px;
}

/* [CHANGE] Remove decorative chevrons from the V-Chat pill */
#vendyl-chat-bubble::before,
#vendyl-chat-bubble::after {
  content: '';
  font-weight: 700;
  font-size: 13px;
  color: #266be3;
  opacity: 0.9;
  margin: 0;
}

#vendyl-chat-bubble:hover {
  background: #f3f6ff;
  box-shadow: 0 14px 32px rgba(38,107,227,0.26);
  transform: translateY(-2px);
}

/* Soft pulse */
@keyframes vendylSoftPulse {
  0%, 80%, 100% { box-shadow: 0 10px 26px rgba(38,107,227,0.18); }
  40%          { box-shadow: 0 14px 40px rgba(38,107,227,0.32); }
}
#vendyl-chat-bubble {
  animation: vendylSoftPulse 4.5s ease-in-out infinite;
}
#vendyl-chat-bubble.vendyl-has-new {
  animation-duration: 2.5s;
  box-shadow: 0 14px 40px rgba(38,107,227,0.42);
}

/* ============================
 * Chat Panel
 * ============================ */

#vendyl-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 88px;
  width: 420px;
  max-width: calc(100% - 48px);
  height: 520px;
  max-height: 520px;
  display: none;
  flex-direction: column;
  background: #ffffff;
  color: #111827;
  border-radius: 26px;
  border: 2px solid #266be3;
  box-shadow: 0 18px 40px rgba(15,23,42,0.28);
  overflow: hidden;
  z-index: 999999;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  box-sizing: border-box;
}

#vendyl-chat-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 20px 10px;
  background: #ffffff;
  border-bottom: 1px solid rgba(148,163,253,0.28);
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  box-sizing: border-box;
}

#vendyl-chat-panel header span#vendyl-close {
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

/* ============================
 * Conversation list (rolodex)
 * ============================ */

.vendyl-threads {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px;
  background: #ffffff;
  border-bottom: 1px solid rgba(148,163,253,0.18);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  box-sizing: border-box;
}

.vendyl-threads::-webkit-scrollbar {
  height: 4px;
}
.vendyl-threads::-webkit-scrollbar-thumb {
  background: rgba(148,163,253,0.6);
  border-radius: 999px;
}

.vendyl-threads-empty {
  padding: 6px 16px 8px;
  font-size: 11px;
  opacity: 0.6;
}

.vendyl-thread-item {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  font-size: 13px;
  border-radius: 999px;
  border: none;
  background: #e5edff;
  color: #1d4ed8;
  cursor: pointer;
  outline: none;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.vendyl-thread-item:hover {
  background: #d0ddff;
}

.vendyl-thread-item.active {
  background: #2563eb;
  color: #ffffff;
}

.vendyl-thread-item,
.vendyl-thread-item:focus {
  box-shadow: none !important;
}

/* ============================
 * Messages
 * ============================ */

.vendyl-body {
  flex: 1;
  padding: 10px 16px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f8fafc;
  box-sizing: border-box;
}

.msg {
  display: inline-flex;
  max-width: 80%;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
  box-sizing: border-box;
}

.msg.me {
  margin-left: auto;
  background: #2563eb;
  color: #ffffff;
}

.msg.them {
  margin-right: auto;
  background: #e5e7eb;
  color: #111827;
}

.msg.pending {
  opacity: 0.7;
}

/* Ensure all content inside outgoing (blue) bubbles is visible */
.msg.me a,
.msg.me span,
.msg.me svg,
.msg.me i {
  color: #ffffff !important;
  fill: #ffffff !important;
}
.msg.me a:hover {
  text-decoration: underline;
}

/* Hook for attachment icon+label if needed */
.vendyl-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: transparent;
}

/* ============================
 * Input row
 * ============================ */

.vendyl-input {
  position: relative;
  padding: 8px 14px 10px;
  background: #ffffff;
  border-top: 1px solid rgba(148,163,253,0.18);
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

/* Attach (+) button – Vendyl blue plus, transparent bg */
#vendyl-attach {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#vendyl-attach::before,
#vendyl-attach::after {
  content: '';
  position: absolute;
  background: #266be3;
  border-radius: 1px;
}

#vendyl-attach::before {
  width: 16px;
  height: 2px;
}

#vendyl-attach::after {
  width: 2px;
  height: 16px;
}

#vendyl-attach:hover::before,
#vendyl-attach:hover::after {
  background: #1d4ed8;
}

/* ============================
 * Composer (single-line pill, centered text)
 * ============================ */

#vendyl-input {
  width: 100%;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  padding: 0 40px 0 56px;          /* space for + and send */
  border-radius: 999px;
  border: 1px solid rgba(148,163,253,0.9);
  background: #f9fafb;
  color: #111827;
  font-size: 16px;
  line-height: 40px;               /* vertical center */
  resize: none;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  box-sizing: border-box;
}

#vendyl-input::placeholder {
  color: rgba(148,163,253,0.9);
}

#vendyl-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37,99,235,0.08);
}

/* ============================
 * Send button – chevron ^ made of Vendyl blue lines
 * ============================ */

#vendyl-send {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;          /* transparent background */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-indent: -9999px;             /* hide any text */
}

/* Two lines forming a ^ (no circle) */
#vendyl-send::before,
#vendyl-send::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 2px;
  background: #266be3;              /* Vendyl blue */
  border-radius: 1px;
  transform-origin: center;
}

/* Left stroke up, right stroke up => ^ */
#vendyl-send::before {
  transform: translateX(-3px) translateY(-3px) rotate(-45deg);
}

#vendyl-send::after {
  transform: translateX(3px) translateY(-3px) rotate(45deg);
}

/* Slight accent on hover */
#vendyl-send:hover::before,
#vendyl-send:hover::after {
  background: #1d4ed8;
}

/* ============================
 * Mobile
 * ============================ */

@media (max-width: 640px) {
  #vendyl-chat-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    top: 10px;
    bottom: 10px;
    width: auto;
    max-width: none;
    height: auto;
    max-height: calc(100vh - 20px);
    border-radius: 22px;
  }

  .vendyl-threads {
    padding-left: 12px;
    padding-right: 12px;
  }

  .vendyl-input {
    padding-left: 10px;
    padding-right: 10px;
  }

  #vendyl-attach {
    left: 18px;
  }

  #vendyl-input {
    padding-left: 52px;
    padding-right: 40px;
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    font-size: 15px;
    line-height: 40px;
  }

  #vendyl-send {
    right: 16px;
  }

  #vendyl-chat-bubble {
    right: 16px;
    bottom: 86px; /* lifted on mobile to clear cart/footer area */
    padding: 9px 20px;
    font-size: 14px;
    border-width: 2px;
  }
}
