/* === Style global du corps === */
body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(to bottom right, rgba(255,255,255,0.1), rgba(200,200,255,0.15));
  backdrop-filter: blur(10px);
  color: #333;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  transition: background-color 0.4s ease, color 0.4s ease;
  user-select: none; /* Empêche la sélection de texte */
  -webkit-user-select: none;
  -ms-user-select: none;
}

/* === Header principal === */
header {
  background: rgba(255,255,255,0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  transform-style: preserve-3d;
  perspective: 800px;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  transform: translateZ(0);
}

/* Effet 3D au survol du header */
header:hover {
  transform: rotateX(3deg) translateZ(15px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  cursor: default;
}

/* === Sections du header === */
.header-left {
  display: flex;
  align-items: center;
}

.name {
  font-size: 1.3rem;
  font-weight: bold;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px; /* Espace entre icônes */
}

/* Liens et bouton du header (mail, whatsapp, thème) */
.header-right a,
#theme-toggle {
  text-decoration: none;
  border: none;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin: 0;
  color: #333;
  transition: color 0.4s ease, transform 0.4s ease;
}

/* Icônes dans le header */
.header-right i,
#theme-toggle i {
  font-size: 28px;
  margin: 0;
  pointer-events: none; /* Pas de clic sur icône */
  transition: color 0.4s ease, transform 0.4s ease;
}

#theme-toggle i {
  font-size: 24px;
  background: transparent;
  box-shadow: none;
}

/* Animation au survol des icônes et bouton */
.header-right a:hover i,
#theme-toggle:hover i {
  transform: scale(1.2);
  color: #007AFF; /* Bleu vif */
}

/* Style du bouton thème (transparent, sans bordure) */
#theme-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
}

/* Couleur et transition de l’icône thème */
#theme-toggle i {
  color: #333;
  pointer-events: none;
}

/* Couleur et zoom au hover */
#theme-toggle:hover i {
  color: #007AFF;
  transform: scale(1.2);
}

/* === Contenu principal en deux colonnes === */
.main-content {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem;
  flex-wrap: wrap; /* Responsive wrap */
}

/* Colonne services à gauche */
.left-services {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1 1 300px;
  max-width: 400px;
}

/* Colonne carte à droite */
.right-map {
  flex: 1 1 500px;
}

/* === Tuiles (services) === */
.tile {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  color: #222;
  width: 100%;
  height: 90px;
  padding: 0.5rem;
  text-align: center;
  transition: all 0.3s ease;
  overflow: hidden;
  cursor: pointer;
  position: relative;

  /* Flexbox pour centrer contenu */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Survol avec légère mise en avant */
.tile:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  transform: scale(1.03) rotateX(2deg);
  z-index: 10;
}

/* Tuiles étendues avec contenu visible */
.tile.expanded {
  height: 200px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.15);
  cursor: default;
  transform: scale(1.03) rotateX(2deg);
  z-index: 10;
}

.tile.expanded .details {
  opacity: 1;
  max-height: 500px;
  pointer-events: auto;
  color: #222;
}

/* Titres des tuiles */
.tile .title {
  color: #222;
  font-weight: bold;
  font-size: 1rem;
  margin-top: 6px;
}

/* Détails cachés par défaut, s’affichent au hover/expand */
.tile .details {
  color: #333;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, max-height 0.4s ease;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Icônes dans les tuiles */
.tile i {
  color: #007AFF;
  transition: color 0.3s ease, transform 0.3s ease;
  font-size: 22px;
  margin: 0 4px;
  opacity: 1;
}

/* Changement couleur et taille icônes au hover */
.tile:hover i {
  color: #0051d4;
  transform: scale(1.2);
}

/* === Carte Leaflet === */
#map {
  height: 450px;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.4s ease;
  max-width: 100%;
  box-sizing: border-box;
  filter: none !important;
}

/* Cacher les crédits et logo Leaflet */
.leaflet-control-attribution,
.leaflet-control-container .leaflet-control-logo {
  display: none !important;
}

/* Style des popups Leaflet */
.leaflet-popup-content-wrapper {
  background: rgba(255, 255, 255, 0.85) !important;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  margin-bottom: 12px; /* pour positionner correctement */
}

/* Supprimer la flèche sur les popups */
.leaflet-popup-tip-container {
  display: none !important;
}

/* === Footer === */
footer {
  background: linear-gradient(135deg, #1a1a1a, #333333);
  color: #ddd;
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.9rem;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.4);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  border-radius: 8px 8px 0 0;
  line-height: 1.6;
  letter-spacing: 0.02em;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Liens dans le footer et popups */
footer a.footer-link,
footer a,
.popup-content a {
  color: #66ccff;
  text-decoration: none;
  font-weight: 600;
  margin-left: 0.4rem;
  transition: color 0.3s ease, transform 0.3s ease;
}

/* Effets au hover sur liens */
footer a.footer-link:hover,
footer a:hover {
  color: #3399ff;
  text-decoration: underline;
  transform: scale(1.05);
}

/* === Animation pour footer au chargement === */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
      }
}

footer {
  animation: fadeInUp 0.8s ease forwards;
}

/* === Styles des popups modales === */
.popup {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: border-box;
}

.popup.fadeIn {
  animation: fadeInAnim 0.3s ease forwards;
}

.popup.fadeOut {
  animation: fadeOutAnim 0.3s ease forwards;
}

.popup-content {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(18px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 2rem;
  max-width: 600px;
  max-height: calc(90vh - env(safe-area-inset-bottom));
  overflow-y: auto;
  position: relative;
  outline: none;
  box-sizing: border-box;
  margin-bottom: env(safe-area-inset-bottom);
}

@supports(padding: max(env(safe-area-inset-bottom))) {
  .popup-content {
    max-height: calc(90vh - max(env(safe-area-inset-bottom)));
  }
}

/* Boutons fermer popup */
#close-popup,
#close-apropos {
  position: absolute;
  top: 15px;
  left: 15px;
  width: 18px;
  height: 18px;
  background-color: rgba(255, 0, 0, 0.6);
  border-radius: 50%;
  border: 1.5px solid rgba(255, 0, 0, 0.9);
  cursor: pointer;
  box-shadow:
    0 0 6px rgba(255, 0, 0, 0.8),
    0 0 10px rgba(255, 0, 0, 0.5);
  transition: box-shadow 0.3s ease;
  z-index: 1000;
}

#close-popup:hover,
#close-apropos:hover {
  box-shadow:
    0 0 10px rgba(255, 0, 0, 1),
    0 0 15px rgba(255, 0, 0, 0.7);
}

/* Popup style verre dépoli Leaflet */
.liquid-glass-popup {
  padding: 0.5rem !important;
  position: relative !important;
}

/* Bouton fermer des popups Leaflet */
.popup-close-btn {
  position: absolute;
  top: -10px;
  right: -20px;
  width: 18px;
  height: 18px;
  background-color: rgba(255, 0, 0, 0.6);
  border-radius: 50%;
  border: 1.5px solid rgba(255, 0, 0, 0.9);
  cursor: pointer;
  box-shadow:
    0 0 6px rgba(255, 0, 0, 0.8),
    0 0 10px rgba(255, 0, 0, 0.5);
  transition: box-shadow 0.3s ease;
  z-index: 1000;
}

.popup-close-btn:hover {
  box-shadow:
    0 0 10px rgba(255, 0, 0, 1),
    0 0 15px rgba(255, 0, 0, 0.7);
}

/* Cacher les éléments */
.hidden {
  display: none;
}

/* Animations fade in/out pour popups */
@keyframes fadeInAnim {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeOutAnim {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
}

/* === Responsive pour écrans < 992px === */
@media screen and (max-width: 992px) {
  .main-content {
    flex-direction: column;
    padding-left: env(safe-area-inset-left, 1rem);
    padding-right: env(safe-area-inset-right, 1rem);
    padding-top: 1rem;
    padding-bottom: 2rem;
    gap: 2rem;
  }

  .tile,
  #map {
    width: calc(100vw - env(safe-area-inset-left, 1rem) - env(safe-area-inset-right, 1rem) - 2rem);
    max-width: 400px;
    margin: 0 auto;
    box-sizing: border-box;
  }

  .right-map {
    order: 2;
    flex: 1 1 auto;
    max-width: 100%;
  }

  .left-services {
    order: 1;
    max-width: 100%;
    flex: 1 1 auto;
  }

  .popup-content {
    max-width: 90vw;
    padding: 1.5rem 1rem;
    border-radius: 10px;
  }

  .popup-content i {
    margin-right: 6px;
    color: #007AFF;
    font-size: 1rem;
  }
}