/* ========================================
   HEADER MOBILE - VERSION MAQUETTE
   ======================================== */

/* Header Mobile Principal */
.mobile-header-row {
  background: #2EFFD3 !important;
  height: 56px !important;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px !important;
  box-sizing: border-box;
  width: 100vw !important;
  min-width: 100vw !important;
  max-width: 100vw !important;
  margin: 0 !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1001 !important;
  border-bottom: 1px solid #2EFFD3 !important;
  border-radius: 0 !important;
  /* Harmonisation iPhone/Android */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}


/* Gestion du safe-area pour iPhone X+ */
@supports (padding: max(0px)) {
  .mobile-header-row {
    padding-top: max(16px, env(safe-area-inset-top));
    height: max(56px, calc(56px + env(safe-area-inset-top)));
  }
}

/* Burger Menu - Gauche */
.burger-menu {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 28px;
  height: 28px;
  cursor: pointer;
  z-index: 2001;
  flex-shrink: 0;
  order: 1; /* S'assurer qu'il est à gauche */
}

.burger-menu span {
  display: block;
  width: 22px;
  height: 2px;
  margin: 3px 0;
  background-color: #17507b;
  border-radius: 1px;
  transition: all 0.3s ease;
  opacity: 1;
}

/* Logo - Centre */
.mobile-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-decoration: none;
  order: 2; /* S'assurer qu'il est au centre */
  margin: 0 auto; /* Centrer le logo */
  /* Harmonisation iPhone/Android */
  min-width: 0; /* Permet au flex de rétrécir si nécessaire */
  flex-shrink: 1; /* Permet au logo de rétrécir si nécessaire */
  padding: 0 8px; /* Espacement horizontal pour éviter les débordements */
}

.mobile-logo-img {
  max-height: 27px;
  max-width: 136px;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  /* Harmonisation iPhone/Android */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  /* Préserver les proportions */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Sélecteur de Langues - Droite */
.mobile-language-dropdown {
  position: relative;
  display: flex !important;
  align-items: center;
  flex-shrink: 0;
  z-index: 10000;
  order: 3; /* S'assurer qu'il est à droite */
  margin-left: auto; /* Forcer à droite */
  visibility: visible !important;
  opacity: 1 !important;
}

/* Sélecteur de Langues - Version avec codes (PT, FR, etc.) */
.mobile-language-selector {
  position: relative;
  display: none !important; /* Masquer le sélecteur de langue sur mobile */
  align-items: center;
  flex-shrink: 0;
  z-index: 10000;
  order: 3; /* S'assurer qu'il est à droite */
  margin-left: auto; /* Forcer à droite */
  visibility: hidden !important;
  opacity: 0 !important;
}

.mobile-lang-toggle {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s;
  color: #17507b;
  font-weight: 600;
  font-size: 14px;
  gap: 4px;
}

.mobile-lang-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.mobile-current-lang {
  display: inline-block;
}

.mobile-dropdown-arrow {
  font-size: 0.7em;
  transition: transform 0.2s ease;
}

.mobile-language-selector.open .mobile-dropdown-arrow {
  transform: rotate(180deg);
}

.mobile-lang-options {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  padding: 8px;
  min-width: 60px;
  z-index: 10002;
  flex-direction: column;
  gap: 4px;
}

.mobile-language-selector.open .mobile-lang-options {
  display: flex;
}

.mobile-lang-option {
  background: none;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 8px;
  outline: none;
  transition: background 0.13s;
  color: #17507b;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  width: 100%;
}

.mobile-lang-option:hover,
.mobile-lang-option:focus {
  background: #e8f1ff;
  outline: none;
}

.mobile-dropdown-toggle {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: background 0.15s;
  width: 32px;
  height: 32px;
  justify-content: center;
}

.mobile-dropdown-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.mobile-flag-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #e0e0e0;
  box-shadow: 0 1px 4px 0 rgba(0,0,0,0.07);
  background: #fff;
  display: block;
  transition: border 0.13s;
}

.mobile-dropdown-caret {
  font-size: 0.8em;
  margin-left: 4px;
  color: #17507b;
  transition: transform 0.2s ease;
}

.mobile-language-dropdown.open .mobile-dropdown-caret {
  transform: rotate(180deg);
}

/* Menu déroulant mobile - Exactement comme desktop */
.mobile-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  padding: 0.35em 0.4em;
  width: auto;
  z-index: 10002;
  flex-direction: column;
  gap: 0.13em;
  align-items: center;
  min-width: unset;
  white-space: nowrap;
}

.mobile-language-dropdown.open .mobile-dropdown-menu {
  display: flex;
}

.mobile-flag-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0.13em 0.04em;
  cursor: pointer;
  border-radius: 50%;
  outline: none;
  transition: box-shadow 0.13s;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.mobile-flag-btn.active,
.mobile-flag-btn:focus,
.mobile-flag-btn:hover {
  background: #e8f1ff;
  box-shadow: 0 0 0 2px #0066cc44;
  border-radius: 50%;
  outline: none;
}

.mobile-flag-btn.active .mobile-flag-icon,
.mobile-flag-btn:focus .mobile-flag-icon,
.mobile-flag-btn:hover .mobile-flag-icon {
  border-color: #0066cc;
}

.mobile-flag-btn .mobile-flag-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #e0e0e0;
  box-shadow: 0 1px 4px 0 rgba(0,0,0,0.07);
  background: #fff;
  display: block;
  transition: border 0.13s;
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

/* Petits écrans mobiles (iPhone SE, petits Android) */
@media (max-width: 375px) {
  .mobile-header-row {
    padding: 0 12px !important;
    margin: 0 !important;
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
  }
  
  .mobile-logo-img {
    max-height: 24px;
    max-width: 111px;
  }
  
  .burger-menu {
    width: 24px;
    height: 24px;
  }
  
  .burger-menu span {
    width: 18px;
  }
}

/* Écrans mobiles moyens (iPhone standard, Android standard) */
@media (min-width: 376px) and (max-width: 414px) {
  .mobile-logo-img {
    max-height: 26px;
    max-width: 128px;
  }
}

/* Tablettes */
@media (min-width: 768px) and (max-width: 900px) {
  .mobile-header-row {
    height: 60px;
    padding: 0 20px;
  }
  
  .mobile-logo-img {
    max-height: 31px;
    max-width: 153px;
  }
  
  .burger-menu,
  .mobile-dropdown-toggle {
    width: 32px;
    height: 32px;
  }
  
  .burger-menu span {
    width: 24px;
    height: 3px;
  }
  
  .mobile-flag-icon {
    width: 26px;
    height: 26px;
  }
  
  .mobile-dropdown-menu {
    width: 44px;
    padding: 6px;
  }
  
  .mobile-flag-btn {
    width: 36px;
    height: 36px;
  }
  
  .mobile-flag-btn .mobile-flag-icon {
    width: 24px;
    height: 24px;
  }
}

/* Desktop - Masquer le header mobile */
@media (min-width: 901px) {
  .mobile-header-row {
    display: none !important;
  }
}

/* ========================================
   ÉTATS SPÉCIAUX
   ======================================== */

/* Header avec menu ouvert */
.mobile-header-row.menu-open {
  background: #2EFFD3;
}

/* Focus states pour l'accessibilité */
.burger-menu:focus,
.mobile-dropdown-toggle:focus {
  outline: 2px solid #17507b;
  outline-offset: 2px;
}

/* Animation du burger menu */
.burger-menu:hover span {
  background-color: #0d3a5f;
}

/* ========================================
   COMPATIBILITÉ NAVIGATEURS
   ======================================== */

/* Support des anciens navigateurs */
@supports not (padding: max(0px)) {
  .mobile-header-row {
    padding-top: 16px;
  }
}

/* Support iOS Safari */
@supports (-webkit-touch-callout: none) {
  .mobile-header-row {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  
  .mobile-logo-img {
    /* Optimisation pour iOS */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
}

/* Support Android Chrome */
@supports not (-webkit-touch-callout: none) {
  .mobile-header-row {
    /* Optimisations Android */
    will-change: transform;
  }
  
  .mobile-logo-img {
    /* Optimisation pour Android */
    will-change: transform;
  }
}
