/* ════════════════════════════════════════════════════════════════
   BELLUNE CHAT — style.css
   Visual inspirado no WhatsApp. Mobile-first.
   ════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

:root {
  --wa-bg:          #111b21;
  --wa-chat-bg:     #0b1014;
  --wa-bubble-in:   #202c33;
  --wa-bubble-out:  #005c4b;
  --wa-text:        #e9edef;
  --wa-text-dim:    #8696a0;
  --wa-text-time:   #667781;
  --wa-header:      #202c33;
  --wa-footer:      #202c33;
  --wa-divider:     #2a3942;
  --wa-green:       #00a884;
  --wa-green-dk:    #008069;
  --wa-tick:        #53bdeb;
  --gold:           #c8933a;
  --gold-lt:        #f0ddb8;
  --online:         #00a884;

  /* Card/PIX special */
  --card-bg:        #1a2730;
  --card-border:    #2d3f49;
}

html, body {
  height: 100%;
  background: var(--wa-bg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ── App wrapper ──────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100vh; /* fallback */
  max-width: 480px;
  margin: 0 auto;
  background: var(--wa-chat-bg);
  position: relative;
  /* wallpaper sutil */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Ccircle cx='10' cy='10' r='1.2' fill='%23ffffff08'/%3E%3Ccircle cx='50' cy='30' r='0.8' fill='%23ffffff06'/%3E%3Ccircle cx='30' cy='60' r='1' fill='%23ffffff07'/%3E%3Ccircle cx='70' cy='70' r='0.6' fill='%23ffffff05'/%3E%3C/svg%3E");
}

/* Desktop: moldura estilo dispositivo */
@media (min-width: 481px) {
  body { display: flex; align-items: center; justify-content: center; background: #0a0f13; }
  #app {
    height: 96vh;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0,0,0,.9);
    overflow: hidden;
    border: 1px solid #1a2530;
  }
}

/* ── Header ───────────────────────────────────────────────── */
#chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 8px;
  background: var(--wa-header);
  z-index: 10;
  flex-shrink: 0;
  border-bottom: 1px solid var(--wa-divider);
}

.header-back svg { display:block; cursor:pointer; flex-shrink:0; }

.header-avatar {
  position: relative;
  flex-shrink: 0;
}

.avatar-ring {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c8933a 0%, #7a5240 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--wa-header), 0 0 0 3px var(--gold);
  overflow: hidden;
}

.avatar-inner {
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
}

.online-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--online);
  border: 2px solid var(--wa-header);
}

.header-info { flex: 1; min-width: 0; }

.header-name {
  font-size: .95rem;
  font-weight: 600;
  color: var(--wa-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.header-status {
  font-size: .73rem;
  color: var(--wa-text-dim);
  margin-top: 1px;
}

.header-icons {
  display: flex;
  gap: 14px;
  flex-shrink: 0;
}
.header-icons svg { display: block; cursor: pointer; }

/* ── Chat area ────────────────────────────────────────────── */
#chat-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 12px 8px;
  scroll-behavior: smooth;
}

#chat-area::-webkit-scrollbar { width: 4px; }
#chat-area::-webkit-scrollbar-thumb { background: #2a3942; border-radius: 4px; }

#messages-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 100%;
  justify-content: flex-end;
}

/* ── Date separator ───────────────────────────────────────── */
.date-sep {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}
.date-sep span {
  background: rgba(0,0,0,.35);
  color: var(--wa-text-dim);
  font-size: .68rem;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: .02em;
}

/* ── Mensagens ────────────────────────────────────────────── */
.msg-row {
  display: flex;
  margin: 2px 0;
  animation: msgIn .22s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-row.in  { justify-content: flex-start; }
.msg-row.out { justify-content: flex-end; }

/* Bolha */
.bubble {
  max-width: 78%;
  padding: 7px 12px 6px;
  border-radius: 8px;
  font-size: .875rem;
  line-height: 1.45;
  color: var(--wa-text);
  position: relative;
  word-break: break-word;
}

.msg-row.in  .bubble {
  background: var(--wa-bubble-in);
  border-top-left-radius: 2px;
}
.msg-row.out .bubble {
  background: var(--wa-bubble-out);
  border-top-right-radius: 2px;
}

/* Rabinho da bolha */
.msg-row.in .bubble::before {
  content: '';
  position: absolute;
  top: 0; left: -7px;
  border-width: 8px 8px 0 0;
  border-style: solid;
  border-color: var(--wa-bubble-in) transparent transparent transparent;
}
.msg-row.out .bubble::before {
  content: '';
  position: absolute;
  top: 0; right: -7px;
  border-width: 8px 0 0 8px;
  border-style: solid;
  border-color: var(--wa-bubble-out) transparent transparent transparent;
}

/* Timestamp + ticks */
.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 3px;
}
.msg-time {
  font-size: .67rem;
  color: var(--wa-text-time);
  white-space: nowrap;
}
.msg-ticks svg { display: block; }

/* ── Typing indicator ─────────────────────────────────────── */
.typing-row {
  display: flex;
  justify-content: flex-start;
  margin: 4px 0;
  animation: msgIn .2s ease;
}
.typing-bubble {
  background: var(--wa-bubble-in);
  border-radius: 8px;
  border-top-left-radius: 2px;
  padding: 10px 14px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.typing-bubble::before {
  content: '';
  position: absolute;
  /* reutilizando a classe — sem pseudoelemento aqui */
}
.typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--wa-text-dim);
  animation: typingPulse 1.2s infinite ease;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typingPulse {
  0%, 60%, 100% { opacity: .3; transform: scale(.8); }
  30%           { opacity: 1;  transform: scale(1);  }
}

/* ── Quick reply buttons ──────────────────────────────────── */
.quick-replies {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 8px 0 4px;
  padding: 0 2px;
  animation: msgIn .25s ease;
}
.quick-btn {
  background: var(--wa-bubble-in);
  border: 1px solid var(--wa-green);
  color: var(--wa-green);
  border-radius: 20px;
  padding: 9px 18px;
  font-size: .84rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.quick-btn:hover, .quick-btn:active {
  background: var(--wa-green);
  color: #fff;
  transform: scale(.98);
}

/* ── Card especial (planos / PIX) ─────────────────────────── */
.card-msg {
  max-width: 90%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  animation: msgIn .25s ease;
  margin: 6px 0;
}

.card-header {
  background: linear-gradient(135deg, #1a2c24 0%, #0d2018 100%);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--wa-green);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.card-header h4 {
  font-size: .82rem;
  font-weight: 700;
  color: var(--wa-text);
}
.card-header p {
  font-size: .7rem;
  color: var(--wa-text-dim);
  margin-top: 1px;
}

.card-body { padding: 14px 16px; }

/* Planos */
.plans-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}
.plan-card {
  border: 1.5px solid var(--wa-divider);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all .18s;
  position: relative;
  text-align: center;
  background: #18262e;
}
.plan-card:hover, .plan-card:active {
  border-color: var(--wa-green);
  transform: translateY(-1px);
}
.plan-card.featured {
  border-color: var(--gold);
  background: #1a2820;
}
.plan-badge {
  position: absolute;
  top: -9px; left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: #111;
  font-size: .57rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.plan-name {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--wa-text-dim);
  margin-bottom: 6px;
}
.plan-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--wa-text);
  line-height: 1;
}
.plan-price sup {
  font-size: .65rem;
  font-weight: 500;
  vertical-align: top;
  margin-top: 5px;
  display: inline-block;
}
.plan-period {
  font-size: .65rem;
  color: var(--wa-text-dim);
  margin-top: 4px;
}
.plan-hint {
  font-size: .63rem;
  color: var(--wa-green);
  margin-top: 5px;
  font-weight: 500;
}

/* PIX Block */
.pix-block {
  animation: msgIn .25s ease;
}
.pix-label {
  font-size: .67rem;
  color: var(--wa-text-dim);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 5px;
  font-weight: 600;
}
.pix-key-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0b1014;
  border: 1px solid var(--wa-divider);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.pix-key-value {
  flex: 1;
  font-size: .84rem;
  font-weight: 600;
  color: var(--wa-green);
  font-family: 'Courier New', monospace;
  word-break: break-all;
}
.pix-copy-icon { flex-shrink: 0; cursor: pointer; }
.pix-copy-icon svg { display: block; }

.pix-plan-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  background: #0d1e17;
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid #1a3528;
}
.pix-plan-name {
  font-size: .8rem;
  color: var(--wa-text-dim);
}
.pix-plan-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--wa-text);
}

.pix-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Botões de ação ───────────────────────────────────────── */
.btn-pix-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: var(--wa-green);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.btn-pix-copy:hover { background: var(--wa-green-dk); }
.btn-pix-copy.copied { background: #1a5c42; }

.btn-paid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px;
  background: transparent;
  color: var(--wa-green);
  border: 1.5px solid var(--wa-green);
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.btn-paid:hover {
  background: rgba(0,168,132,.1);
}

.btn-doubt {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 9px;
  background: transparent;
  color: var(--wa-text-dim);
  border: 1px solid var(--wa-divider);
  border-radius: 8px;
  font-size: .8rem;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.btn-doubt:hover { border-color: var(--wa-text-dim); }

.btn-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 13px;
  background: #25d366;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  margin-top: 2px;
}
.btn-whatsapp:hover { background: #1fb855; transform: translateY(-1px); }
.btn-whatsapp svg { flex-shrink: 0; }

/* ── Copy feedback toast ──────────────────────────────────── */
#copy-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #2a3942;
  color: var(--wa-text);
  padding: 9px 18px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  z-index: 999;
  white-space: nowrap;
  border: 1px solid var(--wa-green);
}
#copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Footer ───────────────────────────────────────────────── */
#chat-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--wa-footer);
  flex-shrink: 0;
  border-top: 1px solid var(--wa-divider);
}

.footer-emoji, .footer-attach, .footer-mic {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.footer-input {
  flex: 1;
  background: var(--wa-bg);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: .84rem;
  color: var(--wa-text-dim);
  min-height: 40px;
  display: flex;
  align-items: center;
}

/* ── Texto em negrito dentro de bolhas ────────────────────── */
.bubble strong { color: #fff; font-weight: 600; }
.bubble em { color: var(--gold-lt); font-style: normal; }

/* ── Scroll suave automático ──────────────────────────────── */
.msg-row, .quick-replies, .pix-block, .card-msg {
  transition: none;
}

/* ── Highlight check final ────────────────────────────────── */
.msg-row.out .bubble { text-align: left; }

/* Checkmarks */
.ticks-double path { fill: var(--wa-text-time); }
.ticks-double.read path { fill: var(--wa-tick); }

/* ── Responsivo desktop leve ──────────────────────────────── */
@media (min-width: 481px) {
  .bubble { max-width: 72%; }
  .plans-grid { gap: 12px; }
}

/* Avatar foto Lara */
.avatar-img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center center;
  border-radius: 50%;
  display: block;
  image-rendering: auto;
  transform: translateZ(0);
  backface-visibility: hidden;
}
/* Plans grid 3 colunas */
.plans-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}
@media(max-width:340px){
  .plans-grid-3 { grid-template-columns: 1fr; }
}
