/* ===========================
   TELAS E CHAT
   =========================== */

/* Tela de boas-vindas */
#screen-welcome {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  text-align: center;
}

.welcome-logo {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 2.5rem;
}

.welcome-title {
  margin-bottom: 1rem;
}

.welcome-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 420px;
  margin: 0 auto 2.5rem;
  font-style: italic;
  font-family: var(--font-serif);
  font-size: 1.15rem;
}

.welcome-form {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.welcome-form input {
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.welcome-aviso {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 1.5rem;
  line-height: 1.5;
}

/* Barra de progresso dos pilares */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.progress-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 80px;
}

.progress-segments {
  display: flex;
  gap: 4px;
  flex: 1;
}

.progress-segment {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  transition: background 0.5s ease;
}

.progress-segment.active {
  background: var(--gold-dim);
}

.progress-segment.done {
  background: var(--gold);
}

/* Tela de chat */
#screen-chat {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: 56px; /* espaço para progress bar */
}

.chat-messages {
  flex: 1;
  padding: 2rem 1.25rem;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-bottom: 160px; /* espaço para o input */
}

/* Bolhas de mensagem */
.message {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  animation: fadeSlideIn 0.3s ease;
}

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

.message-assistant .message-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 1rem 1.25rem;
  max-width: 85%;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
}

.message-user {
  align-items: flex-end;
}

.message-user .message-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius) 0 var(--radius) var(--radius);
  padding: 0.75rem 1rem;
  max-width: 75%;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Cursor piscante no typewriter */
.cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--gold);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Indicador de digitando */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--gold-dim);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* Input fixo no rodapé */
.chat-input-area {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, var(--bg) 30%);
  padding: 1rem 1.25rem 1.5rem;
  z-index: 50;
}

.chat-input-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.chat-input-inner textarea {
  flex: 1;
  resize: none;
  min-height: 52px;
  max-height: 150px;
  overflow-y: auto;
  line-height: 1.5;
  padding: 0.875rem 1rem;
}

.btn-send {
  background: var(--gold-dim);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.btn-send:hover { background: var(--gold); }
.btn-send:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-send svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* Tela de captura WhatsApp */
#screen-capture {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.capture-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}

.capture-icon {
  font-size: 2.5rem;
  margin-bottom: 1.25rem;
}

.capture-card h2 {
  margin-bottom: 0.75rem;
}

.capture-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
}

.capture-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.capture-aviso {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
}

.input-error {
  border-color: var(--danger) !important;
}

.error-msg {
  color: var(--danger);
  font-size: 0.8rem;
  text-align: left;
}

/* Tela de devolutiva */
#screen-devolutiva {
  min-height: 100vh;
  padding: 3rem 1.25rem;
}

.devolutiva-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.devolutiva-header .badge {
  margin-bottom: 1rem;
}

.devolutiva-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.8;
  max-width: 600px;
  margin: 0 auto;
  white-space: pre-line;
}

/* Tela CTA */
#screen-cta {
  padding: 2.5rem 1.25rem 3rem;
}

.cta-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
}

.cta-card h3 {
  margin-bottom: 0.75rem;
}

.cta-card p {
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  font-size: 0.95rem;
}

.cta-urgency {
  background: rgba(201,168,76,0.08);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--gold);
  margin-bottom: 1.25rem;
}

/* Loading overlay */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsivo */
@media (max-width: 480px) {
  .message-assistant .message-bubble,
  .message-user .message-bubble {
    max-width: 95%;
  }

  .capture-card {
    padding: 2rem 1.25rem;
  }

  .devolutiva-body {
    padding: 1.5rem;
    font-size: 1rem;
  }
}
