/**
 * SYSTÈME DE MENUS RESPONSIVE COMPLET - InnovX
 * Optimisation pour tous les menus : header, mobile, sidebars
 */

/* ============================================
   HEADER PRINCIPAL - RESPONSIVE
   ============================================ */

/* Desktop - Grand écran (1200px+) */
@media (min-width: 1200px) {
  header nav.lg\:flex {
    gap: 1.5rem !important;
  }
  
  header nav.lg\:flex a,
  header nav.lg\:flex button {
    font-size: 1rem !important;
    padding: 0.75rem 1.25rem !important;
  }
}

/* Desktop - Écran moyen (1024px - 1199px) */
@media (min-width: 1024px) and (max-width: 1199px) {
  header .max-w-7xl {
    padding-left: 2rem !important;
    padding-right: 2rem !important;
  }
  
  header nav.lg\:flex {
    gap: 0.75rem !important;
  }
  
  header nav.lg\:flex a,
  header nav.lg\:flex button {
    font-size: 0.875rem !important;
    padding: 0.625rem 0.875rem !important;
  }
  
  header img.h-12 {
    height: 2.5rem !important;
  }
  
  /* Menu "Mon Compte" plus compact */
  .bg-innovx-yellow.text-black {
    padding-left: 0.875rem !important;
    padding-right: 0.875rem !important;
    font-size: 0.875rem !important;
  }
  
  /* Sous-menu dropdown */
  header .group .absolute {
    width: 14rem !important;
    font-size: 0.8rem !important;
  }
}

/* Tablettes (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  header {
    padding: 0 1rem !important;
  }
  
  header .max-w-7xl {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  header .py-6 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
  
  header img.h-12 {
    height: 2rem !important;
  }
  
  /* Forcer le menu hamburger sur tablette */
  header nav.lg\:flex {
    display: none !important;
  }
  
  #mobile-menu-btn {
    display: block !important;
  }
  
  /* Menu mobile optimisé pour tablette */
  #mobile-menu {
    max-width: 500px !important;
    margin: 0 auto !important;
  }
  
  #mobile-menu a {
    font-size: 1rem !important;
    padding: 0.875rem 1rem !important;
  }
}

/* Mobile (max 767px) */
@media (max-width: 767px) {
  header {
    padding: 0 0.75rem !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
  }
  
  header .max-w-7xl {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  
  header .py-6 {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }
  
  header img.h-12 {
    height: 1.75rem !important;
  }
  
  /* Bouton hamburger plus grand pour tactile */
  #mobile-menu-btn {
    min-width: 48px !important;
    min-height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Menu mobile plein écran */
  #mobile-menu {
    position: fixed !important;
    top: 64px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: #141414 !important;
    overflow-y: auto !important;
    z-index: 9998 !important;
    padding: 1rem !important;
  }
  
  #mobile-menu a {
    font-size: 1.125rem !important;
    padding: 1rem !important;
    min-height: 48px !important;
    display: flex !important;
    align-items: center !important;
  }
  
  /* Ajuster le contenu principal pour le header fixe */
  main {
    padding-top: 4px !important;
  }
}

/* ============================================
   MENU DROPDOWN "BIENTÔT" - RESPONSIVE
   ============================================ */

/* Sur desktop : hover fonctionne */
@media (min-width: 1024px) {
  header .group:hover .absolute {
    opacity: 1 !important;
    visibility: visible !important;
  }
}

/* Sur mobile/tablette : click/touch au lieu de hover */
@media (max-width: 1023px) {
  /* Masquer le menu dropdown desktop */
  header .group .absolute {
    display: none !important;
  }
  
  /* Version mobile dans le menu hamburger */
  #mobile-menu .text-innovx-yellow {
    display: block !important;
    padding: 0.75rem 1rem !important;
    font-weight: 600 !important;
    border-bottom: 1px solid rgba(247, 219, 97, 0.2) !important;
  }
  
  #mobile-menu .pl-6 {
    padding-left: 2rem !important;
  }
  
  #mobile-menu .pl-6 .text-gray-400 {
    padding: 0.75rem 0.5rem !important;
    border-left: 2px solid rgba(247, 219, 97, 0.3) !important;
    margin-left: 0.5rem !important;
    font-size: 0.95rem !important;
  }
  
  /* Supprimer les lignes jaunes du menu Mon Compte sur mobile */
  #mobile-mon-compte-menu a,
  #mobile-mon-compte-menu .flex.items-center {
    border-left: none !important;
    padding-left: 0.75rem !important;
  }
  
  #mobile-mon-compte-menu .flex.flex-col {
    padding-left: 0 !important;
  }
}

/* ============================================
   SIDEBARS (FORMATIONS, PUBLICITÉ) - RESPONSIVE
   ============================================ */

/* Desktop (1024px+) : sidebar visible normalement */
@media (min-width: 1024px) {
  aside.w-64 {
    display: flex !important;
    width: 16rem !important;
    position: sticky !important;
    top: 0 !important;
    height: 100vh !important;
    overflow-y: auto !important;
  }
  
  main.flex-1 {
    margin-left: 0 !important;
  }
}

/* Tablette et mobile (max 1023px) : sidebar en drawer coulissant */
@media (max-width: 1023px) {
  /* Masquer la sidebar par défaut */
  aside.w-64 {
    position: fixed !important;
    top: 64px !important;
    left: -100% !important;
    width: 280px !important;
    max-width: 80vw !important;
    height: calc(100vh - 64px) !important;
    z-index: 9997 !important;
    transition: left 0.3s ease-in-out !important;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3) !important;
  }
  
  /* Sidebar ouverte */
  aside.w-64.sidebar-open {
    left: 0 !important;
  }
  
  /* Overlay pour fermer la sidebar */
  .sidebar-overlay {
    position: fixed !important;
    top: 64px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 9996 !important;
    display: none !important;
  }
  
  .sidebar-overlay.active {
    display: block !important;
  }
  
  /* Bouton pour ouvrir la sidebar sur mobile */
  .sidebar-toggle-btn {
    position: fixed !important;
    top: 70px !important;
    left: 10px !important;
    z-index: 9998 !important;
    background: #f7db61 !important;
    color: #000 !important;
    border: 2px solid #000 !important;
    border-radius: 0.5rem !important;
    padding: 0.75rem !important;
    min-width: 48px !important;
    min-height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s ease !important;
  }
  
  .sidebar-toggle-btn:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  }
  
  .sidebar-toggle-btn i {
    font-size: 1.25rem !important;
  }
  
  /* Contenu principal prend toute la largeur */
  main.flex-1 {
    margin-left: 0 !important;
    width: 100% !important;
  }
  
  /* Ajuster le padding du contenu pour éviter le chevauchement avec le bouton */
  main.flex-1 > div {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}

/* Mobile très petit (max 480px) */
@media (max-width: 480px) {
  aside.w-64 {
    width: 90vw !important;
  }
  
  .sidebar-toggle-btn {
    top: 65px !important;
    left: 8px !important;
    padding: 0.625rem !important;
  }
  
  /* Navigation sidebar plus compacte */
  aside nav a {
    font-size: 0.875rem !important;
    padding: 0.625rem 0.75rem !important;
  }
  
  aside h3 {
    font-size: 0.7rem !important;
  }
}

/* ============================================
   FOOTER - RESPONSIVE
   ============================================ */

/* Tablette (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  footer .lg\:grid-cols-6 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 2rem !important;
  }
  
  footer h3 {
    font-size: 1rem !important;
  }
  
  footer .text-sm {
    font-size: 0.875rem !important;
  }
}

/* Mobile (max 767px) */
@media (max-width: 767px) {
  footer {
    padding: 2rem 1rem !important;
  }
  
  footer .lg\:grid-cols-6 {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
  
  footer h3 {
    font-size: 1.125rem !important;
    margin-bottom: 0.75rem !important;
  }
  
  footer .text-sm {
    font-size: 0.875rem !important;
  }
  
  footer .text-2xl {
    font-size: 1.5rem !important;
  }
  
  footer input[type="email"] {
    font-size: 0.875rem !important;
    padding: 0.75rem 1rem !important;
  }
  
  footer .text-xs {
    font-size: 0.75rem !important;
  }
}

/* ============================================
   ANIMATIONS ET TRANSITIONS
   ============================================ */

/* Animation d'ouverture du menu mobile */
@keyframes slideInDown {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

#mobile-menu:not(.hidden) {
  animation: slideInDown 0.3s ease-out;
}

/* Animation d'ouverture de la sidebar */
@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

aside.sidebar-open {
  animation: slideInLeft 0.3s ease-out;
}

/* ============================================
   AMÉLIORATIONS UX TACTILE
   ============================================ */

/* Zones de touch plus grandes sur mobile */
@media (max-width: 767px) {
  a, button {
    min-height: 44px !important;
    min-width: 44px !important;
  }
  
  /* Feedback visuel au touch */
  a:active, button:active {
    opacity: 0.7 !important;
    transform: scale(0.98) !important;
  }
}

/* Amélioration du scroll sur les menus longs */
aside nav,
#mobile-menu {
  scrollbar-width: thin;
  scrollbar-color: #f7db61 #141414;
}

aside nav::-webkit-scrollbar,
#mobile-menu::-webkit-scrollbar {
  width: 6px;
}

aside nav::-webkit-scrollbar-track,
#mobile-menu::-webkit-scrollbar-track {
  background: #141414;
}

aside nav::-webkit-scrollbar-thumb,
#mobile-menu::-webkit-scrollbar-thumb {
  background: #f7db61;
  border-radius: 3px;
}

aside nav::-webkit-scrollbar-thumb:hover,
#mobile-menu::-webkit-scrollbar-thumb:hover {
  background: #fae089;
}

/* ============================================
   ACCESSIBILITÉ
   ============================================ */

/* Focus visible pour navigation au clavier */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #f7db61 !important;
  outline-offset: 2px !important;
}

/* Texte du menu mobile plus lisible */
#mobile-menu a {
  line-height: 1.5 !important;
  letter-spacing: 0.01em !important;
}

/* Contraste amélioré pour les sous-menus */
aside .space-y-1 a {
  transition: all 0.2s ease !important;
}

aside .space-y-1 a:hover {
  background: rgba(247, 219, 97, 0.15) !important;
}


