@media (min-width: 48rem) {
  /* 769px */
  .popup-overlay {
    display: none !important;
  }
}

/* CSS apenas para mobile */
.popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  /* Menos padding para caber na tela sem rolagem */
  padding: clamp(0.5rem, 2vh, 0.75rem) 0.75rem;
  box-sizing: border-box;
}

.popup-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-container {
  position: relative;
  width: 100%;
  /* Evita forçar altura grande; objetivo é caber na viewport */
  min-height: 0;
  background-color: #ffffff;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 0.25rem 1.25rem rgba(0, 0, 0, 0.2);
  font-family: "Montserrat", sans-serif;
  /* Menos padding inferior: o CTA está no fluxo */
  padding-bottom: clamp(0.125rem, 0.75vh, 0.375rem);
}

.popup-cover-section {
  position: relative;
  width: 100%;
  /* Capa menor para liberar espaço ao CTA */
  height: clamp(7.25rem, 18vh, 9rem);
}

.popup-cover-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.popup-cover-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.popup-profile-info {
  position: absolute;
  /* Menos sobreposição para precisar de menos margem no conteúdo */
  bottom: clamp(-3.375rem, -9vh, -2.75rem);
  left: 1rem;
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  z-index: 2;
}

.popup-profile-image {
  width: clamp(3.75rem, 14vw, 4.5rem);
  height: clamp(3.75rem, 14vw, 4.5rem);
  border-radius: 50%;
  border: 0.25rem solid #ffffff;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.1);
}

.popup-profile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.popup-profile-text {
  padding-bottom: 0.5rem;
}

.popup-profile-name {
  font-size: clamp(0.875rem, 4vw, 1rem);
  font-weight: 600;
  color: #333;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.popup-verified {
  display: flex;
  align-items: center;
}

.popup-verified svg {
  width: clamp(1rem, 5vw, 1.125rem);
  height: clamp(1rem, 5vw, 1.125rem);
}

.popup-profile-username {
  font-size: clamp(0.75rem, 3.5vw, 0.875rem);
  color: #666;
  margin-top: 0.125rem;
}

.popup-stats {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  gap: 1rem;
  color: #ffffff;
  font-size: clamp(0.75rem, 3.5vw, 0.875rem);
  text-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.5);
}

.popup-stats span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.popup-stats i {
  font-size: clamp(0.875rem, 4vw, 1rem);
}

.close-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: #ffffff;
  font-size: clamp(1rem, 5vw, 1.25rem);
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-active {
  overflow: hidden;
}

.popup-content {
  /* Aumentado para não sobrepor a foto/perfil */
  /* Reduzido novamente para subir o conteúdo e caber na tela */
  margin-top: clamp(2.75rem, 6.5vh, 3.25rem);
  padding: 1rem;
}

.popup-headline {
  padding: 0 1.25rem;
  /* Removido deslocamento negativo para descer o título */
  margin-top: 0;
}

.popup-headline h2 {
  font-size: clamp(0.9375rem, 4.5vw, 1.0625rem);
  font-weight: 700;
  color: #555555;
  text-align: center;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.popup-verification-items {
  padding: 0 1.25rem;
}

.verification-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.75rem;
}

.check-icon {
  width: clamp(0.9rem, 3vw, 0.9rem);
  height: clamp(0.9rem, 3vw, 0.9rem);
  background-color: #ff6b3d;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.check-icon i {
  color: #ffffff;
  font-size: clamp(0.5rem, 2.5vw, 0.5625rem);
}

.verification-item span:last-child {
  font-size: clamp(0.875rem, 4vw, 1rem);
  color: #424242;
}

.popup-additional-headline {
  text-align: center;
  margin: 1.25rem 0 0.9375rem;
  width: 110%;
  transform: translateX(-5%);
  margin-left: auto;
  margin-right: auto;
}

.popup-additional-headline h3 {
  font-size: clamp(0.75rem, 3.5vw, 0.875rem);
  font-weight: 600;
  color: #555;
  line-height: 1.4;
}

.subscription-button-popup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  width: calc(100% - 1.875rem);
  /* Coloca o botão no fluxo logo abaixo do h3 */
  margin: 0.5rem auto 0.125rem;
  border: none;
  border-radius: 9999px;
  background: linear-gradient(to right, #f58370, #f5a55b);
  color: #ffffff;
  font-family: "Montserrat", sans-serif;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
  transition: opacity 0.2s;
  will-change: opacity;
  /* Removida a posição absoluta para ficar logo após o h3 */
  position: static;
}

.subscription-button-popup:hover {
  opacity: 0.9;
}

.subscription-button-popup span {
  font-size: clamp(1.125rem, 5vw, 1.3125rem);
}

.payment-trust {
  /* Entra no fluxo abaixo do botão */
  position: static;
  margin-top: 0.375rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1.25rem;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.trust-item i {
  color: #ff6b3d;
  font-size: clamp(0.625rem, 3vw, 0.75rem);
}

.trust-item span {
  color: #666;
  font-size: clamp(0.6rem, 2.6vw, 0.656rem);
  font-weight: 500;
  white-space: nowrap;
}

.popup-overlay.active .popup-container {
  animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-1.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* iPhone X, XS, 11 Pro, 12 Mini, 13 Mini */
@media screen and (device-width: 375px) and (device-height: 812px) and (-webkit-min-device-pixel-ratio: 3) {
  .popup-container {
    min-height: 0;
  }

  .popup-cover-section {
    height: clamp(10rem, 28vh, 12.5rem);
  }

  .popup-content {
    /* Acompanha o perfil um pouco mais baixo */
    margin-top: clamp(2.5rem, 6vh, 3rem);
  }

  .popup-headline h2 {
    font-size: clamp(1rem, 4.2vw, 1.125rem);
    margin-bottom: 1rem;
  }

  .verification-item {
    margin-bottom: 0.5rem;
    gap: 0.75rem;
  }

  .verification-item span:last-child {
    font-size: clamp(0.875rem, 3.8vw, 1rem);
  }

  .popup-additional-headline h3 {
    font-size: clamp(0.75rem, 3.5vw, 0.875rem);
  }
}

/* iPhone 11, XR */
@media screen and (device-width: 414px) and (device-height: 896px) and (-webkit-min-device-pixel-ratio: 2) {
  .popup-container {
    min-height: 0;
  }

  .popup-cover-section {
    height: clamp(10rem, 22vh, 11rem);
  }

  .popup-content {
    margin-top: clamp(2.5rem, 6vh, 3rem);
  }

  .popup-headline h2 {
    font-size: clamp(1.125rem, 4.5vw, 1.25rem);
    margin-bottom: 0.75rem;
    line-height: 1.3;
  }

  .verification-item {
    margin-bottom: 0.5rem;
    gap: 0.625rem;
  }

  .verification-item span:last-child {
    font-size: clamp(1rem, 4.2vw, 1.125rem);
  }

  .popup-additional-headline h3 {
    font-size: clamp(0.875rem, 4vw, 1rem);
    line-height: 1.3;
  }
}

/* iPhone 12 Pro, 13 Pro, 14 Pro */
@media screen and (device-width: 390px) and (device-height: 844px) and (-webkit-min-device-pixel-ratio: 3) {
  .popup-container {
    min-height: 0;
  }

  .popup-cover-section {
    height: clamp(10rem, 22vh, 11rem);
  }

  .popup-content {
    margin-top: clamp(2.5rem, 6vh, 3rem);
  }

  .popup-headline h2 {
    font-size: clamp(1.125rem, 4.5vw, 1.25rem);
    margin-bottom: 0.75rem;
    line-height: 1.3;
  }

  .verification-item {
    margin-bottom: 0.5rem;
    gap: 0.625rem;
  }

  .verification-item span:last-child {
    font-size: clamp(1rem, 4.2vw, 1.125rem);
  }

  .popup-additional-headline h3 {
    font-size: clamp(0.875rem, 4vw, 1rem);
    line-height: 1.3;
  }
}

/* iPhone 12 Pro Max, 13 Pro Max, 14 Pro Max */
@media screen and (device-width: 428px) and (device-height: 926px) and (-webkit-min-device-pixel-ratio: 3) {
  .popup-container {
    min-height: 0;
  }

  .popup-cover-section {
    height: clamp(10rem, 22vh, 11rem);
  }

  .popup-content {
    margin-top: clamp(2.5rem, 6vh, 3rem);
  }

  .popup-headline h2 {
    font-size: clamp(1.125rem, 4.5vw, 1.25rem);
    margin-bottom: 0.75rem;
    line-height: 1.3;
  }

  .verification-item {
    margin-bottom: 0.5rem;
    gap: 0.625rem;
  }

  .verification-item span:last-child {
    font-size: clamp(1rem, 4.2vw, 1.125rem);
  }

  .popup-additional-headline h3 {
    font-size: clamp(0.875rem, 4vw, 1rem);
    line-height: 1.3;
  }
}
