/* Mobile-only styles for full-screen overlay nav (loaded only on small screens) */
:root{
  --mc-bg: #ffffff;
  --mc-accent: #FE6649;
  --card-bg: #ffffff;
  --card-radius: 14px;
  --icon-size: 64px; /* tuned for screenshot balance */
  --label-size: 22px; /* tuned label size */
  --chev-size: 24px;
  --modal-padding: 18px;
  --cta-font-size: 20px;
}

/* Additional mobile submenu styles copied from index.html to ensure the Assurance submenu
   renders the same across all pages (mobile-only). */
@media (max-width: 768px) {
  .mobileMenuContent { padding: 18px; }
  /* header area: back, centered title, close */
  .mobileHeader { display:flex; align-items:center; justify-content:space-between; padding:8px 6px 18px 6px; }
  .mobileBack, .mobileClose { background:transparent; border:0; padding:6px; margin: 20px; display:flex; align-items:center; justify-content:center; }
  .mobileBack .mobileIconSVG path { stroke:#ff6a54; }
  .mobileClose { width:42px; height:42px; border-radius:10px; border:3px solid #ff6a54; box-sizing:border-box; }
  .mobileClose .mobileIconSVG path { stroke:#ff6a54; }
  .mobileTitle { flex:1; text-align:center; font-size:28px; font-weight:800; color:#083a64; font-family:'Lato',sans-serif; }
  .mobileHeader > * { min-width:48px; }

  .mobileSubmenu { display:flex; flex-direction:column; gap:18px; padding:6px 6px 36px 6px; }
  .mobileSubItem {
    display:flex; align-items:center; justify-content:space-between;
    background:#eaf4fb; /* very light blue */
    border-radius:14px;
    padding:18px 16px;
    box-sizing:border-box;
    cursor:pointer;
    color:#083a64; /* deep navy */
    font-weight:800;
    font-family: 'Lato', sans-serif;
    text-decoration: none;
  }
  .mobileSubItem:active { transform: translateY(1px); }
  .mobileSubItem .left { display:flex; align-items:center; gap:14px; }
  .mobileSubItem .icon {
    width:48px; height:48px; background-size:contain; background-repeat:no-repeat; background-position:center; flex:0 0 48px;
    border-radius:8px; /* subtle rounding to match asset look */
  }
  .mobileSubItem .label { font-size:22px; line-height:1; color:#083a64; }
  .mobileSubItem .chev {
    width:44px; height:44px; border-radius:50%; background:#ff6a54; color:white; display:flex; align-items:center; justify-content:center;
    font-size:20px; flex:0 0 44px; box-shadow: 0 2px 0 rgba(0,0,0,0.04);
  }
  /* white card wrapper to match assurance detail look */
  .mobileCard {
    background: #ffffff;
    border-radius: 14px;
    padding: 20px; /* increased padding to make the white box bigger */
    box-shadow: 0 18px 40px rgba(11,36,64,0.08); /* slightly stronger shadow */
    margin-top: 12px;
    width: 100%;
    box-sizing: border-box;
  }
  /* ensure links inside submenu look like buttons */
  .mobileSubItem[href] { display:flex; }
}

/* Ensure this file only applies to small screens via the <link media> in HTML */

/* Overlay backdrop */
.menu-overlay{
  display: none;
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 9998;
  transition: opacity 200ms ease;
  opacity: 0;
}
.menu-overlay.show{ display:block; opacity:1; }

/* Full screen menu container */
.menu-links{
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--mc-bg);
  padding: 28px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  -webkit-touch-callout: none;
}
.menu-links.show{
  /* make the menu a flex container so we can center content vertically/horizontally */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh; /* ensure it fills viewport */
  padding: 0 !important; /* remove extra padding so content is truly centered */
  width: 100vw !important;
  height: 100vh !important;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

/* Ensure viewport sizing and remove default body margins on small screens */
@media (max-width: 768px){
  html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%;
  }
  .menu-links{
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
    padding-left: 18px;
    padding-right: 18px;
  }
  /* Keep the center alignment but allow the group to scroll if it overflows */
  .menu-links .menu-center{
    width: 100%;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center; /* center child cards */
    justify-content: center;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-top: 8px;
    padding-bottom: 8px;
    margin: 0 auto !important; /* center the block vertically/horizontally */
    box-sizing: border-box;
  }
  /* center each nav-item inside the centered container */
  .menu-links .nav-item{ align-self: center; }
}

/* Hide desktop mega-dropdown content inside the mobile overlay */
.menu-links .nav-dropdown,
.menu-links .mega,
.menu-links .mega-inner,
.menu-links .mega-left,
.menu-links .mega-main,
.menu-links .mega-right,
.menu-links .cta-button,
.menu-links .cta-icon,
.menu-links .nos-offres,
.menu-links .seo-links,
.menu-links .help-box{
  display: none !important;
}

/* Make the label the visible full-width card (use existing button.nav-label) */
.menu-links .nav-item{
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.menu-links .nav-item .nav-label{
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: #eaf4fb; /* pale blue like the screenshot */
  padding: 18px 20px;
  border-radius: 14px;
  box-shadow: none;
  color: #0f3350; /* dark navy */
  font-weight: 800;
  text-align: left;
  position: relative;
}

/* Left icon injected via pseudo-element */
.menu-links .nav-item .nav-label::before{
  content: '';
  display: block;
  width: var(--icon-size);
  height: var(--icon-size);
  flex: 0 0 var(--icon-size);
  border-radius: 10px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Right chevron via ::after */
.menu-links .nav-item .nav-label::after{
  content: '\203A'; /* single right-pointing angle quotation mark similar to chevron */
  font-size: var(--chev-size);
  color: var(--mc-accent);
  margin-left: auto;
  line-height: 1;
}

/* Hide the original small arrow inside the label */
.menu-links .nav-item .nav-label .nav-arrow{ display: none; }

/* Set images for the pseudo icons (escape spaces) */
.menu-links .nav-item:nth-of-type(1) .nav-label::before{ background-image: url("./RES/img/health.webp"); }
.menu-links .nav-item:nth-of-type(2) .nav-label::before{ background-image: url("./RES/img/gas_electricity.webp"); }
.menu-links .nav-item:nth-of-type(3) .nav-label::before{ background-image: url("./RES/img/internet.webp"); }
.menu-links .nav-item:nth-of-type(4) .nav-label::before{ background-image: url("./RES/img/loan_insurance.webp"); }
.menu-links .nav-item:nth-of-type(5) .nav-label::before{ background-image: url("./RES/img/funeral_insurance.webp"); }

/* Spacing between cards when centered */
.menu-links .nav-item{ margin: 12px 0; }
.menu-links .nav-item{
  background: var(--card-bg);
  border-radius: var(--card-radius);
  padding: 0;
  display: block;
  width: 100%;
  max-width: 640px; /* constrain width so items look centered */
}

.menu-links .nav-item .nav-icon{
  width: var(--icon-size);
  height: var(--icon-size);
  flex: 0 0 var(--icon-size);
  border-radius: 12px;
  background-size: cover;
  background-position: center;
}

.menu-links .nav-item .nav-label{
  font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  font-size: var(--label-size);
  line-height: 1.08;
  color: #222;
  font-weight: 700;
  flex: 1 1 auto;
  text-align: left;
}

.menu-links .nav-item .nav-chev{
  font-size: var(--chev-size);
  color: var(--mc-accent);
  margin-left: 8px;
  flex: 0 0 auto;
}

/* Close button in top-right when overlay open */
.menu-toggle{
  background: transparent;
  border: none;
  font-size: 28px;
  padding: 6px 10px;
  cursor: pointer;
}

/* Make menu-toggle stick to the top-right on mobile */
@media (max-width: 768px){
  .navbar .menu-toggle{
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 10001;
    background: rgba(255,255,255,0.95);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  /* When menu is visible on small screens, make sure content is centered and usable */
  .menu-links.show{
    padding: 0 !important; /* remove extra padding so true centering works in emulators */
  }
  /* Absolute center the inner wrapper so it's centered regardless of browser chrome */
  .menu-links .menu-center{
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: calc(100% - 36px) !important;
    box-sizing: border-box !important;
    z-index: 10002 !important;
    padding: 8px 0 !important;
  }
}

/* Prevent background scrolling when menu is open */
body.menu-open{
  overflow: hidden;
  height: 100vh;
  /* keep body from scrolling but avoid fixed positioning which can interfere in some emulators */
  position: static;
  width: 100%;
}

/* Specific icons: first item use provided Mutuelle image */
.menu-links .nav-item:nth-of-type(1) .nav-icon{ background-image: url("./RES/img/health.webp" ); }
.menu-links .nav-item:nth-of-type(2) .nav-icon{ background-image: url("./RES/img/gas_electricity.webp" ); }
.menu-links .nav-item:nth-of-type(3) .nav-icon{ background-image: url("./RES/img/internet.webp" ); }
.menu-links .nav-item:nth-of-type(4) .nav-icon{ background-image: url("./RES/img/loan_insurance.webp" ); }
.menu-links .nav-item:nth-of-type(5) .nav-icon{ background-image: url("./RES/img/funeral_insurance.webp" ); }

/* Slightly larger touch targets on very small phones */
@media (max-width: 380px){
  :root{ --icon-size: 56px; --label-size: 18px; --chev-size: 20px; }
  .menu-links{ padding: 18px 12px; }
  .menu-links .nav-item{ max-width: 92%; }
}

/* Force nav items to be visually centered and full-width inside menu-center */
.menu-links .menu-center .nav-item{
  width: 100% !important;
  max-width: 640px !important;
}

/* Ensure the visible button fills the card area */
.menu-links .nav-item .nav-label{
  width: 100% !important;
}

/* Strong override for emulators: ensure overlay truly fills viewport and is centered */
@media (max-width: 768px){
  .menu-links.show{
    position: fixed !important;
    inset: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100vw !important;
    height: 100vh !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .menu-links .menu-center{
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: 640px !important;
    margin: 0 auto !important;
  }
}

/* Robust standalone mobile modal (created by JS) to guarantee full-screen centered menu */
#mobileMenuModal{
  position: fixed !important;
  inset: 0 !important;
  background: #ffffff !important;
  z-index: 12000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  animation: modalFadeIn 220ms ease both;
  overflow-x: hidden !important; /* prevent horizontal overflow */
}
#mobileMenuModal .mobileMenuContent{
  /* make the content fill available width but keep inner padding so items fit */
  width: 100% !important;
  max-width: 720px !important;
  max-height: 88vh !important;
  overflow-y: auto !important;
  background: transparent !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
  padding: 0 12px !important; /* small horizontal padding so inner cards don't touch edges */
  box-sizing: border-box !important;
}
#mobile-menu .mobileMenuItem,
#mobileMenuModal .mobileMenuItem{
  background: #eaf4fb !important;
  border-radius: 14px !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 12px !important; /* reduce padding to avoid overflow */
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08) !important;
  color: #0f3350 !important;
  font-weight: 800 !important;
  font-size: var(--label-size) !important;
  overflow: hidden !important; /* prevent child elements from overflowing horizontally */
}
#mobile-menu .mobileMenuItem .chev {
  /*width: 44px;*/
  /*height: 44px;*/
  border-radius: 50%;
  /*background: #ff6a54;*/
  /*color: white;*/
  color: #ff6a54;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  /*flex: 0 0 44px;*/
  /*box-shadow: 0 2px 0 rgba(0,0,0,0.04);*/
}
#mobile-menu .mobileIcon,
#mobileMenuModal .mobileIcon{
  width: var(--icon-size) !important;
  height: var(--icon-size) !important;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  flex: 0 0 auto !important;
}
#mobileMenuModal .mobileChev{
  margin-left: auto !important;
  font-size: var(--chev-size) !important;
  color: var(--mc-accent) !important;
  flex: 0 0 auto !important; /* don't let the chevron shrink or be pushed out */
  min-width: 32px !important;
  text-align: center !important;
}

/* Mobile detail view (when a menu item is clicked) */
#mobileMenuModal .mobileDetail{
  width: 100% !important;
  background: white !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 18px !important;
  box-sizing: border-box !important;
  padding: 18px !important;
  border-radius: 12px !important;
  animation: detailSlideUp 260ms cubic-bezier(.2,.9,.2,1) both;
}
#mobileMenuModal .mobileHeader{
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  padding: 8px 12px !important;
}
#mobileMenuModal .mobileBack{
  position: absolute !important;
  left: 14px !important;
  width: 40px !important;
  height: 40px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--mc-accent) !important;
}
.menuBack{
  color: var(--mc-accent) !important;
  background: transparent;
  border: 0;
}
#mobileMenuModal .mobileClose{
  position: absolute !important;
  right: 14px !important;
  width: 40px !important;
  height: 40px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--mc-accent) !important;
  border: 2px solid var(--mc-accent) !important;
  border-radius: 10px !important;
}
#mobileMenuModal .mobileTitle{
  /* hide the center title inside the white card - we use the floating overlay title instead */
  display: none !important;
}

/* Floating overlay title in the top-left corner of the modal (visible when menu/submenu open) */
.mobileOverlayHeader{
  position: absolute;
  top: 12px;
  /*left: 12px;*/
  z-index: 12010;
  pointer-events: none; /* decorative container; title itself can be readable but clicks pass through */
  width: 95%;
}
.mobileOverlayTitle{
  pointer-events: auto;
  font-size: 20px;
  font-weight: 800;
  color: #0f3350;
  font-family: 'Lato', sans-serif;
}

/* Big CTA style */
#mobile-menu .mobileCTA,
#mobileMenuModal .mobileCTA{
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  background: var(--mc-accent) !important;
  color: #fff !important;
  padding: 18px !important;
  border-radius: 14px !important;
  font-size: var(--cta-font-size) !important;
  font-weight: 800 !important;
  text-decoration: none !important;
}
#mobile-menu .mobileCTA img,
#mobileMenuModal .mobileCTA img{ width: var(--icon-size) !important; height: var(--icon-size) !important; object-fit: contain; }

#mobile-menu .mobileSectionTitle,
#mobileMenuModal .mobileSectionTitle{
  font-size: 20px !important;
  font-weight: 800 !important;
  color: #0f3350 !important;
  margin-top: 6px !important;
}

#mobile-menu .mobileHelpBox,
#mobileMenuModal .mobileHelpBox{
  background: #eaf4fb !important;
  border-radius: 14px !important;
  padding: 18px !important;
}

/* entrance animations */
@keyframes modalFadeIn{
  from{ opacity: 0; transform: translateY(6px) scale(.995); }
  to{ opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes detailSlideUp{
  from{ opacity: 0; transform: translateY(12px); }
  to{ opacity: 1; transform: translateY(0); }
}

/* small helper for svg icons inside header */
/*.mobileIconSVG{ width:20px; height:20px; display:inline-block; }*/
.mobileIconSVG{ width:26px; height:26px; display:inline-block; }

#mobile-menu .mobileHelpBox a,
#mobileMenuModal .mobileHelpBox a {
  display: block !important;
  color: #7fb5e6 !important;
  text-decoration: none !important;
  padding: 8px 0 !important;
  font-size: 18px !important;
}

#mobile-menu .mobileSectionTitle,
#mobileMenuModal .mobileSectionTitle {
  margin-bottom: 8px !important;
}



/* Final absolute guarantee: if device emulator still misreports viewport, force the inner wrapper to fixed center */
@media (max-width: 768px){
  .menu-links.show > .menu-center{
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    width: calc(100% - 36px) !important;
    padding: 8px 0 !important;
    z-index: 11000 !important;
    box-sizing: border-box !important;
  }

  #mmenu-toggle {
    display: block;
    font-size: 28px;
    background: none;
    border: none;
    cursor: pointer;
    position: fixed;
    right: 16px;
    top: 16px;
    z-index: 30000;
    color: #fe6649;
    font-weight: bold;
  }
}
