/* ========== AUDIT POPUP ==========
   Refonte 2026-06-02: bottom-right slide-in → centered modal.
   Reason: Sleeknote benchmark 677M impressions — centered modal 4.68% CVR
   vs slide-in 2.85% (-39%). Detail: docs/research/2026-06-02-exit-intent-popup-timing-bench.md
   Palette aligned with landing (cream / ink / terracotta-dark / terracotta-deep). */

:root {
  --popup-cream:           #fbf8f4;
  --popup-cream-dark:      #f2ebe1;
  --popup-ink:             #1a0f08;
  --popup-ink-light:       #6b5848;
  --popup-terracotta:      #c67b4f;
  --popup-terracotta-deep: #a85b32;
  --popup-border:          rgba(26, 15, 8, 0.12);
  --popup-error:           #c0392b;
}

#auditPopup {
  /* Native dialog reset */
  border: none;
  padding: 0;
  background: var(--popup-cream);
  color: var(--popup-ink);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(26, 15, 8, 0.28), 0 4px 16px rgba(26, 15, 8, 0.12);

  /* Centered modal */
  max-width: 460px;
  width: 92vw;
  max-height: 92vh;
  margin: auto;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;

  /* Entry animation */
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  animation: auditPopupIn 0.3s ease-out forwards;
}

#auditPopup[open] {
  display: block;
}

#auditPopup::backdrop {
  background: rgba(26, 15, 8, 0);
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
  animation: auditBackdropIn 0.3s ease-out forwards;
}

@keyframes auditPopupIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes auditBackdropIn {
  to {
    background: rgba(26, 15, 8, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
  }
}

/* Popup container */
.audit-popup-content {
  padding: 32px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Close button (≥40px tap target, visible top-right per NN/g) */
#auditPopupClose {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--popup-ink-light);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: color 0.2s, background 0.2s;
  z-index: 1;
}

#auditPopupClose:hover {
  color: var(--popup-ink);
  background: rgba(26, 15, 8, 0.06);
}

/* Heading */
.audit-popup-heading {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 500;
  font-size: 1.45rem;
  color: var(--popup-ink);
  line-height: 1.2;
  margin: 4px 36px 0 0;
  letter-spacing: -0.3px;
}

.audit-popup-subheading {
  font-size: 0.92rem;
  color: var(--popup-ink-light);
  line-height: 1.5;
  margin: 6px 0 0;
}

/* Form */
#auditPopupForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.audit-popup-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audit-popup-form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--popup-ink);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.audit-popup-form-input,
.audit-popup-form-select {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1.5px solid var(--popup-border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--popup-ink);
  background: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.audit-popup-form-input:focus,
.audit-popup-form-select:focus {
  outline: none;
  border-color: var(--popup-terracotta);
  box-shadow: 0 0 0 3px rgba(168, 91, 50, 0.15);
}

.audit-popup-form-select {
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b5848' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.audit-popup-form-input::placeholder {
  color: var(--popup-ink-light);
}

/* Submit */
.audit-popup-submit {
  padding: 14px 24px;
  background: var(--popup-terracotta);
  color: var(--popup-cream);
  border: none;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  font-family: inherit;
  margin-top: 6px;
  letter-spacing: 0.1px;
  box-shadow: 0 4px 14px rgba(168, 91, 50, 0.25);
}

.audit-popup-submit:hover {
  background: var(--popup-terracotta-deep);
  box-shadow: 0 6px 18px rgba(168, 91, 50, 0.32);
}

.audit-popup-submit:active {
  transform: scale(0.98);
}

.audit-popup-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* Inline error */
.audit-popup-error {
  font-size: 0.85rem;
  color: var(--popup-error);
  text-align: center;
  margin-top: 4px;
  display: none;
}

/* RGPD mention — Art.7.1 consent notice (P0-C) */
.audit-popup-rgpd-mention {
  font-size: 0.72rem;
  color: var(--popup-ink-light);
  margin: 8px 0 0;
  line-height: 1.5;
  text-align: center;
}

.audit-popup-rgpd-mention a {
  color: var(--popup-terracotta);
  text-decoration: underline;
}

/* Trust signal */
.audit-popup-trust {
  font-size: 0.75rem;
  color: var(--popup-ink-light);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 2px 0 0;
}

.audit-popup-trust svg {
  width: 14px;
  height: 14px;
  color: var(--popup-terracotta);
}

/* Responsive */
@media (max-width: 480px) {
  .audit-popup-content {
    padding: 28px 22px 22px;
  }

  .audit-popup-heading {
    font-size: 1.3rem;
  }
}
