/* ========================================
   MODAL DE CAPTURA — Lead Multi-Step
   ======================================== */

:root {
  --ig-grad-start: #833ab4;
  --ig-grad-mid:   #fd1d1d;
  --ig-grad-end:   #fcb045;
  --ig-green:      #4aa94a;
  --ig-green-dark: #3a8a3a;
  --lead-card-max: 480px;
}

.lead-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: leadFadeIn 0.2s ease;
  overscroll-behavior: none;
}
.lead-modal[hidden] { display: none !important; }

.lead-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 12, 8, 0.78);
  cursor: pointer;
}

.lead-modal-card {
  position: relative;
  background: var(--bg);
  border: 1.5px solid #d4c8b8;
  border-radius: 14px;
  box-shadow: 6px 6px 0 rgba(201, 104, 48, 0.9);
  width: 100%;
  max-width: var(--lead-card-max);
  padding: 2rem 1.5rem;
  max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.lead-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  border: none;
  background: transparent;
  border-radius: 12px;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--orange);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
  z-index: 5;
}
@media (hover: hover) {
  .lead-modal-close:hover {
    background: #e8d4c0;
    color: var(--orange-dark);
  }
}
/* Step 4 após loading: exibe caixa arredondada com fundo */
.lead-modal-card.is-analysis-done .lead-modal-close {
  background: #f0e4d7;
}
@media (hover: hover) {
  .lead-modal-card.is-analysis-done .lead-modal-close:hover {
    background: #e8d4c0;
  }
}

.lead-progress {
  display: flex;
  gap: 8px;
  margin-bottom: 1.5rem;
}
.lead-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d4c8b8;
  transition: background 0.18s, transform 0.18s;
}
.lead-progress-dot.is-active {
  background: var(--orange);
  transform: scale(1.3);
}

.lead-step { display: none; }
.lead-step.is-active {
  display: block;
  animation: leadSlideIn 0.22s ease;
}

.lead-step-eyebrow {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 0.5rem;
}
.lead-step-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 0.75rem;
}
.lead-step-title .accent {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 1.65rem;
  color: var(--orange);
}
.lead-step-sub {
  font-size: 0.9rem;
  color: var(--text-2);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.lead-field {
  display: block;
  margin-bottom: 0.75rem;
}
.lead-field input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1.5px solid #d4c8b8;
  border-radius: 12px;
  background: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lead-field input::placeholder { color: #c0b8ad; }
.lead-field input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(224, 122, 58, 0.15);
}

.lead-phone-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  border: 1.5px solid #d4c8b8;
  border-radius: 12px;
  background: #fff;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lead-phone-wrap:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(224, 122, 58, 0.15);
}

/* Seletor de país */
.lead-country-wrap {
  position: relative;
  border-right: 1.5px solid #d4c8b8;
}
.lead-country-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.875rem 0.6rem;
  height: 100%;
  background: #faf6ef;
  border: none;
  border-radius: 10px 0 0 10px;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-2);
  white-space: nowrap;
  transition: background 0.15s;
}
.lead-country-btn:hover { background: #f3ede0; }
.lead-country-flag { font-size: 1.1rem; line-height: 1; }
.lead-country-chevron {
  width: 11px;
  height: 11px;
  color: var(--text-3);
  flex-shrink: 0;
  transition: transform 0.15s;
}
.lead-country-btn[aria-expanded="true"] .lead-country-chevron {
  transform: rotate(180deg);
}
.lead-country-dropdown {
  position: fixed;
  min-width: 224px;
  background: var(--bg);
  border: 1.5px solid #d4c8b8;
  border-radius: 12px;
  box-shadow: 4px 4px 0 rgba(201, 104, 48, 0.5);
  z-index: 20000;
  max-height: 220px;
  overflow-y: auto;
  list-style: none;
  padding: 0.35rem 0;
  animation: leadSlideIn 0.18s ease;
}
.lead-country-dropdown[hidden] { display: none; }
.lead-country-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.5rem 0.875rem;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.875rem;
  color: var(--text);
  transition: background 0.12s;
}
.lead-country-item:hover,
.lead-country-item[aria-selected="true"] {
  background: rgba(224, 122, 58, 0.09);
  color: var(--orange-dark);
}
.lead-country-item .c-dial {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-3);
  margin-left: auto;
}

.lead-phone-wrap input {
  border: none;
  border-radius: 0 10px 10px 0;
  padding: 0.875rem 1rem;
  width: 100%;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  background: transparent;
  outline: none;
}
.lead-phone-wrap input::placeholder { color: #c0b8ad; }

.lead-ddd-msg {
  padding: 0.6rem 0.875rem;
  background: rgba(224, 122, 58, 0.08);
  border: 1px solid rgba(224, 122, 58, 0.25);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--orange-dark);
  margin-bottom: 0.75rem;
  animation: leadSlideIn 0.2s ease;
  line-height: 1.45;
}
.lead-ddd-msg[hidden] { display: none; }

.lead-error {
  padding: 0.6rem 0.875rem;
  background: rgba(192, 57, 43, 0.07);
  border: 1px solid rgba(192, 57, 43, 0.22);
  border-radius: 8px;
  font-size: 0.82rem;
  color: #c0392b;
  margin-bottom: 0.75rem;
  line-height: 1.45;
}
.lead-error[hidden] { display: none; }

.lead-btn-primary {
  display: block;
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--orange-dark);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.lead-btn-primary:hover:not(:disabled) {
  background: var(--orange-dark);
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 #a55420;
}
.lead-btn-primary:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--orange-dark);
}
.lead-btn-primary:disabled {
  background: #c0b8ad;
  box-shadow: 4px 4px 0 #a8a098;
  cursor: not-allowed;
}

.lead-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.7rem 1rem;
  background: transparent;
  border: 1.5px solid #d4c8b8;
  border-radius: 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.88rem;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  margin-top: 0.75rem;
}
.lead-btn-secondary:hover {
  border-color: var(--orange);
  color: var(--orange);
}

/* Step 2 — Instagram */
.lead-ig-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--orange-dark) 0%, var(--orange) 55%, var(--orange-light) 100%);
  display: grid;
  place-items: center;
  color: #fff;
  margin: 0 auto 1.25rem;
  box-shadow: 3px 3px 0 rgba(201, 104, 48, 0.35);
}
.lead-ig-icon svg { width: 32px; height: 32px; }

.lead-ig-title {
  padding-left: 0.3rem;
}
.lead-ig-title .ig-name {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 1.65rem;
  color: var(--orange);
  -webkit-text-fill-color: var(--orange);
}
.lead-ig-title .ig-suffix {
  color: var(--text);
  -webkit-text-fill-color: var(--text);
}
.check-icon[hidden] { display: none !important; }

.lead-ig-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin-bottom: 0.75rem;
}
.lead-ig-wait-msg {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--text-2);
  text-align: left;
  margin: 0 0 0.75rem;
}
.lead-ig-wait-msg[hidden] { display: none !important; }
.lead-field-ig {
  flex: 1;
  margin-bottom: 0 !important;
  position: relative;
}
.lead-field-ig input {
  padding-left: 1.85rem;
}
.lead-ig-prefix {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  color: var(--text-3);
  pointer-events: none;
  z-index: 1;
}

.lead-btn-ig-submit {
  width: 46px;
  min-width: 46px;
  background: var(--ig-green);
  border: none;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 3px 3px 0 var(--ig-green-dark);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.lead-btn-ig-submit:hover:not(:disabled) {
  background: var(--ig-green-dark);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #2d6e2d;
}
.lead-btn-ig-submit:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--ig-green-dark);
}
.lead-btn-ig-submit:disabled {
  background: #a0c8a0;
  box-shadow: 3px 3px 0 #80a880;
  cursor: not-allowed;
}
.lead-btn-ig-submit .check-icon { width: 18px; height: 18px; }

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: leadSpin 0.7s linear infinite;
}
.spinner[hidden] { display: none; }

/* Step 3 — Profile card */
.lead-profile-card {
  border: 1.5px solid #d4c8b8;
  border-radius: 14px;
  overflow: hidden;
  margin: 0.875rem 0;
  box-shadow: 3px 3px 0 rgba(201, 104, 48, 0.45);
}
.lead-profile-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.65rem 1rem;
  background: linear-gradient(145deg, var(--orange-dark) 0%, var(--orange) 55%, var(--orange-light) 100%);
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
}
.lead-profile-header .ig-small { width: 16px; height: 16px; flex-shrink: 0; }

.lead-profile-body {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  background: #fff;
}
.lead-profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e8e0d8;
  flex-shrink: 0;
  background: #ede8e0;
}
.lead-profile-info { flex: 1; min-width: 0; }
.lead-profile-name {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.2;
}
.verified-badge { width: 16px; height: 16px; color: #1d9bf0; flex-shrink: 0; }
.verified-badge { display: none; }
.verified-badge.visible { display: inline-block; }
.lead-profile-username {
  font-size: 0.8rem;
  color: var(--text-2);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid #ede8e0;
  background: #faf6ef;
}
.lead-profile-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6rem 0.5rem;
  border-right: 1px solid #ede8e0;
  gap: 1px;
}
.lead-profile-stats > div:last-child { border-right: none; }
.lead-profile-stats strong {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}
.lead-profile-stats span {
  font-size: 0.7rem;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
}

.lead-link-retry {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 0.35rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.84rem;
  color: var(--text-2);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: color 0.15s;
  margin-bottom: 0.25rem;
}
.lead-link-retry:hover { color: var(--orange); }

.lead-profile-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  background: rgba(74, 169, 74, 0.07);
  border-left: 3px solid #3a9c3a;
  border-top: 1px solid rgba(74, 169, 74, 0.15);
  font-size: 0.82rem;
  color: #2e7d2e;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
}

.lead-profile-footer-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: #3a9c3a;
}

.lead-step3-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.75rem;
}
.lead-step3-actions .lead-btn-secondary { margin-top: 0; flex-shrink: 0; }
.lead-btn-confirm {
  flex: 1;
  background: var(--ig-green) !important;
  box-shadow: 4px 4px 0 var(--ig-green-dark) !important;
}
.lead-btn-confirm:hover:not(:disabled) {
  background: var(--ig-green-dark) !important;
  box-shadow: 5px 5px 0 #2d6e2d !important;
}

/* Step 4 — Análise */
.lead-analysis-loading[hidden],
.lead-analysis-content[hidden] { display: none !important; }

.lead-analysis-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  margin: 1.5rem 0 1.75rem;
  min-height: 240px;
}

/* === Vídeo mascote loading === */
.lead-mascote-video {
  display: block;
  width: 100%;
  max-width: 340px;
  border-radius: 16px;
  border: 3px solid #c96830;
  box-shadow: 4px 4px 0 #8f4215;
  margin: 0 auto;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.lead-loading-phrase-wrap {
  position: relative;
  width: 100%;
  min-height: 3.5rem;
  display: flex;
  justify-content: center;
}
.lead-loading-phrase {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-2);
  text-align: center;
  line-height: 1.45;
  max-width: 280px;
  width: 100%;
  margin: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.lead-loading-phrase.is-visible { opacity: 1; }

/* Skeleton fallback — exibido se o vídeo mascote falhar */
.lead-mascote-skeleton {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 16/9;
  border-radius: 16px;
  border: 3px solid #c96830;
  box-shadow: 4px 4px 0 #8f4215;
  margin: 0 auto;
  background: #f0e8dc;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 24px 20px;
  box-sizing: border-box;
}
.lead-mascote-skeleton[hidden] { display: none !important; }

.skel-bar {
  height: 13px;
  border-radius: 6px;
  background: linear-gradient(90deg, #ddd4c4 25%, #f0e8dc 50%, #ddd4c4 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.5s ease-in-out infinite;
  width: 100%;
}
.skel-bar--short  { width: 55%; }
.skel-bar--medium { width: 75%; }

@keyframes skel-shimmer {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}

.lead-analysis-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0 0;
}
.lead-analysis-content .lead-step-title {
  margin-bottom: 0;
}

.lead-analysis-scenario-msg {
  background: #f5f0e8;
  border: 1.5px solid #d4c8b8;
  border-radius: 14px;
  padding: 1rem 1.15rem;
  animation: leadSlideIn 0.3s ease;
}

.lead-analysis-scenario-msg p {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #3a2f22;
  margin: 0;
}

.lead-analysis-scenario-msg.is-full {
  padding: 1.25rem 1.3rem;
  box-shadow: 3px 3px 0 rgba(201, 104, 48, 0.3);
}

.lead-analysis-scenario-msg.is-full p {
  font-size: 0.95rem;
}

.lead-analysis-scenario-msg[hidden] { display: none !important; }

.lead-analysis-block {
  background: #fff;
  border: 1.5px solid #d4c8b8;
  border-radius: 14px;
  padding: 1rem 1.15rem;
  box-shadow: 3px 3px 0 rgba(201, 104, 48, 0.3);
  animation: leadSlideIn 0.3s ease;
}

.lead-analysis-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  letter-spacing: 0.01em;
}

.lead-analysis-icon-search,
.lead-analysis-icon-feed {
  width: 16px;
  height: 16px;
  color: var(--orange-dark);
  flex-shrink: 0;
}

.lead-analysis-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
}

.lead-analysis-post {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0.5rem 0 0.75rem;
  padding: 0.5rem;
  background: #faf6ed;
  border-radius: 10px;
}

.lead-analysis-post-img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: #e5dcc9;
}

.lead-analysis-post-stats {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.15rem;
  flex-shrink: 0;
}

.lead-analysis-caption {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  color: var(--text-2);
  line-height: 1.4;
  margin: 0;
  flex: 1;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lead-analysis-caption.no-caption {
  font-style: italic;
  color: var(--text-3);
  -webkit-line-clamp: unset;
}

.lead-analysis-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
}

.lead-analysis-stat svg {
  color: var(--orange);
}

.lead-step4-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.lead-step4-cta-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1.5;
  text-align: left;
  margin: 0;
}

.lead-btn-checkout {
  flex: 1;
  font-size: 1rem;
  padding: 1rem 1.5rem;
}
.lead-btn-checkout.is-loading,
.lead-btn-checkout.is-loading:hover,
.lead-btn-checkout.is-loading:focus,
.lead-btn-checkout.is-loading:active {
  transform: none !important;
  box-shadow: 4px 4px 0 var(--orange-dark) !important;
  background: var(--orange) !important;
  transition: none !important;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  outline: none !important;
}

/* Animações */
@keyframes leadFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes leadSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes leadSpin {
  to { transform: rotate(360deg); }
}
@keyframes leadShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .lead-modal,
  .lead-step.is-active,
  .lead-ddd-msg { animation: none; }
  .spinner { animation-duration: 1.5s; }
}

@media (max-width: 767px) {
  .lead-modal-card {
    padding: 1.5rem 1rem;
    max-height: 96vh;
  }
  .lead-step-title { font-size: 1.25rem; }
  .lead-btn-ig-submit { width: 44px; min-width: 44px; }
  /* Evita zoom automático do iOS ao focar em inputs com font-size < 16px */
  .lead-field input,
  .lead-phone-wrap input,
  #leadIg {
    font-size: 16px;
  }
  .lead-analysis-block { padding: 0.875rem 1rem; }
  .lead-analysis-post-img { width: 60px; height: 60px; }
}
