/**
 * Express Entry Hub - Form Guardian (next-gen: never lose a half-filled form)
 *
 * Styles the leave-warning modal and the draft-resume banner that protect the
 * assessment questionnaire. Uses the plugin's Gold Series design tokens
 * (--gold-gradient, --color-primary, --spacing-*) so it inherits whatever
 * palette the admin selected in Tools -> Plugin Color Theme.
 *
 * @package ExpressEntryHub
 * @since 2.2.0
 */

/* ========================================================================
   OVERLAY + CONFIRM CARD ("you are about to leave your assessment")
   ======================================================================== */

.eeh-fg-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000; /* above the orb (which sits at ~999999) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md, 16px);
  background: rgba(28, 18, 10, 0.62);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: eehFgFade 0.18s ease-out;
}

.eeh-fg-card {
  width: 100%;
  max-width: 460px;
  box-sizing: border-box;
  padding: var(--spacing-lg, 24px);
  border: 2px solid transparent;
  border-radius: 18px;
  background:
    linear-gradient(#fffdfa, #fdf7f0) padding-box,
    var(--gold-gradient, linear-gradient(135deg, #c2714a 0%, #d4845c 50%, #e09a72 100%)) border-box;
  box-shadow: 0 22px 60px rgba(60, 35, 15, 0.38);
  text-align: center;
  animation: eehFgRise 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.eeh-fg-icon {
  font-size: 30px;
  line-height: 1;
  margin-bottom: var(--spacing-sm, 8px);
}

.eeh-fg-title {
  margin: 0 0 var(--spacing-sm, 8px);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-primary, #8b4513);
}

.eeh-fg-text {
  margin: 0 0 var(--spacing-sm, 8px);
  font-size: 0.95rem;
  line-height: 1.55;
  color: #3d2b1f;
}

.eeh-fg-text strong {
  color: var(--color-primary, #8b4513);
}

.eeh-fg-hint {
  margin: 0 0 var(--spacing-md, 16px);
  font-size: 0.82rem;
  line-height: 1.5;
  font-style: italic;
  color: #7a6a5c;
}

.eeh-fg-actions {
  display: flex;
  gap: var(--spacing-sm, 8px);
  justify-content: center;
  flex-wrap: wrap;
}

.eeh-fg-btn {
  flex: 1 1 auto;
  min-width: 150px;
  padding: 11px 16px;
  border: 0;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.eeh-fg-btn:focus-visible {
  outline: 2px solid var(--color-primary, #8b4513);
  outline-offset: 2px;
}

/* "Stay" is the safe, primary action — gold gradient, visual weight. */
.eeh-fg-stay {
  color: #fff;
  background: var(--gold-gradient, linear-gradient(135deg, #c2714a 0%, #d4845c 50%, #e09a72 100%));
  box-shadow: 0 4px 14px rgba(139, 69, 19, 0.32);
}

/* "Leave anyway" is deliberately quieter — the visitor must mean it. */
.eeh-fg-go {
  color: #6b5a4d;
  background: #f1e8df;
}

.eeh-fg-go:hover,
.eeh-fg-go:focus-visible {
  color: #8b2f14;
  background: #f7e2da;
}

.eeh-fg-btn:hover {
  transform: translateY(-1px);
}

/* ========================================================================
   DRAFT-RESUME BANNER ("you have unsaved answers from your last visit")
   ======================================================================== */

.eeh-fg-resume {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm, 8px);
  flex-wrap: wrap;
  margin: 0 0 var(--spacing-md, 16px);
  padding: 12px 14px;
  border: 1px solid rgba(194, 113, 74, 0.35);
  border-left: 4px solid var(--color-primary, #8b4513);
  border-radius: 10px;
  background: rgba(224, 154, 114, 0.12);
  font-size: 0.89rem;
  line-height: 1.45;
  color: #3d2b1f;
}

.eeh-fg-resume-icon {
  font-size: 18px;
  line-height: 1;
}

.eeh-fg-resume-text {
  flex: 1 1 200px;
}

.eeh-fg-resume .eeh-fg-btn {
  flex: 0 0 auto;
  min-width: 0;
  padding: 8px 14px;
  font-size: 0.83rem;
}

.eeh-fg-resume-yes {
  color: #fff;
  background: var(--gold-gradient, linear-gradient(135deg, #c2714a 0%, #d4845c 50%, #e09a72 100%));
}

.eeh-fg-resume-no {
  color: #6b5a4d;
  background: #f1e8df;
}

/* ========================================================================
   ORB AWARENESS: the orb glows amber while a form is at risk
   ======================================================================== */

#eeh-avp-orb.eeh-avp-form-guard {
  box-shadow: 0 6px 22px rgba(214, 137, 16, 0.55), inset 0 0 0 2px rgba(255, 214, 140, 0.55);
}

#eeh-avp-orb.eeh-avp-form-guard .eeh-avp-ring {
  animation: eehFgOrbPing 2.2s ease-out infinite;
}

@keyframes eehFgFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes eehFgRise {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes eehFgOrbPing {
  0% { transform: scale(0.9); opacity: 0.85; }
  70% { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* Mobile: stack the actions so neither button is ever a tiny tap target. */
@media (max-width: 520px) {
  .eeh-fg-actions {
    flex-direction: column;
  }

  .eeh-fg-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .eeh-fg-overlay,
  .eeh-fg-card,
  #eeh-avp-orb.eeh-avp-form-guard .eeh-avp-ring {
    animation: none;
  }

  .eeh-fg-btn:hover {
    transform: none;
  }
}
