/* ==========================================================================
   Fiorin Imóveis — Simulação de Financiamento
   Mobile-first, sem frameworks
   ========================================================================== */

:root {
  --color-teal: #1a5f6e;
  --color-teal-dark: #124450;
  --color-teal-light: #257c8f;
  --color-red: #c62828;
  --color-red-dark: #a01f1f;
  --color-red-light: #e5533f;
  --color-white: #ffffff;
  --color-gray: #e0e0e0;
  --color-gray-dark: #9e9e9e;
  --color-text: #22303a;
  --color-whatsapp: #25d366;
  --color-whatsapp-dark: #1eb958;

  --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 16px;
  --radius-pill: 999px;
  --shadow-soft: 0 8px 24px rgba(26, 95, 110, 0.18);
  --shadow-card: 0 4px 20px rgba(26, 95, 110, 0.1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--color-white);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
}

.app {
  width: 100%;
  min-height: 100vh;
  position: relative;
}

/* ---------------------------------------------------------------------- */
/* Screens (SPA sections)                                                  */
/* ---------------------------------------------------------------------- */

.screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  flex-direction: column;
  position: relative;
}

.screen.is-active {
  display: flex;
  animation: screenIn 0.45s ease both;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(14px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* ---------------------------------------------------------------------- */
/* Buttons (shared)                                                         */
/* ---------------------------------------------------------------------- */

.btn {
  position: relative;
  overflow: hidden;
  min-height: 50px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  padding: 14px 20px;
  transition: transform 0.15s var(--ease-bounce), background-color 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.btn-block {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-cta {
  background: linear-gradient(135deg, var(--color-red), var(--color-red-light));
  color: var(--color-white);
  font-size: 1.1rem;
  padding: 17px 20px;
  border-radius: var(--radius-pill);
  margin-top: auto;
  box-shadow: var(--shadow-soft), 0 0 0 0 rgba(198, 40, 40, 0.5);
  animation: ctaPulse 2.4s ease-in-out infinite, floatUpIn 0.6s var(--ease-bounce) 0.3s both;
}

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

.btn-cta .btn-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

.btn-cta:hover .btn-arrow,
.btn-cta:active .btn-arrow {
  transform: translateX(4px);
}

@keyframes ctaPulse {
  0%, 100% { box-shadow: var(--shadow-soft), 0 0 0 0 rgba(198, 40, 40, 0.35); }
  50% { box-shadow: var(--shadow-soft), 0 0 0 10px rgba(198, 40, 40, 0); }
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-teal), var(--color-teal-light));
  color: var(--color-white);
  flex: 1;
  box-shadow: 0 4px 14px rgba(26, 95, 110, 0.3);
}

.btn-primary:not(:disabled):active {
  background: var(--color-teal-dark);
}

.btn-secondary {
  background: var(--color-gray);
  color: var(--color-text);
  flex: 0 0 auto;
  min-width: 100px;
}

.btn-whatsapp {
  background: linear-gradient(135deg, var(--color-whatsapp), var(--color-whatsapp-dark));
  color: var(--color-white);
  border-radius: var(--radius-pill);
  font-size: 1.1rem;
  padding: 17px 24px;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
  animation: ctaPulse 2.4s ease-in-out infinite;
}

.whatsapp-icon {
  display: inline-flex;
  align-items: center;
}

/* Ripple effect (generic, injected via JS) */
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  transform: scale(0);
  pointer-events: none;
  animation: rippleAnim 0.6s ease-out forwards;
}

@keyframes rippleAnim {
  to { transform: scale(1); opacity: 0; }
}

/* ==========================================================================
   ETAPA 1 — Capa do imóvel
   ========================================================================== */

.deco-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.25;
  z-index: 0;
  pointer-events: none;
  animation: blobFloat 9s ease-in-out infinite;
}

.deco-blob-teal {
  width: 220px;
  height: 220px;
  background: var(--color-teal);
  top: -60px;
  right: -60px;
}

.deco-blob-red {
  width: 160px;
  height: 160px;
  background: var(--color-red);
  top: 120px;
  left: -60px;
  animation-delay: -4s;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(12px, 18px) scale(1.08); }
}

.cover-header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 18px 16px 10px;
  animation: fadeIn 0.5s ease both;
}

.logo {
  height: 44px;
  width: auto;
}

.gallery {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--color-gray);
  border-radius: 0 0 22px 22px;
  box-shadow: var(--shadow-card);
}

.gallery-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.gallery-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1);
  transition: opacity 0.6s ease;
}

.gallery-img.is-active {
  opacity: 1;
  animation: kenBurns 4.5s ease-out forwards;
}

@keyframes kenBurns {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

.gallery-fade-top {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.18), transparent 30%, transparent 70%, rgba(0, 0, 0, 0.35));
  pointer-events: none;
}

.gallery-dots {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 2;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.25s var(--ease-bounce), width 0.25s ease;
}

.dot.is-active {
  background: var(--color-white);
  width: 22px;
  border-radius: var(--radius-pill);
}

.cover-content {
  position: relative;
  z-index: 1;
  padding: 22px 16px 32px;
  flex: 1;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.6s ease 0.05s both;
}

.property-name {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--color-teal);
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.property-location {
  font-size: 0.95rem;
  color: var(--color-gray-dark);
  margin: 0 0 14px;
}

.property-price {
  margin: 0 0 20px;
}

.price-tag {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-white);
  background: linear-gradient(135deg, var(--color-red), var(--color-red-light));
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  letter-spacing: -0.02em;
  box-shadow: 0 6px 16px rgba(198, 40, 40, 0.3);
}

.features-list {
  list-style: none;
  padding: 0;
  margin: 0 0 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.features-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.95rem;
  line-height: 1.4;
  opacity: 0;
  animation: featureIn 0.5s ease forwards;
}

.features-list li:nth-child(1) { animation-delay: 0.1s; }
.features-list li:nth-child(2) { animation-delay: 0.18s; }
.features-list li:nth-child(3) { animation-delay: 0.26s; }
.features-list li:nth-child(4) { animation-delay: 0.34s; }
.features-list li:nth-child(5) { animation-delay: 0.42s; }

@keyframes featureIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.feature-icon {
  flex: 0 0 auto;
  font-size: 1.15rem;
  line-height: 1.3;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 95, 110, 0.08);
  border-radius: 10px;
}

/* ==========================================================================
   ETAPA 2 — Formulário multi-step
   ========================================================================== */

.form-progress-wrap {
  padding: 18px 16px 0;
}

.form-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-gray);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.form-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-red), var(--color-red-light));
  border-radius: var(--radius-pill);
  transition: width 0.45s var(--ease-bounce);
}

.step-counter {
  margin: 8px 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-gray-dark);
  text-align: right;
}

.sim-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 22px 16px calc(20px + env(safe-area-inset-bottom, 0px));
}

.questions-viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
}

.form-question {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
}

.form-question.is-active {
  display: flex;
}

.form-question.slide-in-right { animation: slideInRight 0.38s ease forwards; }
.form-question.slide-out-left { animation: slideOutLeft 0.3s ease forwards; }
.form-question.slide-in-left { animation: slideInLeft 0.38s ease forwards; }
.form-question.slide-out-right { animation: slideOutRight 0.3s ease forwards; }

@keyframes slideInRight {
  from { transform: translateX(36px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutLeft {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(-36px); opacity: 0; }
}
@keyframes slideInLeft {
  from { transform: translateX(-36px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(36px); opacity: 0; }
}

.question-icon {
  font-size: 2.2rem;
  margin-bottom: 10px;
  animation: iconPop 0.4s var(--ease-bounce) both;
}

@keyframes iconPop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.question-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-teal);
  line-height: 1.3;
  margin: 0 0 22px;
  letter-spacing: -0.01em;
}

.field-input {
  width: 100%;
  min-height: 56px;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 14px 18px;
  border: 2px solid var(--color-gray);
  border-radius: var(--radius);
  color: var(--color-text);
  background: var(--color-white);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.field-input:focus {
  outline: none;
  border-color: var(--color-teal);
  box-shadow: 0 0 0 4px rgba(26, 95, 110, 0.12);
  transform: translateY(-1px);
}

.field-error {
  color: var(--color-red);
  font-size: 0.85rem;
  min-height: 1.1em;
  margin: 8px 0 0;
}

.option-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.option-buttons-2 {
  grid-template-columns: 1fr 1fr;
}

.option-btn {
  position: relative;
  overflow: hidden;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px solid var(--color-gray);
  background: var(--color-white);
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, transform 0.18s var(--ease-bounce), box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.option-icon {
  font-size: 1.2rem;
}

.option-btn:active {
  transform: scale(0.95);
}

.option-btn.is-selected {
  border-color: var(--color-teal);
  background: linear-gradient(135deg, var(--color-teal), var(--color-teal-light));
  color: var(--color-white);
  box-shadow: 0 6px 16px rgba(26, 95, 110, 0.35);
  animation: optionSelected 0.35s var(--ease-bounce);
}

@keyframes optionSelected {
  0% { transform: scale(1); }
  40% { transform: scale(1.07); }
  100% { transform: scale(1); }
}

.form-nav {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(16px);
  width: calc(100% - 32px);
  max-width: 528px;
  display: flex;
  gap: 10px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 10px;
  box-shadow: 0 12px 32px rgba(26, 95, 110, 0.22);
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.3s var(--ease-bounce), visibility 0.25s, bottom 0.2s ease;
}

.form-nav.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.form-nav .btn.is-hidden {
  display: none;
}

.form-nav .btn.pop-in {
  animation: navBtnPopIn 0.32s var(--ease-bounce);
}

@keyframes navBtnPopIn {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   ETAPA 3 — Conclusão / Resumo
   ========================================================================== */

.result-content {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 36px 16px 24px;
  overflow: hidden;
}

.result-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.confetti-piece {
  position: absolute;
  top: -10%;
  font-size: 1.4rem;
  animation-name: confettiFall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}

@keyframes confettiFall {
  from { transform: translateY(0) rotate(0deg); opacity: 1; }
  to   { transform: translateY(60vh) rotate(360deg); opacity: 0; }
}

.result-badge {
  position: relative;
  z-index: 1;
  font-size: 2.6rem;
  margin-bottom: 6px;
  animation: iconPop 0.5s var(--ease-bounce) both;
}

.result-title {
  position: relative;
  z-index: 1;
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-teal);
  margin: 0 0 22px;
  line-height: 1.3;
  animation: fadeIn 0.5s ease 0.1s both;
}

.result-card {
  position: relative;
  z-index: 1;
  background: var(--color-white);
  border: 1px solid var(--color-gray);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 6px 18px;
  margin-bottom: 28px;
  animation: fadeIn 0.5s ease 0.18s both;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-gray);
}

.result-row:last-child {
  border-bottom: none;
}

.result-label {
  font-size: 0.9rem;
  color: var(--color-gray-dark);
}

.result-value {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.result-row-highlight {
  background: rgba(198, 40, 40, 0.05);
  margin: 0 -18px;
  padding: 14px 18px;
  border-radius: 10px;
}

.result-row-highlight .result-value {
  color: var(--color-red);
  font-size: 1.25rem;
}

#btnWhatsapp {
  position: relative;
  z-index: 1;
  animation: fadeIn 0.5s ease 0.3s both, ctaPulse 2.4s ease-in-out 0.8s infinite;
}

/* ==========================================================================
   Breakpoints — tablet / desktop
   ========================================================================== */

@media (min-width: 480px) {
  .property-name {
    font-size: 1.7rem;
  }

  .price-tag {
    font-size: 2.1rem;
  }
}

@media (min-width: 700px) {
  .app {
    max-width: 560px;
    margin: 0 auto;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
  }

  body {
    background: #f2f4f5;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
