/* ============================================================
   TechPioneerHub — Chatbot widget
   Floating help bot with FAQ matching, dark/light aware.
   ============================================================ */
.tph-chatbot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  z-index: 9000;
  font-family: var(--font, 'Inter Tight', system-ui, sans-serif);
  color: var(--text, #eef2fb);
}

/* --- Toggle button --- */
.tph-chat-toggle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: var(--grad, linear-gradient(135deg, #f9560f, #ff8a3d));
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 40px rgba(0,0,0,.45);
  transition: transform .15s, box-shadow .15s;
  outline: none;
}
.tph-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 48px rgba(0,0,0,.6);
}
.tph-chat-toggle.tph-hidden {
  transform: scale(0.8) translate(calc(var(--hidden-x, 0px)), calc(var(--hidden-y, 80px)));
  opacity: 0;
  pointer-events: none;
}

/* --- Chat window --- */
.tph-chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 100%;
  max-width: 360px;
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(0,0,0,.45);
  background: var(--card, #141a2e);
  border: 1px solid var(--border, rgba(255,255,255,.09));
  overflow: hidden;
  display: none;
  flex-direction: column;
}
.tph-chatbot.tph-open .tph-chat-window {
  display: flex;
}

/* Window header */
.tph-chat-header {
  background: var(--grad, linear-gradient(135deg, #f9560f, #ff8a3d));
  color: #fff;
  padding: 16px 20px;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tph-chat-header .tph-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,.4);
  box-shadow: 0 0 8px rgba(255,255,255,.6);
}
.tph-chat-header .tph-status-dot.tph-online {
  background: #22c55e;
}

/* Messages area */
.tph-chat-messages {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tph-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.tph-msg-bot {
  align-self: flex-start;
  background: var(--card2, #1a2140);
  color: var(--text, #eef2fb);
  border-bottom-left-radius: 6px;
}
.tph-msg-user {
  align-self: flex-end;
  background: var(--primary, #f9560f);
  color: #fff;
  border-bottom-right-radius: 6px;
}

/* Typing indicator */
.tph-typing {
  opacity: 0.8;
}
.tph-typing .tph-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.tph-typing .tph-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  animation: tph-bounce 1.4s ease-in-out infinite both;
}
.tph-typing .tph-dots span:nth-child(1) { animation-delay: -0.32s; }
.tph-typing .tph-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes tph-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Quick-reply chips */
.tph-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.tph-quick-replies button {
  background: var(--bg2, #0f1424);
  color: var(--muted, #94a3b8);
  border: 1px solid var(--border, rgba(255,255,255,.09));
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
}
.tph-quick-replies button:hover {
  background: var(--primary, #f9560f);
  color: #fff;
  border-color: var(--primary, #f9560f);
}

/* Input area */
.tph-chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border, rgba(255,255,255,.09));
  background: var(--bg2, #0f1424);
}
.tph-chat-input input[type="text"] {
  flex: 1;
  border: 1px solid var(--border, rgba(255,255,255,.09));
  background: var(--card, #141a2e);
  color: var(--text, #eef2fb);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.tph-chat-input input[type="text"]::placeholder {
  color: var(--muted2, #64748b);
}
.tph-chat-input input[type="text"]:focus {
  border-color: var(--primary, #f9560f);
}
.tph-chat-input button {
  background: var(--grad, linear-gradient(135deg, #f9560f, #ff8a3d));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: opacity .15s;
}
.tph-chat-input button:hover {
  opacity: .9;
}
.tph-chat-input button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Light theme overrides */
body.light .tph-chatbot {
  color: var(--text, #0f172a);
}
body.light .tph-chat-window {
  background: var(--card, #ffffff);
  color: var(--text, #0f172a);
}
body.light .tph-chat-header .tph-status-dot {
  box-shadow: 0 0 8px rgba(255,255,255,.8);
}
body.light .tph-msg-bot {
  background: var(--bg2, #f1f5f9);
  color: var(--text, #0f172a);
}
body.light .tph-chat-messages {
  background: var(--card, #ffffff);
}
body.light .tph-chat-input {
  background: var(--bg2, #f1f5f9);
  border-top-color: var(--border, #e2e8f0);
}
body.light .tph-chat-input input[type="text"] {
  background: var(--card, #ffffff);
  border-color: var(--border, #e2e8f0);
  color: var(--text, #0f172a);
}
body.light .tph-msg-user {
  background: var(--primary, #f9560f);
  color: #fff;
}

/* Close button in header */
.tph-chat-header .tph-close-btn {
  margin-left: auto;
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
