/**
 * custom_node_modal_promo — styles.
 * Mobile-first avec flexbox.
 */

#cnmp-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  transition: background-color 0.4s ease;
}
#cnmp-overlay.cnmp-open {
  display: flex;
  background-color: rgba(0, 0, 0, 0.7);
}

#cnmp-modal {
  position: relative;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  width: 300px;
  max-width: 300px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translate(0, 0) scale(1);
  transition:
    transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.4s ease;
}

/* ============================================================
   MOBILE — modal ancrée à 120px du haut, ne dépasse pas le bas
   ============================================================ */
@media (max-width: 599px) {
  #cnmp-overlay {
    align-items: flex-start;
    padding-top: 120px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    padding-bottom: 0;
  }
  #cnmp-modal {
    width: 100%;
    max-width: 100%;
    max-height: calc(90vh - 120px);
  }
}

/* ============================================================
   PARAGRAPH — structure interne
   ============================================================ */
.cnmp-paragraph {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ============================================================
   HEADER — accroche + bouton fermeture côte à côte
   ============================================================ */
.cnmp-head {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem 0.75rem 0.5rem 1rem;
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
}

.cnmp-head__top {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.cnmp-fiche {
  align-self: flex-start;
}

.cnmp-accroche__titre {
  flex: 1;
  margin: 0;
  padding: 0;
  letter-spacing: -0.05rem;
  font-weight: 900;
  text-transform: uppercase;
  font-variant: small-caps;
  font-size: clamp(1rem, 4vw, 2.5rem);
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.2;
}

/* ============================================================
   BOUTON FERMETURE — dans .cnmp-head, non absolu
   ============================================================ */
.cnmp-close {
  flex-shrink: 0;
  background: #fff;
  border: 2px solid red;
  color: red;
  border-radius: 4px;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.cnmp-close:hover,
.cnmp-close:focus { background: #fff8f8; outline: 2px solid red; }

/* ============================================================
   BODY WRAP — bandeau + contenu scrollable
   ============================================================ */
.cnmp-body-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ============================================================
   BANDEAU — mobile : icône + texte côte à côte (row)
   ============================================================ */
.cnmp-aside {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  flex-shrink: 0;
}

.cnmp-aside__icon {
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
  background-color: #fff;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.cnmp-aside__label {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
}

/* ============================================================
   COULEURS DU BANDEAU PAR TYPE
   ============================================================ */
.cnmp-paragraph--prix      .cnmp-aside { background: #1a5276; }
.cnmp-paragraph--temps     .cnmp-aside { background: #1e6b3c; }
.cnmp-paragraph--dispo     .cnmp-aside { background: #d06f00; }
.cnmp-paragraph--social    .cnmp-aside { background: #7d3c0a; }
.cnmp-paragraph--incentive .cnmp-aside { background: #154360; }
.cnmp-paragraph--contexte  .cnmp-aside { background: #4a235a; }

/* ============================================================
   ICÔNES SVG PAR TYPE — bandeau
   ============================================================ */
.cnmp-paragraph--prix .cnmp-aside__icon {
  -webkit-mask-image: url("/sites/default/files/media/svg/prix.svg");
  mask-image: url("/sites/default/files/media/svg/prix.svg");
}
.cnmp-paragraph--temps .cnmp-aside__icon {
  -webkit-mask-image: url("/sites/default/files/media/svg/temps.svg");
  mask-image: url("/sites/default/files/media/svg/temps.svg");
}
.cnmp-paragraph--dispo .cnmp-aside__icon {
  -webkit-mask-image: url("/sites/default/files/media/svg/dispo.svg");
  mask-image: url("/sites/default/files/media/svg/dispo.svg");
}
.cnmp-paragraph--social .cnmp-aside__icon {
  -webkit-mask-image: url("/sites/default/files/media/svg/social.svg");
  mask-image: url("/sites/default/files/media/svg/social.svg");
}
.cnmp-paragraph--incentive .cnmp-aside__icon {
  -webkit-mask-image: url("/sites/default/files/media/svg/incentive.svg");
  mask-image: url("/sites/default/files/media/svg/incentive.svg");
}
.cnmp-paragraph--contexte .cnmp-aside__icon {
  -webkit-mask-image: url("/sites/default/files/media/svg/contexte.svg");
  mask-image: url("/sites/default/files/media/svg/contexte.svg");
}

/* ============================================================
   ZONE CONTENU SCROLLABLE
   ============================================================ */
.cnmp-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  position: relative;
}

/* Dégradé bas — signal visuel de scroll */
.cnmp-body::after {
  content: '';
  position: sticky;
  bottom: 0;
  display: block;
  height: 2.5rem;
  flex-shrink: 0;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.85) 60%,
    rgba(255, 255, 255, 1) 100%
  );
  pointer-events: none;
  margin-top: auto;
}

.cnmp-body__accroche { font-size: 1.1rem; font-weight: 600; color: #222; line-height: 1.3; }

.cnmp-body__prix     { display: flex; align-items: baseline; justify-content: center; gap: 0.6rem; flex-wrap: wrap; }
.cnmp-prix-barre     { font-size: 1.2rem; color: #888; text-decoration: line-through; }
.cnmp-prix-remise    { font-size: 1.5rem; font-weight: 700; color: #222; }
.cnmp-prix-pct,
.cnmp-prix-calcule   { padding: 0.2rem 0.5rem; border-radius: 3px; }
.cnmp-prix-pct       { font-size: 2rem; background: rgb(0, 181, 200); color: #fff; }
.cnmp-prix-calcule   { font-size: 1.8rem; font-weight: 700; background: green; color: #fff; }

.cnmp-body__places   { display: flex; align-items: center; background: #424242; padding: 0.5rem; width: fit-content; }
.cnmp-places__nb     { font-size: 2rem; background-color: #519741; width: 105px; height: 50px; border-radius: 50rem; border: 2px solid #fff; font-weight: bold; color: #fff; text-align: center; padding: 0 1rem 0.5rem 0.9rem; }
.cnmp-places__label  { margin: 0 0.35rem; font-size: 1.5rem; color: #fff; }

.cnmp-body__info--1  { font-size: 0.9rem; color: #444; line-height: 1.5; }
.cnmp-body__info--2  { font-size: 0.70rem; color: #444; }

.cnmp-body__periode  { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: #666; flex-wrap: wrap; }
.cnmp-periode__label { font-style: italic; }
.cnmp-periode__date  { font-weight: 600; color: #444; }

/* ============================================================
   CODE PROMO
   ============================================================ */
.cnmp-body__code    { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.cnmp-code__label   { font-size: 0.8rem; color: #666; }
.cnmp-code__value   { font-family: monospace; font-size: 1rem; font-weight: 700; color: #222; letter-spacing: 0.08em; background: #f0f0f0; padding: 0.2rem 0.5rem; border-radius: 3px; }
.cnmp-code__copy    { font-size: 0.72rem; padding: 0.2rem 0.5rem; background: #333; color: #fff; border: none; border-radius: 3px; cursor: pointer; transition: background 0.15s; white-space: nowrap; }
.cnmp-code__copy:hover { background: #111; }
.cnmp-code__copy--done { background: #1e6b3c; }

/* ============================================================
   COUNTDOWN
   ============================================================ */
.cnmp-body__countdown  { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; padding: 0.5rem 0; }
.cnmp-countdown__label { font-size: 0.8rem; color: #666; text-align: center; }
.cnmp-countdown        { display: flex; gap: 0.6rem; align-items: center; justify-content: center; }
.cnmp-countdown__block { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }
.cnmp-countdown__number { display: flex; align-items: center; justify-content: center; background: #111; color: #fff; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; width: 3rem; height: 3rem; border-radius: 4px; line-height: 1; }
.cnmp-countdown__unit  { font-size: 0.6rem; color: #888; letter-spacing: 0.08em; text-transform: uppercase; }
.cnmp-countdown__sep   { display: none; }

/* ============================================================
   FOOTER FIXE
   ============================================================ */
.cnmp-footer {
  flex-shrink: 0;
  border-top: 1px solid #e5e5e5;
  background: #fafafa;
}
.cnmp-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  align-items: center;
  justify-content: center;
}
.cnmp-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border: 2px solid #aaa;
  border-radius: 0;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  background: #e8e8e8;
  color: #444;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  position: relative;
}
.cnmp-toggle:hover { background: #d5d5d5; border-color: #888; }
.cnmp-toggle input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.cnmp-toggle__icon { display: inline-block; width: 1.1rem; height: 1.1rem; flex-shrink: 0; background-color: currentColor; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain; }
.cnmp-toggle--stop .cnmp-toggle__icon { -webkit-mask-image: url("/sites/default/files/media/svg/stop.svg"); mask-image: url("/sites/default/files/media/svg/stop.svg"); }
.cnmp-toggle--loop .cnmp-toggle__icon { -webkit-mask-image: url("/sites/default/files/media/svg/loop.svg"); mask-image: url("/sites/default/files/media/svg/loop.svg"); }
.cnmp-toggle--active { background: #333; color: #fff; border-color: #333; }
.cnmp-toggle--active:hover { background: #222; border-color: #222; }

@media (max-width: 360px) {
  .cnmp-actions { flex-direction: column; align-items: stretch; }
  .cnmp-toggle  { justify-content: center; }
}

/* ============================================================
   FAB
   ============================================================ */
.cnmp-fab { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 999; width: 3rem; height: 3rem; border-radius: 10px; border: 1px solid #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.2); transition: transform 0.2s, opacity 0.2s; }
.cnmp-fab--hidden { opacity: 0; pointer-events: none; transform: scale(0.8); }
.cnmp-fab:hover, .cnmp-fab:focus { filter: brightness(1.15); transform: scale(1.1); outline: none; }
.cnmp-fab__icon { display: inline-block; width: 90%; height: 90%; background-color: #fff; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain; }

.cnmp-fab--prix      { background: #1a5276; }
.cnmp-fab--temps     { background: #1e6b3c; }
.cnmp-fab--dispo     { background: #d06f00; }
.cnmp-fab--social    { background: #7d3c0a; }
.cnmp-fab--incentive { background: #154360; }
.cnmp-fab--contexte  { background: #4a235a; }

.cnmp-fab--prix .cnmp-fab__icon      { -webkit-mask-image: url("/sites/default/files/media/svg/prix.svg");      mask-image: url("/sites/default/files/media/svg/prix.svg"); }
.cnmp-fab--temps .cnmp-fab__icon     { -webkit-mask-image: url("/sites/default/files/media/svg/temps.svg");     mask-image: url("/sites/default/files/media/svg/temps.svg"); }
.cnmp-fab--dispo .cnmp-fab__icon     { -webkit-mask-image: url("/sites/default/files/media/svg/dispo.svg");     mask-image: url("/sites/default/files/media/svg/dispo.svg"); }
.cnmp-fab--social .cnmp-fab__icon    { -webkit-mask-image: url("/sites/default/files/media/svg/social.svg");    mask-image: url("/sites/default/files/media/svg/social.svg"); }
.cnmp-fab--incentive .cnmp-fab__icon { -webkit-mask-image: url("/sites/default/files/media/svg/incentive.svg"); mask-image: url("/sites/default/files/media/svg/incentive.svg"); }
.cnmp-fab--contexte .cnmp-fab__icon  { -webkit-mask-image: url("/sites/default/files/media/svg/contexte.svg");  mask-image: url("/sites/default/files/media/svg/contexte.svg"); }

/* ============================================================
   RESPONSIVE DESKTOP ≥ 600px
   ============================================================ */
@media (min-width: 600px) {
  #cnmp-modal { width: 560px; max-width: 560px; max-height: 88vh; }
  .cnmp-body-wrap { flex-direction: row; }
  .cnmp-aside {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 7rem;
    flex-shrink: 0;
    padding: 1.25rem 0.75rem;
    gap: 0.6rem;
    text-align: center;
  }
  .cnmp-aside__icon  { width: 5rem; height: 5rem; }
  .cnmp-aside__label { font-size: clamp(0.85rem, 4vw, 1.2rem); font-weight: bold; text-align: center; width: 90%; word-break: break-word; hyphens: auto; }
  .cnmp-body { flex: 1; }
}

@media (max-width: 599px) {
  .cnmp-aside__label { font-size: clamp(0.85rem, 5vw, 1.5rem); width: 100%; white-space: nowrap; }
}

/* ============================================================
   MODE TRAVAIL
   ============================================================ */
#cnmp-overlay.cnmp--work #cnmp-modal { border: 5px solid red; }

@media (prefers-reduced-motion: reduce) {
  #cnmp-modal { transition: none; }
  .cnmp-fab   { transition: none; }
}
.cnmp-head .cnmp-fiche {
  display: flex;
  justify-content: center;
  width: 100%;
}

.cnmp-head .cnmp-fiche {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* ============================================================
   FIX iOS — overflow body + footer toujours visible
   ============================================================ */
@media (max-width: 599px) {
  #cnmp-modal {
    height: calc(90vh - 120px);
  }

  .cnmp-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .cnmp-paragraph {
    flex: 1;
    min-height: 0;
  }

  .cnmp-body-wrap {
    flex: 1;
    min-height: 0;
  }

  .cnmp-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .cnmp-footer {
    flex-shrink: 0;
  }
}
