/*
 * floating.css — WhatsApp pulse button, AI chatbot launcher,
 * 20-second popup, and mobile bottom CTA bar.
 * Mirrors Floating.jsx from the design system.
 */

/* ── WHATSAPP PULSE ──────────────────────────────────────── */
.tsu-wa-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-overlay);
  width: 64px;
  height: 64px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--whatsapp), var(--whatsapp-dark));
  border: none;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 12px 28px rgba(37,211,102,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--dur-base) var(--ease-spring);
}
.tsu-wa-btn:hover { transform: scale(1.08); }
.tsu-wa-btn__pulse {
  position: absolute;
  inset: -8px;
  border-radius: var(--radius-pill);
  background: rgba(37,211,102,0.4);
  animation: tsu-pulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes tsu-pulse {
  0%   { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ── AI CHAT BUTTON ──────────────────────────────────────── */
.tsu-chat-btn {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: var(--z-overlay);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--ink-900), var(--ink-700));
  border: 1px solid rgba(201,168,97,0.3);
  cursor: pointer;
  color: #fff;
  box-shadow: 0 12px 28px rgba(15,23,42,0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--dur-base) var(--ease-spring);
}
.tsu-chat-btn:hover { transform: scale(1.08); }
.tsu-chat-btn .tsu-icon { color: var(--gold); }

/* ── CHAT PANEL ──────────────────────────────────────────── */
.tsu-chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: calc(var(--z-overlay) + 50);
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 48px);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: var(--radius-xl);
  box-shadow: 0 32px 80px rgba(15,23,42,0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: tsu-panel-in var(--dur-slow) var(--ease-spring);
}
@keyframes tsu-panel-in {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}
.tsu-chat-panel.is-closed { display: none; }

/* Chat header */
.tsu-chat-panel__hdr {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--ink-900), var(--brand-emerald-dark));
  color: #fff;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  flex-shrink: 0;
}
.tsu-chat-panel__av {
  width: 38px; height: 38px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-900);
  flex-shrink: 0;
}
.tsu-chat-panel__name {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  font-size: 14px;
}
.tsu-chat-panel__status {
  font-family: var(--font-body);
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  display: flex; align-items: center; gap: 4px;
}
.tsu-chat-panel__dot {
  width: 6px; height: 6px;
  background: var(--brand-emerald-400);
  border-radius: var(--radius-pill);
  box-shadow: 0 0 8px var(--brand-emerald-400);
}
.tsu-chat-panel__close {
  margin-left: auto;
  background: transparent; border: none;
  color: rgba(255,255,255,0.6); cursor: pointer;
  display: flex; align-items: center;
  transition: color var(--dur-base);
}
.tsu-chat-panel__close:hover { color: #fff; }

/* Chat body */
.tsu-chat-panel__body {
  flex: 1; overflow-y: auto;
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.tsu-chat-msg {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: 16px;
  max-width: 85%;
}
.tsu-chat-msg--bot {
  background: var(--ink-50);
  color: var(--ink-800);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.tsu-chat-msg--me {
  background: var(--grad-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* Typing indicator */
.tsu-chat-typing {
  display: flex; gap: 4px; padding: 12px 14px;
  background: var(--ink-50);
  border-radius: 16px; border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.tsu-chat-typing span {
  width: 6px; height: 6px;
  background: var(--ink-300);
  border-radius: var(--radius-pill);
  animation: tsu-typing 1.4s infinite ease-in-out;
}
.tsu-chat-typing span:nth-child(2) { animation-delay: 0.18s; }
.tsu-chat-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes tsu-typing {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%            { transform: scale(1);   opacity: 1;   }
}

/* Quick-reply chips */
.tsu-chat-chips {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 0 18px 8px;
  flex-shrink: 0;
}
.tsu-chat-chip {
  font-family: var(--font-body); font-size: 11px; font-weight: var(--fw-semibold);
  color: var(--brand-emerald);
  background: var(--brand-emerald-tint);
  border: 1px solid var(--brand-emerald-200);
  padding: 7px 12px; border-radius: var(--radius-pill);
  cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.tsu-chat-chip:hover {
  background: var(--brand-emerald);
  color: #fff;
}

/* Live-agent handoff */
.tsu-chat-handoff {
  margin: 12px 18px 4px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(201,168,97,0.15), rgba(201,168,97,0.04));
  border: 1px solid rgba(201,168,97,0.32);
  border-radius: var(--radius-md);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.tsu-chat-handoff__icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-pill);
  background: rgba(201,168,97,0.2);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold); flex-shrink: 0;
}
.tsu-chat-handoff__text {
  flex: 1;
  font-family: var(--font-body); font-size: 12px;
  color: var(--ink-500); line-height: 1.4;
}
.tsu-chat-handoff__text strong { color: var(--ink-800); }

/* Composer */
.tsu-chat-composer {
  padding: 14px;
  border-top: 1px solid var(--border-default);
  background: rgba(255,255,255,0.96);
  display: flex; gap: 8px; align-items: center;
  flex-shrink: 0;
}
.tsu-chat-composer__mic {
  width: 32px; height: 32px;
  border-radius: var(--radius-pill);
  background: transparent; border: none;
  color: var(--brand-emerald); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.tsu-chat-composer__input {
  flex: 1;
  font-family: var(--font-body); font-size: 13px;
  background: var(--bg-soft);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  padding: 10px 16px; color: var(--ink-800); outline: none;
  transition: border-color var(--dur-base);
}
.tsu-chat-composer__input:focus { border-color: var(--brand-emerald); }
.tsu-chat-composer__input::placeholder { color: var(--ink-300); }
.tsu-chat-composer__send {
  width: 38px; height: 38px;
  border-radius: var(--radius-pill); border: none;
  background: var(--grad-primary); color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity var(--dur-base);
}
.tsu-chat-composer__send:hover { opacity: 0.88; }

/* ── 20-SECOND POPUP ─────────────────────────────────────── */
.tsu-popup-backdrop {
  position: fixed; inset: 0;
  z-index: var(--z-modal);
  background: rgba(15,23,42,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: tsu-fade-in var(--dur-slow) var(--ease-out);
}
.tsu-popup-backdrop.is-hidden { display: none; }
@keyframes tsu-fade-in { from { opacity: 0; } to { opacity: 1; } }

.tsu-popup {
  width: 100%; max-width: 480px;
  border-radius: var(--radius-2xl); overflow: hidden;
  background: #fff;
  box-shadow: 0 32px 80px rgba(15,23,42,0.4);
  animation: tsu-pop-in var(--dur-slow) var(--ease-spring);
}
@keyframes tsu-pop-in {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.tsu-popup__banner {
  position: relative;
  height: 200px; overflow: hidden;
  background: linear-gradient(135deg, var(--ink-900) 0%, var(--brand-emerald-dark) 60%, var(--brand-emerald) 100%);
}
.tsu-popup__banner-img {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0.42;
}
.tsu-popup__offer-pill {
  position: absolute; top: 20px; left: 20px;
  background: var(--grad-gold);
  color: var(--ink-900); padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body); font-weight: var(--fw-bold);
  font-size: 11px; letter-spacing: var(--ls-eyebrow); text-transform: uppercase;
}
.tsu-popup__close-btn {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.24);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-base);
}
.tsu-popup__close-btn:hover { background: rgba(255,255,255,0.28); }
.tsu-popup__headline {
  position: absolute; left: 20px; bottom: 16px; color: #fff;
  font-family: var(--font-display); font-weight: var(--fw-black);
  font-size: 36px; letter-spacing: -0.025em;
}
.tsu-popup__headline-sub {
  font-family: var(--font-body); font-size: 12px;
  font-weight: var(--fw-semibold); color: rgba(255,255,255,0.8);
  letter-spacing: 0.12em; text-transform: uppercase;
}
.tsu-popup__headline-pct { color: var(--gold); }

.tsu-popup__body { padding: 24px 28px 28px; }
.tsu-popup__title {
  font-family: var(--font-display); font-weight: var(--fw-bold);
  font-size: 22px; color: var(--ink-800);
  letter-spacing: var(--ls-tight); margin: 0; line-height: 1.2;
}
.tsu-popup__desc {
  font-family: var(--font-body); font-size: 14px; line-height: 1.55;
  color: var(--ink-500); margin: 10px 0 18px;
}
.tsu-popup__actions {
  display: flex; flex-direction: column; gap: 8px;
}
.tsu-popup__fine-print {
  font-family: var(--font-body); font-size: 11px;
  color: var(--ink-300); text-align: center; margin-top: 12px;
}

/* ── MOBILE BOTTOM BAR ───────────────────────────────────── */
.tsu-mobile-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: calc(var(--z-overlay) - 100);
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid var(--border-default);
  padding: 10px 12px env(safe-area-inset-bottom, 10px);
  display: none;
}
.tsu-mobile-bar__inner {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 8px;
}
.tsu-mobile-bar__btn {
  font-family: var(--font-body); font-weight: var(--fw-semibold);
  font-size: 12px; padding: 12px 8px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  gap: 6px; border: none; cursor: pointer;
  text-decoration: none;
}
.tsu-mobile-bar__btn--call {
  background: #fff; color: var(--brand-emerald);
  border: 1px solid var(--border-default);
}
.tsu-mobile-bar__btn--wa {
  background: linear-gradient(135deg, var(--whatsapp), var(--whatsapp-dark));
  color: #fff;
}
.tsu-mobile-bar__btn--quote {
  background: var(--grad-primary); color: #fff;
  box-shadow: 0 8px 20px rgba(14,122,75,0.32);
}

@media (max-width: 760px) {
  .tsu-mobile-bar { display: block; }
  /* Push WA / chat buttons up to clear the mobile bar */
  .tsu-wa-btn  { bottom: 84px; }
  .tsu-chat-btn { bottom: 160px; }
}
