/* ===================================================
   POPUP2.CSS — Premium Second-Chance Rewards Popup
   Dark luxury design with Binance-inspired gold accents,
   advanced glassmorphism, floating animations, and
   premium visual effects.
   =================================================== */

/* ---------------------------------------------------
   CSS Custom Properties (Popup 2 Scope)
   --------------------------------------------------- */
:root {
  --p2-gold: #F3BA2F;
  --p2-gold-light: #FFD666;
  --p2-gold-dark: #C4941F;
  --p2-gold-deep: #9A6E12;
  --p2-bg-dark: #0B0E11;
  --p2-bg-card: rgba(16, 20, 26, 0.92);
  --p2-bg-card-inner: rgba(22, 27, 35, 0.6);
  --p2-border: rgba(243, 186, 47, 0.12);
  --p2-border-hover: rgba(243, 186, 47, 0.35);
  --p2-text-primary: #EAECEF;
  --p2-text-secondary: rgba(234, 236, 239, 0.7);
  --p2-text-muted: rgba(234, 236, 239, 0.4);
  --p2-glow: rgba(243, 186, 47, 0.2);
  --p2-radius: 24px;
  --p2-radius-sm: 14px;
  --p2-radius-btn: 14px;
  --p2-transition: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --p2-transition-slow: 600ms cubic-bezier(0.16, 1, 0.3, 1);
  --p2-max-width: 560px;
}

/* ---------------------------------------------------
   Overlay — Background blur + dark scrim
   --------------------------------------------------- */
.popup2-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;

  /* Initial hidden state */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  /* Smooth transition */
  transition:
    opacity var(--p2-transition-slow),
    visibility var(--p2-transition-slow);
}

/* Active state — visible */
.popup2-overlay.popup2-overlay--active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Backdrop: dark scrim + heavier blur */
.popup2-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

/* ---------------------------------------------------
   Popup Container — Advanced Glassmorphism card
   --------------------------------------------------- */
.popup2 {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--p2-max-width);
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;

  /* Glassmorphism */
  background: var(--p2-bg-card);
  backdrop-filter: blur(50px) saturate(1.8);
  -webkit-backdrop-filter: blur(50px) saturate(1.8);
  border: 1px solid var(--p2-border);
  border-radius: var(--p2-radius);

  /* Premium shadow stack */
  box-shadow:
    0 0 80px rgba(243, 186, 47, 0.06),
    0 0 40px rgba(243, 186, 47, 0.04),
    0 30px 100px rgba(0, 0, 0, 0.6),
    0 10px 40px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);

  /* Entrance animation: scale + translate + fade */
  transform: scale(0.88) translateY(30px);
  transition:
    transform var(--p2-transition-slow),
    opacity var(--p2-transition-slow);
}

/* Active state — fully scaled */
.popup2-overlay--active .popup2 {
  transform: scale(1) translateY(0);
}

/* Outer glow ring */
.popup2::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--p2-radius) + 2px);
  background: linear-gradient(
    135deg,
    rgba(243, 186, 47, 0.15) 0%,
    transparent 40%,
    transparent 60%,
    rgba(243, 186, 47, 0.1) 100%
  );
  z-index: -1;
  opacity: 0;
  transition: opacity var(--p2-transition-slow);
}

.popup2-overlay--active .popup2::before {
  opacity: 1;
}

/* Scrollbar styling */
.popup2::-webkit-scrollbar {
  width: 4px;
}

.popup2::-webkit-scrollbar-track {
  background: transparent;
}

.popup2::-webkit-scrollbar-thumb {
  background: rgba(243, 186, 47, 0.2);
  border-radius: 4px;
}

/* Inner padding */
.popup2__inner {
  padding: 2rem 1.75rem 1.75rem;
  text-align: center;
}

/* ---------------------------------------------------
   Decorative Gold Orbs (background accents)
   --------------------------------------------------- */
.popup2__orb {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(40px);
}

.popup2__orb--1 {
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(243, 186, 47, 0.1) 0%, transparent 70%);
}

.popup2__orb--2 {
  bottom: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(243, 186, 47, 0.06) 0%, transparent 70%);
}

/* ---------------------------------------------------
   Close Button (X)
   --------------------------------------------------- */
.popup2__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--p2-text-secondary);
  cursor: pointer;
  transition:
    background var(--p2-transition),
    color var(--p2-transition),
    border-color var(--p2-transition),
    transform var(--p2-transition),
    box-shadow var(--p2-transition);
}

.popup2__close:hover,
.popup2__close:focus-visible {
  background: rgba(243, 186, 47, 0.12);
  border-color: var(--p2-border-hover);
  color: var(--p2-gold);
  transform: rotate(90deg);
  box-shadow: 0 0 16px rgba(243, 186, 47, 0.15);
}

.popup2__close:focus-visible {
  outline: 2px solid var(--p2-gold);
  outline-offset: 2px;
}

.popup2__close svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

/* ---------------------------------------------------
   Illustration Area (premium reward visual)
   --------------------------------------------------- */
.popup2__visual {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  overflow: visible;
  animation: p2-float 4s ease-in-out infinite;
}

.popup2__visual-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(243, 186, 47, 0.15);
  box-shadow: 0 0 40px rgba(243, 186, 47, 0.1);
}

/* Floating glow behind visual */
.popup2__visual::before {
  content: '';
  position: absolute;
  inset: -15px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(243, 186, 47, 0.12) 0%, transparent 70%);
  animation: p2-glow-pulse 3s ease-in-out infinite;
  z-index: -1;
}

/* Sparkle particles */
.popup2__visual::after {
  content: '';
  position: absolute;
  top: -8px;
  right: -4px;
  width: 24px;
  height: 24px;
  background: radial-gradient(circle, var(--p2-gold) 0%, transparent 70%);
  border-radius: 50%;
  animation: p2-sparkle 2s ease-in-out infinite;
}

@keyframes p2-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

@keyframes p2-glow-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.08); }
}

@keyframes p2-sparkle {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50%      { opacity: 1; transform: scale(1.2); }
}

/* ---------------------------------------------------
   Headline
   --------------------------------------------------- */
.popup2__headline {
  margin: 0 0 0.625rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--p2-text-primary);
  letter-spacing: -0.02em;
}

/* Gold gradient text for emphasis */
.popup2__headline-highlight {
  background: linear-gradient(
    135deg,
    var(--p2-gold-light),
    var(--p2-gold),
    var(--p2-gold-dark)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------------------------------------------------
   Subheadline
   --------------------------------------------------- */
.popup2__subheadline {
  margin: 0 0 0.75rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--p2-text-secondary);
}

/* ---------------------------------------------------
   Rewards List
   --------------------------------------------------- */
.popup2__rewards {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.popup2__reward-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--p2-bg-card-inner);
  border: 1px solid rgba(243, 186, 47, 0.08);
  border-radius: var(--p2-radius-sm);
  text-align: left;
  transition:
    border-color var(--p2-transition),
    background var(--p2-transition),
    box-shadow var(--p2-transition);
}

.popup2__reward-item:hover {
  border-color: rgba(243, 186, 47, 0.2);
  background: rgba(243, 186, 47, 0.04);
  box-shadow: 0 0 20px rgba(243, 186, 47, 0.05);
}

.popup2__reward-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 1.125rem;
  background: linear-gradient(
    135deg,
    rgba(243, 186, 47, 0.15) 0%,
    rgba(243, 186, 47, 0.05) 100%
  );
  border: 1px solid rgba(243, 186, 47, 0.15);
  border-radius: 10px;
}

.popup2__reward-text {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--p2-text-primary);
}

.popup2__reward-text small {
  display: block;
  margin-top: 0.125rem;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--p2-text-muted);
}

/* ---------------------------------------------------
   Disclaimer note (inside popup)
   --------------------------------------------------- */
.popup2__disclaimer {
  margin: 0 0 1rem;
  padding: 0.625rem 0.875rem;
  background: rgba(243, 186, 47, 0.04);
  border: 1px solid rgba(243, 186, 47, 0.08);
  border-radius: 10px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--p2-text-muted);
  text-align: left;
}

/* ---------------------------------------------------
   Message / Body Text
   --------------------------------------------------- */
.popup2__message {
  margin: 0 0 1.25rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.65;
  color: var(--p2-text-secondary);
}

/* ---------------------------------------------------
   Buttons Container
   --------------------------------------------------- */
.popup2__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
}

/* ---------------------------------------------------
   Primary Button — Premium Gold Gradient CTA
   --------------------------------------------------- */
.popup2__btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 1rem 1.75rem;
  border: none;
  border-radius: var(--p2-radius-btn);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--p2-bg-dark);
  cursor: pointer;
  text-decoration: none;
  overflow: hidden;

  /* Premium gold gradient */
  background: linear-gradient(
    135deg,
    var(--p2-gold-light) 0%,
    var(--p2-gold) 35%,
    var(--p2-gold-dark) 100%
  );

  /* Glow effect */
  box-shadow:
    0 0 24px rgba(243, 186, 47, 0.3),
    0 4px 20px rgba(243, 186, 47, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);

  transition:
    transform var(--p2-transition),
    box-shadow var(--p2-transition),
    filter var(--p2-transition);

  animation: p2-btn-glow 3s ease-in-out infinite;
}

@keyframes p2-btn-glow {
  0%, 100% {
    box-shadow:
      0 0 24px rgba(243, 186, 47, 0.3),
      0 4px 20px rgba(243, 186, 47, 0.18),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }
  50% {
    box-shadow:
      0 0 36px rgba(243, 186, 47, 0.4),
      0 6px 28px rgba(243, 186, 47, 0.25),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }
}

/* Shimmer animation overlay */
.popup2__btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    transparent 20%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 80%
  );
  transform: translateX(-100%);
  transition: transform 0.7s ease;
}

.popup2__btn-primary:hover::before,
.popup2__btn-primary:focus-visible::before {
  transform: translateX(100%);
}

.popup2__btn-primary:hover,
.popup2__btn-primary:focus-visible {
  transform: translateY(-2px) scale(1.01);
  box-shadow:
    0 0 40px rgba(243, 186, 47, 0.4),
    0 8px 32px rgba(243, 186, 47, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  filter: brightness(1.1);
}

.popup2__btn-primary:focus-visible {
  outline: 2px solid var(--p2-text-primary);
  outline-offset: 3px;
}

.popup2__btn-primary:active {
  transform: translateY(0) scale(0.98);
  animation: none;
}

/* ---------------------------------------------------
   Secondary Button — Ghost / Outline
   --------------------------------------------------- */
.popup2__btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.8rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--p2-radius-btn);
  background: rgba(255, 255, 255, 0.03);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--p2-text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--p2-transition),
    border-color var(--p2-transition),
    color var(--p2-transition),
    transform var(--p2-transition);
}

.popup2__btn-secondary:hover,
.popup2__btn-secondary:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--p2-text-primary);
  transform: translateY(-1px);
}

.popup2__btn-secondary:focus-visible {
  outline: 2px solid var(--p2-gold);
  outline-offset: 3px;
}

.popup2__btn-secondary:active {
  transform: translateY(0);
}

/* ---------------------------------------------------
   Microcopy
   --------------------------------------------------- */
.popup2__microcopy {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--p2-text-muted);
  letter-spacing: 0.01em;
}

/* ---------------------------------------------------
   Body scroll lock when popup2 is open
   --------------------------------------------------- */
body.popup2-open {
  overflow: hidden;
}

/* ---------------------------------------------------
   Focus trap visual indicator
   --------------------------------------------------- */
.popup2:focus {
  outline: none;
}

/* ---------------------------------------------------
   RESPONSIVE
   --------------------------------------------------- */

/* Small phones (max 380px) */
@media (max-width: 380px) {
  .popup2__inner {
    padding: 1.5rem 1.25rem 1.25rem;
  }

  .popup2__visual {
    width: 130px;
    height: 130px;
    margin-bottom: 1rem;
  }

  .popup2__headline {
    font-size: 1.2rem;
  }

  .popup2__subheadline {
    font-size: 0.8125rem;
  }

  .popup2__reward-item {
    padding: 0.625rem 0.75rem;
  }

  .popup2__reward-text {
    font-size: 0.8125rem;
  }

  .popup2__btn-primary {
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
  }
}

/* Tablets and up (min 600px) */
@media (min-width: 600px) {
  .popup2__inner {
    padding: 2.5rem 2.25rem 2rem;
  }

  .popup2__visual {
    width: 200px;
    height: 200px;
    margin-bottom: 1.5rem;
  }

  .popup2__headline {
    font-size: 1.625rem;
  }

  .popup2__subheadline,
  .popup2__message {
    font-size: 0.9375rem;
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
  }

  .popup2__rewards {
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
  }

  .popup2__actions {
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }

  .popup2__disclaimer {
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Desktop (min 768px) */
@media (min-width: 768px) {
  :root {
    --p2-max-width: 580px;
  }

  .popup2 {
    box-shadow:
      0 0 100px rgba(243, 186, 47, 0.08),
      0 0 50px rgba(243, 186, 47, 0.05),
      0 40px 120px rgba(0, 0, 0, 0.65),
      inset 0 1px 0 rgba(255, 255, 255, 0.07);
  }
}

/* ---------------------------------------------------
   Reduced Motion — respect user preference
   --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .popup2-overlay,
  .popup2,
  .popup2::before,
  .popup2__close,
  .popup2__btn-primary,
  .popup2__btn-secondary,
  .popup2__btn-primary::before,
  .popup2__reward-item,
  .popup2__visual {
    transition: none !important;
    animation: none !important;
  }

  .popup2-overlay--active .popup2 {
    transform: none;
  }

  .popup2__visual::before,
  .popup2__visual::after {
    animation: none !important;
  }
}
