/* ─── SERVICES CONTAINER (Flexbox pour centrage auto dernière ligne) ─── */
.services-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* ✅ Centre automatiquement les cartes de la dernière ligne */
  gap: 30px;
  margin: 0 auto;
  max-width: 1400px;
  padding: 0 20px;
}

/* ─── SERVICE CARD ───────────────────────────────────────────── */
.service-card {
  position: relative;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 380px;
  
  /* ✅ Calcul précis pour 4 colonnes avec gap de 30px */
  flex: 0 0 calc(25% - 22.5px);
  max-width: calc(25% - 22.5px);
}

/* ─── IMAGE & CONTENU ────────────────────────────────────────── */
.service-image {
  position: relative;
  width: 100%;
  height: 250px;
  overflow: hidden;
  background: #f8f9fa;
}

.service-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.5s ease;
}

.service-card:hover .service-image img {
  transform: scale(1.08);
}

.service-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
  z-index: 1;
  pointer-events: none;
}

.service-card:hover .service-image::after {
  background: rgba(0, 0, 0, 0.2);
}

.service-content {
  padding: 20px;
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.service-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a202c;
  margin: 0 0 10px 0;
  line-height: 1.4;
  padding-right: 80px;
}

/* Bouton Zoom */
.service-content .preview-link {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(71, 178, 228, 0.15);
  color: #47b2e4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  text-decoration: none;
  transition: all 0.3s ease;
  z-index: 3;
  border: 2px solid transparent;
}

.service-content .preview-link:hover {
  background: #47b2e4;
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(71, 178, 228, 0.4);
}

/* Bouton Maps */
.service-content .details-link {
  position: absolute;
  top: 64px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  text-decoration: none;
  transition: all 0.3s ease;
  z-index: 3;
  border: 2px solid transparent;
}

.service-content .details-link:hover {
  background: #dc3545;
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

/* Hover premium */
.service-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
}

/* ─── RESPONSIVE PRÉCIS ─────────────────────────────────────── */

/* Tablette large : 3 colonnes */
@media (max-width: 1199px) {
  .service-card {
    flex: 0 0 calc(33.333% - 20px);
    max-width: calc(33.333% - 20px);
  }
  .service-image { height: 230px; }
}

/* Tablette : 2 colonnes */
@media (max-width: 991px) {
  .services-grid { gap: 20px; padding: 0 15px; }
  .service-card {
    flex: 0 0 calc(50% - 15px);
    max-width: calc(50% - 15px);
  }
  .service-image { height: 220px; }
  .service-card { min-height: 370px; }
}

/* Mobile : 1 colonne */
@media (max-width: 767px) {
  .services-grid {
    gap: 25px;
    padding: 0 15px;
  }
  .service-card {
    flex: 0 0 100%;
    max-width: 480px;
    margin: 0 auto;
    min-height: 390px;
  }
  .service-image { height: 240px; }
  .service-title { font-size: 15px; padding-right: 70px; }
  
  .service-content .preview-link,
  .service-content .details-link {
    width: 32px; height: 32px; font-size: 14px;
  }
  .service-content .preview-link { top: 15px; right: 15px; }
  .service-content .details-link { top: 54px; right: 15px; }
}

/* Petit mobile */
@media (max-width: 480px) {
  .services-grid { padding: 0 10px; gap: 20px; }
  .service-card { min-height: 360px; border-radius: 15px; }
  .service-image { height: 200px; }
  .service-content { padding: 15px; }
  .service-title { font-size: 14px; padding-right: 65px; }
  
  .service-content .preview-link,
  .service-content .details-link {
    width: 30px; height: 30px; font-size: 13px;
  }
  .service-content .preview-link { top: 12px; right: 12px; }
  .service-content .details-link { top: 48px; right: 12px; }
}

/* ─── RTL SUPPORT ───────────────────────────────────────────── */
[dir="rtl"] .service-title { padding-right: 0; padding-left: 80px; }
[dir="rtl"] .service-content .preview-link,
[dir="rtl"] .service-content .details-link { right: auto; left: 20px; }

@media (max-width: 767px) and (dir="rtl") {
  .service-content .preview-link, .service-content .details-link { left: 15px; }
  .service-title { padding-left: 70px; }
}
@media (max-width: 480px) and (dir="rtl") {
  .service-content .preview-link, .service-content .details-link { left: 12px; }
  .service-title { padding-left: 65px; }
}