/* ================================================================== *
 * GPS Shop — Suporte IA · widget (redesign v1.1)
 * Estilo: chat widget moderno (Intercom / Crisp / Drift)
 * ================================================================== */
.gpsia {
  --gpsia-navy: #092136;
  --gpsia-navy-2: #1a3a5c;
  --gpsia-navy-hdr: #0d2d4a;
  --gpsia-orange: #F5A623;
  --gpsia-orange-2: #e8950a;
  --gpsia-green: #4ade80;
  --gpsia-wa: #25D366;
  --gpsia-ai-bg: #f8f9fa;
  --gpsia-ai-bd: #e5e7eb;
  --gpsia-ink: #1a1a1a;
  --gpsia-muted: #9aa3ad;

  position: fixed;
  right: 22px;
  bottom: 96px;
  z-index: 2147483000;
  font-family: inherit;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* ------------------------------------------------------------------ *
 * Launcher — círculo 56px
 * ------------------------------------------------------------------ */
.gpsia-launcher {
  position: relative;
  width: 56px; height: 56px;
  border: 0; border-radius: 50%;
  background: linear-gradient(145deg, var(--gpsia-navy-2) 0%, var(--gpsia-navy) 70%);
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow:
    0 2px 4px rgba(9,33,54,.12),
    0 8px 18px rgba(9,33,54,.24),
    0 16px 34px rgba(9,33,54,.18);
  opacity: 0; transform: translateY(14px) scale(.85);
  transition: opacity .5s ease, transform .5s cubic-bezier(.22,1,.36,1), box-shadow .25s ease;
  -webkit-tap-highlight-color: transparent;
}
.gpsia-ready .gpsia-launcher { opacity: 1; transform: none; }
.gpsia-ready .gpsia-launcher:hover {
  transform: scale(1.05);
  box-shadow:
    0 3px 6px rgba(9,33,54,.16),
    0 10px 22px rgba(9,33,54,.30),
    0 20px 40px rgba(9,33,54,.22);
}
.gpsia-ready .gpsia-launcher:active { transform: scale(.97); }
.gpsia-launcher:focus-visible { outline: 3px solid var(--gpsia-orange); outline-offset: 3px; }

.gpsia-launcher-icon { width: 26px; height: 26px; display: grid; place-items: center; }
.gpsia-launcher-icon svg { width: 26px; height: 26px; color: var(--gpsia-orange); fill: var(--gpsia-orange); }

.gpsia-badge {
  position: absolute; top: -3px; right: -3px;
  background: var(--gpsia-orange);
  color: var(--gpsia-navy);
  font-size: 9.5px; font-weight: 800; line-height: 1; letter-spacing: .4px;
  padding: 3.5px 5px; border-radius: 7px;
  box-shadow: 0 2px 5px rgba(9,33,54,.28);
  border: 1.5px solid var(--gpsia-navy);
}

/* pulse — só o anel, sutil */
.gpsia-ready .gpsia-launcher::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(245,166,35,.40);
  animation: gpsia-ring 3s cubic-bezier(.22,1,.36,1) infinite;
  pointer-events: none;
}
@keyframes gpsia-ring {
  0%   { box-shadow: 0 0 0 0 rgba(245,166,35,.40); }
  60%  { box-shadow: 0 0 0 13px rgba(245,166,35,0); }
  100% { box-shadow: 0 0 0 0 rgba(245,166,35,0); }
}
.gpsia-open .gpsia-launcher::after { animation: none; }

/* ------------------------------------------------------------------ *
 * Painel
 * ------------------------------------------------------------------ */
.gpsia-panel {
  position: absolute; right: 0; bottom: 72px;
  width: 360px; height: 600px; max-height: 78vh;
  background: #fff; border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow:
    0 0 0 1px rgba(9,33,54,.04),
    0 6px 16px rgba(9,33,54,.10),
    0 18px 50px rgba(9,33,54,.22);
  transform-origin: bottom right;
  /* estado fechado — transição de SAÍDA (slide-down + fade, 200ms ease-in) */
  opacity: 0; transform: translateY(16px); visibility: hidden; pointer-events: none;
  transition: opacity .2s ease-in, transform .2s ease-in, visibility 0s linear .2s;
}
.gpsia-open .gpsia-panel {
  /* estado aberto — transição de ENTRADA (slide-up + fade, 300ms ease-out) */
  opacity: 1; transform: none; visibility: visible; pointer-events: auto;
  transition: opacity .3s ease-out, transform .3s cubic-bezier(.22,1,.36,1), visibility 0s;
}

/* ---- Header ---- */
.gpsia-header {
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--gpsia-navy) 0%, var(--gpsia-navy-hdr) 100%);
  color: #fff; padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.gpsia-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.gpsia-avatar {
  width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 50%; object-fit: cover; display: block;
  border: 2px solid rgba(255,255,255,.3);
  box-shadow: 0 2px 8px rgba(0,0,0,.20);
}
.gpsia-id-text { min-width: 0; }
.gpsia-id-text strong { display: block; font-size: 16px; font-weight: 700; line-height: 1.2; color: #fff; }
.gpsia-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--gpsia-green); margin-top: 2px;
}
.gpsia-status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--gpsia-green); box-shadow: 0 0 0 0 rgba(74,222,128,.6);
  animation: gpsia-live 2.4s ease-out infinite;
}
@keyframes gpsia-live {
  0% { box-shadow: 0 0 0 0 rgba(74,222,128,.55); }
  70% { box-shadow: 0 0 0 6px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}
.gpsia-close {
  flex: 0 0 auto; width: 32px; height: 32px;
  background: transparent; border: 0; border-radius: 50%;
  color: #cdd8e4; cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s ease, color .15s ease;
}
.gpsia-close:hover { background: rgba(255,255,255,.12); color: #fff; }
.gpsia-close svg { width: 18px; height: 18px; }

/* ---- Log de mensagens ---- */
.gpsia-log {
  flex: 1 1 auto; overflow-y: auto;
  padding: 18px 16px 8px; background: #fff;
  display: flex; flex-direction: column; gap: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: #d7dde4 transparent;
}
.gpsia-log::-webkit-scrollbar { width: 6px; }
.gpsia-log::-webkit-scrollbar-thumb { background: #d7dde4; border-radius: 3px; }

.gpsia-row {
  display: flex; flex-direction: column; gap: 4px; max-width: 84%;
  animation: gpsia-msg-in .28s ease-out both;
}
.gpsia-row--user { align-self: flex-end; align-items: flex-end; }
.gpsia-row--bot  { align-self: flex-start; align-items: flex-start; }
@keyframes gpsia-msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.gpsia-bubble {
  padding: 11px 14px; font-size: 14px; line-height: 1.5;
  border-radius: 18px; white-space: pre-wrap; word-wrap: break-word;
}
.gpsia-bubble--bot {
  background: var(--gpsia-ai-bg); color: var(--gpsia-ink);
  border: 1px solid var(--gpsia-ai-bd);
  border-bottom-left-radius: 6px;
}
.gpsia-bubble--user {
  background: linear-gradient(135deg, var(--gpsia-orange) 0%, var(--gpsia-orange-2) 100%);
  color: #fff; border-bottom-right-radius: 6px;
  box-shadow: 0 4px 12px rgba(245,166,35,.28);
}
.gpsia-time { font-size: 10.5px; color: var(--gpsia-muted); padding: 0 6px; }

/* ---- Digitando ---- */
.gpsia-typing { display: flex; gap: 5px; align-items: center; padding: 14px; }
.gpsia-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #b3bcc6;
  animation: gpsia-bounce 1.3s infinite ease-in-out;
}
.gpsia-typing span:nth-child(2) { animation-delay: .18s; }
.gpsia-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes gpsia-bounce {
  0%, 70%, 100% { transform: translateY(0); opacity: .55; }
  35% { transform: translateY(-6px); opacity: 1; }
}

/* ---- Input ---- */
.gpsia-form {
  flex: 0 0 auto;
  display: flex; gap: 8px; align-items: center;
  padding: 12px 14px; border-top: 1px solid #eef1f4; background: #fff;
}
.gpsia-input {
  flex: 1; min-width: 0;
  border: 1.5px solid #e2e7ec; border-radius: 24px;
  padding: 12px 16px; font-size: 16px; color: var(--gpsia-ink);
  background: #fff; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.gpsia-input::placeholder { color: #aab2bc; }
.gpsia-input:focus { border-color: var(--gpsia-orange); box-shadow: 0 0 0 4px rgba(245,166,35,.16); }
.gpsia-send {
  flex: 0 0 auto; width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: linear-gradient(135deg, var(--gpsia-orange) 0%, var(--gpsia-orange-2) 100%);
  cursor: pointer; display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(245,166,35,.32);
  transition: transform .12s ease, box-shadow .15s ease, opacity .15s ease;
}
.gpsia-send:hover { box-shadow: 0 6px 16px rgba(245,166,35,.42); }
.gpsia-send:active { transform: scale(.92); }
.gpsia-send:disabled { opacity: .5; box-shadow: none; cursor: default; }
.gpsia-send svg { width: 20px; height: 20px; fill: #fff; }

/* ---- Footer ---- */
.gpsia-footer {
  flex: 0 0 auto;
  padding: 8px 12px 11px; background: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.gpsia-wa {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: #128C4A; text-decoration: none;
  padding: 4px 8px; border-radius: 10px; transition: background .15s ease;
}
.gpsia-wa:hover { background: rgba(37,211,102,.10); }
.gpsia-wa svg { width: 16px; height: 16px; }
.gpsia-powered { font-size: 10px; letter-spacing: .2px; color: #b6bdc6; }
.gpsia-powered b { color: #8d96a1; font-weight: 700; }

/* ------------------------------------------------------------------ *
 * Mobile (≤ 600px) — fullscreen, radius só no topo
 * ------------------------------------------------------------------ */
@media (max-width: 600px) {
  .gpsia { right: 18px; bottom: 88px; }
  .gpsia-panel {
    position: fixed; inset: 0;
    width: 100%; height: 100dvh; max-height: 100dvh;
    border-radius: 16px 16px 0 0;
  }
  .gpsia-header { padding: 18px 18px; }
  .gpsia-avatar { width: 44px; height: 44px; }
  .gpsia-id-text strong { font-size: 17px; }
  .gpsia-close { width: 38px; height: 38px; }
  .gpsia-close svg { width: 20px; height: 20px; }
  .gpsia-form { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
}

/* ------------------------------------------------------------------ *
 * Blindagem — o tema WoodMart reseta border-radius/padding/box-shadow
 * em button/input. Reafirmamos com especificidade alta + !important.
 * ------------------------------------------------------------------ */
.gpsia .gpsia-launcher {
  border-radius: 50% !important;
  padding: 0 !important;
  box-shadow:
    0 2px 4px rgba(9,33,54,.12),
    0 8px 18px rgba(9,33,54,.24),
    0 16px 34px rgba(9,33,54,.18) !important;
}
.gpsia.gpsia-ready .gpsia-launcher:hover {
  box-shadow:
    0 3px 6px rgba(9,33,54,.16),
    0 10px 22px rgba(9,33,54,.30),
    0 20px 40px rgba(9,33,54,.22) !important;
}
.gpsia .gpsia-close { border-radius: 50% !important; padding: 0 !important; background: transparent !important; }
.gpsia .gpsia-close:hover { background: rgba(255,255,255,.12) !important; }
.gpsia .gpsia-send {
  border-radius: 50% !important; padding: 0 !important;
  box-shadow: 0 4px 12px rgba(245,166,35,.32) !important;
}
.gpsia .gpsia-send:hover { box-shadow: 0 6px 16px rgba(245,166,35,.42) !important; }
.gpsia .gpsia-send:disabled { box-shadow: none !important; }
.gpsia .gpsia-input {
  border-radius: 24px !important;
  padding: 12px 16px !important;
  border: 1.5px solid #e2e7ec !important;
}
.gpsia .gpsia-input:focus {
  border-color: var(--gpsia-orange) !important;
  box-shadow: 0 0 0 4px rgba(245,166,35,.16) !important;
}
.gpsia .gpsia-badge { border-radius: 7px !important; }
.gpsia .gpsia-avatar { border-radius: 50% !important; object-fit: cover !important; border: 2px solid rgba(255,255,255,.3) !important; max-width: 40px; }
.gpsia .gpsia-wa { color: #128C4A !important; }

/* ------------------------------------------------------------------ *
 * Reduz movimento
 * ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .gpsia-launcher, .gpsia-panel, .gpsia-row { transition: none; animation: none; }
  .gpsia-ready .gpsia-launcher { opacity: 1; transform: none; }
  .gpsia-ready .gpsia-launcher::after { animation: none; }
  .gpsia-status::before { animation: none; }
  .gpsia-open .gpsia-panel { opacity: 1; transform: none; visibility: visible; }
  .gpsia-typing span { animation-duration: 1.3s; }
}
