/**
 * Menu principal Simple CRM 2026 — design moderne (sans plugin mega-menu legacy).
 * Version corrigée :
 * - desktop : fond transparent uniquement avant scroll
 * - desktop sticky : fond blanc + topbar masquée
 * - mobile/tablette : fond blanc permanent + topbar masquée
 */

/* Variables aussi posées au niveau header/body car certaines règles les utilisent hors .scrm-mega-nav. */
:root {
  --scrm-nav-h: 72px;
  --scrm-nav-bg: #fff;
  --scrm-nav-text: #091337;
  --scrm-nav-accent: #e31d24;
  --scrm-nav-muted: #5c6578;
  --scrm-nav-border: #e8ecf2;
  --scrm-nav-shadow: 0 4px 24px rgba(9, 19, 55, 0.1);
}

/* Base header : on neutralise les règles legacy type header{position:absolute;background:#222}. */
header.scrm-header-2026 {
  display: block !important;
  width: 100%;
  z-index: 1040;
}

/* =========================================================
   DESKTOP >= 1024px
   ========================================================= */
@media screen and (min-width: 1024px) {
  /* Avant scroll : header superposé au hero, transparent. */
  body:not(.scrm-mega-nav-sticky) > header.scrm-header-2026 {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    background: transparent !important;
    box-shadow: none !important;
  }

  body:not(.scrm-mega-nav-sticky) > header.scrm-header-2026 .scrm-mega-nav,
  body:not(.scrm-mega-nav-sticky) > header.scrm-header-2026 .scrm-mega-bar,
  body:not(.scrm-mega-nav-sticky) > header.scrm-header-2026 .scrm-mega-drawer {
    background: transparent !important;
  }

  /* Après scroll : header compact fixe, blanc. */
  body.scrm-mega-nav-sticky > header.scrm-header-2026,
  html.scrm-has-scrolled body > header.scrm-header-2026 {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    background: #fff !important;
    box-shadow: var(--scrm-nav-shadow) !important;
  }

  body.scrm-mega-nav-sticky > header.scrm-header-2026 .scrm-mega-nav,
  body.scrm-mega-nav-sticky > header.scrm-header-2026 .scrm-mega-bar,
  body.scrm-mega-nav-sticky > header.scrm-header-2026 .scrm-mega-drawer,
  html.scrm-has-scrolled body > header.scrm-header-2026 .scrm-mega-nav,
  html.scrm-has-scrolled body > header.scrm-header-2026 .scrm-mega-bar,
  html.scrm-has-scrolled body > header.scrm-header-2026 .scrm-mega-drawer {
    background: #fff !important;
  }

  /* La topbar est visible uniquement tout en haut de page. */
  body.scrm-mega-nav-sticky > header.scrm-header-2026 .topbar,
  html.scrm-has-scrolled body > header.scrm-header-2026 .topbar,
  header.scrm-header-2026:has(.scrm-mega-nav.is-sticky) .topbar {
    display: none !important;
  }

  body.scrm-mega-nav-sticky {
    padding-top: var(--scrm-nav-h);
  }
}

/* =========================================================
   MOBILE / TABLETTE <= 1023px
   ========================================================= */
@media screen and (max-width: 1023px) {
  /* Sur mobile, le menu ne doit jamais être transparent : lisibilité prioritaire. */
  header.scrm-header-2026,
  body:not(.scrm-mega-nav-sticky) > header.scrm-header-2026,
  body.scrm-mega-nav-sticky > header.scrm-header-2026,
  html.scrm-has-scrolled body > header.scrm-header-2026 {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    background: #fff !important;
    box-shadow: var(--scrm-nav-shadow) !important;
    z-index: 1040 !important;
  }

  header.scrm-header-2026 .scrm-mega-nav,
  header.scrm-header-2026 .scrm-mega-bar,
  header.scrm-header-2026 .scrm-mega-drawer,
  body:not(.scrm-mega-nav-sticky) > header.scrm-header-2026 .scrm-mega-nav,
  body:not(.scrm-mega-nav-sticky) > header.scrm-header-2026 .scrm-mega-bar,
  body:not(.scrm-mega-nav-sticky) > header.scrm-header-2026 .scrm-mega-drawer {
    background: #fff !important;
  }

  /* La topbar consomme trop de place sur mobile et rend le header illisible. */
  header.scrm-header-2026 .topbar {
    display: none !important;
  }

  body {
    padding-top: var(--scrm-nav-h);
  }
}

/* Si le JS met .is-sticky directement sur la nav, on empêche le double fixed dans le header. */
body.scrm-mega-nav-sticky > header.scrm-header-2026 .scrm-mega-nav.is-sticky {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  box-shadow: none !important;
}

.scrm-mega-nav {
  --scrm-nav-h: 72px;
  --scrm-nav-bg: #fff;
  --scrm-nav-text: #091337;
  --scrm-nav-accent: #e31d24;
  --scrm-nav-muted: #5c6578;
  --scrm-nav-border: #e8ecf2;
  --scrm-nav-shadow: 0 4px 24px rgba(9, 19, 55, 0.1);
  font-family: "Poppins", "Open Sans", sans-serif;
  position: relative;
  z-index: 1040;
}

.scrm-mega-nav.is-sticky {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--scrm-nav-bg) !important;
  box-shadow: var(--scrm-nav-shadow);
}

.scrm-mega-nav.is-sticky .scrm-mega-bar,
.scrm-mega-nav.is-sticky .scrm-mega-drawer {
  background: #fff !important;
}

.scrm-mega-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 20px;
  min-height: var(--scrm-nav-h);
}

.scrm-mega-cta.btn-secondary-2023 {
  flex: 0 0 auto;
  top: 0 !important;
  margin: 0 !important;
  white-space: nowrap;
  font-size: 14px !important;
  line-height: 1.35 !important;
  padding: 10px 18px !important;
}

.scrm-mega-cta .text-short {
  display: none;
}

.scrm-mega-drawer {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.scrm-mega-top {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.scrm-mega-item {
  position: relative;
  list-style: none;
}

@media (min-width: 1024px) {
  /* Panneaux centrés sous la barre (évite coupure à gauche sur CRM, etc.) */
  .scrm-mega-item.has-panel {
    position: static;
  }
}

.scrm-mega-toplink {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 10px 11px;
  color: var(--scrm-nav-text) !important;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  text-decoration: none !important;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

/* Garder les CTA plus compacts que le menu principal */
.scrm-mega-cta.btn-secondary-2023,
.scrm-mega-item.is-demo > .scrm-mega-toplink {
  font-size: 14px !important;
}

.scrm-mega-toplink .fa {
  font-size: 11px;
  opacity: 0.7;
}

.scrm-mega-item:hover > .scrm-mega-toplink,
.scrm-mega-item:focus-within > .scrm-mega-toplink {
  color: var(--scrm-nav-accent) !important;
  background: rgba(227, 29, 36, 0.06);
}

.scrm-mega-item.is-demo > .scrm-mega-toplink {
  border: 2px solid var(--scrm-nav-accent);
  border-radius: 999px;
  color: var(--scrm-nav-accent) !important;
  padding: 7px 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.scrm-mega-item.is-demo:hover > .scrm-mega-toplink {
  background: var(--scrm-nav-accent) !important;
  color: #fff !important;
}

/* Panneaux mega-menu — positionnement desktop uniquement (évite décalage translate(-50%) en vue étroite) */
@media (min-width: 1024px) {
  .scrm-mega-panel {
    position: absolute;
    top: 100%;
    left: 50%;
    right: auto;
    width: min(880px, calc(100vw - 32px));
    min-width: 0;
    max-width: min(880px, calc(100vw - 32px));
    max-height: calc(100vh - var(--scrm-nav-h) - 28px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 20px 22px;
    margin-top: 0;
    background: #fff;
    border: 1px solid var(--scrm-nav-border);
    border-radius: 12px;
    box-shadow: var(--scrm-nav-shadow);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, 10px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    text-align: left;
    z-index: 1050;
  }

  /* Pont invisible lien → panneau (évite fermeture dans le vide) */
  .scrm-mega-panel::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -14px;
    height: 14px;
  }

  .scrm-mega-item.has-panel.is-panel-open > .scrm-mega-panel,
  .scrm-mega-item.has-panel:hover > .scrm-mega-panel,
  .scrm-mega-item.has-panel:focus-within > .scrm-mega-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0);
  }

  .scrm-mega-item.has-panel.is-panel-open > .scrm-mega-toplink {
    color: var(--scrm-nav-accent) !important;
    background: rgba(227, 29, 36, 0.06);
  }

  .scrm-mega-panel--wide {
    width: min(1040px, calc(100vw - 32px));
    max-width: min(1040px, calc(100vw - 32px));
  }
}

/* Panneau type Solutions : catalogue à gauche + familles à droite */
.scrm-mega-layout {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

.scrm-mega-layout-feature {
  flex: 0 0 42%;
  max-width: 380px;
  padding-right: 22px;
  margin-right: 22px;
  border-right: 1px solid var(--scrm-nav-border);
}

.scrm-mega-layout-aside {
  flex: 1 1 auto;
  min-width: 0;
}

.scrm-mega-quicklinks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin: 0 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--scrm-nav-border);
}

.scrm-mega-quicklink {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--scrm-nav-text) !important;
  text-decoration: none !important;
  background: #f4f6fa;
  border-radius: 8px;
  border: 1px solid var(--scrm-nav-border);
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.scrm-mega-quicklink:hover {
  color: var(--scrm-nav-accent) !important;
  border-color: rgba(227, 29, 36, 0.35);
  background: #fff;
}

.scrm-mega-aside-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 28px;
  align-items: start;
}

.scrm-mega-col--feature .scrm-mega-col-title {
  font-size: 14px;
  margin-bottom: 12px;
}

.scrm-mega-col--feature .scrm-mega-col-links a {
  font-size: 13px;
  padding: 5px 0;
}

/* Panneaux sans layout split : empilement mobile, grille desktop (pas de column-count) */
.scrm-mega-cols--flow {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.scrm-mega-cols--flow .scrm-mega-col {
  display: block;
  width: 100%;
  margin-bottom: 0;
}

@media (min-width: 1024px) {
  .scrm-mega-cols--flow {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px 28px;
    align-items: start;
  }
}

@media (max-width: 1100px) {
  .scrm-mega-layout {
    flex-direction: column;
  }

  .scrm-mega-layout-feature {
    flex: none;
    max-width: none;
    padding-right: 0;
    margin-right: 0;
    border-right: none;
    border-bottom: 1px solid var(--scrm-nav-border);
    padding-bottom: 16px;
    margin-bottom: 16px;
  }

  .scrm-mega-aside-grid {
    grid-template-columns: 1fr;
  }
}

.scrm-mega-cols {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px 24px;
  align-items: start;
}

.scrm-mega-col-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--scrm-nav-text);
  margin: 0 0 10px;
  text-decoration: none !important;
}

a.scrm-mega-col-title:hover {
  color: var(--scrm-nav-accent);
}

.scrm-mega-col-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.scrm-mega-col-links a {
  display: block;
  padding: 6px 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--scrm-nav-muted) !important;
  text-decoration: none !important;
  transition: color 0.12s ease;
}

.scrm-mega-col-links a:hover {
  color: var(--scrm-nav-accent) !important;
}

.scrm-mega-col-links .fa-angle-right {
  float: right;
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.5;
}

.scrm-mega-col-links li.has-flyout {
  position: relative;
}

.scrm-mega-flyout {
  position: absolute;
  left: 100%;
  top: 0;
  min-width: 240px;
  padding: 12px 14px;
  margin-left: 8px;
  background: #fff;
  border: 1px solid var(--scrm-nav-border);
  border-radius: 10px;
  box-shadow: var(--scrm-nav-shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s;
  z-index: 2;
}

.scrm-mega-col-links li.has-flyout:hover > .scrm-mega-flyout,
.scrm-mega-col-links li.has-flyout:focus-within > .scrm-mega-flyout {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.scrm-mega-flyout ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.scrm-mega-flyout a {
  display: block;
  padding: 7px 0;
  font-size: 13px;
  color: var(--scrm-nav-muted) !important;
  text-decoration: none !important;
}

.scrm-mega-flyout a:hover {
  color: var(--scrm-nav-accent) !important;
}

.scrm-mega-simple {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 24px;
}

.scrm-mega-simple a {
  display: block;
  padding: 6px 0;
  font-size: 14px;
  color: var(--scrm-nav-muted) !important;
  text-decoration: none !important;
}

.scrm-mega-simple a:hover {
  color: var(--scrm-nav-accent) !important;
}

/* Partage social */
.scrm-mega-share {
  position: relative;
  flex: 0 0 auto;
  margin-left: 4px;
}

.scrm-mega-share-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--scrm-nav-text);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.15s ease;
}

.scrm-mega-share-btn:hover,
.scrm-mega-share-btn[aria-expanded="true"] {
  background: var(--scrm-nav-accent);
}

.scrm-mega-share-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--scrm-nav-border);
  border-radius: 999px;
  box-shadow: var(--scrm-nav-shadow);
  z-index: 5;
}

.scrm-mega-share-panel a {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--scrm-nav-text) !important;
  text-decoration: none !important;
  transition: color 0.12s ease, background 0.12s ease;
}

.scrm-mega-share-panel a:hover {
  color: var(--scrm-nav-accent) !important;
  background: rgba(227, 29, 36, 0.08);
}

.scrm-mega-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--scrm-nav-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.scrm-mega-burger span {
  display: block;
  height: 2px;
  background: var(--scrm-nav-text);
  border-radius: 1px;
}

body.scrm-mega-nav-sticky {
  padding-top: 0;
}

@media (min-width: 1024px) {
  body.scrm-mega-nav-sticky {
    padding-top: var(--scrm-nav-h);
  }
}

@media (max-width: 1199px) {
  .scrm-mega-cta .text-long {
    display: none;
  }

  .scrm-mega-cta .text-short {
    display: inline;
  }

  .scrm-mega-toplink {
    font-size: 13px;
    padding: 10px 8px;
  }
}

@media (max-width: 1023px) {
  .scrm-mega-burger {
    display: inline-flex;
    margin-left: auto;
  }

  .scrm-mega-drawer {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    max-height: calc(100vh - var(--scrm-nav-h));
    max-height: calc(100dvh - var(--scrm-nav-h));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid var(--scrm-nav-border);
    box-shadow: var(--scrm-nav-shadow);
  }

  .scrm-mega-drawer.is-open {
    display: flex;
  }

  .scrm-mega-top {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .scrm-mega-item {
    border-bottom: 1px solid var(--scrm-nav-border);
  }

  .scrm-mega-toplink {
    width: 100%;
    justify-content: space-between;
    border-radius: 0;
    padding: 14px 4px;
    white-space: normal;
    text-align: left;
  }

  .scrm-mega-panel {
    position: static;
    left: auto;
    right: auto;
    width: 100%;
    max-width: 100%;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none !important;
    display: none;
    min-width: 0;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0 0 12px 12px;
    overflow-x: visible;
    overflow-y: visible;
    max-height: none;
  }

  .scrm-mega-panel::before {
    display: none;
  }

  .scrm-mega-item.has-panel:not(.is-open):hover > .scrm-mega-panel,
  .scrm-mega-item.has-panel:not(.is-open).is-panel-open > .scrm-mega-panel,
  .scrm-mega-item.has-panel:not(.is-open):focus-within > .scrm-mega-panel {
    display: none;
    transform: none !important;
  }

  .scrm-mega-item.has-panel.is-open > .scrm-mega-panel {
    display: block !important;
    transform: none !important;
    scroll-margin-top: 8px;
  }

  .scrm-mega-drawer,
  .scrm-mega-top {
    overflow-x: hidden;
  }

  .scrm-mega-cols {
    grid-template-columns: 1fr;
  }

  .scrm-mega-layout {
    flex-direction: column;
  }

  .scrm-mega-layout-feature {
    flex: none;
    max-width: none;
    padding-right: 0;
    margin-right: 0;
    border-right: none;
    border-bottom: 1px solid var(--scrm-nav-border);
    padding-bottom: 16px;
    margin-bottom: 16px;
  }

  .scrm-mega-aside-grid {
    grid-template-columns: 1fr;
  }

  /* Empilement strict (évite tout résidu column/grid du thème sur téléphone) */
  .scrm-mega-cols--flow {
    display: flex !important;
    flex-direction: column !important;
    column-count: unset !important;
    grid-template-columns: unset !important;
  }

  .scrm-mega-flyout {
    position: static;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    margin: 0 0 8px 12px;
    box-shadow: none;
    border: none;
    padding: 0;
  }

  .scrm-mega-col-links .fa-angle-right {
    display: none;
  }

  .scrm-mega-share {
    margin: 12px 0 0;
    align-self: flex-end;
  }
}

/* Masquer tout résidu mega-menu legacy si présent */
.mega-menu .drop-down-multilevel,
.mega-menu .menu-links {
  display: none !important;
}


/* =========================================================
   GARDE-FOUS FINAUX — à conserver tout en bas du fichier
   ========================================================= */

@media screen and (max-width: 1023px) {
  header.scrm-header-2026,
  header.scrm-header-2026 .scrm-mega-nav,
  header.scrm-header-2026 .scrm-mega-bar,
  header.scrm-header-2026 .scrm-mega-drawer,
  header.scrm-header-2026 .scrm-mega-drawer.is-open {
    background: #fff !important;
  }

  header.scrm-header-2026 .topbar {
    display: none !important;
  }
}

@media screen and (min-width: 1024px) {
  body.scrm-mega-nav-sticky header.scrm-header-2026 .topbar,
  html.scrm-has-scrolled header.scrm-header-2026 .topbar,
  header.scrm-header-2026:has(.scrm-mega-nav.is-sticky) .topbar {
    display: none !important;
  }

  body.scrm-mega-nav-sticky header.scrm-header-2026,
  html.scrm-has-scrolled header.scrm-header-2026 {
    background: #fff !important;
  }

  body.scrm-mega-nav-sticky header.scrm-header-2026 .scrm-mega-nav,
  body.scrm-mega-nav-sticky header.scrm-header-2026 .scrm-mega-bar,
  body.scrm-mega-nav-sticky header.scrm-header-2026 .scrm-mega-drawer,
  html.scrm-has-scrolled header.scrm-header-2026 .scrm-mega-nav,
  html.scrm-has-scrolled header.scrm-header-2026 .scrm-mega-bar,
  html.scrm-has-scrolled header.scrm-header-2026 .scrm-mega-drawer {
    background: #fff !important;
  }
}

/* Correctifs ultimes si le JS utilise .is-sticky sur .scrm-mega-nav au lieu de body.scrm-mega-nav-sticky. */
@media screen and (min-width: 1024px) {
  header.scrm-header-2026:has(.scrm-mega-nav.is-sticky) {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    background: #fff !important;
    box-shadow: var(--scrm-nav-shadow) !important;
  }

  header.scrm-header-2026:has(.scrm-mega-nav.is-sticky) .scrm-mega-nav.is-sticky {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    box-shadow: none !important;
  }
}

@media screen and (max-width: 1023px) {
  body,
  body.scrm-mega-nav-sticky {
    padding-top: var(--scrm-nav-h) !important;
  }

  header.scrm-header-2026 .scrm-mega-nav.is-sticky {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    box-shadow: none !important;
  }
}
