/* ============================================
   POPUP PRESENTE 50% OFF
   ============================================ */

/* ---------- OVERLAY ---------- */
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: background 0.4s ease, opacity 0.4s ease, visibility 0.4s ease;
  padding: 16px;
}

.popup-overlay.active {
  opacity: 1;
  visibility: visible;
  background: rgba(0, 0, 0, 0.75);
}

/* ---------- CONTAINER ---------- */
/* Altura inicial reduzida; cresce quando o texto aparece (.popup-content.visible) */
.popup-container {
  position: relative;
  background: linear-gradient(165deg, #1a0005 0%, #2a0008 40%, #1a0005 100%);
  border: 2px solid rgba(255, 30, 30, 0.35);
  border-radius: 18px;
  max-width: 520px;
  width: 100%;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 28px 28px;
  box-shadow:
    0 0 60px rgba(255, 0, 0, 0.25),
    0 0 120px rgba(255, 0, 0, 0.1),
    0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.8) translateY(30px);
  transition:
    transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    max-height 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup-overlay.active .popup-container {
  transform: scale(1) translateY(0);
}

/* Expande o modal quando o texto/copy é exibido */
.popup-container:has(.popup-content.visible) {
  max-height: 92vh;
}

/* ---------- CLOSE BUTTON ---------- */
.popup-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.6);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
  line-height: 1;
}

.popup-close:hover {
  background: rgba(255, 50, 50, 0.3);
  color: #fff;
  border-color: rgba(255, 50, 50, 0.5);
}

/* ---------- GIFT AREA ---------- */
.gift-area {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 140px;
  margin-bottom: 6px;
  overflow: visible;
}

/* Glow pulsante atrás do presente */
.gift-glow {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 20, 20, 0.4) 0%, rgba(255, 0, 0, 0) 70%);
  animation: glowPulse 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes glowPulse {
  0%, 100% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
}

/* ---------- GIFT BOX ---------- */
.gift-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  transform: scale(0);
  z-index: 2;
}

.gift-wrapper.shown {
  transform: scale(1);
}

.gift-wrapper.animate-in {
  animation: giftBounceIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.gift-wrapper.wiggle {
  transform: scale(1);
  animation: giftWiggle 0.6s ease-in-out 3;
}

@keyframes giftBounceIn {
  0% { transform: scale(0) rotate(-15deg); }
  60% { transform: scale(1.15) rotate(5deg); }
  80% { transform: scale(0.95) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes giftWiggle {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(-8deg); }
  30% { transform: rotate(8deg); }
  45% { transform: rotate(-6deg); }
  60% { transform: rotate(6deg); }
  75% { transform: rotate(-3deg); }
}

/* Base da caixa */
.gift-base {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 70px;
}

.gift-base-box {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #e81224 0%, #c10a1c 50%, #a00818 100%);
  border-radius: 6px 6px 10px 10px;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.2),
    0 4px 15px rgba(200, 0, 0, 0.4);
}

.gift-base-ribbon {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 100%;
  background: linear-gradient(180deg, #ffd700 0%, #ffb800 50%, #e6a600 100%);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

/* Tampa da caixa */
.gift-lid {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 28px;
  z-index: 3;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

.gift-lid.open {
  transform: translateX(-50%) translateY(-60px) rotate(-25deg);
  opacity: 0;
}

.gift-lid-box {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #ff2d3b 0%, #e81224 100%);
  border-radius: 8px 8px 2px 2px;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.25),
    0 -2px 8px rgba(200, 0, 0, 0.3);
}

.gift-lid-bow {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 28px;
}

.gift-lid-bow::before,
.gift-lid-bow::after {
  content: '';
  position: absolute;
  top: 6px;
  width: 22px;
  height: 18px;
  border-radius: 50% 50% 0 50%;
  background: linear-gradient(135deg, #ffd700 0%, #ffb800 100%);
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
}

.gift-lid-bow::before {
  left: 0;
  transform: rotate(-15deg);
}

.gift-lid-bow::after {
  right: 0;
  border-radius: 50% 50% 50% 0;
  transform: rotate(15deg);
}

/* ---------- SPARKLES / BRILHO ---------- */
.sparkle-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.sparkle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #ffd700;
  border-radius: 50%;
  box-shadow: 0 0 6px #ffd700, 0 0 12px rgba(255, 215, 0, 0.5);
  animation: sparkleFade 1.5s ease-in-out infinite;
}

@keyframes sparkleFade {
  0%, 100% { opacity: 0; transform: scale(0); }
  50% { opacity: 1; transform: scale(1); }
}

/* ---------- CONFETTI ---------- */
.confetti-container {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 250px;
  pointer-events: none;
  z-index: 5;
  overflow: visible;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: 0;
  left: 50%;
  opacity: 0;
}

.confetti-piece.burst {
  animation: confettiBurst var(--duration, 1.5s) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes confettiBurst {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform:
      translate(var(--tx, 0px), var(--ty, 200px))
      rotate(var(--rot, 720deg))
      scale(0.4);
  }
}

/* ---------- POPUP CONTENT / COPY ---------- */
.popup-content {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  text-align: left;
}

.popup-content.visible {
  opacity: 1;
  transform: translateY(0);
}

.popup-title {
  font-family: 'Encode Sans', Arial, sans-serif;
  font-size: clamp(17px, 4vw, 22px);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.35;
  margin-bottom: 16px;
  text-align: center;
}

.popup-emoji {
  display: inline-block;
  animation: emojiPop 0.6s ease-out;
}

@keyframes emojiPop {
  0% { transform: scale(0) rotate(-30deg); }
  60% { transform: scale(1.3) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.highlight-red {
  color: #ff3040;
  text-shadow: 0 0 20px rgba(255, 48, 64, 0.5);
}

.popup-text {
  font-family: 'Encode Sans', Arial, sans-serif;
  font-size: clamp(13px, 3vw, 15px);
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.65;
  margin-bottom: 14px;
}

.popup-text strong {
  color: #ffffff;
  font-weight: 700;
}

.popup-text-emphasis {
  color: rgba(255, 255, 255, 0.9);
}

/* ---------- ACTIONS / BOTÕES ---------- */
.popup-actions {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.popup-btn-cta {
  display: block;
  width: 100%;
  padding: 18px 24px;
  background: linear-gradient(180deg, #2ecc40 0%, #27ae35 40%, #1e9a2c 100%);
  color: #ffffff;
  font-family: 'Encode Sans', Arial, sans-serif;
  font-size: clamp(14px, 3.2vw, 16px);
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  border-radius: 12px;
  line-height: 1.4;
  box-shadow:
    0 4px 15px rgba(46, 204, 64, 0.35),
    0 0 30px rgba(46, 204, 64, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.25s ease;
  animation: ctaPulse 2.5s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

.popup-btn-cta::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s ease;
}

.popup-btn-cta:hover::before {
  left: 100%;
}

.popup-btn-cta:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 6px 25px rgba(46, 204, 64, 0.45),
    0 0 40px rgba(46, 204, 64, 0.2);
}

.popup-btn-cta:active {
  transform: translateY(0) scale(0.98);
}

@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 4px 15px rgba(46, 204, 64, 0.35), 0 0 30px rgba(46, 204, 64, 0.15); }
  50% { box-shadow: 0 4px 25px rgba(46, 204, 64, 0.55), 0 0 50px rgba(46, 204, 64, 0.25); }
}

.popup-btn-dismiss {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.35);
  font-family: 'Encode Sans', Arial, sans-serif;
  font-size: clamp(11px, 2.5vw, 12px);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
  line-height: 1.5;
}

.popup-btn-dismiss:hover {
  color: rgba(255, 255, 255, 0.55);
}

/* ---------- SCROLLBAR CUSTOM ---------- */
/* Esconde a barra de rolagem vertical (scroll continua funcionando) */
.popup-container {
  scrollbar-width: none;           /* Firefox */
  -ms-overflow-style: none;       /* IE / Edge */
}

.popup-container::-webkit-scrollbar {
  display: none;                  /* Chrome, Safari, Opera */
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 480px) {
  .popup-container {
    padding: 20px 18px 22px;
    border-radius: 14px;
    max-height: 260px;
  }

  .popup-container:has(.popup-content.visible) {
    max-height: 95vh;
  }

  .gift-area {
    height: 120px;
    margin-bottom: 4px;
  }

  .gift-wrapper {
    width: 100px;
    height: 100px;
  }

  .gift-base {
    width: 82px;
    height: 58px;
  }

  .gift-lid {
    bottom: 50px;
    width: 92px;
    height: 24px;
  }

  .gift-base-ribbon {
    width: 14px;
  }

  .popup-title {
    font-size: 16px;
  }

  .popup-text {
    font-size: 13px;
  }

  .popup-btn-cta {
    padding: 15px 18px;
    font-size: 13px;
  }

  .popup-btn-dismiss {
    font-size: 11px;
  }
}
