/* Base responsive styles for all devices */
* {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  overflow-x: hidden;
}

body.menu-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

img {
  max-width: 100%;
  height: auto;
}

a, button {
  touch-action: manipulation;
}

.menu-toggle {
  display: none !important;
}

.nav-close {
  display: none !important;
}

@media screen and (max-width: 1024px) {
  .container {
    width: 90%;
    padding: 0 15px;
  }

  .menu-toggle, #menu-toggle, #mobile-menu {
    display: none !important;
  }

  .menu-overlay {
    display: none !important;
  }

  .services-grid, .features-grid, .footer-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .pricing-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  #navbar {
    position: fixed !important;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background-color: var(--secondary-color);
    z-index: 1000;
    padding-top: 70px;
    transition: right 0.3s ease;
    overflow-y: auto;
  }

  #navbar.active {
    right: 0;
  }

  #navbar ul {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
  }

  #navbar ul li {
    width: 100%;
    margin: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

  #navbar ul li a {
    display: block;
    padding: 15px 20px;
    text-align: left;
    font-size: 16px;
  }

  #navbar ul li.active a {
    border-left: 4px solid var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
  }

  header .container {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}

@media screen and (max-width: 767px) {
  /* Structure du header optimisée */
  header {
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  }
  
  header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  /* Logo plus compact */
  .logo h1 {
    font-size: 22px;
    margin: 0;
  }
  
  /* Meilleur espace pour les icônes et boutons tactiles */
  .service-icon, 
  .feature-icon, 
  .social-media a,
  .btn,
  .hamburger-menu,
  #navbar ul li a {
    min-height: 48px; /* Taille minimale recommandée pour zone tactile */
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .btn {
    justify-content: center;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
  }
  
  /* Améliorer l'espacement des sections */
  section {
    padding: 30px 0;
  }
  
  .section-title {
    margin-bottom: 25px;
    font-size: 24px;
    text-align: center;
  }
  
  /* Optimiser les cartes de services */
  .service-card {
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    background-color: #fff;
  }
  
  .service-card h3 {
    font-size: 18px;
    margin: 15px 0 10px;
  }
  
  /* Meilleure lisibilité du texte */
  p {
    font-size: 16px;
    line-height: 1.6;
  }
  
  /* Améliorer le menu hamburger */
  .hamburger-menu {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.1);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
  }
  
  .hamburger-menu span {
    width: 24px;
    height: 3px;
    margin: 4px 0;
    border-radius: 3px;
  }
  
  /* Style du menu mobile */
  #navbar {
    background-color: var(--secondary-color);
    padding-top: 60px;
  }
  
  #navbar ul li a {
    padding: 15px 20px;
    font-size: 18px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    transition: background-color 0.2s ease;
  }
  
  #navbar ul li a:active {
    background-color: rgba(255,255,255,0.2);
  }
  
  /* Optimiser les grilles pour mobile */
  .services-grid,
  .features-grid,
  .footer-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  /* Optimiser la section hero */
  .hero {
    padding: 40px 0;
    background-position: center;
  }
  
  .hero-content {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    background-color: rgba(255,255,255,0.9);
  }
  
  .hero h2 {
    font-size: 24px;
    margin-bottom: 15px;
  }
  
  .hero p {
    font-size: 16px;
    margin-bottom: 25px;
  }
  
  .hero-buttons {
    flex-direction: column;
    gap: 15px;
  }
  
  /* Optimisation pour la section hero en mobile */
  .hero-content h2,
  .hero-content p {
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  }
  
  /* Fond semi-transparent pour améliorer la lisibilité */
  .hero-content {
    background-color: rgba(0, 0, 0, 0.4);
    padding: 15px;
    border-radius: 8px;
  }
  
  /* Boutons plus visibles */
  .hero-buttons .btn {
    min-width: 100%;
    margin: 10px 0;
    font-weight: 600;
  }
  
  /* Optimisation du footer */
  footer {
    padding: 30px 0;
  }
  
  .footer-content > div {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  
  .footer-content > div:last-child {
    border-bottom: none;
  }
  
  .footer-contact ul li {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    font-size: 15px;
  }
  
  .footer-contact ul li i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
  }
  
  .social-media {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
  }
  
  /* État actif du menu visible */
  #navbar ul li.active a {
    border-left: 4px solid var(--primary-color);
    background-color: rgba(255,255,255,0.1);
    font-weight: bold;
  }
}

@media screen and (max-width: 480px) {
  .hero h2 {
    font-size: 20px;
  }

  .hero p {
    font-size: 16px;
  }

  .hero-buttons {
    flex-direction: column;
  }

  .menu-toggle {
    font-size: 28px;
    padding: 12px;
  }

  .pricing-card-title {
    flex-direction: column;
    text-align: center;
  }

  .pricing-card-price {
    margin-top: 10px;
  }

  .pricing-badge {
    right: 10px;
  }

  .footer-content > div {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

  .footer-content > div:last-child {
    border-bottom: none;
  }

  .footer-bottom {
    text-align: center;
    flex-direction: column;
  }

  .footer-bottom p {
    margin: 5px 0;
  }

  .desktop-only {
    display: none;
  }

  .container {
    width: 92%;
    padding: 0 10px;
  }
  
  .logo h1 {
    font-size: 20px;
  }
  
  .hamburger-menu {
    width: 44px;
    height: 44px;
  }
  
  .section-title {
    font-size: 22px;
  }
  
  .service-card, .feature {
    padding: 15px;
  }
  
  /* Améliorer la performance de scroll */
  html {
    scroll-behavior: smooth;
  }
  
  /* Limiter les animations sur mobile pour de meilleures performances */
  .service-card, .feature {
    transition: none;
  }
}

/* Menu hamburger personnalisé avec trois traits */
.hamburger-menu {
  display: none;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  position: relative;
  z-index: 1001;
  margin-left: auto;
}

.hamburger-menu span {
  display: block;
  width: 25px;
  height: 3px;
  background-color: #fff;
  margin: 5px auto;
  transition: all 0.3s ease-in-out;
  border-radius: 2px;
}

/* Animation du menu hamburger */
.hamburger-menu.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.hamburger-menu.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Overlay pour fermer le menu */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

@media screen and (min-width: 1025px) {
  /* Toujours afficher la navigation sur desktop */
  #navbar {
    display: block !important;
  }
  
  /* Masquer le menu hamburger sur desktop */
  .hamburger-menu {
    display: none;
  }
  
  .mobile-nav-overlay {
    display: none;
  }
}

@media screen and (max-width: 1024px) {
  /* Afficher le menu hamburger uniquement sur tablettes/mobiles */
  .hamburger-menu {
    display: block;
  }
  
  /* Cacher le menu par défaut sur mobile */
  #navbar {
    position: fixed !important;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background-color: var(--secondary-color);
    z-index: 1000;
    padding-top: 70px;
    transition: right 0.3s ease;
    overflow-y: auto;
  }
  
  /* Afficher le menu quand il est actif */
  #navbar.active {
    right: 0;
  }
  
  #navbar ul {
    flex-direction: column;
    padding: 0;
    margin: 0;
  }
  
  #navbar ul li {
    width: 100%;
    margin: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  
  #navbar ul li a {
    display: block;
    padding: 15px 20px;
    text-align: left;
    font-size: 16px;
  }
  
  #navbar ul li.active a {
    border-left: 4px solid var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
  }
  
  /* Empêcher les autres styles de menu de s'appliquer */
  .menu-toggle, #menu-toggle {
    display: none !important;
  }
  
  .menu-overlay {
    display: none !important;
  }

  .services-grid, .features-grid, .footer-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .pricing-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  #navbar {
    position: fixed !important;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background-color: var(--secondary-color);
    z-index: 1000;
    padding-top: 70px;
    transition: right 0.3s ease;
    overflow-y: auto;
  }

  #navbar.active {
    right: 0;
  }

  #navbar ul {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
  }

  #navbar ul li {
    width: 100%;
    margin: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

  #navbar ul li a {
    display: block;
    padding: 15px 20px;
    text-align: left;
    font-size: 16px;
  }

  #navbar ul li.active a {
    border-left: 4px solid var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
  }

  header .container {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}

@media screen and (max-width: 767px) {
  .hamburger-menu {
    width: 40px;
    height: 40px;
  }

  .hamburger-menu span {
    width: 22px;
  }
}
