/*
 * ep-alert-popup.css — EdgePath Global Success/Error Popup Alerts
 * Minimalist dark green (#064E3B) & white palette.
 * Centered, animated popup cards. Fully responsive: mobile, tablet,
 * desktop and every size in between — the card never touches the
 * screen edges. Loaded site-wide from includes/header.php and
 * admin/includes/header.php. Driven by assets/js/ep-alert-popup.js
 * via the global window.EPAlert API.
 */

:root {
  --epa-green:        #3C2080;
  --epa-green-mid:     #4D2EB3;
  --epa-green-light:   #6650C0;
  --epa-green-soft:    rgba(60, 32, 128, 0.10);
  --epa-green-ring:    rgba(102, 80, 192, 0.20);
  --epa-white:         #ffffff;
  --epa-ink:           #180838;
  --epa-muted:         #6b7280;
  --epa-backdrop:      rgba(24, 8, 56, 0.66);
  --epa-shadow:        0 32px 80px -20px rgba(24, 8, 56, 0.45), 0 10px 28px -10px rgba(0,0,0,0.20);
  --epa-radius:        clamp(16px, 3vw, 22px);
  --epa-ease:          cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Overlay ────────────────────────────────────────────────────────────
   Safe padding on every axis keeps the card off the edges on any
   viewport — phones, foldables, tablets, ultrawide desktops, etc. */
.epa-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 6vw, 48px);
  padding-top: calc(clamp(16px, 6vw, 48px) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(clamp(16px, 6vw, 48px) + env(safe-area-inset-bottom, 0px));
  background: var(--epa-backdrop);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  animation: epa-backdrop-in 0.28s var(--epa-ease) forwards;
}

.epa-overlay.epa-closing {
  animation: epa-backdrop-out 0.22s var(--epa-ease) forwards;
}

@keyframes epa-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes epa-backdrop-out { from { opacity: 1; } to { opacity: 0; } }

/* ─── Card ───────────────────────────────────────────────────────────── */
.epa-card {
  position: relative;
  width: 100%;
  max-width: clamp(300px, 90vw, 400px);
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--epa-white);
  border: 1px solid var(--epa-green-ring);
  border-radius: var(--epa-radius);
  box-shadow: var(--epa-shadow);
  padding: clamp(28px, 6vw, 40px) clamp(22px, 6vw, 32px) clamp(22px, 5vw, 28px);
  text-align: center;
  transform: translateY(18px) scale(0.94);
  opacity: 0;
  animation: epa-card-in 0.4s var(--epa-ease) 0.05s forwards;
}

.epa-overlay.epa-closing .epa-card {
  animation: epa-card-out 0.2s var(--epa-ease) forwards;
}

@keyframes epa-card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes epa-card-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(10px) scale(0.96); }
}

/* ─── Dismiss (x) ────────────────────────────────────────────────────── */
.epa-dismiss {
  position: absolute;
  top: clamp(10px, 2.5vw, 14px);
  right: clamp(10px, 2.5vw, 14px);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 999px;
  background: var(--epa-green-soft);
  color: var(--epa-green);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.epa-dismiss:hover { background: var(--epa-green-ring); transform: rotate(90deg); }
.epa-dismiss svg { width: 15px; height: 15px; }

/* ─── Icon badge ─────────────────────────────────────────────────────── */
.epa-icon-wrap {
  position: relative;
  width: clamp(56px, 14vw, 68px);
  height: clamp(56px, 14vw, 68px);
  margin: 0 auto clamp(16px, 4vw, 20px);
  display: grid;
  place-items: center;
}

.epa-icon-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  animation: epa-ring-pulse 1.6s var(--epa-ease) 0.15s infinite;
}

.epa-icon-circle {
  position: relative;
  width: 72%;
  height: 72%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transform: scale(0.6);
  opacity: 0;
  animation: epa-icon-pop 0.45s var(--epa-ease) 0.18s forwards;
}

.epa-icon-circle svg {
  width: 46%;
  height: 46%;
  stroke-width: 3;
}

@keyframes epa-icon-pop {
  0%   { opacity: 0; transform: scale(0.5); }
  70%  { opacity: 1; transform: scale(1.12); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes epa-ring-pulse {
  0%   { box-shadow: 0 0 0 0 var(--epa-green-ring); }
  100% { box-shadow: 0 0 0 14px rgba(6, 78, 59, 0); }
}

/* Success: solid dark-green fill, white check */
.epa-card.epa-success .epa-icon-circle {
  background: linear-gradient(135deg, var(--epa-green) 0%, var(--epa-green-mid) 100%);
  color: var(--epa-white);
}

/* Error: white fill, dark-green ring + icon — same palette, distinct shape */
.epa-card.epa-error .epa-icon-circle {
  background: var(--epa-white);
  color: var(--epa-green);
  border: 2.5px solid var(--epa-green);
}

/* ─── Copy ───────────────────────────────────────────────────────────── */
.epa-title {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--epa-ink);
  font-size: clamp(1.05rem, 4vw, 1.3rem);
  letter-spacing: -0.01em;
}

.epa-message {
  margin: 0 auto clamp(20px, 5vw, 26px);
  color: var(--epa-muted);
  font-size: clamp(0.86rem, 3vw, 0.95rem);
  line-height: 1.55;
  max-width: 34ch;
}

/* ─── Action button ──────────────────────────────────────────────────── */
.epa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: none;
  cursor: pointer;
  border-radius: 12px;
  padding: clamp(11px, 3vw, 13px) 18px;
  font-size: clamp(0.88rem, 3vw, 0.95rem);
  font-weight: 700;
  transition: box-shadow 0.25s, transform 0.25s var(--epa-ease), background 0.2s;
}

.epa-card.epa-success .epa-btn {
  background: linear-gradient(135deg, var(--epa-green) 0%, var(--epa-green-mid) 100%);
  color: var(--epa-white);
  box-shadow: 0 8px 22px rgba(6, 78, 59, 0.32);
}
.epa-card.epa-success .epa-btn:hover { box-shadow: 0 12px 28px rgba(6, 78, 59, 0.42); transform: translateY(-1px); }

.epa-card.epa-error .epa-btn {
  background: var(--epa-white);
  color: var(--epa-green);
  border: 1.5px solid var(--epa-green);
}
.epa-card.epa-error .epa-btn:hover { background: var(--epa-green-soft); transform: translateY(-1px); }

.epa-btn:active { transform: translateY(0); }

/* ─── Auto-dismiss progress bar (success only, optional) ────────────── */
.epa-progress {
  position: absolute;
  left: 0; bottom: 0;
  height: 3px;
  width: 100%;
  background: var(--epa-green-soft);
  border-radius: 0 0 var(--epa-radius) var(--epa-radius);
  overflow: hidden;
}
.epa-progress > span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--epa-green-mid);
  transform-origin: left;
  animation-name: epa-progress-shrink;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes epa-progress-shrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ─── Small-phone safety net ─────────────────────────────────────────── */
@media (max-width: 360px) {
  .epa-overlay { padding: 14px; }
  .epa-card { border-radius: 16px; }
}

/* Large / desktop: keep the card from feeling lost on huge screens */
@media (min-width: 1440px) {
  .epa-card { max-width: 420px; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .epa-overlay, .epa-card, .epa-icon-circle, .epa-icon-ring, .epa-progress > span {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
