/* ============================================================
   Studio Andressa Souza Beauty — Chat de atendimento
   Tema claro quente (creme + terracota) — leve e legível.
   ============================================================ */

:root {
  --bg: #f5efe6;
  --bg-2: #efe6d9;
  --bot-bubble: #ffffff;
  --bot-text: #2c1c12;
  --cream: #fffaf4;
  --muted: #9b8a79;
  --line: rgba(92, 62, 40, 0.12);
  --line-strong: rgba(92, 62, 40, 0.22);
  --terra: #c67a5b;
  --terra-deep: #a75f43;
  --terra-soft: #e0a483;
  --gold: #b0803f;
  --guest-text: #ffffff;
  --radius: 20px;
  --shadow: 0 2px 10px rgba(74, 48, 30, 0.08);
  --shadow-lg: 0 12px 34px rgba(74, 48, 30, 0.16);
  --font-display: "Cormorant Garamond", "Times New Roman", serif;
  --font-body: "Jost", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--bot-text);
  font-family: var(--font-body);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* leve brilho quente no topo */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(224, 164, 131, 0.20), transparent 60%);
}

/* barra de progresso */
.progress-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  z-index: 40;
  background: rgba(92, 62, 40, 0.08);
}
.progress-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--terra-soft), var(--terra-deep));
  border-radius: 0 3px 3px 0;
  transition: width .5s cubic-bezier(.22,.61,.36,1);
}

/* cabeçalho fixo da marca */
.brandbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  background: rgba(245, 239, 230, 0.88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brandbar__logo {
  width: 28px; height: auto;
  filter: drop-shadow(0 1px 4px rgba(74, 48, 30, 0.25));
}
.brandbar__name {
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #3a2416;
}
.brandbar__name i { font-style: normal; color: var(--gold); }

/* selo de confiança */
.trust {
  text-align: center;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 16px 10px 0;
}

.chat {
  position: relative;
  z-index: 1;
  width: min(100%, 680px);
  margin: 0 auto;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 10px 16px calc(24px + env(safe-area-inset-bottom));
}

.chat__messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
}

/* ---- linhas ---- */
.row {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  max-width: 100%;
  animation: rise .34s cubic-bezier(.22,.61,.36,1) both;
}
.row--bot { justify-content: flex-start; }
.row--guest { justify-content: flex-end; }

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 36px;
  background: var(--bg-2);
  box-shadow: 0 0 0 2px #fff, 0 2px 8px rgba(74,48,30,.18);
}
.avatar--spacer { visibility: hidden; }

/* ---- balões ---- */
.bubble {
  max-width: min(80%, 500px);
  padding: 12px 16px;
  font-size: 15.5px;
  font-weight: 300;
  line-height: 1.5;
  border-radius: var(--radius);
  word-wrap: break-word;
  white-space: pre-wrap;
}
.bubble--bot {
  background: var(--bot-bubble);
  color: var(--bot-text);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow);
}
.bubble--guest {
  background: linear-gradient(135deg, #d98a64, #bd6b48);
  color: var(--guest-text);
  font-weight: 400;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 14px rgba(167, 95, 67, 0.28);
}
.bubble strong { font-weight: 600; color: var(--terra-deep); }
.bubble--guest strong { color: #fff; }

/* mídia */
.bubble--media {
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.bubble--media .video-wrap {
  position: relative;
  width: min(78vw, 460px);
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}
.bubble--media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.bubble--audio {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-bottom-left-radius: 6px;
  padding: 10px 12px;
}
.bubble--audio audio { display: block; width: min(70vw, 300px); }

/* digitando */
.typing {
  display: inline-flex;
  gap: 4px;
  padding: 15px 17px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow);
}
.typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--terra);
  opacity: .45;
  animation: blink 1.3s infinite both;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }

/* ---- área de input ---- */
.chat__input {
  position: sticky;
  bottom: 0;
  margin-top: 16px;
  padding: 10px 0 6px;
  background: linear-gradient(0deg, var(--bg) 72%, transparent);
}

.field {
  display: flex;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 7px 7px 7px 20px;
  box-shadow: var(--shadow-lg);
  transition: border-color .2s, box-shadow .2s;
}
.field:focus-within { border-color: var(--terra); box-shadow: 0 0 0 3px rgba(198,122,91,.15), var(--shadow-lg); }
.field input {
  flex: 1;
  border: 0;
  outline: 0;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  background: transparent;
  color: var(--bot-text);
  min-width: 0;
}
.field input::placeholder { color: var(--muted); font-weight: 300; }

.btn-ok, .choice {
  flex: 0 0 auto;
  border: 0;
  cursor: pointer;
  background: linear-gradient(135deg, #d0855f, #a75f43);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 14px rgba(167, 95, 67, 0.30);
  transition: transform .08s, filter .15s;
}
.btn-ok { font-size: 15px; padding: 12px 22px; border-radius: 999px; }
.btn-ok:hover, .choice:hover { filter: brightness(1.06); }
.btn-ok:active, .choice:active { transform: scale(.97); }
.btn-ok:disabled { opacity: .45; cursor: default; }

/* botões de escolha */
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.choice {
  font-size: 15px;
  padding: 13px 24px;
  border-radius: 999px;
  animation: rise .3s cubic-bezier(.22,.61,.36,1) both;
}

.field.invalid { border-color: #e4572e; }
.hint-error {
  color: #c0431f;
  font-size: 13px;
  margin: 8px 6px 0;
  text-align: right;
}

/* CTA final WhatsApp */
.cta-wa {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  background: linear-gradient(135deg, #2bd16f, #17a34a);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  padding: 15px 26px;
  border-radius: 999px;
  box-shadow: 0 14px 30px -10px rgba(23, 163, 74, 0.5);
  animation: rise .3s cubic-bezier(.22,.61,.36,1) both;
}
.cta-wa svg { width: 22px; height: 22px; fill: currentColor; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 480px) {
  .bubble { max-width: 84%; }
  .chat { padding: 6px 12px calc(18px + env(safe-area-inset-bottom)); }
  .brandbar .mark { font-size: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  .row, .choice, .cta-wa { animation: none; }
  .typing span { animation: none; }
  .progress-bar span { transition: none; }
}
