:root{
  --green:#0f5c4f;
  --green2:#0b4d43;
  --bg:#efeae2;
  --bubble:#ffffff;
  --sent:#dcf8c6;
  --muted:#6b7c74;
  --tick:#53bdeb;
}

*{ box-sizing:border-box; }
html,body{ height:100%; margin:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial; }
body{ background:#dcdcdc; overflow:hidden; }

.app{
  width:100vw;
  height:100dvh;
  display:flex;
  flex-direction:column;
  background: var(--bg);
}

/* ========================= TOPBAR ========================= */
.topbar{
  background: linear-gradient(180deg, var(--green), var(--green2));
  padding: 14px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
  color:#fff;
  flex-wrap: nowrap;
}

.profile{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.avatar{
  width: 64px;
  height: 64px;
  border-radius: 999px;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,.20);
  flex: 0 0 auto;
}

.profile-meta{ min-width:0; }

.profile-meta .name{
  font-size: 16px;
  font-weight: 700;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status{
  margin-top: 6px;
  font-size: 12px;
  display:flex;
  align-items:center;
  gap: 8px;
  opacity:.95;
  white-space: nowrap;
}
.dot{
  width:10px;
  height:10px;
  border-radius:999px;
  background:#2ecc71;
  box-shadow:0 0 0 3px rgba(46,204,113,.18);
}

.actions{
  display:flex;
  align-items:center;
  gap: 12px;
  flex: 0 0 auto;
  margin-left:auto;
  white-space: nowrap;
}

.online-pill{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
}

.pill-dot{
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background:#2ecc71;
  box-shadow:0 0 0 3px rgba(46,204,113,.18);
}

.btn-ghost{
  border:none;
  cursor:pointer;
  background: rgba(255,255,255,.22);
  color:#fff;
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  flex: 0 0 auto;
}

/* ========================= CHAT ========================= */
.chat{
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 22px 18px;
  background: url("./images/WPC.jpg") center/cover no-repeat;
  display:flex;
  flex-direction:column;
  position: relative;
}

/* ========================= BOLHAS ========================= */
.bubble{
  width: fit-content;
  max-width: 520px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--bubble);
  margin: 0 0 14px 0;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
  overflow-wrap: anywhere;
  word-break: break-word;
  will-change: transform, opacity;
}

.bubble.received{ align-self:flex-start; }
.bubble.sent{
  background: var(--sent);
  align-self:flex-end;
  margin-left:auto;
  border-top-right-radius: 6px;
}

.meta{
  margin-top: 6px;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:4px;
  font-size: 12px;
  color: rgba(0,0,0,.55);
}

.ticks{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-left: 2px;
  transform: translateY(1px);
}
.ticks svg{ width:18px; height:18px; fill: var(--tick); display:block; }

/* ========================= DIGITANDO (WHATSAPP REAL - 3 bolinhas) ========================= */
.typingline{
  width: fit-content;
  margin: 0 0 14px 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

/* Balão (tamanho real) */
.wa-typing-bubble{
  position: relative;
  width: 88px;
  height: 44px;
  background: #ffffff;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  box-shadow:
    0 1px 1px rgba(0,0,0,.10),
    0 2px 6px rgba(0,0,0,.08);
}

/* Rabinho */
.wa-typing-bubble::before{
  content: "";
  position: absolute;
  left: 12px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 0 0 0 14px;
  transform: rotate(45deg);
  box-shadow: -1px 1px 0 rgba(0,0,0,.03);
}

.wa-dot{
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #7c7c7c;
  opacity: .85;
  animation: waDot 1.15s infinite ease-in-out;
}

.wa-dot:nth-child(2){ animation-delay: .15s; }
.wa-dot:nth-child(3){ animation-delay: .30s; }

@keyframes waDot{
  0%,100%{ transform: translateY(0); opacity:.55; }
  50%{ transform: translateY(-3px); opacity:1; }
}

/* Mobile proporcional */
@media (max-width: 680px){
  .wa-typing-bubble{
    width: 78px;
    height: 40px;
    border-radius: 20px;
    gap: 9px;
  }
  .wa-dot{ width: 6px; height: 6px; }
}


/* ========================= FOOTER ========================= */
.footer{ flex: 0 0 auto; padding-bottom: env(safe-area-inset-bottom); }

.composer{
  background:#ffffff;
  border-top:2px solid #e0e0e0;
}
.composer-inner{
  display:flex;
  align-items:center;
  gap:12px;
  padding: 12px 14px;
}
.composer-inner input{
  flex:1;
  height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  border: 2px solid #d1d7db;
  outline:none;
  font-size: 16px;
  background:#fff;
}
.composer-inner input::placeholder{ color:#9aa0a6; }

.send-btn{
  height: 48px;
  padding: 0 22px;
  border-radius: 14px;
  border:none;
  background: var(--green);
  color:#fff;
  font-size:16px;
  font-weight:800;
  cursor:pointer;
}
.send-btn:disabled{ opacity:.55; cursor:not-allowed; }
.send-btn:active{ transform: translateY(1px); }

.secure-bar{
  background:#f1fff6;
  text-align:center;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  border-top:2px solid #dfeee4;
}
.secure-title{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  font-size:16px;
  font-weight:700;
  color:#1a7f4d;
}
.secure-lock{ width:18px; height:18px; }
.secure-sub{
  margin-top:6px;
  font-size:12px;
  color:#6b7c74;
}

/* ========================= PREVIEW VIDEO ========================= */
.video-thumb{
  width: 260px;
  max-width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background:#000;
  position: relative;
  cursor:pointer;
}
.video-thumb video{
  width: 100%;
  height: auto;
  display:block;
  object-fit: cover;
  opacity:.92;
  pointer-events:none;
}
.video-thumb .play-overlay{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  background: linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,.35));
}
.video-thumb .play-overlay span{
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  color:#fff;
  display:grid;
  place-items:center;
  font-size: 26px;
  box-shadow: 0 10px 22px rgba(0,0,0,.25);
}

/* ========================= VIDEO MODAL ========================= */
.video-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.70);
  z-index: 250;
}
.video-modal{
  position: fixed;
  inset: 0;
  z-index: 251;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 16px;
}
.video-modal-inner{
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  background: #000;
  border-radius: 16px;
  overflow:hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
  display:flex;
  align-items:center;
  justify-content:center;
}
.modal-video{
  width: 100%;
  height: auto;
  max-height: 85vh;
  object-fit: contain;
  background:#000;
  display:block;
}
.video-close{
  position:absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border:none;
  cursor:pointer;
  background: rgba(0,0,0,.55);
  color:#fff;
  font-size: 18px;
  font-weight: 900;
  display:flex;
  align-items:center;
  justify-content:center;
}
.video-close:hover{ background: rgba(0,0,0,.75); }

.hidden{ display:none; }

/* ========================= PIX ========================= */
.bubble.pix-bubble .pix-lines{
  font-size: 16px;
  line-height: 1.35;
  font-weight: 500;
  color: rgba(0,0,0,.88);
}
.bubble.pix-bubble .pix-lines b{ font-weight: 700; }

.copy-pix-btn{
  appearance: none;
  -webkit-appearance: none;
  border: 0 !important;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;

  display:block;
  width: 100%;
  margin: 14px 0 0;

  padding: 16px 18px;
  border-radius: 16px;

  background: var(--green);
  color: #fff;

  font-size: 20px;
  font-weight: 900;

  white-space: nowrap;
  word-break: keep-all;
  overflow: hidden;
  text-overflow: ellipsis;

  box-shadow: 0 10px 22px rgba(0,0,0,.12);
  cursor:pointer;

  transition: background .18s ease, transform .12s ease;
}
.copy-pix-btn:active{ transform: translateY(1px); }
.copy-pix-btn.is-copied{
  background: #97dec9 !important;
  color: #ffffff !important;
  box-shadow: none;
}

.pix-waiting{
  display:none;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: rgb(34, 34, 34);
  line-height: 1.25;
}
.pix-waiting.show{ display:block; }

#paidBtn{
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  outline: 0;
  background: var(--green);
  color: #fff;

  width: 100%;
  padding: 16px 18px;
  border-radius: 16px;

  font-size: 20px;
  font-weight: 900;
  line-height: 1;

  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;

  white-space: nowrap;
  word-break: keep-all;

  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0,0,0,.12);
}
#paidBtn:active{ transform: translateY(1px); }

/* ========================= MOBILE ========================= */
@media (max-width: 680px){
  .topbar{ padding: 12px 12px; gap: 10px; }
  .avatar{ width: 54px; height: 54px; }

  .profile-meta .name{ font-size: 15px; line-height: 1.05; }
  .status{ margin-top: 4px; }

  .online-pill{ display: none !important; }
  .actions{ gap: 0 !important; margin-left: auto; }

  .btn-ghost{
    height: 40px;
    padding: 0 14px;
    font-size: 13px;
    border-radius: 12px;
  }

  .chat{ padding: 16px 12px; }

.bubble {
  line-height: 1.28; /* WhatsApp real usa algo entre 1.25–1.3 */
}

.bubble span,
.bubble p {
  line-height: inherit;
}


  .bubble{ max-width: 92%; }
  .copy-pix-btn, #paidBtn{
    font-size: 18px !important;
    padding: 14px 16px !important;
  }

  /* typing proporcional no mobile */
  .wa-typing-bubble{
    width: 78px;
    height: 40px;
    border-radius: 20px;
    gap: 9px;
  }
  .wa-dot{ width: 6px; height: 6px; }
}

/* =========================
   EMPTY STATE
   ========================= */
.empty-state{
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  pointer-events: none;
  padding: 24px;
}
.empty-emoji{
  font-size: 42px;
  opacity: .85;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.15));
}
.empty-title{
  font-size: 22px;
  font-weight: 800;
  color: #4a4a4a;
}
.empty-sub{
  font-size: 14px;
  font-weight: 600;
  color: #7a7a7a;
  max-width: 360px;
  line-height: 1.35;
}
.empty-state.hidden{ display: none !important; }

/* =========================
   ANIMAÇÃO REAL (WhatsApp-like)
   ========================= */

/* Entrada suave do balão */
.bubble.pop{
  animation: waBubbleIn 260ms cubic-bezier(.2,.9,.2,1.1) both;
  transform-origin: bottom right;
}

/* quando for recebida (lado esquerdo), muda origem */
.bubble.received.pop{
  transform-origin: bottom left;
}

@keyframes waBubbleIn{
  0%   { opacity:0; transform: translateY(10px) scale(.96); filter: blur(.2px); }
  60%  { opacity:1; transform: translateY(0) scale(1.01); filter: blur(0); }
  100% { opacity:1; transform: translateY(0) scale(1); }
}

/* sombra mais parecida com WhatsApp */
.bubble{
  box-shadow:
    0 1px 1px rgba(0,0,0,.10),
    0 2px 10px rgba(0,0,0,.08);
}

/* =========================
   DIGITANDO: APARECE/SOME SUAVE
   ========================= */

.typingline{
  animation: waTypingIn 180ms ease-out both;
}
@keyframes waTypingIn{
  from { opacity:0; transform: translateY(8px) scale(.98); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}
.typingline.hide{
  animation: waTypingOut 160ms ease-in both;
}
@keyframes waTypingOut{
  from { opacity:1; transform: translateY(0) scale(1); }
  to   { opacity:0; transform: translateY(6px) scale(.98); }
}


/* =========================
   MODAL SUPORTE (OPÇÕES)
========================= */
.options-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 9998;
}

.options-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 18px;
}

.options-card{
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(0,0,0,.45);
  padding: 18px 16px 16px;
  position: relative;
  animation: modalIn 220ms ease-out both;
}

@keyframes modalIn{
  from{ opacity:0; transform: translateY(10px) scale(.98); }
  to{ opacity:1; transform: translateY(0) scale(1); }
}

.options-close{
  position:absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: none;
  background: rgba(0,0,0,.06);
  font-size: 22px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}

.options-head{
  text-align:center;
  padding: 4px 8px 10px;
}

.options-icon{
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: #2ecc71;
  display:flex;
  align-items:center;
  justify-content:center;
  margin: 0 auto 10px;
  box-shadow: 0 10px 22px rgba(46,204,113,.22);
}

.options-icon img{
  width: 30px;
  height: 30px;
}

.options-head h2{
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color:#222;
}

.options-head p{
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 600;
  color:#6d6d6d;
}

.options-block{
  border-radius: 14px;
  padding: 12px;
  margin-top: 12px;
  border: 2px solid transparent;
}

.options-block.green{
  background: #eafff1;
  border-color: #bfe9d0;
}

.options-block.blue{
  background: #eef4ff;
  border-color: #c7d9ff;
}

.options-row{
  display:flex;
  align-items:center;
  gap: 10px;
  margin-bottom: 10px;
}

.opt-circle{
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 18px;
  font-weight: 800;
}

.opt-circle.green{ background:#28c76f; color:#ffffff; }
.opt-circle.blue{ background:#3b82f6; color:#fff; }

.opt-text .opt-title{
  font-size: 15px;
  font-weight: 900;
  color:#222;
}

.opt-text .opt-sub{
  font-size: 12px;
  font-weight: 700;
  color:#6b7280;
}

.opt-btn{
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 900;
  cursor:pointer;
  text-decoration:none;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}

.opt-btn.green{
  background: #1fbf62;
  color:#fff;
  box-shadow: 0 10px 22px rgba(31,191,98,.22);
}

.opt-btn.blue{
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  color:#fff;
  box-shadow: 0 10px 22px rgba(59,130,246,.22);
}

.options-or{
  text-align:center;
  font-weight: 900;
  color:#999;
  margin: 10px 0 0;
}

.opt-number-wrap{
  background:#fff;
  border-radius: 12px;
  padding: 10px;
  border: 2px solid rgba(0,0,0,.08);
}

.opt-number{
  width:100%;
  border:none;
  outline:none;
  text-align:center;
  font-size: 18px;
  font-weight: 900;
  color:#1d4ed8;
  background: transparent;
}

.options-foot{
  text-align:center;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 800;
  color:#1a7f4d;
}

.hidden{ display:none !important; }

@media (max-width: 520px){
  .options-card{ max-width: 360px; }
}

/* =========================
   WHATSAPP REAL TYPING (super parecido)
   Mantém o formato atual, muda só animação + micro “respirada”
   ========================= */

/* Respiração do balão (muito sutil) */
.wa-typing-bubble{
  animation: waBubbleBreath 1.08s infinite ease-in-out;
  will-change: transform;
}

@keyframes waBubbleBreath{
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(0.985); } /* bem leve */
}

/* Pontinhos mais “WhatsApp”: sobe pouco, some/volta e dá micro scale */
.wa-dot{
  will-change: transform, opacity;
  animation: waDotReal 1.08s infinite;
  animation-timing-function: cubic-bezier(.25,.1,.25,1);
  opacity: .45;
}

/* Stagger igual ao WhatsApp */
.wa-dot:nth-child(1){ animation-delay: 0ms; }
.wa-dot:nth-child(2){ animation-delay: 120ms; }
.wa-dot:nth-child(3){ animation-delay: 240ms; }

/* A curva aqui é o segredo: não é “pula”, é “respira” */
@keyframes waDotReal{
  0%   { transform: translateY(0) scale(1);     opacity: .38; }
  18%  { transform: translateY(-2.2px) scale(1.06); opacity: .92; }
  35%  { transform: translateY(0) scale(1);     opacity: .52; }
  100% { transform: translateY(0) scale(1);     opacity: .38; }
}

/* Entrada/saída do digitando mais WhatsApp (se você já usa hide, melhor ainda) */
.typingline{
  animation: waTypingIn 170ms ease-out both;
}
@keyframes waTypingIn{
  from{ opacity:0; transform: translateY(6px); }
  to  { opacity:1; transform: translateY(0); }
}
.typingline.hide{
  animation: waTypingOut 140ms ease-in both;
}
@keyframes waTypingOut{
  from{ opacity:1; transform: translateY(0); }
  to  { opacity:0; transform: translateY(4px); }
}

/* Mobile: mantém proporcional */
@media (max-width: 600px){
  @keyframes waBubbleBreath{
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(0.988); }
  }
  @keyframes waDotReal{
    0%   { transform: translateY(0) scale(1);     opacity: .38; }
    18%  { transform: translateY(-2px) scale(1.06); opacity: .92; }
    35%  { transform: translateY(0) scale(1);     opacity: .52; }
    100% { transform: translateY(0) scale(1);     opacity: .38; }
  }
}
