/* ============================================================
   FrugalNova - Exit-Intent Popup
   Premium, non-intrusive lead capture triggered on exit
   ============================================================ */

/* --- OVERLAY --- */
.ei-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 46, 68, 0.72);
  backdrop-filter: blur(8px) saturate(1.2);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(.22, 1, .36, 1);
}

.ei-overlay.ei-visible {
  opacity: 1;
  pointer-events: all;
}

/* --- POPUP CARD --- */
.ei-popup {
  position: relative;
  background: #ffffff;
  border-radius: 24px;
  box-shadow:
    0 0 0 1px rgba(26, 46, 68, 0.08),
    0 24px 60px rgba(26, 46, 68, 0.22),
    0 60px 120px rgba(26, 46, 68, 0.14);
  max-width: 560px;
  width: 100%;
  overflow: hidden;
  transform: translateY(32px) scale(0.94);
  transition: transform 0.5s cubic-bezier(.22, 1, .36, 1), opacity 0.4s;
  opacity: 0;
}

.ei-overlay.ei-visible .ei-popup {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* --- Decorative top gradient bar --- */
.ei-popup::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #B5246A 0%, #4f8ef7 50%, #B5246A 100%);
  background-size: 200% 100%;
  animation: ei-bar-sweep 3s linear infinite;
}

@keyframes ei-bar-sweep {
  0%   { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

/* --- Subtle background gradient blob --- */
.ei-popup::after {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(181,36,106,.1) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

/* --- CLOSE BUTTON --- */
.ei-close {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 34px; height: 34px;
  background: rgba(26,46,68,.06);
  border: 1px solid rgba(26,46,68,.1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: #5a5a6b;
  transition: all 0.25s cubic-bezier(.22, 1, .36, 1);
  z-index: 10;
  line-height: 1;
}
.ei-close:hover {
  background: rgba(181,36,106,.1);
  border-color: rgba(181,36,106,.3);
  color: #B5246A;
  transform: rotate(90deg) scale(1.1);
}

/* --- BODY --- */
.ei-body {
  padding: 1.75rem 1.75rem 1.25rem;
  position: relative;
  z-index: 1;
}

/* --- EYEBROW / TAG --- */
.ei-tag {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  background: rgba(181,36,106,.08);
  border: 1px solid rgba(181,36,106,.2);
  border-radius: 100px;
  padding: .35rem 1rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #B5246A;
  margin-bottom: 0.8rem;
}
.ei-tag-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #B5246A;
  box-shadow: 0 0 0 3px rgba(181,36,106,.25);
  animation: ei-dot-pulse 2s ease infinite;
  flex-shrink: 0;
}
@keyframes ei-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(181,36,106,.25); }
  50%       { box-shadow: 0 0 0 6px rgba(181,36,106,.07); }
}

/* --- HEADLINE --- */
.ei-headline {
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  color: #1a2e44;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}
.ei-headline em {
  font-style: normal;
  color: #B5246A;
}

/* --- SUB-TEXT --- */
.ei-subtext {
  font-size: .95rem;
  font-weight: 300;
  color: #5a5a6b;
  line-height: 1.7;
  margin-bottom: 1rem;
}

/* --- PERKS LIST --- */
.ei-perks {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  margin-bottom: 1.75rem;
}
.ei-perk {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .87rem;
  color: #1c1c1e;
  font-weight: 400;
}
.ei-perk-check {
  width: 20px; height: 20px;
  background: linear-gradient(135deg, #1a2e44 0%, #2c4a6e 100%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: .65rem;
  color: #fff;
}

/* --- FORM --- */
.ei-form {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

.ei-input-wrap {
  flex: 1 1 220px;
  position: relative;
}
.ei-input-icon {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: .9rem;
  pointer-events: none;
  color: #9898a8;
}
.ei-input {
  width: 100%;
  padding: .85rem .85rem .85rem 2.5rem;
  border: 1.5px solid #e8e4dc;
  border-radius: 12px;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 400;
  color: #1c1c1e;
  background: #f8f7f4;
  transition: border-color .25s, box-shadow .25s, background .25s;
  outline: none;
  -webkit-appearance: none;
}
.ei-input::placeholder { color: #9898a8; }
.ei-input:focus {
  border-color: #B5246A;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(181,36,106,.1);
}

/* --- CTA BUTTON --- */
.ei-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .85rem 1.8rem;
  background: linear-gradient(135deg, #1a2e44 0%, #2c4a6e 100%);
  color: #fff;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 12px rgba(26,46,68,.25),
    inset 0 -3px 0 rgba(0,0,0,.2);
  transition: all 0.4s cubic-bezier(.22, 1, .36, 1);
  white-space: nowrap;
}
.ei-btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent);
  transform: skewX(-30deg);
  transition: .8s;
}
.ei-btn:hover::before { left: 200%; }
.ei-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 10px 24px rgba(26,46,68,.3),
    inset 0 -2px 0 rgba(0,0,0,.1);
}
.ei-btn:active { transform: translateY(0) scale(.98); }

/* Success state */
.ei-btn.ei-btn--loading .ei-btn-text { opacity: 0; }
.ei-btn.ei-btn--loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ei-spin .7s linear infinite;
}
@keyframes ei-spin { to { transform: rotate(360deg); } }

/* --- NOTE / PRIVACY --- */
.ei-note {
  font-size: .75rem;
  color: #9898a8;
  margin-top: 1rem;
  text-align: center;
  line-height: 1.5;
}

/* --- FOOTER SOCIAL PROOF --- */
.ei-social-proof {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 1rem 2.5rem 1.5rem;
  border-top: 1px solid rgba(26,46,68,.06);
  position: relative;
  z-index: 1;
}
.ei-avatars {
  display: flex;
}
.ei-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: linear-gradient(135deg, #e8e4dc, #f0ede6);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  margin-left: -8px;
  color: #1a2e44;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.ei-avatar:first-child { margin-left: 0; }
.ei-sp-text {
  font-size: .8rem;
  color: #5a5a6b;
  line-height: 1.4;
}
.ei-sp-text strong {
  color: #1a2e44;
  display: block;
}

/* --- SUCCESS STATE --- */
.ei-success {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3rem 2.5rem;
  position: relative;
  z-index: 1;
}
.ei-success-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, rgba(181,36,106,.1), rgba(79,142,247,.1));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1.2rem;
  animation: ei-success-pop .5s cubic-bezier(.22, 1, .36, 1);
}
@keyframes ei-success-pop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}
.ei-success h3 {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a2e44;
  margin-bottom: .5rem;
}
.ei-success p {
  color: #5a5a6b;
  font-size: .95rem;
  line-height: 1.6;
}

.ei-popup.ei-show-success .ei-body { display: none; }
.ei-popup.ei-show-success .ei-social-proof { display: none; }
.ei-popup.ei-show-success .ei-success { display: flex; }

/* --- DISMISS LINK --- */
.ei-dismiss {
  display: block;
  text-align: center;
  margin-top: .75rem;
  font-size: .8rem;
  color: #9898a8;
  cursor: pointer;
  transition: color .2s;
  background: none;
  border: none;
  font-family: inherit;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: color .2s, text-decoration-color .2s;
}
.ei-dismiss:hover {
  color: #5a5a6b;
  text-decoration-color: currentColor;
}

/* --- RESPONSIVE --- */
@media (max-width: 540px) {
  .ei-body { padding: 2rem 1.5rem 1.5rem; }
  .ei-social-proof { padding: .9rem 1.5rem 1.25rem; }
  .ei-headline { font-size: 1.4rem; }
  .ei-form { flex-direction: column; }
  .ei-btn { width: 100%; justify-content: center; }
}

/* --- Entry animation: prevent flash on load --- */
@media (prefers-reduced-motion: reduce) {
  .ei-overlay, .ei-popup, .ei-popup::before {
    transition: none;
    animation: none;
  }
}
