/* ============================================================
   Naturgy WhatsApp Bot — simulador (palco da demo)
   Chat = visual do WhatsApp · marca Naturgy no avatar/branding
   ============================================================ */
:root {
  /* WhatsApp */
  --wa-header: #008069;
  --wa-accent: #00a884;
  --wa-chat-bg: #efeae2;
  --wa-bubble-in: #ffffff;
  --wa-bubble-out: #d9fdd3;
  --wa-text: #111b21;
  --wa-text-soft: #667781;
  --wa-tick: #53bdeb;
  --wa-composer: #f0f2f5;

  /* Naturgy (extraído do Gestor Serasa _theme.scss) */
  --naturgy-orange: #e57200;
  --naturgy-blue: #004571;

  --phone-radius: 44px;
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 0%, #1f2c34 0%, #0b141a 70%);
  padding: 24px 12px;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.stage__note {
  font-size: 12px;
  color: #8a97a3;
  max-width: 360px;
  text-align: center;
  line-height: 1.5;
}

/* ===== Moldura de celular ===== */
.phone {
  width: 390px;
  max-width: 96vw;
  height: min(820px, 90vh);
  background: #111;
  border-radius: var(--phone-radius);
  padding: 12px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4), 0 0 0 2px #2a2a2a;
}

.phone__screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 32px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--wa-chat-bg);
}

/* ===== Header ===== */
.wa-header {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--wa-header);
  color: #fff;
  padding: 14px 12px 12px;
  flex-shrink: 0;
}

.wa-header__back {
  background: none;
  border: none;
  color: #fff;
  display: flex;
  cursor: pointer;
  padding: 0;
}

.wa-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--naturgy-orange);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.wa-header__info {
  flex: 1;
  min-width: 0;
}

.wa-header__name {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.wa-verified {
  display: inline-flex;
}

.wa-header__status {
  font-size: 12.5px;
  opacity: 0.85;
}

.wa-header__actions {
  display: flex;
  align-items: center;
  gap: 18px;
  color: #fff;
}

/* ===== Chat ===== */
.wa-chat {
  flex: 1;
  overflow: hidden auto;
  padding: 14px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background-image: radial-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px);
  background-size: 22px 22px;
}

.wa-chat::-webkit-scrollbar {
  width: 6px;
}
.wa-chat::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

.wa-day,
.wa-system {
  align-self: center;
  background: #ffffff;
  color: var(--wa-text-soft);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 8px;
  margin: 6px 0;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
  text-align: center;
  max-width: 85%;
}

.wa-day {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ===== Bolhas ===== */
.bubble {
  position: relative;
  max-width: 78%;
  padding: 6px 9px 8px;
  border-radius: 8px;
  font-size: 14.2px;
  line-height: 1.4;
  color: var(--wa-text);
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
  animation: pop 0.18s ease-out;
}

@keyframes pop {
  from { transform: translateY(4px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.bubble--in {
  align-self: flex-start;
  background: var(--wa-bubble-in);
  border-top-left-radius: 0;
}

.bubble--out {
  align-self: flex-end;
  background: var(--wa-bubble-out);
  border-top-right-radius: 0;
}

.bubble--in::before,
.bubble--out::before {
  content: "";
  position: absolute;
  top: 0;
  width: 8px;
  height: 13px;
}
.bubble--in::before {
  left: -8px;
  background: radial-gradient(circle at top right, transparent 70%, var(--wa-bubble-in) 0);
}
.bubble--out::before {
  right: -8px;
  background: radial-gradient(circle at top left, transparent 70%, var(--wa-bubble-out) 0);
}

.bubble b {
  font-weight: 600;
}

.bubble code {
  display: inline-block;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
  padding: 4px 6px;
  margin-top: 3px;
  font-family: "Consolas", monospace;
  font-size: 12px;
  word-break: break-all;
  white-space: pre-wrap;
  width: 100%;
}

.bubble__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  font-size: 11px;
  color: var(--wa-text-soft);
  margin-top: 2px;
}

.bubble__tick {
  color: var(--wa-tick);
  font-size: 13px;
  line-height: 1;
}

/* mensagem de áudio (out) */
.bubble--audio {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
}
.bubble--audio .play {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--wa-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.bubble--audio .wave {
  flex: 1;
  height: 3px;
  background: #b9c4bd;
  border-radius: 2px;
  position: relative;
}
.bubble--audio .wave::after {
  content: "";
  position: absolute;
  left: 0;
  top: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--wa-accent);
}

/* ===== Attachment (PDF) ===== */
.attach {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  padding: 10px;
  margin-top: 6px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.attach__icon {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: #f15642;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.attach__name {
  font-size: 13px;
  font-weight: 500;
  word-break: break-word;
}
.attach__sub {
  font-size: 11px;
  color: var(--wa-text-soft);
}

/* ===== Quick replies ===== */
.quick {
  align-self: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 8px;
  max-width: 90%;
}
.quick button {
  background: #fff;
  color: var(--wa-header);
  border: 1px solid rgba(0, 128, 105, 0.4);
  border-radius: 16px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.quick button:hover {
  background: #e7f5f1;
}

/* ===== Menu interativo (List Message) ===== */
.bubble__menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 7px;
  padding-top: 9px;
  border-top: 1px solid #e9edef;
  color: var(--wa-header);
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
}

.sheet-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 20, 26, 0.5);
  display: flex;
  align-items: flex-end;
  z-index: 20;
  animation: fade 0.2s ease-out;
}
.sheet {
  width: 100%;
  background: #fff;
  border-radius: 14px 14px 0 0;
  max-height: 72%;
  overflow-y: auto;
  animation: slideup 0.26s ease-out;
}
.sheet__header {
  position: sticky;
  top: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px;
  border-bottom: 1px solid #eef0f1;
}
.sheet__title {
  font-weight: 600;
  font-size: 15px;
  color: var(--naturgy-blue);
}
.sheet__close {
  background: none;
  border: none;
  font-size: 17px;
  color: #8696a0;
  cursor: pointer;
  line-height: 1;
}
.sheet__item {
  padding: 13px 16px;
  border-bottom: 1px solid #f4f4f4;
  cursor: pointer;
  transition: background 0.12s;
}
.sheet__item:hover {
  background: #f5f6f6;
}
.sheet__item-title {
  font-size: 14.5px;
  color: #111b21;
}
.sheet__item-desc {
  font-size: 12.5px;
  color: #667781;
  margin-top: 2px;
}
@keyframes slideup {
  from { transform: translateY(100%); }
  to { transform: none; }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== Typing ===== */
.typing {
  align-self: flex-start;
  background: var(--wa-bubble-in);
  border-radius: 8px;
  border-top-left-radius: 0;
  padding: 10px 12px;
  display: flex;
  gap: 4px;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}
.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aa6a0;
  animation: blink 1.3s infinite both;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ===== Composer ===== */
.wa-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 10px;
  background: var(--wa-composer);
  flex-shrink: 0;
}

.wa-inputbar {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 24px;
  padding: 4px 6px;
  gap: 4px;
}

.wa-icon {
  background: none;
  border: none;
  color: #54656f;
  display: flex;
  cursor: pointer;
  padding: 6px;
}

.wa-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  padding: 6px 2px;
  background: transparent;
  color: var(--wa-text);
}

.wa-send {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--wa-accent);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.12s;
}
.wa-send:active {
  transform: scale(0.92);
}
.wa-send.recording {
  background: #e53935;
  animation: recpulse 1s infinite;
}

@keyframes recpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(229, 57, 53, 0); }
}

/* ===== Recording overlay ===== */
.wa-recording {
  position: absolute;
  left: 10px;
  right: 66px;
  bottom: 12px;
  height: 46px;
  background: #fff;
  border-radius: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.wa-recording__dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #e53935;
  animation: blink 1s infinite;
}
.wa-recording__time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--wa-text);
}
.wa-recording__hint {
  font-size: 12px;
  color: var(--wa-text-soft);
}

/* ===== Painel de demonstração (notificações proativas) ===== */
.demo-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  max-width: 390px;
}
.demo-panel__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--naturgy-blue);
}
.demo-panel__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.demo-panel__btns button {
  background: var(--naturgy-orange);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: filter 0.15s;
}
.demo-panel__btns button:hover {
  filter: brightness(0.92);
}

@media (max-width: 430px) {
  body { padding: 0; }
  .phone {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    padding: 0;
  }
  .phone__screen { border-radius: 0; }
  .stage__note { display: none; }
}
