/* GoodUX FAQ Chatbot Widget */

:root {
  --gux-pink: #012C90;
  --gux-pink-light: rgba(1, 44, 144, 0.1);
  --gux-pink-hover: #012C90;
  --gux-white: #ffffff;
  --gux-bg: #f9f9f9;
  --gux-border: #ebebeb;
  --gux-text-primary: #1a1a1a;
  --gux-text-secondary: #666666;
  --gux-text-muted: #999999;
  --gux-shadow: 0 8px 32px rgba(0,0,0,0.12);
  --gux-radius: 16px;
  --gux-radius-sm: 10px;
  --gux-radius-xs: 6px;
}

#gux-chat-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--gux-white);
  border: none;
  cursor: pointer;
  padding: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(1, 44, 144, 0.35);
  z-index: 9999;
  transition: transform 0.2s ease, background 0.2s ease, width 0.2s ease, height 0.2s ease, box-shadow 0.2s ease;
}

#gux-chat-toggle:hover {
  background: var(--gux-white);
  transform: scale(1.08);
  box-shadow: 0 8px 28px rgba(1, 44, 144, 0.45);
}
#gux-chat-toggle.open {
  width: 44px;
  height: 44px;
  background: var(--gux-pink);
  box-shadow: 0 4px 16px rgba(1, 44, 144, 0.35);
}

#gux-chat-toggle.open:hover {
  background: var(--gux-pink-hover);
}

#gux-chat-toggle svg {
  width: 24px;
  height: 24px;
  fill: white;
  transition: opacity 0.2s;
}

#gux-toggle-open { display: block; }
#gux-toggle-close { display: none; }

#gux-chat-toggle.open #gux-toggle-open { display: none; }
#gux-chat-toggle.open #gux-toggle-close { display: block; }

/* Chat Window */
#gux-chat-window {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 370px;
  height: 540px;
  background: var(--gux-white);
  border-radius: var(--gux-radius);
  box-shadow: var(--gux-shadow);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  border: 1px solid var(--gux-border);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  overscroll-behavior: contain !important;
  transform: translateY(12px) scale(0.97);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
#gux-chat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#gux-chat-window.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* Header */
#gux-chat-header {
  background: var(--gux-white);
  border-bottom: 1px solid var(--gux-border);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#gux-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gux-pink-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#gux-header-avatar svg {
  width: 18px;
  height: 18px;
  fill: var(--gux-pink);
}

/* ─── Header Name Single Line Fix ─── */
#gux-header-name {
  font-size: 14px ;
  font-weight: 600 ;
  white-space: nowrap ;
  overflow: hidden ;
  text-overflow: ellipsis ;
  line-height: 1.2 ;
}

#gux-header-info {
  flex: 1 ;
  min-width: 0 ;
  overflow: hidden ;
}
#gux-header-status {
  font-size: 11px;
  color: var(--gux-text-muted);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.gux-status-dot {
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
}

.gux-status-dot.loading {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
  animation: guxPulse 1.2s infinite ease-in-out;
}

.gux-status-dot.error {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

@keyframes guxPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
}

#gux-header-close {
  background: transparent ;
  background-color: transparent ;
  border: none ;
  width: 32px ;
  min-width: 32px ;
  max-width: 32px ;
  flex-shrink: 0 ;
  padding: 4px ;
  cursor: pointer ;
}

#gux-header-close:hover {
  background: transparent ;
  background-color: transparent ;
}

#gux-header-close svg {
  width: 16px ;
  height: 16px ;
  stroke: #000000 ;
  fill: none ;
  stroke-width: 2 ;
  stroke-linecap: round ;
}





/* Messages Area */
#gux-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
    min-height: 0;

   overscroll-behavior: contain !important;
  overflow-y: auto !important;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--gux-bg);
  scroll-behavior: smooth;
}

#gux-messages::-webkit-scrollbar {
  width: 4px;
}

#gux-messages::-webkit-scrollbar-track {
  background: transparent;
}

#gux-messages::-webkit-scrollbar-thumb {
  background: var(--gux-border);
  border-radius: 4px;
}

/* Message Bubbles */
.gux-message {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: guxFadeIn 0.2s ease;
}

@keyframes guxFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.gux-message.bot { align-self: flex-start; align-items: flex-start; }
.gux-message.user { align-self: flex-end; align-items: flex-end; }

.gux-label {
  font-size: 9px;
  font-family: monospace;
  color: var(--gux-text-muted);
  margin-bottom: 4px;
  padding-left: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.gux-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  white-space: pre-wrap;
  word-break: break-word;
}

.gux-message.bot .gux-bubble {
  background: var(--gux-white);
  color: var(--gux-text-primary);
  border: 1px solid var(--gux-border);
  border-bottom-left-radius: 4px;
}

.gux-message.user .gux-bubble {
  background: var(--gux-pink);
  color: white;
  border-bottom-right-radius: 4px;
}

.gux-time {
  font-size: 10px;
  color: var(--gux-text-muted);
  margin-top: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.gux-message.user .gux-time {
  text-align: right;
}

/* Suggestion Chips */
/* REPLACE the existing #gux-suggestions rule with this */

.gux-chip {
  background: var(--gux-white);
  border: 1px solid var(--gux-border);
  color: var(--gux-text-primary);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
   flex: 0 1 calc(50% - 4px) ;
  max-width: calc(50% - 4px) ;
  white-space: nowrap ;
  overflow: hidden ;
  text-overflow: ellipsis ;
  text-align: center ;
  box-sizing: border-box ;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.gux-chip:hover {
  background: var(--gux-pink-light);
  border-color: var(--gux-pink);
  color: var(--gux-pink);
}

/* Input Area */
/* REPLACE the existing #gux-input-area rule with this */
#gux-input-area {
  padding: 10px 14px ;
  display: flex ;
  flex-direction: row ;
  gap: 8px ;
    flex-shrink: 0;

  align-items: center ;
  box-sizing: border-box ;
  width: 100% !;
  background: var(--gux-white) ;
}


/* REPLACE the existing #gux-send-btn rule with this */
#gux-send-btn {
  width: 38px ;
  height: 38px ;
  min-width: 38px ;
  min-height: 38px ;
  border-radius: 50% ;
  background: var(--gux-pink) ;
  flex-shrink: 0 ;
  padding: 0 ;
  display: flex ;
  align-items: center ;
  justify-content: center ;
}

#gux-input::placeholder {
  color: var(--gux-text-muted);
}

#gux-input:focus {
  border-color: var(--gux-pink);
  background: var(--gux-white);
}

/* REPLACE the existing #gux-mic-btn rule with this */

#gux-mic-btn:hover {
  color: var(--gux-pink);
}

#gux-mic-btn.listening {
  color: var(--gux-pink);
  animation: guxPulse 1.2s infinite ease-in-out;
}

#gux-mic-btn svg {
  width: 20px;
  height: 20px;
}

#gux-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gux-pink);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
}

#gux-send-btn:hover {
  background: var(--gux-pink-hover);
  transform: scale(1.05);
}

#gux-send-btn svg {
  width: 16px;
  height: 16px;
  fill: white;
  margin-left: 2px;
}

/* Typing Indicator */
.gux-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--gux-white);
  border: 1px solid var(--gux-border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.gux-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gux-text-muted);
  animation: guxTyping 1.2s infinite;
}

.gux-typing span:nth-child(2) { animation-delay: 0.2s; }
.gux-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes guxTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Powered by */
#gux-footer {
  padding: 6px 14px 8px;
  text-align: left;
  font-size: 10px;
  color: var(--gux-text-muted);
  background: var(--gux-white);
  border-top: 1px solid var(--gux-border);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --- Responsive Breakpoints --- */

/* Tablet */
@media (max-width: 1023px) {
  #gux-chat-window {
    width: 420px;
    height: 600px;
  }
}

/* Large Mobile */
@media (max-width: 767px) {
  #gux-chat-window {
    width: 88vw;
    height: 65vh;
    right: 15px;
    bottom: 170px;
  }
}

/* Mobile */
@media (max-width: 550px) {
  #gux-chat-window {
    width: 92vw;
    height: 60vh;
    right: 15px;
    bottom: 170px;
  }

  #gux-chat-toggle {
    right: 15px;
    bottom: 160px;
  }

  #gux-input-area {
    padding: 8px 10px ;
  }

  #gux-input {
    font-size: 16px ;
    padding: 9px 14px ;
  }

  #gux-send-btn {
    width: 36px ;
    height: 36px ;
    min-width: 36px ;
    min-height: 36px ;
  }

  #gux-mic-btn {
    width: 32px ;
    height: 32px ;
    padding: 4px ;
  }
}

/* Small Mobile */
@media (max-width: 440px) {
  #gux-chat-window {
    width: calc(100vw - 30px); /* 15px margin on both sides */
    height: 60vh;
  }

  #gux-input-area {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
}

/* Lead Capture Form */
#gux-lead-capture {
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  background: var(--gux-white);
  overflow-y: auto;
}

#gux-lead-capture h3 {
  font-size: 18px;
  color: var(--gux-text-primary);
  margin-bottom: 8px;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#gux-lead-capture p {
  font-size: 13.5px;
  color: var(--gux-text-secondary);
  text-align: center;
  margin-bottom: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.gux-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gux-form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gux-text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.gux-form-input {
  border: 1px solid var(--gux-border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--gux-text-primary);
  background: var(--gux-bg);
  outline: none;
  transition: border-color 0.15s;
}

.gux-form-input:focus {
  border-color: var(--gux-pink);
  background: var(--gux-white);
}

.gux-form-btn {
  background: var(--gux-pink);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s;
}

.gux-form-btn:hover {
  background: var(--gux-pink-hover);
}

.gux-form-error {
  color: #012C90;
  font-size: 12px;
  margin-top: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: none;
}
/* ─── Input Area Full Width Fix ─── */


#gux-input {
  flex: 1 1 auto ;
  min-width: 0 ;
  width: 100% ;
  box-sizing: border-box ;
  border-radius: 22px ;
  border: 1.5px solid var(--gux-pink) !important;
  padding: 10px 18px ;
  font-size: 14px ;
  background: var(--gux-white) ;
  outline: none ;
}

#gux-input:focus {
  border: 1.5px solid var(--gux-pink) !important;
}



#gux-mic-btn {
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0 ;
  padding: 6px ;
  width: 36px ;
  height: 36px ;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gux-text-muted);
  transition: color 0.15s, transform 0.15s;
}


#gux-suggestions {
  padding: 8px 14px ;
  display: flex ;
  flex-direction: row ;
  flex-wrap: wrap ;
  gap: 8px ;
  box-sizing: border-box ;
  width: 100% ;
  flex-shrink: 0;
}