/* =====================================================================
   SHOPSMART — Customer Service Auto-Reply Chatbot (popup styles)
   Separate, self-contained file. Include after shopsmart-nav.css:
     <link rel="stylesheet" href="shopsmart-chatbot.css">
     <script src="shopsmart-chatbot.js" defer></script>
   ===================================================================== */

.ss-chat-window {
  position: fixed;
  z-index: 600;
  bottom: 24px;
  right: 24px;
  width: 340px;
  max-width: calc(100vw - 24px);
  height: 460px;
  max-height: calc(100vh - 48px);
  background: #16171b;
  border: 1.5px solid #24252b;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Poppins', 'Segoe UI', Verdana, sans-serif;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.ss-chat-window.ss-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ss-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #0d6ea8, #29b6f6);
  color: #fff;
  flex-shrink: 0;
}
.ss-chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #eaf9ff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ss-chat-avatar video { width: 100%; height: 100%; object-fit: cover; }
.ss-chat-header-text { flex: 1; min-width: 0; }
.ss-chat-title { font-size: 14px; font-weight: 700; line-height: 1.2; }
.ss-chat-subtitle { font-size: 11px; opacity: 0.9; display: flex; align-items: center; gap: 5px; }
.ss-chat-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #4ee06a;
  box-shadow: 0 0 0 2px rgba(78,224,106,0.25);
  flex-shrink: 0;
}
.ss-chat-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  transition: background .15s ease;
}
.ss-chat-close:hover { background: rgba(255,255,255,0.3); }

.ss-chat-livebtn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, transform .12s ease;
}
.ss-chat-livebtn:hover { background: rgba(255,255,255,0.3); }
.ss-chat-livebtn:active { transform: scale(0.92); }
.ss-chat-livebtn svg { width: 14px; height: 14px; }

.ss-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #0f1013;
}
.ss-chat-body::-webkit-scrollbar { width: 6px; }
.ss-chat-body::-webkit-scrollbar-thumb { background: #24252b; border-radius: 3px; }

.ss-msg {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: ss-msg-in .16s ease;
}
@keyframes ss-msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.ss-msg-bot {
  align-self: flex-start;
  background: #1e1f25;
  color: #f2f2f4;
  border-bottom-left-radius: 4px;
}
.ss-msg-user {
  align-self: flex-end;
  background: #29b6f6;
  color: #06202c;
  border-bottom-right-radius: 4px;
}
.ss-msg-quick {
  align-self: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}
.ss-quick-btn {
  background: transparent;
  border: 1.3px solid #29b6f6;
  color: #29b6f6;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.ss-quick-btn:hover { background: #29b6f6; color: #06202c; }

.ss-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  background: #1e1f25;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.ss-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #6b6c74;
  animation: ss-typing-bounce 1s infinite ease-in-out;
}
.ss-typing span:nth-child(2) { animation-delay: .15s; }
.ss-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ss-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.ss-chat-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #24252b;
  background: #16171b;
  flex-shrink: 0;
}
.ss-chat-input {
  flex: 1;
  background: #1e1f25;
  border: 1.3px solid #24252b;
  color: #f2f2f4;
  font-family: inherit;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 999px;
  outline: none;
  min-width: 0;
  transition: border-color .15s ease;
}
.ss-chat-input:focus { border-color: #29b6f6; }
.ss-chat-input::placeholder { color: #6b6c74; }
.ss-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #29b6f6;
  color: #06202c;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .12s ease, background .15s ease;
}
.ss-chat-send:hover { background: #6fe3ff; transform: scale(1.06); }
.ss-chat-send:active { transform: scale(0.94); }
.ss-chat-send svg { width: 16px; height: 16px; }

/* Mic (voice input) + speaker (voice reply mute) buttons */
.ss-chat-mic,
.ss-chat-voice-toggle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #1e1f25;
  color: #29b6f6;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .12s ease, background .15s ease, color .15s ease;
}
.ss-chat-mic:hover,
.ss-chat-voice-toggle:hover { background: #24252b; }
.ss-chat-mic:active,
.ss-chat-voice-toggle:active { transform: scale(0.92); }
.ss-chat-mic svg,
.ss-chat-voice-toggle svg { width: 15px; height: 15px; }

/* Listening state: red + pulsing ring while the mic is capturing speech */
.ss-chat-mic.ss-mic-active {
  background: #ff4d4f;
  color: #fff;
  animation: ss-mic-pulse 1.1s infinite;
}
@keyframes ss-mic-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,77,79,0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(255,77,79,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,77,79,0); }
}

/* Hands-free voice-to-voice session is on but bot is currently speaking
   (not actively listening this instant) — steady glow, no pulse. */
.ss-chat-mic.ss-mic-convo:not(.ss-mic-active) {
  background: #0d6ea8;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(41,182,246,0.55);
}

/* Browser doesn't support speech recognition */
.ss-chat-mic.ss-mic-unsupported {
  color: #4a4b52;
  cursor: not-allowed;
}

/* Voice replies muted */
.ss-chat-voice-toggle.ss-voice-muted { color: #6b6c74; }

@media (max-width: 560px) {
  .ss-chat-window {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 12px;
    height: min(70vh, 520px);
  }
}


/* =====================================================================
   Full-screen "ShopSmart Live" voice assistant
   Opened from the header icon in the chat popup (id="ssChatLive").
   Layout: top icon bar, glowing ShopSmart-branded orb in the middle,
   rounded input bar (type / mic / close) pinned to the bottom.
   ===================================================================== */
.ss-voice-screen {
  position: fixed;
  inset: 0;
  z-index: 700;
  background: #000;
  color: #f4f6fa;
  font-family: 'Poppins', 'Segoe UI', Verdana, sans-serif;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
  transition: opacity .2s ease, transform .2s ease;
}
.ss-voice-screen.ss-voice-open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.ss-voice-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 10px;
  flex-shrink: 0;
}
.ss-voice-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #f4f6fa;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.ss-voice-icon-btn:hover { background: rgba(255,255,255,0.08); }
.ss-voice-icon-btn svg { width: 20px; height: 20px; }
.ss-voice-icon-btn.ss-voice-muted { color: #6b6c74; }

.ss-voice-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 0 20px 20px;
  text-align: center;
}

/* The glowing "orb" — ShopSmart's logo standing in for the assistant's
   pulsing sphere, with a soft radial glow behind it so it still reads
   as a living, breathing presence rather than a static image. */
.ss-voice-logo-wrap {
  position: relative;
  width: min(62vw, 260px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ss-voice-float 4.5s ease-in-out infinite;
}
.ss-voice-logo {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 22px rgba(120,170,255,0.45));
}
.ss-voice-ring {
  position: absolute;
  inset: -55%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(120,170,255,0.35) 0%, rgba(80,140,255,0.12) 45%, rgba(0,0,0,0) 72%);
  filter: blur(2px);
  z-index: 0;
  animation: ss-voice-pulse-ring 2.6s ease-in-out infinite;
}
@keyframes ss-voice-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes ss-voice-pulse-ring {
  0%, 100% { transform: scale(1); opacity: 0.75; }
  50% { transform: scale(1.12); opacity: 1; }
}

.ss-voice-caption {
  font-size: 15.5px;
  line-height: 1.55;
  color: #f4f6fa;
  max-width: 480px;
  min-height: 22px;
}
.ss-voice-caption:empty { min-height: 0; }
.ss-voice-caption.ss-voice-caption-user {
  color: #29b6f6;
}

.ss-voice-lang-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 480px;
}
.ss-voice-lang-chip {
  background: transparent;
  border: 1.3px solid #29b6f6;
  color: #29b6f6;
  font-size: 12.5px;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.ss-voice-lang-chip:hover { background: #29b6f6; color: #06202c; }

/* Bottom rounded bar: text input on top, plus / mic / close row below */
.ss-voice-bar {
  flex-shrink: 0;
  margin: 0 14px 18px;
  padding: 14px 14px 10px;
  background: #1c1d22;
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ss-voice-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #f4f6fa;
  font-family: inherit;
  font-size: 15px;
  padding: 4px 6px;
}
.ss-voice-input::placeholder { color: #8a8b93; }

.ss-voice-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ss-voice-plus {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #3a3b42;
  color: #f4f6fa;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s ease, transform .12s ease;
}
.ss-voice-plus:hover { background: #46474f; }
.ss-voice-plus:active { transform: scale(0.92); }
.ss-voice-plus svg { width: 18px; height: 18px; }

.ss-voice-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ss-voice-mic {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #f4f6fa;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.ss-voice-mic:hover { background: rgba(255,255,255,0.08); }
.ss-voice-mic svg { width: 20px; height: 20px; }
/* actively listening: red + pulsing, matching the popup mic states */
.ss-voice-mic.ss-mic-active {
  background: #ff4d4f;
  color: #fff;
  animation: ss-voice-mic-pulse 1.1s ease-out infinite;
}
@keyframes ss-voice-mic-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,77,79,0.5); }
  70%  { box-shadow: 0 0 0 10px rgba(255,77,79,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,77,79,0); }
}
/* hands-free session on, bot currently speaking: steady blue glow */
.ss-voice-mic.ss-mic-convo:not(.ss-mic-active) {
  background: #0d6ea8;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(41,182,246,0.55);
}
.ss-voice-mic.ss-mic-unsupported {
  color: #6b6c74;
  cursor: not-allowed;
}
/* Red call-end style cancel button — ends the live voice chat */
.ss-voice-close {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: #ff3b30;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255,59,48,0.45);
  transition: background .15s ease, transform .12s ease;
}
.ss-voice-close:hover { background: #e0332a; }
.ss-voice-close:active { transform: scale(0.92); }
.ss-voice-close svg { width: 18px; height: 18px; }

@media (max-width: 480px) {
  .ss-voice-logo-wrap { width: 60vw; }
  .ss-voice-caption { font-size: 14.5px; }
}
