/* TekBis Assistant — floating chat widget */

:root {
  --tb-chat-primary: #1248F4;
  --tb-chat-primary-dark: #0d36b8;
  --tb-chat-bg: #ffffff;
  --tb-chat-surface: #f4f7fb;
  --tb-chat-text: #0f172a;
  --tb-chat-muted: #64748b;
  --tb-chat-border: #e2e8f0;
  --tb-chat-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
  --tb-chat-radius: 16px;
  --tb-chat-font: "Montserrat", "Lato", system-ui, sans-serif;
}

.tekbis-chat-root {
  position: fixed;
  right: 20px;
  bottom: 100px;
  /* Above call-bar (100001), navbar (10000–10053), WhatsApp float (1000) */
  z-index: 100100;
  font-family: var(--tb-chat-font);
  -webkit-font-smoothing: antialiased;
  isolation: isolate;
}

.tekbis-chat-launcher {
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  background: var(--tb-chat-primary);
  color: #fff;
  box-shadow: 0 10px 28px rgba(18, 72, 244, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.tekbis-chat-launcher:hover {
  background: var(--tb-chat-primary-dark);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 32px rgba(18, 72, 244, 0.5);
}

.tekbis-chat-launcher:focus-visible {
  outline: 3px solid rgba(18, 72, 244, 0.35);
  outline-offset: 3px;
}

.tekbis-chat-launcher svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.tekbis-chat-launcher.is-open {
  background: #0f172a;
}

/* HubSpot-style proactive greeting teaser */
.tekbis-chat-teaser {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: min(280px, calc(100vw - 40px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  padding: 22px 16px 16px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s ease;
  pointer-events: none;
  z-index: 2;
}

.tekbis-chat-teaser.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.tekbis-chat-teaser-avatar {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.tekbis-chat-teaser-avatar .tekbis-chat-bot-face,
.tekbis-chat-avatar .tekbis-chat-bot-face {
  width: 100%;
  height: 100%;
  display: block;
}

.tekbis-chat-teaser-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
}

.tekbis-chat-teaser-close:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.tekbis-chat-teaser-body {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 8px 2px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: #334155;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 500;
}

.tekbis-chat-teaser-wave {
  margin-right: 2px;
}

.tekbis-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0;
}

.tekbis-chat-panel {
  position: absolute;
  right: 0;
  bottom: 70px;
  width: min(380px, calc(100vw - 32px));
  /* Keep panel below call-bar + navbar when open */
  height: min(520px, calc(100dvh - 170px));
  max-height: calc(100dvh - 170px);
  background: var(--tb-chat-bg);
  border: 1px solid var(--tb-chat-border);
  border-radius: var(--tb-chat-radius);
  box-shadow: var(--tb-chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
  pointer-events: none;
  z-index: 3;
}

.tekbis-chat-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.tekbis-chat-header {
  background: linear-gradient(135deg, #1248F4 0%, #0d36b8 100%);
  color: #fff;
  padding: 14px 14px 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.tekbis-chat-header-text {
  flex: 1;
  min-width: 0;
}

.tekbis-chat-header-text strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.tekbis-chat-header-text span {
  display: block;
  font-size: 12px;
  opacity: 0.88;
  margin-top: 2px;
}

.tekbis-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tekbis-chat-clear {
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  flex-shrink: 0;
}

.tekbis-chat-clear:hover {
  background: rgba(255, 255, 255, 0.24);
}

.tekbis-chat-close {
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.tekbis-chat-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

.tekbis-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--tb-chat-surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tekbis-chat-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--tb-chat-text);
  white-space: pre-wrap;
  word-break: break-word;
}

.tekbis-chat-msg a {
  color: var(--tb-chat-primary);
  text-decoration: underline;
}

.tekbis-chat-msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--tb-chat-border);
  border-bottom-left-radius: 4px;
}

.tekbis-chat-msg--user {
  align-self: flex-end;
  background: var(--tb-chat-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.tekbis-chat-msg--user a {
  color: #fff;
}

.tekbis-chat-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--tb-chat-border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.tekbis-chat-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: tekbis-chat-bounce 1.2s infinite ease-in-out;
}

.tekbis-chat-typing i:nth-child(2) { animation-delay: 0.15s; }
.tekbis-chat-typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes tekbis-chat-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.tekbis-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
  background: var(--tb-chat-surface);
  flex-shrink: 0;
}

.tekbis-chat-chip {
  border: 1px solid var(--tb-chat-border);
  background: #fff;
  color: var(--tb-chat-text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.tekbis-chat-chip:hover {
  border-color: var(--tb-chat-primary);
  color: var(--tb-chat-primary);
  background: #eef3ff;
}

.tekbis-chat-footer {
  border-top: 1px solid var(--tb-chat-border);
  padding: 10px 12px 12px;
  background: #fff;
  flex-shrink: 0;
}

.tekbis-chat-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.tekbis-chat-input {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 110px;
  border: 1px solid var(--tb-chat-border);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: var(--tb-chat-text);
  outline: none;
  background: #fff;
}

.tekbis-chat-input:focus {
  border-color: var(--tb-chat-primary);
  box-shadow: 0 0 0 3px rgba(18, 72, 244, 0.12);
}

.tekbis-chat-send {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: var(--tb-chat-primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.tekbis-chat-send:hover:not(:disabled) {
  background: var(--tb-chat-primary-dark);
}

.tekbis-chat-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tekbis-chat-send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.tekbis-chat-disclaimer {
  margin: 8px 2px 0;
  font-size: 11px;
  color: var(--tb-chat-muted);
  line-height: 1.35;
  text-align: center;
}

.tekbis-chat-disclaimer a {
  color: var(--tb-chat-primary);
  text-decoration: none;
  font-weight: 600;
}

.tekbis-chat-disclaimer a:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .tekbis-chat-root {
    right: 14px;
    bottom: 96px;
  }

  .tekbis-chat-panel {
    width: calc(100vw - 28px);
    height: min(65dvh, 520px);
    max-height: calc(100dvh - 160px);
  }
}
