/* ==========================================================================
   Chat flutuante — estilos completos (independente de conta.css)
   ========================================================================== */

.site-chat-widget {
  --chat-accent: #7c5cff;
  --chat-accent-soft: #a78bfa;
  --chat-accent-glow: rgba(124, 92, 255, 0.45);
  --chat-surface: #12151f;
  --chat-elevated: #1a1f2e;
  --chat-border: rgba(255, 255, 255, 0.09);
  --chat-text: #f8fafc;
  --chat-muted: #94a3b8;
  --chat-radius: 1.125rem;
  --chat-ease: cubic-bezier(0.22, 1, 0.36, 1);

  position: fixed;
  inset: 0;
  z-index: 10100;
  pointer-events: none;
}

.site-chat-widget__fab,
.site-chat-panel,
.site-chat-toast {
  pointer-events: auto;
}

/* --- Toast (nova mensagem) ------------------------------------------------- */
.site-chat-toast {
  position: fixed;
  right: max(1.25rem, env(safe-area-inset-right, 0px));
  bottom: calc(max(1.25rem, env(safe-area-inset-bottom, 0px)) + 4rem);
  z-index: 10103;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: min(calc(100vw - 2rem), 340px);
  padding: 0.85rem 0.9rem 0.9rem;
  border-radius: 1rem;
  border: 1px solid rgba(167, 139, 250, 0.35);
  background: linear-gradient(165deg, #1f2438 0%, #151a28 100%);
  color: var(--chat-text, #f8fafc);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(124, 92, 255, 0.12),
    0 8px 28px rgba(124, 92, 255, 0.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transition:
    opacity 0.32s var(--chat-ease, cubic-bezier(0.22, 1, 0.36, 1)),
    visibility 0.32s,
    transform 0.38s var(--chat-ease, cubic-bezier(0.22, 1, 0.36, 1));
  cursor: pointer;
}

.site-chat-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.site-chat-toast__close {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.site-chat-toast__close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.site-chat-toast__body {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding-right: 1.5rem;
}

.site-chat-toast__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(139, 109, 255, 0.5), rgba(91, 61, 240, 0.3));
  color: #ede9fe;
}

.site-chat-toast__text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.site-chat-toast__title {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-chat-toast__preview {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--chat-muted, #94a3b8);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.site-chat-toast__action {
  align-self: flex-start;
  padding: 0.45rem 0.85rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(145deg, #8b6dff, #5b3df0);
  color: #fff;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(124, 92, 255, 0.35);
  transition: filter 0.2s ease, transform 0.15s ease;
}

.site-chat-toast__action:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.site-chat-widget.has-unread .site-chat-widget__fab {
  animation: site-chat-fab-attn 2s ease-in-out infinite;
}

.site-chat-widget.has-unread .site-chat-widget__fab-ring {
  opacity: 0.75;
  animation: site-chat-fab-pulse 1.6s ease-out infinite;
}

@keyframes site-chat-fab-attn {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

/* --- FAB ------------------------------------------------------------------- */
.site-chat-widget__fab {
  position: fixed;
  right: max(1.25rem, env(safe-area-inset-right, 0px));
  bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  z-index: 10102;
  display: inline-flex;
  isolation: isolate;
  align-items: center;
  justify-content: center;
  width: 3.35rem;
  height: 3.35rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: linear-gradient(145deg, #9b7dff 0%, #6d4aff 48%, #5b3df0 100%);
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    0 10px 32px var(--chat-accent-glow),
    0 2px 10px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition:
    transform 0.28s var(--chat-ease),
    opacity 0.25s ease,
    box-shadow 0.28s ease;
}

.site-chat-widget__fab-ring {
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid rgba(167, 139, 250, 0.45);
  opacity: 0;
  pointer-events: none;
}

@keyframes site-chat-fab-pulse {
  0% {
    transform: scale(0.92);
    opacity: 0.65;
  }
  70% {
    transform: scale(1.12);
    opacity: 0;
  }
  100% {
    transform: scale(1.12);
    opacity: 0;
  }
}

.site-chat-widget__fab:hover {
  transform: translateY(-3px);
  box-shadow:
    0 14px 40px rgba(124, 92, 255, 0.55),
    0 4px 14px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.site-chat-widget__fab:active {
  transform: translateY(-1px);
}

.site-chat-widget__fab-icon {
  flex-shrink: 0;
}

.site-chat-widget.is-open .site-chat-widget__fab {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.88) translateY(10px);
}

.site-chat-widget.is-live:not(.is-open):not(.has-unread) .site-chat-widget__fab-icon {
  animation: site-chat-fab-icon-idle 3.2s ease-in-out infinite;
}

.site-chat-widget.is-live:not(.is-open):not(.has-unread) .site-chat-widget__fab-ring {
  opacity: 0.45;
  animation: site-chat-fab-pulse 3.2s ease-out infinite;
}

@keyframes site-chat-fab-icon-idle {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.07);
  }
}

.site-chat-widget__fab-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #fb7185, #f43f5e);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
  border: 2px solid #0b0d14;
  box-shadow: 0 2px 10px rgba(244, 63, 94, 0.55);
}

.site-chat-widget__fab-badge:not([hidden]) {
  display: block;
}

/* --- Painel ---------------------------------------------------------------- */
.site-chat-panel {
  position: fixed;
  right: max(1.25rem, env(safe-area-inset-right, 0px));
  bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  z-index: 10101;
  display: flex;
  flex-direction: column;
  width: min(calc(100vw - 2rem), 392px);
  height: min(calc(100dvh - 5.5rem), 580px);
  max-height: calc(100dvh - 2rem);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(124, 92, 255, 0.12), transparent 55%),
    linear-gradient(168deg, #1a1f2e 0%, #131722 42%, #0f1219 100%);
  border: 1px solid var(--chat-border);
  border-radius: var(--chat-radius);
  box-shadow:
    0 28px 72px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(124, 92, 255, 0.1),
    0 12px 40px rgba(124, 92, 255, 0.14);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(0.95);
  transform-origin: bottom right;
  transition:
    opacity 0.32s var(--chat-ease),
    visibility 0.32s,
    transform 0.38s var(--chat-ease),
    height 0.32s var(--chat-ease);
}

.site-chat-widget.is-open .site-chat-panel,
.site-chat-widget.is-minimized .site-chat-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.site-chat-widget.is-minimized .site-chat-panel {
  height: auto;
  min-height: 0;
  max-height: none;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(124, 92, 255, 0.15);
}

.site-chat-widget.is-minimized .site-chat-panel__content {
  display: none;
}

.site-chat-widget.is-minimized .site-chat-panel__head-main {
  cursor: pointer;
  pointer-events: auto;
}

.site-chat-widget.is-minimized .site-chat-panel__head-main:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* --- Cabeçalho ------------------------------------------------------------- */
.site-chat-panel__head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 0.8rem 0.85rem 0.9rem;
  border-bottom: 1px solid var(--chat-border);
  background: linear-gradient(180deg, rgba(26, 31, 46, 0.98) 0%, rgba(18, 21, 31, 0.95) 100%);
  flex-shrink: 0;
}

.site-chat-panel__head::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124, 92, 255, 0.35), transparent);
}

.site-chat-panel__head-main {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1;
  min-width: 0;
  padding: 0.15rem;
  margin: -0.15rem;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 0.625rem;
  transition: background 0.2s ease;
}

.site-chat-widget.is-open .site-chat-panel__head-main {
  cursor: default;
  pointer-events: none;
}

.site-chat-panel__head-badge {
  position: absolute;
  top: 0.1rem;
  right: 0.1rem;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #fb7185, #f43f5e);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
  border: 2px solid #1a1f2e;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.45);
}

.site-chat-panel__head-badge[hidden] {
  display: none;
}

.site-chat-panel__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(139, 109, 255, 0.45), rgba(91, 61, 240, 0.25));
  color: #ddd6fe;
  box-shadow:
    0 0 0 1px rgba(167, 139, 250, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.site-chat-panel__head-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.2rem;
}

.site-chat-panel__title {
  display: block;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--chat-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-chat-panel__sub {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #86efac;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-chat-panel__status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.65);
  animation: site-chat-status-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes site-chat-status-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(0.92); }
}

.site-chat-panel__controls {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.site-chat-panel__ctrl {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease;
}

.site-chat-panel__ctrl:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: translateY(-1px);
}

.site-chat-panel__ctrl--end {
  display: none;
}

.site-chat-widget.has-active-chat .site-chat-panel__ctrl--end {
  display: flex;
}

.site-chat-panel__ctrl--end:hover {
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.25);
  color: #fecaca;
}

/* --- Conteúdo / gate ------------------------------------------------------- */
.site-chat-panel__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* [hidden] não pode ser sobrescrito por display:flex no painel de mensagens */
.site-chat-panel__gate[hidden],
.site-chat-panel__body[hidden],
.site-chat-panel__gate-error[hidden] {
  display: none !important;
}

.site-chat-panel__gate:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 1.35rem 1.25rem max(1.5rem, env(safe-area-inset-bottom, 0px));
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 92, 255, 0.35) transparent;
}

.site-chat-panel__content.is-gate .site-chat-panel__body {
  display: none !important;
}

.site-chat-panel__content.is-chat .site-chat-panel__gate {
  display: none !important;
}

.site-chat-panel__gate-hero {
  text-align: center;
  margin-bottom: 1.35rem;
}

.site-chat-panel__gate-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 0.85rem;
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(124, 92, 255, 0.22), rgba(91, 61, 240, 0.1));
  color: #c4b5fd;
  box-shadow:
    0 8px 24px rgba(124, 92, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.site-chat-panel__gate-title {
  margin: 0 0 0.4rem;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--chat-text);
}

.site-chat-panel__gate-lead {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--chat-muted);
}

.site-chat-panel__field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.site-chat-panel__field span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--chat-muted);
  letter-spacing: 0.02em;
}

.site-chat-panel__field input {
  padding: 0.7rem 0.85rem;
  border-radius: 0.625rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(11, 13, 20, 0.85);
  color: var(--chat-text);
  font: inherit;
  font-size: 0.875rem;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.site-chat-panel__field input::placeholder {
  color: #64748b;
}

.site-chat-panel__field input:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.site-chat-panel__field input:focus {
  outline: none;
  border-color: rgba(124, 92, 255, 0.55);
  background: #0b0d14;
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}

.site-chat-panel__start {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.625rem;
  background: linear-gradient(145deg, #8b6dff 0%, #6d4aff 55%, #5b3df0 100%);
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(124, 92, 255, 0.35);
  transition:
    filter 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease;
}

.site-chat-panel__start:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(124, 92, 255, 0.45);
}

.site-chat-panel__start:active {
  transform: translateY(0);
}

.site-chat-panel__start:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.site-chat-panel__gate-error {
  margin: 0.85rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: 0.5rem;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fca5a5;
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* --- Mensagens ------------------------------------------------------------- */
.site-chat-panel__body:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: #0e1118;
}

.site-chat-widget .site-chat-panel__messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
  max-height: none !important;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 92, 255, 0.35) transparent;
}

.site-chat-panel__messages::-webkit-scrollbar {
  width: 6px;
}

.site-chat-panel__messages::-webkit-scrollbar-thumb {
  background: rgba(124, 92, 255, 0.35);
  border-radius: 999px;
}

.site-chat-panel__empty {
  margin: auto;
  padding: 2.5rem 1rem;
  text-align: center;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #64748b;
}

.site-chat-panel__empty--loading {
  color: var(--chat-muted);
  animation: site-chat-loading-pulse 1.4s ease-in-out infinite;
}

@keyframes site-chat-loading-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.site-chat-row {
  display: flex;
  width: 100%;
  clear: both;
}

.site-chat-row--mine {
  justify-content: flex-end;
}

.site-chat-row--theirs {
  justify-content: flex-start;
}

.site-chat-bubble {
  max-width: 88%;
  padding: 0.6rem 0.85rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  word-wrap: break-word;
  animation: site-chat-bubble-in 0.28s var(--chat-ease) backwards;
}

@keyframes site-chat-bubble-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.site-chat-bubble--mine {
  color: #fff;
  background: linear-gradient(145deg, rgba(139, 109, 255, 0.95) 0%, rgba(91, 61, 240, 0.88) 100%);
  border-bottom-right-radius: 0.3rem;
  box-shadow: 0 4px 16px rgba(124, 92, 255, 0.28);
}

.site-chat-bubble--theirs {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom-left-radius: 0.3rem;
}

.site-chat-bubble__meta {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.42);
  letter-spacing: 0.01em;
}

.site-chat-bubble--theirs .site-chat-bubble__meta {
  color: rgba(148, 163, 184, 0.85);
}

/* --- Composer -------------------------------------------------------------- */
.site-chat-panel__form {
  flex-shrink: 0;
  padding: 0.75rem;
  border-top: 1px solid var(--chat-border);
  background: linear-gradient(180deg, #141824 0%, #10141f 100%);
}

.site-chat-panel__form {
  display: block;
}

.site-chat-panel__composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.35rem 0.35rem 0.35rem 0.85rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(11, 13, 20, 0.9);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.site-chat-panel__composer:focus-within {
  border-color: rgba(124, 92, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.14);
}

.site-chat-panel__composer textarea {
  flex: 1;
  min-height: 1.5rem;
  max-height: 7rem;
  padding: 0.55rem 0;
  border: none;
  background: transparent;
  color: var(--chat-text);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.45;
  resize: none;
  field-sizing: content;
}

.site-chat-panel__composer textarea::placeholder {
  color: #64748b;
}

.site-chat-panel__composer textarea:focus {
  outline: none;
}

.site-chat-panel__send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #8b6dff, #5b3df0);
  box-shadow: 0 4px 14px rgba(124, 92, 255, 0.4);
  cursor: pointer;
  transition:
    filter 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease;
}

.site-chat-panel__send:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: scale(1.04);
  box-shadow: 0 6px 18px rgba(124, 92, 255, 0.5);
}

.site-chat-panel__send:active:not(:disabled) {
  transform: scale(0.98);
}

.site-chat-panel__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.site-chat-panel__send:not(:disabled) {
  pointer-events: auto;
}

/* --- Utilitários ----------------------------------------------------------- */
.site-chat-widget .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 479px) {
  .site-chat-widget.is-open .site-chat-panel {
    right: 0;
    left: 0;
    width: auto;
    bottom: 0;
    max-height: 100dvh;
    height: min(92dvh, 640px);
    border-radius: 1.125rem 1.125rem 0 0;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .site-chat-panel {
    right: max(0.65rem, env(safe-area-inset-right, 0px));
    left: max(0.65rem, env(safe-area-inset-left, 0px));
    width: auto;
    bottom: max(0.65rem, env(safe-area-inset-bottom, 0px));
    height: min(calc(100dvh - 4rem), 580px);
  }

  .site-chat-widget__fab {
    right: max(0.65rem, env(safe-area-inset-right, 0px));
    bottom: max(0.65rem, env(safe-area-inset-bottom, 0px));
  }

  .site-chat-panel__gate:not([hidden]) {
    padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
    padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
  }

  .site-chat-panel__field input {
    font-size: 1rem;
  }
}

/* --- Header site (botão suporte) ------------------------------------------- */
@media (max-width: 899px) {
  body.site-chat-open {
    overflow: hidden;
  }

  /* Permite toque no composer/botão enviar (evita bloqueio do touch-action no body) */
  .site-chat-widget.is-open .site-chat-panel,
  .site-chat-widget.is-open .site-chat-panel__form,
  .site-chat-widget.is-open .site-chat-panel__composer,
  .site-chat-widget.is-open .site-chat-panel__send,
  .site-chat-widget.is-open .site-chat-panel__start {
    touch-action: manipulation;
  }

  .site-chat-panel__gate:not([hidden]),
  .site-chat-panel__messages {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }
}

@media (min-width: 900px) {
  body.site-chat-open {
    overflow: auto;
  }
}

.arena-header__chat-btn {
  position: relative;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-shrink: 0;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md, 0.75rem);
  border: 1px solid rgba(124, 92, 255, 0.35);
  background: rgba(124, 92, 255, 0.12);
  color: #e2e8f0;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.arena-header__chat-btn:hover {
  background: rgba(124, 92, 255, 0.22);
  border-color: rgba(124, 92, 255, 0.5);
}

.arena-header__chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #fb7185, #f43f5e);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
  border: 2px solid #0b0d14;
}

.arena-header__chat-badge[hidden] {
  display: none;
}

@media (min-width: 900px) {
  .arena-header__chat-btn {
    display: inline-flex;
  }

  .site-chat-toast {
    bottom: calc(max(1.25rem, env(safe-area-inset-bottom, 0px)) + 4.5rem);
  }
}

@media (max-width: 899px) {
  .arena-header__actions .arena-btn--nav {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-chat-widget__fab-ring,
  .site-chat-panel__status-dot,
  .site-chat-panel__empty--loading,
  .site-chat-bubble,
  .site-chat-widget.has-unread .site-chat-widget__fab,
  .site-chat-widget.is-live:not(.is-open) .site-chat-widget__fab-icon {
    animation: none;
  }

  .site-chat-toast {
    transition: opacity 0.15s ease;
    transform: none;
  }
}
