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

:root {
  --wa-bg: #e5ddd5;
  --wa-header: #075e54;
  --wa-header-dark: #054c44;
  --wa-bubble-in: #ffffff;
  --wa-bubble-out: #dcf8c6;
  --wa-ink: #111b21;
  --wa-muted: #667781;
  --wa-accent: #128c7e;
  --wa-accent-dark: #075e54;
}

html, body {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0b141a;
}

#app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  justify-content: center;
  background: #0b141a;
  overflow: hidden;
}

.phone {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--wa-bg);
  background-image: url("/chat-bg.jpg");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  position: relative;
  box-shadow: 0 0 60px rgba(0,0,0,.5);
}
.phone.no-photo { background-image: none; }

/* Header */
.wa-header {
  background: var(--wa-header);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 5;
}
.wa-header img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.wa-header .who { display: flex; flex-direction: column; line-height: 1.25; }
.wa-header .name { font-size: 16.5px; font-weight: 600; }
.wa-header .status { font-size: 12.5px; opacity: .85; }

/* Chat log */
.wa-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scroll-behavior: smooth;
}
.wa-log > * { flex-shrink: 0; }

.bubble-row { display: flex; margin: 2px 0; }
.bubble-row.out { justify-content: flex-end; }
.bubble-row.in { justify-content: flex-start; }

.bubble-group { display: flex; align-items: center; gap: 6px; max-width: 78%; }

.wa-edit-pencil {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: none;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  padding: 0;
  color: var(--wa-muted);
  cursor: pointer;
  transition: transform .1s ease, color .15s ease;
}
.wa-edit-pencil:hover { color: var(--wa-accent-dark); }
.wa-edit-pencil:active { transform: scale(.9); }

.wa-edit-slot:empty { display: none; }
.wa-edit-slot {
  display: flex;
  justify-content: flex-end;
  margin: 4px 0 8px;
}
.wa-edit-slot .wa-choices,
.wa-edit-slot .wa-composer {
  max-width: 78%;
  background: rgba(255, 255, 255, .55);
  border-radius: 14px;
  padding: 8px;
  backdrop-filter: blur(2px);
}

.bubble {
  max-width: 78%;
  min-width: 0;
  padding: 7px 9px 8px 10px;
  border-radius: 8px;
  font-size: 14.5px;
  line-height: 1.35;
  color: var(--wa-ink);
  box-shadow: 0 1px 0.5px rgba(0,0,0,.13);
  position: relative;
  white-space: pre-line;
}
.bubble-group .bubble { max-width: 100%; }
.bubble.in { background: var(--wa-bubble-in); border-top-left-radius: 2px; }
.bubble.out { background: var(--wa-bubble-out); border-top-right-radius: 2px; }
.bubble .time {
  display: block;
  text-align: right;
  font-size: 10.5px;
  color: var(--wa-muted);
  margin-top: 2px;
  margin-left: 10px;
  float: right;
}

.bubble.notice {
  background: #e1f3fb;
  color: #075e54;
  font-size: 13px;
  text-align: center;
  max-width: 88%;
  margin: 6px auto;
  border-radius: 8px;
}

.typing-row { display: flex; justify-content: flex-start; margin: 2px 0; }
.typing-bubble {
  background: var(--wa-bubble-in);
  border-radius: 8px;
  border-top-left-radius: 2px;
  padding: 10px 14px;
  box-shadow: 0 1px 0.5px rgba(0,0,0,.13);
  display: flex;
  gap: 4px;
}
.typing-bubble span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #9aa5aa;
  animation: wa-typing 1.1s infinite ease-in-out;
}
.typing-bubble span:nth-child(2) { animation-delay: .15s; }
.typing-bubble span:nth-child(3) { animation-delay: .3s; }
@keyframes wa-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Controls (quick replies / inputs) pinned above the input bar */
.wa-controls {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.wa-controls:empty { padding: 0; }
.wa-choices { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.wa-choice-btn {
  background: #fff;
  border: 1px solid var(--wa-accent);
  color: var(--wa-accent-dark);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: transform .1s ease, background .15s ease;
}
.wa-choice-btn:active { transform: scale(.96); background: #eafaf3; }

/* Real WhatsApp-style compose bar: emoji-prefixed pill input + circular send */
.wa-composer {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}
.wa-input-pill {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border-radius: 24px;
  padding: 8px 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
  min-height: 42px;
}
.wa-input-pill .emoji {
  font-size: 19px;
  flex-shrink: 0;
  opacity: .85;
  line-height: 1;
}
.wa-input-pill input {
  flex: 1;
  font: inherit;
  font-size: 15.5px;
  border: none;
  outline: none;
  color: var(--wa-ink);
  background: transparent;
  min-width: 0;
}
.wa-input-pill input::placeholder { color: #8696a0; }
.wa-send-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: #b7c4c1;
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: not-allowed;
  transition: background .15s ease, transform .1s ease;
}
.wa-send-btn.ready { background: var(--wa-accent); cursor: pointer; }
.wa-send-btn.ready:active { transform: scale(.94); }

/* WhatsApp-style multi-select poll bubble */
.poll-bubble {
  max-width: 82%;
  background: var(--wa-bubble-in);
  color: var(--wa-ink);
  border-radius: 8px;
  border-top-left-radius: 2px;
  padding: 12px 14px 10px;
  box-shadow: 0 1px 0.5px rgba(0,0,0,.13);
}
.poll-bubble.locked .poll-option { cursor: default; pointer-events: none; }
.poll-question-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.poll-question { font-weight: 700; font-size: 15px; line-height: 1.35; margin-bottom: 6px; }
.poll-edit-pencil { background: none; box-shadow: none; color: var(--wa-muted); margin-top: 2px; }
.poll-edit-pencil:hover { color: var(--wa-accent-dark); }
.poll-sub { font-size: 12.5px; color: var(--wa-muted); margin-bottom: 10px; }
.poll-option { cursor: pointer; padding: 7px 0; }
.poll-divider { height: 1px; background: rgba(0,0,0,.08); margin: 4px 0; }
.poll-option-decline .poll-label { color: var(--wa-muted); font-style: italic; }
.poll-option-top { display: flex; align-items: center; gap: 10px; }
.poll-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,.25);
  flex-shrink: 0;
  transition: background .15s ease, border-color .15s ease;
}
.poll-circle.checked { background: var(--wa-accent); border-color: var(--wa-accent); }
.poll-label { flex: 1; font-size: 14.5px; }
.poll-detail { font-size: 12px; font-weight: 400; color: var(--wa-muted); margin: 2px 0 0 28px; }
.poll-bar-track {
  height: 3px;
  background: rgba(0,0,0,.08);
  border-radius: 2px;
  margin: 6px 0 0 28px;
  overflow: hidden;
}
.poll-bar-fill { height: 100%; width: 0; background: var(--wa-accent); transition: width .2s ease; }
.poll-footer { font-size: 11px; color: var(--wa-muted); text-align: right; margin-top: 8px; }

.poll-continue {
  width: auto;
  height: auto;
  border-radius: 20px;
  padding: 11px 22px;
  font-size: 14.5px;
  font-weight: 700;
  align-self: flex-end;
}

.wa-invalid {
  margin: auto;
  text-align: center;
  padding: 40px 30px;
  color: #3a4a48;
}
.wa-invalid h2 { margin-bottom: 8px; font-size: 20px; }
