/* Deriv Affiliate Popups - AlgoPipX
   Palette: #FF444F (red), #0B0B0D (dark), #FFFFFF (white), #F5F5F5 (light gray)
*/

:root {
  --deriv-red: #FF444F;
  --deriv-dark: #0B0B0D;
  --deriv-white: #FFFFFF;
  --deriv-light: #F5F5F5;
}

/* Container (fixed, bottom-right on desktop, bottom-center on mobile) */
.apx-popup-stack {
  position: fixed;
  z-index: 9999;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none; /* allow clicks to pass except on card */
}

@media (max-width: 640px) {
  .apx-popup-stack {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 12px;
  }
}

/* Card */
.apx-popup {
  width: min(92vw, 360px);
  background: var(--deriv-white);
  color: var(--deriv-dark);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(11, 11, 13, 0.25);
  border: 1px solid #ececec;
  overflow: hidden;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(12px);
  animation: apx-fade-slide-in 420ms ease forwards;
}

/* Accent top border */
.apx-popup::before {
  content: '';
  display: block;
  height: 3px;
  background: var(--deriv-red);
}

.apx-popup__inner {
  padding: 12px 14px 14px 14px;
}

.apx-popup__headline {
  font-weight: 800;
  font-size: 16px;
  color: var(--deriv-red);
  line-height: 1.25;
}

.apx-popup__body {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--deriv-dark);
}

.apx-popup__cta {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
  color: var(--deriv-white);
  background: var(--deriv-red);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
}

.apx-popup__cta:hover {
  filter: brightness(0.95);
}

.apx-popup__dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid #eee;
  background: var(--deriv-light);
  color: #555;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.apx-popup__dismiss:hover { background: #eee; }

/* Footer row */
.apx-popup__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.apx-popup__brand {
  font-size: 11px;
  color: #666;
}

/* Animations */
@keyframes apx-fade-slide-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes apx-fade-slide-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(12px); }
}

.apx-exiting {
  animation: apx-fade-slide-out 380ms ease forwards;
}
