/*
 * TrygBot Chat Widget
 * Author: Jamshadul Rafi — https://www.jamshadulrafi.com
 */

.tbot-root,
.tbot-root * { box-sizing: border-box; }

.tbot-root {
  position: fixed;
  right: 1rem;
  bottom: 5.5rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 1024px) {
  .tbot-root { right: 1.5rem; }
}

/* ---------- icons (CSS masks — Elementor strips inline <svg>) ---------- */
.tbot-i {
  display: inline-block;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-size: contain;
          mask-size: contain;
}
.tbot-i-shield  { -webkit-mask-image: var(--tbot-ic-shield);  mask-image: var(--tbot-ic-shield); }
.tbot-i-phone   { -webkit-mask-image: var(--tbot-ic-phone);   mask-image: var(--tbot-ic-phone); }
.tbot-i-x       { -webkit-mask-image: var(--tbot-ic-x);       mask-image: var(--tbot-ic-x); }
.tbot-i-send    { -webkit-mask-image: var(--tbot-ic-send);    mask-image: var(--tbot-ic-send); }
.tbot-i-message { -webkit-mask-image: var(--tbot-ic-message); mask-image: var(--tbot-ic-message); }
.tbot-i-chev    { -webkit-mask-image: var(--tbot-ic-chev);    mask-image: var(--tbot-ic-chev); }

/* ---------- panel ---------- */
.tbot-panel {
  display: flex;
  flex-direction: column;
  width: 340px;
  max-width: calc(100vw - 2rem);
  height: 500px;
  max-height: calc(100vh - 9rem);
  border-radius: 1rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.09);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
  transform-origin: bottom right;
  animation: tbot-panel-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.tbot-panel.tbot-closing {
  animation: tbot-panel-out 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  pointer-events: none;
}
@keyframes tbot-panel-in {
  from { opacity: 0; transform: scale(0.88) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes tbot-panel-out {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to   { opacity: 0; transform: scale(0.88) translateY(16px); }
}

/* ---------- header ---------- */
.tbot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  flex-shrink: 0;
  background: var(--tbot-brand, #0a3d3a);
}
.tbot-head-l { display: flex; align-items: center; gap: 0.625rem; }
.tbot-avwrap { position: relative; }
.tbot-av {
  width: 2.25rem; height: 2.25rem;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.tbot-av .tbot-i { width: 1.1rem; height: 1.1rem; }
.tbot-dot-live {
  position: absolute;
  bottom: -0.125rem; right: -0.125rem;
  width: 0.75rem; height: 0.75rem;
  border-radius: 9999px;
  background: #4ade80;
  border: 2px solid var(--tbot-brand, #0a3d3a);
  animation: tbot-blink 1.8s linear infinite;
}
@keyframes tbot-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.tbot-name { color: #fff; font-weight: 700; font-size: 0.875rem; line-height: 1.35; }
.tbot-sub  { color: rgba(255, 255, 255, 0.55); font-size: 0.68rem; line-height: 1.35; }

.tbot-head-r { display: flex; align-items: center; gap: 0.5rem; }
.tbot-hbtn {
  width: 2rem; height: 2rem;
  border: 0; padding: 0; cursor: pointer;
  border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transition: background-color 0.15s ease;
  text-decoration: none;
}
.tbot-hbtn:hover, .tbot-hbtn:focus-visible { background: rgba(255, 255, 255, 0.22); }
.tbot-hbtn .tbot-i { width: 0.875rem; height: 0.875rem; }
.tbot-hbtn.tbot-close .tbot-i { width: 1rem; height: 1rem; }

/* ---------- messages ---------- */
.tbot-body {
  flex: 1 1 0%;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
  overscroll-behavior: contain;
}
.tbot-body::-webkit-scrollbar { width: 6px; }
.tbot-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 999px; }
.tbot-body::-webkit-scrollbar-track { background: transparent; }

.tbot-row { display: flex; }
.tbot-row.tbot-bot  { justify-content: flex-start; }
.tbot-row.tbot-user { justify-content: flex-end; }
.tbot-row.tbot-anim { animation: tbot-msg-in 0.25s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes tbot-msg-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.tbot-mav {
  width: 1.75rem; height: 1.75rem;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  margin-right: 0.5rem;
  margin-top: 0.125rem;
  flex-shrink: 0;
  background: var(--tbot-brand, #0a3d3a);
  color: #fff;
}
.tbot-mav .tbot-i { width: 0.875rem; height: 0.875rem; }

.tbot-bub {
  max-width: 82%;
  padding: 0.625rem 0.875rem;
  font-size: 0.82rem;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.tbot-bot .tbot-bub {
  background: #f1f5f9;
  color: #1e293b;
  border-radius: 4px 18px 18px 18px;
}
.tbot-user .tbot-bub {
  background: var(--tbot-brand, #0a3d3a);
  color: #fff;
  border-radius: 18px 4px 18px 18px;
}
.tbot-bub p { margin: 0; }
.tbot-bub p + p { margin: 0.3rem 0 0; }
.tbot-bub strong { font-weight: 700; }
.tbot-bub a { color: inherit; text-decoration: underline; }

/* ---------- typing ---------- */
.tbot-typing {
  display: flex; align-items: center; gap: 0.25rem;
  padding: 0.75rem 1rem;
  background: #f1f5f9;
  border-radius: 4px 18px 18px 18px;
}
.tbot-typing span {
  width: 0.375rem; height: 0.375rem;
  border-radius: 9999px;
  background: #94a3b8;
  animation: tbot-dot 0.7s ease-in-out infinite;
}
.tbot-typing span:nth-child(2) { animation-delay: 0.15s; }
.tbot-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes tbot-dot {
  0%, 100% { transform: translateY(0);      opacity: 0.5; }
  50%      { transform: translateY(-4px);   opacity: 1; }
}

/* ---------- chips ---------- */
.tbot-chips {
  display: flex; flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
  margin-left: 2.25rem;
  animation: tbot-chip-in 0.25s ease 0.1s both;
}
@keyframes tbot-chip-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tbot-chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  color: var(--tbot-brand, #0a3d3a);
  transition: background-color 0.15s ease, border-color 0.15s ease;
  text-align: left;
}
.tbot-chip:hover, .tbot-chip:focus-visible {
  background: #f0f2f5;
  border-color: var(--tbot-brand, #0a3d3a);
}
.tbot-chip .tbot-i { width: 0.75rem; height: 0.75rem; opacity: 0.5; }

/* ---------- composer ---------- */
.tbot-foot { padding: 0.75rem; flex-shrink: 0; border-top: 1px solid #f1f5f9; }
.tbot-inrow { display: flex; gap: 0.5rem; }
.tbot-input {
  flex: 1 1 0%;
  min-width: 0;
  padding: 0.625rem 0.875rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-family: inherit;
  outline: none;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  color: #1e293b;
  transition: border-color 0.15s ease, opacity 0.15s ease;
}
.tbot-input::placeholder { color: #94a3b8; }
.tbot-input:focus { border-color: var(--tbot-brand, #0a3d3a); }
.tbot-input:disabled { opacity: 0.6; }

.tbot-send {
  width: 2.5rem; height: 2.5rem;
  flex-shrink: 0;
  border: 0; padding: 0; cursor: pointer;
  border-radius: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  background: #e2e8f0;
  color: #94a3b8;
  opacity: 0.5;
  transition: opacity 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
.tbot-send .tbot-i { width: 1rem; height: 1rem; }
.tbot-send.tbot-on { background: var(--tbot-brand, #0a3d3a); color: #fff; opacity: 1; }
.tbot-send.tbot-on:active { transform: scale(0.92); }

.tbot-note { text-align: center; margin-top: 0.5rem; font-size: 0.65rem; color: #cbd5e1; }
.tbot-note a { color: #94a3b8; font-weight: 600; text-decoration: none; }

/* ---------- launcher ---------- */
.tbot-fab {
  position: relative;
  width: 3.5rem; height: 3.5rem;
  border: 0; padding: 0; cursor: pointer;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--tbot-brand, #0a3d3a) 0%, var(--tbot-brand-2, #125c54) 100%);
  box-shadow: 0 8px 32px var(--tbot-glow, rgba(10, 61, 58, 0.4));
  animation: tbot-fab-glow 3s ease-in-out infinite;
  transition: transform 0.15s ease;
}
.tbot-fab:hover { transform: scale(1.08); }
.tbot-fab:active { transform: scale(0.94); }
@keyframes tbot-fab-glow {
  0%, 100% { box-shadow: 0 8px 32px var(--tbot-glow, rgba(10, 61, 58, 0.4)); }
  50%      { box-shadow: 0 8px 40px var(--tbot-glow-2, rgba(10, 61, 58, 0.6)); }
}
.tbot-fab .tbot-i { width: 1.5rem; height: 1.5rem; }
.tbot-fab .tbot-ic-slot { display: flex; animation: tbot-icon-in 0.18s ease both; }
@keyframes tbot-icon-in {
  from { opacity: 0; transform: rotate(90deg); }
  to   { opacity: 1; transform: rotate(0deg); }
}
.tbot-fab .tbot-ic-slot.tbot-ic-close { animation-name: tbot-icon-in-rev; }
@keyframes tbot-icon-in-rev {
  from { opacity: 0; transform: rotate(-90deg); }
  to   { opacity: 1; transform: rotate(0deg); }
}

.tbot-fab-dot {
  position: absolute;
  top: 0.125rem; right: 0.125rem;
  width: 0.875rem; height: 0.875rem;
  border-radius: 9999px;
  background: #4ade80;
  border: 2px solid #fff;
  animation: tbot-scale-pulse 2.2s ease-in-out infinite;
}
@keyframes tbot-scale-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.25); }
}

.tbot-badge {
  position: absolute;
  top: -0.25rem; left: -0.25rem;
  width: 1.25rem; height: 1.25rem;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  background: var(--tbot-badge, #d97706);
  color: #fff;
  font-weight: 800;
  font-size: 0.65rem;
  line-height: 1;
  animation: tbot-pop 0.2s ease both;
}
@keyframes tbot-pop { from { transform: scale(0); } to { transform: scale(1); } }

.tbot-sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .tbot-root *,
  .tbot-root *::before,
  .tbot-root *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- icon sources ---------- */
.tbot-root {
  --tbot-ic-shield: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z'/%3E%3C/svg%3E");
  --tbot-ic-phone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384'/%3E%3C/svg%3E");
  --tbot-ic-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18'/%3E%3Cpath d='m6 6 12 12'/%3E%3C/svg%3E");
  --tbot-ic-send: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z'/%3E%3Cpath d='m21.854 2.147-10.94 10.939'/%3E%3C/svg%3E");
  --tbot-ic-message: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.9 20A9 9 0 1 0 4 16.1L2 22Z'/%3E%3C/svg%3E");
  --tbot-ic-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
}
