/* Newsletter / Bons plans module (standalone)
   Include this file ONLY on pages where you include newsletter_module.html
*/

:root{
  --nl-bg: #ffffff;
  --nl-text: #111111;
  --nl-muted: rgba(17,17,17,.72);
  --nl-overlay: rgba(0,0,0,.38);
  --nl-border: rgba(17,17,17,.14);
  --nl-shadow: 0 18px 45px rgba(0,0,0,.22);
  --nl-radius: 16px;

  /* animation */
  --nl-anim: 280ms;
  --nl-ease: cubic-bezier(.2,.9,.2,1);
}

html.nl-lock,
html.nl-lock body{
  overflow: hidden;
}

/* Overlay */
.nl-overlay{
  position: fixed;
  inset: 0;
  background: var(--nl-overlay);
  display: grid;
  align-items: end; /* mobile: bottom sheet */
  justify-items: stretch;
  z-index: 9999;
  padding: 12px;
  padding-bottom:0;

  /* hidden by default (animatable) */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--nl-anim) var(--nl-ease),
    visibility 0s linear var(--nl-anim);
}

.nl-overlay.is-hidden{
  /* kept for backward-compat; same effect as default hidden state */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.nl-overlay.is-open{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity var(--nl-anim) var(--nl-ease),
    visibility 0s;
}

/* Panel */
.nl-panel{
  background: var(--nl-bg);
  color: var(--nl-text);
  border-radius: var(--nl-radius) var(--nl-radius) 0 0;
  box-shadow: var(--nl-shadow);
  padding: 18px 16px 16px;
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;

  /* slide-up animation (mobile) */
  transform: translateY(110%);
  transition: transform var(--nl-anim) var(--nl-ease);
  will-change: transform;
}

.nl-overlay.is-open .nl-panel{
  transform: translateY(0);
}

@media (min-width: 900px){
  .nl-overlay{
    align-items: center;
    justify-items: center;
  }
  .nl-panel{
    border-radius: var(--nl-radius);
    width: min(520px, calc(100% - 24px));
    padding: 20px 18px 18px;

    /* desktop: subtle pop-in instead of big slide */
    transform: translateY(10px) scale(.98);
    transition:
      transform var(--nl-anim) var(--nl-ease),
      opacity var(--nl-anim) var(--nl-ease);
    opacity: 0.98;
  }
  .nl-overlay.is-open .nl-panel{
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .nl-overlay,
  .nl-panel{
    transition: none !important;
  }
}

/* Close button */
.nl-close{
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--nl-text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.nl-close:hover{
  background: rgba(17,17,17,.06);
}

/* Text */
.nl-title{
  margin: 0 42px 6px 0;
  font-size: 18px;
  font-weight: 700;
}

.nl-text{
  margin: 0 0 12px 0;
  color: var(--nl-muted);
  font-size: 14px;
  line-height: 1.35;
}

/* Inline form: input + button on same line, button glued to the right */
.nl-form{
  display: flex;
  align-items: stretch;
  width: 100%;
  margin-top: 10px;
}

.nl-form input[type="email"]{
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--nl-border);
  border-right: 0;               /* glued */
  border-radius: 12px 0 0 12px;  /* left only */
  outline: none;
  font-size: 14px;
  background: #fff;
  color: var(--nl-text);
}

.nl-form input[type="email"]::placeholder{
  color: rgba(17,17,17,.45);
}

.nl-form input[type="email"]:focus{
  border-color: rgba(17,17,17,.35);
}

.nl-submit{
  height: 44px;
  padding: 0 16px;               /* small width */
  border: 1px solid var(--nl-border);
  border-radius: 0 12px 12px 0;  /* right only */
  background: #111;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  min-width: 56px;
}

.nl-submit:hover{
  filter: brightness(1.08);
}

.nl-submit:disabled{
  opacity: .75;
  cursor: default;
}

/* Footnote */
.nl-footnote{
  margin: 10px 0 0 0;
  color: rgba(17,17,17,.55);
  font-size: 12px;
}

/* Accessible hidden label */
.sr-only{
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}


/* Feedback commun : popup et futurs formulaires latéraux */
[data-newsletter-feedback][hidden] { display: none !important; }
[data-newsletter-feedback]:not([hidden]) {
  display: block;
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid #d5d9de;
  border-radius: 10px;
  background: #f5f6f7;
  color: #414851;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  overflow-wrap: anywhere;
}
[data-newsletter-feedback][data-state="success"] {
  background: #eaf7ed;
  border-color: #b6dfbf;
  color: #216b35;
}
[data-newsletter-feedback][data-state="success"]::before {
  content: "✓";
  font-weight: 700;
  margin-right: 6px;
}
[data-newsletter-feedback][data-state="error"] {
  background: #fef0ef;
  border-color: #efb8b5;
  color: #992a25;
}
