/**
 * Front-end CSS — Mobile sticky bar
 *
 * Provides the styles for the mobile sticky bar with horizontal carousel:
 * - Sections navigation (previous, current, next)
 * - Toggle button (collapse/expand)
 * - Left/right arrows
 * - Responsive behavior (≤ 1024px)
 *
 * @package anchorflow-menu
 * @since 1.0.0
 */

/* === Main container === */
.menu-ancrage-mobile-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #ffffff;
  color: #333;
  height: 50px;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.10);
  display: flex;
  align-items: center;
  padding: 0;
  z-index: 99999999;
  /* Ensure the bar stays above TranslatePress language switcher (z-index: 9999999) */
  font-size: 14px;
  transition: transform 0.3s ease;
  overflow: visible;
}

/* === Toggle button (open/close the mobile bar) === */
.menu-ancrage-mobile-bar .menu-ancrage-port-toggle {
  position: absolute;
  top: -40px;
  left: 2px;
  width: 40px;
  height: 40px;
  border-radius: 6px 6px 0 0;
  background-color: #ffffff;
  color: #1f5daa;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 0;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.18);
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

/* The icon container takes up the whole button and centers the SVG */
.menu-ancrage-port-toggle .menu-ancrage-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 0;
  padding: 0;
}

.menu-ancrage-toggle-icon {
  font-size: 1em;
  line-height: 1;
  transform: translateY(1px);
}

/* Prevent any red color on click (mouse, touch) */
.menu-ancrage-mobile-bar .menu-ancrage-port-toggle:focus:not(:focus-visible),
.menu-ancrage-mobile-bar .menu-ancrage-port-toggle:active {
  outline: none;
  box-shadow: none;
}

/* === Hide the mobile bar downward === */
.menu-ancrage-mobile-bar.wrapper-collapsed {
  transform: translateY(100%);
}

/* === Make the toggle button move down with the bar when hidden === */
.menu-ancrage-mobile-bar.wrapper-collapsed .menu-ancrage-port-toggle {
  transform: translateY(0%);
}

/* === Wrapper (arrows + carousel) === */
.menu-ancrage-mobile-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
}

.menu-ancrage-mobile-carousel {
  position: relative;
  flex: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
  scrollbar-width: none;
  scroll-behavior: smooth;
  display: flex;
  justify-content: flex-start;
  /* important for smooth swipe + snap */
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scroll-snap-type: x proximity;
}


.menu-ancrage-mobile-carousel::-webkit-scrollbar {
  display: none;
}

/* === List of links === */
.menu-ancrage-mobile-sections {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 0;
}

.menu-ancrage-mobile-sections.centered {
  margin-left: auto;
  margin-right: auto;
}

.menu-ancrage-mobile-sections a {
  display: inline-block;
  font-size: 14px;
  text-decoration: none;
  color: #333;
  padding: 6px 12px 6px 20px;
  position: relative;
  line-height: 1.5;
  /* Removes the tiny tap highlight on iOS */
  -webkit-tap-highlight-color: transparent;
  /* forces a stable line height */
  min-height: 20px;
  /* prevents line break on render */
  transition: color 0.3s ease;
  /* Added to work together with the container's scroll-snap */
  scroll-snap-align: center;
  /* not “mandatory” every time, just a soft helper */
  scroll-snap-stop: normal;
}

.menu-ancrage-mobile-sections a.active {
  color: #1F5DAA;
  font-weight: bold;
}

/* Safari iOS fix: prevent non-active links from keeping focus/interaction styles */
.menu-ancrage-mobile-sections a:focus:not(.active),
.menu-ancrage-mobile-sections a:hover:not(.active),
.menu-ancrage-mobile-sections a:active:not(.active),
.menu-ancrage-mobile-sections a:visited:not(.active) {
  color: #333 !important;
  font-weight: normal;
  outline: none;
}

.menu-ancrage-mobile-sections a.active::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background-color: #1F5DAA;
  border-radius: 50%;
}

/* === Arrow buttons inside the mobile bar (base) === */
.menu-ancrage-mobile-bar .menu-ancrage-mobile-left,
.menu-ancrage-mobile-bar .menu-ancrage-mobile-right {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  color: inherit;
  opacity: 1;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  /* iOS: no blue flash */
  touch-action: manipulation;
}

/* === Inner borders (left/right) === */
.menu-ancrage-mobile-bar .menu-ancrage-mobile-left {
  border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.menu-ancrage-mobile-bar .menu-ancrage-mobile-right {
  border-left: 1px solid rgba(0, 0, 0, 0.08);
}

/* === Hover (mouse/trackpad only, not mobile) === */
@media (hover: hover) and (pointer: fine) {

  .menu-ancrage-mobile-bar .menu-ancrage-mobile-left:hover,
  .menu-ancrage-mobile-bar .menu-ancrage-mobile-right:hover {
    color: inherit;
    opacity: 1;
  }
}

/* === Keyboard focus (accessibility) === */
/* === Click / non-visible focus (mouse/touch): no color change === */
.menu-ancrage-mobile-bar .menu-ancrage-mobile-left:focus-visible,
.menu-ancrage-mobile-bar .menu-ancrage-mobile-right:focus-visible,
.menu-ancrage-port-toggle:focus-visible {
  outline: 2px solid #1F5DAA;
  outline-offset: 2px;
  border-radius: 4px;
  background-color: rgba(31, 93, 170, 0.1);
  box-shadow: 0 0 0 2px rgba(31, 93, 170, 0.15);
}

/* (optional) Ensure SVGs use the current color properly */
.menu-ancrage-mobile-bar .menu-ancrage-button-wrapper svg {
  display: block;
}

.menu-ancrage-mobile-bar .menu-ancrage-button-wrapper svg path {
  fill: currentColor;
  fill-opacity: 1;
}

/* === SVG container inside button === */
.menu-ancrage-button-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  /* centered by default, useful as fallback */
  width: 100%;
  height: 100%;
  line-height: 1;
  pointer-events: none;
  /* does not block the click */
}

/* === Specific alignment left / right === */
.menu-ancrage-mobile-left .menu-ancrage-button-wrapper {
  justify-content: center;
}

.menu-ancrage-mobile-right .menu-ancrage-button-wrapper {
  justify-content: center;
}

/* === SVG style === */
.menu-ancrage-button-wrapper svg {
  display: block;
  width: 24px;
  height: 24px;
}

/* === Hide the mobile bar only above 1024px ===
   -> Use min-width: 1025px to NOT affect exactly 1024px
*/
@media (min-width: 1025px) {
  .menu-ancrage-mobile-bar {
    display: none !important;
  }
}