/* Foxbow Mobile Menu Slide-in avec Accordéons Tactiles */

/* Variables pour le menu mobile */
:root {
  --mobile-menu-width: 320px;
  --mobile-menu-bg: #ffffff;
  --mobile-menu-overlay-bg: rgba(0, 0, 0, 0.5);
  --mobile-menu-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --mobile-menu-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
  --touch-target-min: 48px; /* Taille minimale recommandée pour tactile */
}

/* Overlay sombre derrière le menu */
.foxbow-mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--mobile-menu-overlay-bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--mobile-menu-transition), visibility var(--mobile-menu-transition);
  z-index: 9998;
}

.foxbow-mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Conteneur du menu mobile slide-in */
.foxbow-mobile-menu-container {
  position: fixed;
  top: 0;
  left: -100%;
  width: var(--mobile-menu-width);
  max-width: 85vw;
  height: 100vh;
  background-color: var(--mobile-menu-bg);
  box-shadow: var(--mobile-menu-shadow);
  transition: left var(--mobile-menu-transition);
  z-index: 9999;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling sur iOS */
}

.foxbow-mobile-menu-container.active {
  left: 0;
}

/* Header du menu mobile */
.foxbow-mobile-menu-header {
  position: sticky;
  top: 0;
  background-color: var(--foxbow-green);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  z-index: 10;
  min-height: var(--touch-target-min);
}

.foxbow-mobile-menu-title {
  font-family: var(--foxbow-font-family, 'Scada', sans-serif);
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: white;
}

/* Bouton de fermeture */
.foxbow-mobile-menu-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.foxbow-mobile-menu-close:hover,
.foxbow-mobile-menu-close:active {
  opacity: 0.8;
}

/* Corps du menu */
.foxbow-mobile-menu-body {
  padding: 0;
}

/* Liste du menu mobile */
.foxbow-mobile-menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Item de menu de niveau 1 */
.foxbow-mobile-menu-item {
  border-bottom: 1px solid #e6e6e6;
}

.foxbow-mobile-menu-item:last-child {
  border-bottom: none;
}

/* Lien/bouton de menu */
.foxbow-mobile-menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  min-height: var(--touch-target-min);
  color: #212529;
  text-decoration: none;
  font-family: var(--foxbow-font-family, 'Scada', sans-serif);
  font-size: 15px;
  font-weight: 600;
  background-color: white;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

/* État actif/pressé (tactile) */
.foxbow-mobile-menu-link:active {
  background-color: #f5f5f5;
}

.foxbow-mobile-menu-link:hover {
  background-color: #f9f9f9;
  color: var(--foxbow-green, #71b02c);
}

/* Icône de flèche pour les sous-menus */
.foxbow-mobile-menu-arrow {
  margin-left: auto;
  padding-left: 10px;
  font-size: 16px;
  transition: transform 0.3s ease;
  min-width: 24px;
  text-align: center;
  color: #666;
}

.foxbow-mobile-menu-item.expanded > .foxbow-mobile-menu-link .foxbow-mobile-menu-arrow {
  transform: rotate(180deg);
  color: var(--foxbow-green, #71b02c);
}

/* Label du menu */
.foxbow-mobile-menu-label {
  flex: 1;
}

/* Sous-menu (accordéon) */
.foxbow-mobile-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background-color: #f9f9f9;
}

.foxbow-mobile-menu-item.expanded > .foxbow-mobile-submenu {
  max-height: 2000px; /* Valeur suffisamment grande */
  transition: max-height 0.5s ease-in;
}

/* Liste de sous-menu */
.foxbow-mobile-submenu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Item de sous-menu niveau 2 */
.foxbow-mobile-submenu-item {
  border-bottom: 1px solid #e6e6e6;
}

.foxbow-mobile-submenu-item:last-child {
  border-bottom: none;
}

/* Lien de sous-menu niveau 2 */
.foxbow-mobile-submenu-link {
  display: block;
  padding: 14px 20px 14px 40px;
  min-height: var(--touch-target-min);
  color: #484848;
  text-decoration: none;
  font-family: var(--foxbow-font-family, 'Scada', sans-serif);
  font-size: 14px;
  font-weight: 400;
  background-color: #f9f9f9;
  transition: background-color 0.2s, color 0.2s, padding-left 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.foxbow-mobile-submenu-link:active {
  background-color: #f0f0f0;
}

.foxbow-mobile-submenu-link:hover {
  background-color: #f0f0f0;
  color: var(--foxbow-green, #71b02c);
  padding-left: 45px;
}

/* Mega menu categories pour mobile */
.foxbow-mobile-megamenu-wrapper {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background-color: #f9f9f9;
}

.foxbow-mobile-menu-item.expanded > .foxbow-mobile-megamenu-wrapper {
  max-height: 5000px;
  transition: max-height 0.5s ease-in;
}

/* Catégorie principale dans mega menu mobile */
.foxbow-mobile-category-group {
  border-bottom: 1px solid #e0e0e0;
  padding: 10px 0;
}

.foxbow-mobile-category-group:last-child {
  border-bottom: none;
}

.foxbow-mobile-category-title-wrapper {
  padding: 0;
}

.foxbow-mobile-category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 12px 30px;
  min-height: var(--touch-target-min);
  color: #212529;
  text-decoration: none;
  font-family: var(--foxbow-font-family, 'Scada', sans-serif);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  background-color: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.foxbow-mobile-category-title:active {
  background-color: #f0f0f0;
}

.foxbow-mobile-category-title:hover {
  background-color: #f5f5f5;
  color: var(--foxbow-green, #71b02c);
}

/* Flèche pour les sous-catégories */
.foxbow-mobile-category-arrow {
  margin-left: auto;
  padding-left: 10px;
  font-size: 14px;
  transition: transform 0.3s ease;
  min-width: 24px;
  text-align: center;
  color: #666;
}

.foxbow-mobile-category-group.expanded .foxbow-mobile-category-arrow {
  transform: rotate(180deg);
  color: var(--foxbow-green, #71b02c);
}

/* Liste des sous-catégories */
.foxbow-mobile-subcategories {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background-color: #ffffff;
}

.foxbow-mobile-category-group.expanded > .foxbow-mobile-subcategories {
  max-height: 1500px;
  transition: max-height 0.4s ease-in;
}

.foxbow-mobile-subcategories-list {
  list-style: none;
  margin: 0;
  padding: 5px 0;
}

.foxbow-mobile-subcategory-item {
  border: none;
}

.foxbow-mobile-subcategory-link {
  display: block;
  padding: 10px 20px 10px 50px;
  min-height: 42px;
  color: #484848;
  text-decoration: none;
  font-family: var(--foxbow-font-family, 'Scada', sans-serif);
  font-size: 13px;
  font-weight: 400;
  background-color: white;
  transition: background-color 0.2s, color 0.2s, padding-left 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.foxbow-mobile-subcategory-link:active {
  background-color: #f9f9f9;
}

.foxbow-mobile-subcategory-link:hover {
  background-color: #f5f5f5;
  color: var(--foxbow-green, #71b02c);
  padding-left: 55px;
}

/* Bottom menu items (langue, devise, contact) */
.foxbow-mobile-menu-bottom {
  padding: 20px;
  border-top: 2px solid #e6e6e6;
  background-color: #f9f9f9;
}

/* Animations de feedback tactile */
@keyframes tap-feedback {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.98);
  }
  100% {
    transform: scale(1);
  }
}

.foxbow-mobile-menu-link:active,
.foxbow-mobile-submenu-link:active,
.foxbow-mobile-category-title:active,
.foxbow-mobile-subcategory-link:active {
  animation: tap-feedback 0.2s ease;
}

/* Empêcher le body de scroller quand le menu est ouvert */
body.foxbow-mobile-menu-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* Responsive - uniquement sur mobile */
@media (min-width: 769px) {
  .foxbow-mobile-menu-overlay,
  .foxbow-mobile-menu-container {
    display: none !important;
  }
}

/* Optimisations pour très petits écrans */
@media (max-width: 360px) {
  :root {
    --mobile-menu-width: 280px;
  }

  .foxbow-mobile-menu-link {
    font-size: 14px;
    padding: 14px 15px;
  }

  .foxbow-mobile-submenu-link {
    font-size: 13px;
    padding: 12px 15px 12px 35px;
  }

  .foxbow-mobile-category-title {
    font-size: 13px;
    padding: 12px 15px 12px 25px;
  }

  .foxbow-mobile-subcategory-link {
    font-size: 12px;
    padding: 10px 15px 10px 45px;
  }
}

/* Smooth scroll pour iOS */
@supports (-webkit-overflow-scrolling: touch) {
  .foxbow-mobile-menu-container {
    -webkit-overflow-scrolling: touch;
  }
}
