/**
 * IT2Help - Améliorations UI/UX Mobile
 * Ce fichier contient des améliorations ciblées pour l'interface mobile du site IT2Help.
 * Ces styles sont uniquement appliqués aux appareils mobiles (écrans ≤ 768px).
 */

/* Améliorations mobiles minimales et correctifs ergonomiques */
@media screen and (max-width: 768px) {
  /* Correction du débordement horizontal */
  html,
  body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  /* Zone de clic plus grande pour les boutons et liens */
  a,
  button,
  .btn-primary,
  .btn-outline {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
  }

  /* Images responsives */
  img {
    max-width: 100%;
    height: auto;
  }

  /* Correction du menu mobile si besoin */
  .mobile-menu {
    width: 100vw;
    left: 0;
    right: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: none;
  }

  .mobile-menu.active {
    display: block;
  }

  /* Correction du header sticky */
  .main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    z-index: 1000;
  }

  /* Correction des marges excessives sur mobile */
  .message-success,
  .message-error {
    margin-left: 0.5rem;
    margin-right: 0.5rem;
  }

  .mobile-menu-btn {
    display: flex !important;
  }
  .nav-links {
    display: none !important;
  }

  /* --- CORRECTION CARTES DE SERVICES MOBILE --- */
  .services-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
    padding: 0 1rem !important;
    margin-bottom: 2rem !important;
  }

  .service-card {
    padding: 2rem 1.5rem !important;
    margin: 0 !important;
    min-height: auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .service-card .service-icon {
    margin-bottom: 1rem !important;
  }

  .service-card h3 {
    font-size: 1.3rem !important;
    margin-bottom: 0.75rem !important;
  }

  .service-card p {
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
    margin-bottom: 0.5rem !important;
  }

  /* Structure des icônes SVG - Force les cercles parfaits */
  .service-card .service-icon {
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    min-height: 60px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    aspect-ratio: 1/1 !important;
  }

  .service-card .service-icon svg {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    flex-shrink: 0 !important;
  }

  /* Espacement spécifique pour la section services */
  .services-preview {
    padding: 2rem 0 !important;
  }

  .services-preview .section-header {
    margin-bottom: 2rem !important;
  }
}

@media (min-width: 769px) {
  .mobile-menu {
    display: none !important;
  }
  .mobile-menu-btn {
    display: none !important;
  }
  .nav-links {
    display: block !important;
  }
}

/* Accessibilité : réduction des animations sur mobile */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- CORRECTION FINALE MENU MOBILE V3 --- */
/* Animation pour le bouton hamburger */
.mobile-menu-btn.active .bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg) !important;
}

.mobile-menu-btn.active .bar:nth-child(2) {
  opacity: 0 !important;
}

.mobile-menu-btn.active .bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg) !important;
}

/* Empêcher le défilement quand le menu est ouvert */
body.menu-open {
  overflow: hidden !important;
}

/* Animation pour les éléments au scroll */
.to-animate {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate {
  opacity: 1;
  transform: translateY(0);
}

/* Animation pour les alertes */
.alert {
  transition: opacity 0.3s ease;
}

/* --- CORRECTION FINALE MENU MOBILE V2 --- */
/* Masquer complètement le menu mobile par défaut */
.mobile-menu {
  display: none !important;
  position: fixed;
  top: var(--navbar-height, 60px);
  left: 0;
  width: 100vw;
  height: calc(100vh - var(--navbar-height, 60px));
  background-color: rgba(255, 255, 255, 0.98);
  z-index: 999;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.mobile-menu.active {
  display: block !important;
  transform: translateX(0);
}

/* Bouton hamburger - styles fixes */
.mobile-menu-btn {
  width: 40px !important;
  height: 40px !important;
  display: none !important;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: none !important;
  border: none !important;
  cursor: pointer;
  z-index: 1100;
  padding: 8px;
}

.mobile-menu-btn .bar {
  width: 28px !important;
  height: 4px !important;
  background: #333 !important;
  margin: 3px 0 !important;
  border-radius: 2px !important;
  transition: all 0.3s ease !important;
  display: block !important;
}

/* MOBILE UNIQUEMENT */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex !important;
  }
  .nav-links {
    display: none !important;
  }
}

/* DESKTOP UNIQUEMENT */
@media (min-width: 769px) {
  .mobile-menu,
  .mobile-menu.active {
    display: none !important;
  }
  .mobile-menu-btn {
    display: none !important;
  }
  .nav-links {
    display: block !important;
  }
}
