/* =========================================================
   Skyplan — Lead Capture Modal / PDF Download
   Versão sóbria, discreta e responsiva
   ========================================================= */

:root {
  --sky-navy: #071a36;
  --sky-navy-2: #0b2348;
  --sky-teal: #008b7d;
  --sky-teal-2: #19c7b7;
  --sky-bg: #f5f8fb;
  --sky-card: #ffffff;
  --sky-text: #102033;
  --sky-muted: #5d6b7c;
  --sky-border: #dbe5ec;
  --sky-border-strong: #c8d6e0;
  --sky-soft: #eef4f7;
  --sky-error: #b42318;
  --sky-success: #007f73;
  --sky-shadow-cta: 0 16px 36px rgba(7, 26, 54, 0.22);
  --sky-shadow-modal: 0 32px 90px rgba(3, 14, 34, 0.34);
}

html.lead-modal-open,
body.lead-modal-open {
  overflow: hidden !important;
}

/* ---------- CTA flutuante discreto ---------- */
.download-report-fab,
.report-floating-cta {
  position: fixed !important;
  right: max(18px, env(safe-area-inset-right)) !important;
  bottom: max(18px, env(safe-area-inset-bottom)) !important;
  z-index: 2147483000 !important;

  width: 54px !important;
  height: 54px !important;
  min-width: 54px !important;
  min-height: 54px !important;
  max-width: 54px !important;
  max-height: 54px !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  border-radius: 999px !important;
  background: rgba(7, 26, 54, 0.92) !important;
  color: #ffffff !important;

  font-family: Arial, Helvetica, sans-serif !important;
  font-size: 1.08rem !important;
  line-height: 1 !important;
  text-decoration: none !important;

  box-shadow: var(--sky-shadow-cta) !important;
  cursor: pointer !important;
  opacity: 1 !important;
  visibility: visible !important;

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  -webkit-tap-highlight-color: transparent;

  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.download-report-fab:hover,
.report-floating-cta:hover {
  transform: translateY(-2px);
  background: rgba(0, 139, 125, 0.96) !important;
  border-color: rgba(25, 199, 183, 0.78) !important;
  box-shadow: 0 20px 44px rgba(0, 139, 125, 0.30) !important;
}

.download-report-fab:active,
.report-floating-cta:active {
  transform: translateY(0);
}

.download-report-fab:focus-visible,
.report-floating-cta:focus-visible,
.lead-submit-btn:focus-visible,
.lead-modal-close:focus-visible {
  outline: 3px solid rgba(25, 199, 183, 0.35);
  outline-offset: 4px;
}

.download-report-fab i,
.report-floating-cta i {
  display: block;
  line-height: 1;
  font-size: 1.08em;
}

.download-fallback-icon {
  display: none;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.download-tooltip {
  position: absolute;
  right: 64px;
  bottom: 50%;
  transform: translateY(50%);

  display: inline-flex;
  align-items: center;
  justify-content: center;

  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 10px;

  background: rgba(7, 26, 54, 0.96);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);

  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.01em;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.download-tooltip::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  width: 10px;
  height: 10px;
  background: rgba(7, 26, 54, 0.96);
  transform: translateY(-50%) rotate(45deg);
  border-radius: 2px;
}

.download-report-fab:hover .download-tooltip,
.download-report-fab:focus-visible .download-tooltip,
.report-floating-cta:hover .download-tooltip,
.report-floating-cta:focus-visible .download-tooltip {
  opacity: 1;
  transform: translateY(50%) translateX(-3px);
}

/* Compatibilidade com botão antigo dentro de páginas ou CTAs internos */
.download-report-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--sky-navy);
  color: #ffffff;
  font-family: inherit;
  font-weight: 900;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(7, 26, 54, 0.18);
}

/* ---------- Backdrop ---------- */
.lead-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483001;

  display: none;
  align-items: center;
  justify-content: center;

  width: 100%;
  min-height: 100dvh;
  padding: 24px;

  background: rgba(3, 14, 34, 0.70);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  overflow-x: hidden;
  overflow-y: auto;
}

.lead-modal-backdrop.is-open {
  display: flex;
}

/* ---------- Modal ---------- */
.lead-modal {
  position: relative;
  width: min(560px, 100%);
  max-width: 560px;
  max-height: calc(100dvh - 48px);

  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;

  background: var(--sky-card);
  color: var(--sky-text);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 26px;
  padding: 32px;

  box-shadow: var(--sky-shadow-modal);
  scrollbar-width: thin;
  scrollbar-color: rgba(7, 26, 54, 0.22) transparent;
}

.lead-modal::-webkit-scrollbar {
  width: 8px;
}

.lead-modal::-webkit-scrollbar-thumb {
  background: rgba(7, 26, 54, 0.22);
  border-radius: 999px;
}

.lead-modal-content[hidden],
.lead-success-view[hidden],
.lead-other-role[hidden] {
  display: none !important;
}

.lead-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;

  width: 36px;
  height: 36px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--sky-border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--sky-navy);

  font-family: Arial, Helvetica, sans-serif;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;

  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.lead-modal-close:hover {
  background: var(--sky-soft);
  border-color: var(--sky-border-strong);
  transform: rotate(3deg);
}

.lead-modal-header {
  padding-right: 42px;
  margin-bottom: 18px;
}

.lead-modal-logo {
  display: block;
  width: 124px;
  max-width: 124px;
  height: auto;
  margin: 0 0 18px;
}

.lead-eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--sky-teal);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.17em;
}

.lead-modal h2 {
  margin: 0 0 10px;
  color: var(--sky-navy);
  font-size: clamp(1.52rem, 3.3vw, 2.12rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.lead-modal p {
  margin: 0;
  color: var(--sky-muted);
  font-size: 0.95rem;
  line-height: 1.54;
}

/* ---------- Formulário ---------- */
.lead-form {
  display: grid;
  gap: 13px;
}

.lead-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.lead-form label {
  display: grid;
  gap: 7px;
  color: #152235;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.25;
}

.lead-form input[type="text"],
.lead-form input[type="email"],
.lead-form select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--sky-border);
  border-radius: 13px;
  padding: 0 13px;

  background: #fbfdfe;
  color: var(--sky-navy);

  font-family: inherit;
  font-size: 0.94rem;
  line-height: 1.2;
  outline: none;

  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.lead-form select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 19px,
    calc(100% - 13px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.lead-form input::placeholder {
  color: #94a3b8;
}

.lead-form input:hover,
.lead-form select:hover {
  background: #ffffff;
  border-color: var(--sky-border-strong);
}

.lead-form input:focus,
.lead-form select:focus {
  background: #ffffff;
  border-color: var(--sky-teal-2);
  box-shadow: 0 0 0 4px rgba(25, 199, 183, 0.14);
}

.lead-other-role {
  margin-top: -2px;
}

.lead-hp {
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

.lead-consent {
  display: grid !important;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 10px !important;
  margin-top: 2px;
  color: var(--sky-muted) !important;
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  line-height: 1.42 !important;
}

.lead-consent input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 3px 0 0;
  accent-color: var(--sky-teal);
  cursor: pointer;
}

.lead-submit-btn {
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  padding: 0 18px;
  background: var(--sky-navy);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(7, 26, 54, 0.20);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.lead-submit-btn:hover {
  transform: translateY(-1px);
  background: var(--sky-navy-2);
  box-shadow: 0 18px 38px rgba(7, 26, 54, 0.26);
}

.lead-submit-btn:active {
  transform: translateY(0);
}

.lead-submit-btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.lead-message {
  min-height: 20px;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.4;
}

.lead-message.success { color: var(--sky-success); }
.lead-message.error { color: var(--sky-error); }

/* ---------- Estado de confirmação centralizada ---------- */
.lead-modal.is-success {
  width: min(500px, 100%);
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 38px 30px;
}

.lead-success-view {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  width: 100%;
  min-height: 270px;
}

.lead-success-icon {
  width: 62px;
  height: 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(0, 139, 125, 0.10);
  color: var(--sky-teal);
  font-size: 1.45rem;
  border: 1px solid rgba(0, 139, 125, 0.18);
}

.lead-success-view h2 {
  margin: 4px 0 0;
  font-size: clamp(1.6rem, 4vw, 2.05rem);
}

.lead-success-view p {
  max-width: 360px;
  color: #334155;
  font-size: 0.98rem;
  line-height: 1.55;
}

.lead-success-view small {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
}

/* ---------- Mobile / Tablet ---------- */
@media (max-width: 760px) {
  .download-report-fab,
  .report-floating-cta {
    right: max(14px, env(safe-area-inset-right)) !important;
    bottom: max(14px, env(safe-area-inset-bottom)) !important;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    font-size: 1rem !important;
  }

  .download-tooltip { display: none; }

  .lead-modal-backdrop {
    align-items: flex-end;
    padding: 0;
    background: rgba(3, 14, 34, 0.76);
  }

  .lead-modal {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 24px 24px 0 0;
    padding: 25px 20px 22px;
    box-shadow: 0 -18px 60px rgba(0, 0, 0, 0.28);
  }

  .lead-modal-header {
    padding-right: 38px;
    margin-bottom: 16px;
  }

  .lead-modal-logo {
    width: 108px;
    max-width: 108px;
    margin-bottom: 14px;
  }

  .lead-eyebrow {
    font-size: 0.63rem;
    letter-spacing: 0.14em;
  }

  .lead-modal h2 {
    font-size: clamp(1.38rem, 6.4vw, 1.76rem);
    line-height: 1.08;
  }

  .lead-modal p {
    font-size: 0.9rem;
  }

  .lead-form,
  .lead-form-grid {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .lead-form input[type="text"],
  .lead-form input[type="email"],
  .lead-form select {
    height: 45px;
    font-size: 0.92rem;
  }

  .lead-consent {
    font-size: 0.75rem !important;
  }

  .lead-submit-btn {
    min-height: 48px;
    font-size: 0.92rem;
  }

  .lead-modal.is-success {
    min-height: 330px;
    border-radius: 24px 24px 0 0;
  }
}

@media (max-width: 380px) {
  .lead-modal {
    padding: 23px 17px 21px;
  }

  .lead-modal-logo {
    width: 100px;
    max-width: 100px;
  }

  .lead-modal h2 {
    font-size: 1.34rem;
  }

  .lead-form input[type="text"],
  .lead-form input[type="email"],
  .lead-form select {
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .download-report-fab,
  .report-floating-cta,
  .download-report-btn,
  .download-tooltip,
  .lead-modal-close,
  .lead-form input,
  .lead-form select,
  .lead-submit-btn {
    transition: none !important;
  }
}
