/* ====================================================== */
/*  TALKBOT — Floating Chat Widget                        */
/*  MyBiz brand: #902943 / #b23659                       */
/* ====================================================== */

/* ── Root container ─────────────────────────────────── */
.tb-root {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
/* new */
 width: 450px;                    
  max-width: calc(100vw - 36px); 
}

/* ── Floating trigger button ────────────────────────── */
.tb-trigger {
  pointer-events: auto;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #902943 0%, #c95a78 100%);
  box-shadow:
    0 6px 20px rgba(144, 41, 67, 0.38),
    0 2px 6px rgba(0,0,0,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s ease;
  outline: none;
}

.tb-trigger:hover {
  transform: scale(1.08);
  box-shadow:
    0 12px 28px rgba(144, 41, 67, 0.45),
    0 3px 10px rgba(0,0,0,0.12);
}

.tb-trigger:active {
  transform: scale(0.94);
}

/* Pulse ring */
.tb-trigger::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(144, 41, 67, 0.35);
  animation: tb-pulse-ring 2.8s ease-out infinite;
}

.tb-trigger--open::before {
  animation: none;
  opacity: 0;
}

@keyframes tb-pulse-ring {
  0%   { transform: scale(1);    opacity: 0.6; }
  70%  { transform: scale(1.3);  opacity: 0; }
  100% { transform: scale(1.3);  opacity: 0; }
}

/* Robot icon */
.tb-icon-robot {
  width: 34px;
  height: 34px;
  position: absolute;
  transition:
    opacity 0.25s ease,
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Close icon */
.tb-icon-close {
  width: 20px;
  height: 20px;
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
  transition:
    opacity 0.25s ease,
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tb-trigger--open .tb-icon-robot {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

.tb-trigger--open .tb-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* ── "Talk to our AI" label ─────────────────────────── */
.tb-label {
  pointer-events: none;
  background: #fff;
  color: #902943;
  font-family: 'Google Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 100px;
  box-shadow:
    0 3px 10px rgba(144, 41, 67, 0.13),
    0 1px 3px rgba(0,0,0,0.06);
  white-space: nowrap;
  border: 1px solid rgba(144, 41, 67, 0.10);
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.45s ease,
    transform 0.45s ease;
}

.tb-label--hidden {
  opacity: 0;
  transform: translateX(10px);
  pointer-events: none;
}

/* ── Chat panel ─────────────────────────────────────── */
.tb-panel {
  pointer-events: none;
  width: 450px;
  max-width: calc(100vw - 36px);
  height: 380px;
  max-height: calc(100vh - 110px);

  display: flex;
  flex-direction: column;

  background: #fff;

  border: 1px solid rgba(144, 41, 67, 0.09);
  border-radius: 20px 20px 5px 20px;

  box-shadow:
    0 12px 40px rgba(144, 41, 67, 0.12),
    0 2px 12px rgba(0, 0, 0, 0.05);

  overflow: hidden;

  opacity: 0;
  transform-origin: bottom right;
  transform: scale(0.08) translateY(20px);
  transition: none;
}

.tb-panel--open {
  pointer-events: auto;
  opacity: 1;
  transform: scale(1) translateY(0);
  transition:
    opacity 0.42s cubic-bezier(0.34, 1.2, 0.64, 1),
    transform 0.42s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.tb-panel--closing {
  pointer-events: none;
  opacity: 0;
  transform: scale(0.08) translateY(20px);
  transition:
    opacity 0.35s cubic-bezier(0.4, 0, 1, 1),
    transform 0.40s cubic-bezier(0.55, 0, 1, 0.8);
}

/* ── Panel header ───────────────────────────────────── */
.tb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  background: linear-gradient(135deg, #902943 0%, #b23659 100%);
  flex-shrink: 0;
}

.tb-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tb-avatar svg {
  width: 22px;
  height: 22px;
}

.tb-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tb-title {
  font-family: 'Syne', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.tb-status {
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px;
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  gap: 5px;
}

.tb-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #6ee7b7;
  box-shadow: 0 0 5px rgba(110, 231, 183, 0.7);
  animation: tb-blink 2.2s ease-in-out infinite;
}

@keyframes tb-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

.tb-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.tb-close-btn svg {
  width: 14px;
  height: 14px;
}

.tb-close-btn:hover {
  background: rgba(255,255,255,0.24);
  transform: scale(1.07);
}

/* ── Messages area ──────────────────────────────────── */
.tb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scroll-behavior: smooth;
  background: #fdfafa;
}

.tb-messages::-webkit-scrollbar { width: 4px; }
.tb-messages::-webkit-scrollbar-track { background: transparent; }
.tb-messages::-webkit-scrollbar-thumb {
  background: rgba(144, 41, 67, 0.15);
  border-radius: 50px;
}

/* ── Message rows ───────────────────────────────────── */
.tb-msg {
  display: flex;
  animation: tb-fade-up 0.25s ease both;
}

.tb-msg--user { justify-content: flex-end; }
.tb-msg--bot  { justify-content: flex-start; }

@keyframes tb-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Bubbles ────────────────────────────────────────── */
.tb-bubble {
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  line-height: 1.6;
  font-weight: 400;
  word-break: break-word;
}

.tb-msg--user .tb-bubble {
  background: linear-gradient(135deg, #902943, #b23659);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(144, 41, 67, 0.2);
}

.tb-msg--bot .tb-bubble {
  background: #fff;
  color: #3a2228;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(144, 41, 67, 0.07);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* ── Typing indicator ───────────────────────────────── */
.tb-typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 11px 15px;
}

.tb-typing-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #902943;
  opacity: 0.45;
  animation: tb-typing-dot 1.2s ease-in-out infinite;
}

.tb-typing-bubble span:nth-child(2) { animation-delay: 0.18s; }
.tb-typing-bubble span:nth-child(3) { animation-delay: 0.36s; }

@keyframes tb-typing-dot {
  0%, 80%, 100% { transform: translateY(0);   opacity: 0.35; }
  40%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Input row ──────────────────────────────────────── */
.tb-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-top: 1px solid rgba(144, 41, 67, 0.06);
  background: #fff;
  flex-shrink: 0;
}

.tb-input {
  flex: 1;
  height: 42px;
  border: 1px solid rgba(144, 41, 67, 0.14);
  border-radius: 12px;
  padding: 0 15px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  color: #333;
  background: #fdfafa;
  outline: none;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

.tb-input::placeholder { color: #c0a8b0; }

.tb-input:focus {
  border-color: rgba(144, 41, 67, 0.4);
  box-shadow: 0 0 0 3px rgba(144, 41, 67, 0.07);
  background: #fff;
}

.tb-send-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #902943, #b23659);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(144, 41, 67, 0.25);
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.2s ease;
  flex-shrink: 0;
}

.tb-send-btn svg {
  width: 16px;
  height: 16px;
}

.tb-send-btn:hover {
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 7px 16px rgba(144, 41, 67, 0.32);
}

.tb-send-btn:active  { transform: scale(0.94); }
.tb-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── Mobile ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .tb-root {
    bottom: 14px;
    right: 14px;
  }
/*
  .tb-panel {
    width: calc(100vw - 28px);
    height: 440px;
    border-radius: 18px 18px 5px 18px;
  } 
*/

.tb-panel {
  height: calc(100vh - 160px);   /* was: 500px */
  max-height: 500px;              /* add this — caps it on tall screens */
}

  .tb-trigger {
    width: 56px;
    height: 56px;
  }

  .tb-icon-robot { width: 30px; height: 30px; }
}

/* ── Reduced motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .tb-panel,
  .tb-panel--open,
  .tb-panel--closing,
  .tb-trigger,
  .tb-icon-robot,
  .tb-icon-close {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}