/* =========================================================
   Chat UI — WhatsApp Premium
   Fonte maior (público 40+), animações cinematográficas,
   sombras ricas, sensação de app nativo de alta qualidade.
   Mantém todas as classes originais.
========================================================= */

/* ---------- Tokens ---------- */

:root {
  --bg: #ddd5ca;
  --chat: #ece5db;
  --line: #cfc8be;
  --wpp-header: #075e54;
  --wpp-accent: #25d366;
  --wpp-dark: #1aaa50;
  --bubble-in: #ffffff;
  --bubble-out: #d9f7be;
  --text: #0d1a14;
  --muted: #607068;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-up: 0 4px 18px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.07);
  --radius-bubble: 18px;
}

/* ---------- Reset / Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
html {
  /* scroll-behavior removido — interfere com scroll programático no mobile */
}

body {
  margin: 0;
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  color: var(--text);
  background: radial-gradient(
      ellipse 900px 600px at 110% -10%,
      rgba(37, 211, 102, 0.06),
      transparent 55%
    ),
    radial-gradient(
      ellipse 800px 700px at -10% 110%,
      rgba(7, 94, 84, 0.07),
      transparent 50%
    ),
    var(--bg);
}

/* ---------- App shell ---------- */

.app {
  height: 100vh;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--chat);
  position: relative;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 8px 40px rgba(0, 0, 0, 0.18),
    0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 24px;
  overflow: hidden;
}

/* ---------- Header ---------- */

.wpp-header {
  height: 68px;
  background: linear-gradient(
      108deg,
      rgba(255, 255, 255, 0.07) 0%,
      transparent 45%
    ),
    linear-gradient(180deg, #0b7a6a 0%, #054f44 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 6px 28px rgba(5, 79, 68, 0.45), 0 2px 8px rgba(0, 0, 0, 0.18);
  backdrop-filter: saturate(1.6) blur(14px);
}

.wpp-header .left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wpp-header .back {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  transition: background 0.15s, transform 0.12s;
  opacity: 0.9;
}
.wpp-header .back:hover {
  background: rgba(255, 255, 255, 0.14);
  opacity: 1;
}
.wpp-header .back:active {
  transform: scale(0.93);
}

/* Avatar com anel verde pulsante */
.wpp-header .avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2.5px rgba(87, 255, 156, 0.65),
    0 0 0 5px rgba(87, 255, 156, 0.14), 0 4px 14px rgba(0, 0, 0, 0.3);
  animation: avatarRing 3.2s ease-in-out infinite;
  transition: transform 0.2s ease;
  cursor: pointer;
}
.wpp-header .avatar:hover {
  transform: scale(1.07);
}

/* box-shadow animado substituído por opacity — composite only, zero repaint */
@keyframes avatarRing {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.75;
  }
}

/* Nome + status */
.wpp-header .meta {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  line-height: 1.1;
}

.wpp-header .meta .name,
.wpp-header #contact-name {
  display: block !important;
  color: #fff !important;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.1px;
  margin: 0 0 2px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.wpp-header .meta .status,
.wpp-header #status {
  display: flex !important;
  align-items: center;
  gap: 5px;
  color: rgba(220, 255, 238, 0.92) !important;
  font-size: 12px;
  margin: 0 !important;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
  padding-left: 0;
  position: static;
}

.wpp-header #status::before {
  content: "";
  display: inline-block;
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6dffb0;
  animation: statusGlow 2.2s ease-in-out infinite;
  position: static;
  transform: none;
}

@keyframes statusGlow {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Ícones da direita */
.wpp-header .right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  appearance: none;
  background: transparent;
  border: none;
  padding: 7px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  border-radius: 12px;
  opacity: 0.88;
  transition: opacity 0.15s, transform 0.12s, background 0.15s;
}
.icon-btn svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: currentColor;
}
/* Ícones de chamada ligeiramente maiores — fill puro, sem stroke */
.icon-btn .call-icon {
  width: 26px;
  height: 26px;
}
.icon-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.13);
}
.icon-btn:active {
  transform: scale(0.93);
}

/* ---------- Área de mensagens ---------- */

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px 20px 130px;
  /* scroll-behavior: smooth removido — causa jank no scroll programático mobile */
}

.messages::-webkit-scrollbar {
  width: 5px;
}
.messages::-webkit-scrollbar-track {
  background: transparent;
}
.messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #a8d4b8, #6db890);
  border-radius: 10px;
}
.messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #7fc4a0, #3fa870);
}

/* Banner oculto */
.banner {
  display: none !important;
}

/* ---------- Rows ---------- */

.row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 6px 0;
  animation: rowIn 0.3s cubic-bezier(0.22, 0.9, 0.36, 1) both;
  contain: layout style; /* isola reflow — impede que bolhas novas recalculem layout inteiro */
}

@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.row.left {
  justify-content: flex-start;
}
.row.right {
  justify-content: flex-end;
}

.row .thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 36px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.row .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Bolhas ---------- */

.bubble {
  max-width: min(72vw, 680px);
  background: var(--bubble-in);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-bubble);
  padding: 12px 15px 9px;
  position: relative;
  box-shadow: var(--shadow);
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: 0.1px;
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.22s;
}

/* Durante digitação: desativa transition e will-change */
.bubble.typing-text {
  transition: none;
  will-change: contents;
}

.bubble:hover {
  will-change: transform;
  transform: translateY(-2px) scale(1.006);
  box-shadow: var(--shadow-up);
}

.right .bubble {
  background: var(--bubble-out);
  color: #0c2218;
  border-color: rgba(26, 170, 80, 0.18);
}

/* Caudas — sem filter (pesado, força repaint) */
.left .bubble::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 10px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-right-color: var(--bubble-in);
}

.right .bubble::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 10px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-left-color: var(--bubble-out);
}

/* Entrada das bolhas */
.row.left .bubble.enter {
  animation: msgInLeft 0.34s cubic-bezier(0.22, 0.9, 0.36, 1) both;
}
.row.right .bubble.enter {
  animation: msgInRight 0.28s cubic-bezier(0.22, 0.9, 0.36, 1) both;
}

@keyframes msgInLeft {
  from {
    transform: translateX(-16px) translateY(4px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes msgInRight {
  from {
    transform: translateX(16px) translateY(4px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* ---------- Meta (horário + checks) ---------- */

.meta {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 5px;
}
.row.right .meta {
  justify-content: flex-end;
}
.time {
  opacity: 0.85;
}
.checks {
  opacity: 0.9;
  transition: color 0.3s;
}
.meta .checks.seen {
  color: #34b7f1;
}

/* ---------- Card de áudio ---------- */

.audio {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(145deg, #1bc47d, #075e54);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(7, 94, 84, 0.35), 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
}
.play:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 20px rgba(7, 94, 84, 0.45);
}
.play:active {
  transform: scale(0.93);
}
.play .ic {
  width: 18px;
  height: 18px;
  display: block;
}

.tline {
  flex: 1;
  height: 4px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.tline i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #34b7f1, #25d366);
  border-radius: 4px;
  transition: width 0.1s linear;
}

.aud-time {
  font-size: 12.5px;
  color: var(--muted);
  min-width: 72px;
  text-align: right;
}

/* ---------- Card de vídeo MP4 ---------- */

.video-card {
  width: min(320px, 72vw);
  max-width: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: #000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.chat-video {
  width: 100%;
  max-height: 480px;
  display: block;
  object-fit: cover;
  background: #000;
  border-radius: 14px;
}

.chat-video::-webkit-media-controls,
.chat-video::-webkit-media-controls-panel,
.chat-video::-webkit-media-controls-play-button,
.chat-video::-webkit-media-controls-timeline,
.chat-video::-webkit-media-controls-current-time-display,
.chat-video::-webkit-media-controls-time-remaining-display,
.chat-video::-webkit-media-controls-mute-button,
.chat-video::-webkit-media-controls-toggle-closed-captions-button,
.chat-video::-webkit-media-controls-volume-slider,
.chat-video::-webkit-media-controls-fullscreen-button {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.video-replay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: linear-gradient(145deg, #1bc47d, #075e54);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, filter 0.15s ease;
}

.video-replay.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.video-replay:hover {
  filter: brightness(1.08);
}
.video-replay:active {
  transform: translate(-50%, -50%) scale(0.94);
}
.video-replay .ic {
  width: 24px;
  height: 24px;
  display: block;
}

/* ---------- Barra de input ---------- */

.inputbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(
    180deg,
    rgba(236, 229, 219, 0) 0%,
    rgba(236, 229, 219, 0.96) 28%,
    rgba(236, 229, 219, 1) 100%
  );
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  backdrop-filter: saturate(1.2) blur(16px);
}

.inputbar input {
  flex: 1 1 880px;
  min-width: 0;
  max-width: 1100px;
  height: 52px;
  border-radius: 30px;
  border: 1.5px solid #d2cec8;
  background: #fff;
  padding: 0 20px;
  font-size: 17px;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) inset;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.inputbar input::placeholder {
  color: #9aada5;
  font-size: 16px;
}
.inputbar input:focus {
  outline: none;
  border-color: #25d366;
  box-shadow: 0 0 0 3.5px rgba(37, 211, 102, 0.18),
    0 2px 10px rgba(37, 211, 102, 0.08) inset;
}

/* Botão enviar */
.inputbar button {
  flex: 0 0 56px;
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  border: none !important;
  position: relative !important;
  display: inline-block !important;
  cursor: pointer !important;
  background: linear-gradient(145deg, #2de870, #0ea84a) !important;
  box-shadow: 0 8px 22px rgba(37, 211, 102, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
  color: transparent !important;
  transition: transform 0.13s, filter 0.13s, box-shadow 0.13s !important;
}
.inputbar button:hover {
  filter: brightness(1.08) !important;
  transform: translateY(-2px) scale(1.05) !important;
  box-shadow: 0 14px 34px rgba(37, 211, 102, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}
.inputbar button:active {
  transform: scale(0.93) !important;
  filter: brightness(0.96) !important;
}

.inputbar button::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="white" d="M3 11.3 20.2 3.6c.8-.4 1.7.4 1.3 1.2L14.8 21.1c-.3.8-1.5.8-1.8 0l-2.4-6.1-6.1-2.4c-.8-.3-.8-1.5 0-1.8z"/></svg>')
    center/contain no-repeat !important;
}

/* ---------- CTA ---------- */

.cta {
  margin-top: 10px;
}

.cta a {
  display: inline-block;
  background: linear-gradient(135deg, #31e876, #0fc453);
  color: #032b18;
  text-decoration: none;
  padding: 13px 22px;
  border-radius: 22px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.2px;
  border: 1px solid rgba(37, 211, 102, 0.25);
  box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4),
    0 6px 22px rgba(37, 211, 102, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  animation: ctaPulse 2.4s ease-in-out infinite;
  transition: transform 0.14s, filter 0.14s, box-shadow 0.14s;
  position: relative;
  overflow: hidden;
}

.cta a::before {
  content: "";
  position: absolute;
  top: -80%;
  left: -50%;
  width: 55%;
  height: 240%;
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(255, 255, 255, 0) 65%
  );
  transform: skewX(-18deg);
  transition: left 0.45s ease;
  pointer-events: none;
}
.cta a:hover::before {
  left: 120%;
}

.cta a:hover {
  filter: brightness(1.06);
  transform: translateY(-2px) scale(1.025);
  box-shadow: 0 0 0 7px rgba(37, 211, 102, 0.16),
    0 12px 32px rgba(37, 211, 102, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  animation: none;
}
.cta a:active {
  transform: scale(0.97);
}

@keyframes ctaPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4),
      0 6px 22px rgba(37, 211, 102, 0.28),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(37, 211, 102, 0),
      0 8px 28px rgba(37, 211, 102, 0.34),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
}

/* ---------- Chips ---------- */

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.chip {
  background: #fff;
  border: 1.5px solid #c4e4ce;
  border-radius: 20px;
  padding: 8px 15px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 2px 8px rgba(7, 94, 84, 0.08);
  transition: transform 0.16s cubic-bezier(0.2, 0.9, 0.4, 1), background 0.15s,
    border-color 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}
.chip::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.12), transparent);
  opacity: 0;
  transition: opacity 0.15s;
  border-radius: inherit;
}
.chip:hover {
  background: #ebf9f1;
  border-color: #25d366;
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.2);
}
.chip:hover::after {
  opacity: 1;
}
.chip:active {
  transform: scale(0.96);
}

/* ---------- Typing indicator ---------- */

.typing-wrap .bubble {
  background: var(--bubble-in);
  padding: 14px 18px;
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.typing .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #aac4b8;
  animation: typingBounce 1.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.typing .dot:nth-child(2) {
  animation-delay: 0.18s;
}
.typing .dot:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0) scale(1);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-7px) scale(1.2);
    opacity: 1;
  }
}

/* ---------- Recording badge ---------- */

.recording-wrap .bubble {
  background: var(--bubble-in);
  border: 1px solid #c6e8d4;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.recording.pro {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  color: #2a4438;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
}

.recording.pro .mic {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #edfaf3;
  border: 1px solid #b8e8cc;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 0 3px rgba(191, 233, 207, 0.2);
}
.recording.pro .mic svg {
  width: 20px;
  height: 20px;
  fill: #075e54;
  animation: micBreath 2.2s ease-in-out infinite;
}
.recording.pro .mic::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  animation: micPulse 1.7s ease-out infinite;
}
.recording.pro .label {
  letter-spacing: 0.2px;
  color: #2a4438;
}

.recording.pro .eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
}
.recording.pro .eq i {
  display: block;
  width: 3px;
  height: 30%;
  background: #0b5e4f;
  border-radius: 2px;
  transform-origin: center bottom;
  animation: eqBeat 1s ease-in-out infinite;
  opacity: 0.85;
}
.recording.pro .eq i:nth-child(1) {
  animation-delay: 0s;
}
.recording.pro .eq i:nth-child(2) {
  animation-delay: 0.15s;
}
.recording.pro .eq i:nth-child(3) {
  animation-delay: 0.3s;
}
.recording.pro .eq i:nth-child(4) {
  animation-delay: 0.45s;
}

@keyframes micPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.38);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(37, 211, 102, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
  }
}
@keyframes micBreath {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}
@keyframes eqBeat {
  0%,
  100% {
    transform: scaleY(0.3);
  }
  50% {
    transform: scaleY(1);
  }
}

/* ---------- Utilitários ---------- */

.small {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Responsivo ---------- */

@media (max-width: 640px) {
  .app {
    border-radius: 0;
    height: 100dvh;
    box-shadow: none;
  }
  .wpp-header {
    height: 62px;
    padding: 0 12px;
  }
  .messages {
    padding: 16px 12px 110px;
  }
  .bubble {
    max-width: 86vw;
    font-size: 17px;
    padding: 10px 13px 8px;
  }
  .wpp-header .meta .name,
  .wpp-header #contact-name {
    font-size: 16px;
  }
  .inputbar {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    gap: 10px;
  }
  .inputbar input {
    height: 50px;
    font-size: 16px;
  }
}

@media (max-width: 740px) {
  .inputbar {
    align-items: center;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  }
  .inputbar input {
    flex: 1 1 auto;
    min-width: 0;
    height: 50px;
    font-size: 16px;
    border-radius: 26px;
  }
  .inputbar button {
    flex: 0 0 58px !important;
    width: 58px !important;
    height: 58px !important;
  }
  .inputbar button::before {
    width: 23px !important;
    height: 23px !important;
  }
}

/* ---------- Acessibilidade ---------- */

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

/* ---------- Input pulsante — aguardando nome ---------- */

.inputbar.waiting-name {
  background: linear-gradient(
    180deg,
    rgba(236, 229, 219, 0) 0%,
    rgba(230, 248, 237, 0.97) 28%,
    rgba(225, 245, 232, 1) 100%
  );
}

.inputbar.waiting-name input {
  border-color: #25d366;
  background: #f4fdf7;
  box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5),
    0 0 0 3.5px rgba(37, 211, 102, 0.2);
  animation: inputPulse 1.8s ease-in-out infinite;
}

.inputbar.waiting-name input::placeholder {
  color: #1aaa50;
  font-weight: 600;
}

@keyframes inputPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5),
      0 0 0 3.5px rgba(37, 211, 102, 0.2);
    border-color: #25d366;
  }
  50% {
    box-shadow: 0 0 0 10px rgba(37, 211, 102, 0),
      0 0 0 3.5px rgba(37, 211, 102, 0.4);
    border-color: #0fc453;
  }
}

/* ---------- Ajuste final: vídeo termina sem replay e sem blur ---------- */
.video-card.is-ended:not(.will-blur),
.video-card.is-ended:not(.will-blur) .chat-video {
  filter: none !important;
  opacity: 1 !important;
  transform: none !important;
}

.video-card.is-ended .chat-video {
  pointer-events: none !important;
}

.video-card.is-ended::before,
.video-card.is-ended::after {
  display: none !important;
  content: none !important;
}

.video-replay {
  display: none !important;
}

/* ---------- Ajuste: typewriter sem cursor verde piscante ---------- */
.bubble.typing-text::after {
  content: none !important;
  display: none !important;
}

/* ======================================================
   VIDEOCHAMADA — ícone pulsante + overlay completo
====================================================== */

/* --- Ícone de vídeo pulsante quando disponível --- */

.icon-btn.video-call-active {
  animation: videoBtnPulse 1.8s ease-in-out infinite;
  position: relative;
}
.icon-btn.video-call-active svg {
  filter: drop-shadow(0 0 6px rgba(37, 211, 102, 0.9));
}
.icon-btn.video-call-active::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 14px;
  border: 2px solid rgba(37, 211, 102, 0.7);
  animation: videoBtnRing 1.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes videoBtnPulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.12);
  }
}
@keyframes videoBtnRing {
  0% {
    opacity: 0.9;
    transform: scale(1);
  }
  70% {
    opacity: 0;
    transform: scale(1.5);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

/* --- Overlay base --- */

#vcall-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  max-width: 1280px;
  margin: 0 auto;
  overflow: hidden;
}
#vcall-overlay.open {
  display: flex;
  animation: vcallFadeIn 0.22s ease both;
}
@keyframes vcallFadeIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Vídeo de fundo sempre borrado */
/* --- Tela de "chamando" --- */

#vcall-ringing {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  gap: 16px;
  padding: 40px 20px;
}

.vcall-ringing-avatar {
  position: relative;
  width: 110px;
  height: 110px;
  margin-bottom: 8px;
}
.vcall-ringing-avatar img {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.25);
  position: relative;
  z-index: 1;
}
.ringing-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  animation: ringingExpand 2.4s ease-out infinite;
}
.ringing-ring.ring2 {
  animation-delay: 0.8s;
}
.ringing-ring.ring3 {
  animation-delay: 1.6s;
}

@keyframes ringingExpand {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.vcall-ringing-name {
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.vcall-ringing-status {
  color: rgba(255, 255, 255, 0.65);
  font-size: 15px;
  letter-spacing: 0.3px;
}
.vcall-ringing-actions {
  margin-top: 48px;
}
.vcall-ringing-btn.cancel {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #fff;
  background: #e53935;
  box-shadow: 0 6px 24px rgba(229, 57, 53, 0.5);
  transition: transform 0.13s, filter 0.13s;
}
.vcall-ringing-btn.cancel:hover {
  filter: brightness(1.1);
}
.vcall-ringing-btn.cancel:active {
  transform: scale(0.93);
}

/* --- Tela ativa (com lock) --- */

#vcall-top-bar {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 0;
}
#vcall-contact {
  display: flex;
  flex-direction: column;
}
#vcall-contact .vcall-name {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}
#vcall-contact .vcall-status {
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  margin-top: 2px;
}
#vcall-close-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  font-size: 20px;
  backdrop-filter: blur(8px);
  transition: background 0.15s, transform 0.12s;
}
#vcall-close-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}
#vcall-close-btn:active {
  transform: scale(0.93);
}

#vcall-lock-overlay {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex: 1;
  width: 100%;
  padding: 20px;
}
#vcall-lock-card {
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  padding: 32px 30px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 320px;
  width: 100%;
  text-align: center;
}
#vcall-lock-card .lock-icon {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(37, 211, 102, 0.18);
  border: 1.5px solid rgba(37, 211, 102, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lockPulse 2.2s ease-in-out infinite;
}
#vcall-lock-card .lock-icon svg {
  width: 30px;
  height: 30px;
  color: #25d366;
}
@keyframes lockPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.35);
  }
  50% {
    box-shadow: 0 0 0 14px rgba(37, 211, 102, 0);
  }
}
#vcall-lock-card .lock-title {
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}
#vcall-lock-card .lock-sub {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13.5px;
  line-height: 1.5;
}
#vcall-pay-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.3px;
  box-shadow: 0 6px 22px rgba(37, 211, 102, 0.4);
  animation: ctaPulse 2.2s ease-in-out infinite;
  transition: transform 0.13s, filter 0.13s;
  margin-top: 4px;
}
#vcall-pay-btn:hover {
  filter: brightness(1.07);
  transform: translateY(-2px);
}
#vcall-pay-btn:active {
  transform: scale(0.96);
}

#vcall-avatar-preview {
  position: absolute;
  bottom: 110px;
  right: 18px;
  width: 80px;
  height: 80px;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  z-index: 3;
}
#vcall-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.85);
}

#vcall-bottom-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  width: 100%;
}
.vcall-ctrl {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #fff;
  transition: transform 0.13s, filter 0.13s;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
}
.vcall-ctrl:hover {
  filter: brightness(1.12);
}
.vcall-ctrl:active {
  transform: scale(0.93);
}
.vcall-ctrl.end-call {
  background: #e53935;
  box-shadow: 0 6px 20px rgba(229, 57, 53, 0.4);
  width: 66px;
  height: 66px;
}

/* ── Seta animada apontando para o input (quando aguarda nome) ── */
.inputbar.waiting-name::before {
  content: "👇 Digite aqui";
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #25d366;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
  animation: arrowBounce 1s ease-in-out infinite;
  pointer-events: none;
  z-index: 20;
}
.inputbar.waiting-name::after {
  content: "";
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-top-color: #25d366;
  pointer-events: none;
  z-index: 20;
  animation: arrowBounce 1s ease-in-out infinite;
}
@keyframes arrowBounce {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-4px);
  }
}
.inputbar {
  position: relative;
}
