/* Agendamento Online — mobile-first, sem frameworks */
:root {
  --bg: #e5ddd5;
  --header: #075e54;
  --header-dark: #054d44;
  --outgoing: #dcf8c6;
  --incoming: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #25d366;
  --accent-dark: #1da851;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 100vh;
}

.phone {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  background: var(--bg);
  background-image: radial-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px);
  background-size: 18px 18px;
}

@media (min-width: 520px) {
  body { padding: 24px; align-items: center; }
  .phone {
    height: min(800px, calc(100vh - 48px));
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  }
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--header);
  color: #fff;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.header-info { display: flex; flex-direction: column; line-height: 1.2; }
.header-name { font-size: 1rem; }
.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  opacity: 0.9;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

.msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  line-height: 1.4;
  word-wrap: break-word;
  animation: rise 0.18s ease-out;
}

.msg.in { background: var(--incoming); align-self: flex-start; border-top-left-radius: 4px; }
.msg.out { background: var(--outgoing); align-self: flex-end; border-top-right-radius: 4px; }
.msg .time {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  text-align: right;
  margin-top: 4px;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.typing {
  display: flex;
  gap: 5px;
  align-items: center;
  margin: 0 12px 8px;
  background: var(--incoming);
  border-radius: var(--radius);
  padding: 12px 16px;
  width: fit-content;
}
.typing[hidden] { display: none; }
.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: blink 1.2s infinite;
}
.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 {
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #f0f0f0;
}

/* Chips de ação rápida: rolagem horizontal suave, sem scrollbar invasiva */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 12px;
  background: transparent;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  border: 1px solid #25d366;
  background: #fff;
  color: #075e54;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.chip:hover { background: #dcf8c6; }
.chip:active { transform: scale(0.96); }

.composer input {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 1rem;
  outline: none;
  background: #fff;
}
.composer input:focus { box-shadow: 0 0 0 2px var(--accent); }

.composer button {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.composer button:hover { background: var(--accent-dark); }
.composer button:disabled { opacity: 0.5; cursor: default; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
