/* ====== BASE STYLES ====== */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* ====== MODE SOMBRE ====== */
body.dark-theme {
  background: #1a1a1a;
  color: #e0e0e0;
}

body.dark-theme .bg-light {
  background-color: #2d2d2d !important;
}

body.dark-theme .card {
  background-color: #333;
  color: #e0e0e0;
  border-color: #444;
}

body.dark-theme .text-muted {
  color: #aaa !important;
}

body.dark-theme .btn-primary {
  background-color: #0d6efd;
  border-color: #0d6efd;
}

body.dark-theme .btn-primary:hover {
  background-color: #0b5ed7;
  border-color: #0b5ed7;
}

body.dark-theme footer {
  background-color: #2d2d2d !important;
}

body.dark-theme .modal-content {
  background-color: #333;
  color: #e0e0e0;
}

body.dark-theme .modal-header {
  background-color: #2d2d2d;
  border-bottom-color: #444;
}

body.dark-theme .image-container {
  background-color: #2d2d2d;
}

/* ====== TYPOGRAPHIE RESPONSIVE ====== */
h2.fw-bold {
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  color: #222;
  margin-bottom: 1rem;
}

h3.fw-bold {
  font-weight: 700;
  color: #0d6efd;
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  margin-bottom: 0.8rem;
}

h5.fw-bold {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
}

p {
  font-size: clamp(0.9rem, 2vw, 1rem);
}

.text-muted.fs-5 {
  font-size: clamp(1rem, 2.5vw, 1.25rem) !important;
}

/* ====== CONTENEURS RESPONSIVE ====== */
.container {
  padding-left: clamp(15px, 3vw, 30px);
  padding-right: clamp(15px, 3vw, 30px);
}

#services {
  padding-top: clamp(2rem, 8vw, 5rem);
  padding-bottom: clamp(2rem, 8vw, 5rem);
}

/* ====== GRILLE RESPONSIVE ====== */
.row.g-4 {
  --bs-gutter-x: clamp(1rem, 3vw, 1.5rem);
  --bs-gutter-y: clamp(1rem, 3vw, 1.5rem);
}

/* ====== CARTES RESPONSIVE ====== */
.card {
  border-radius: clamp(0.5rem, 2vw, 1rem);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%;
}

.card-body {
  padding: clamp(1rem, 3vw, 1.5rem);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0.8rem 1.5rem rgba(13, 110, 253, 0.3);
}

/* Désactiver hover sur mobile */
@media (hover: none) and (pointer: coarse) {
  .card:hover {
    transform: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  }
}

/* ====== BOUTONS RESPONSIVE ====== */
.btn-primary {
  background-color: #0d6efd;
  border: none;
  font-weight: 600;
  padding: clamp(0.5rem, 2vw, 0.6rem) clamp(1rem, 3vw, 1.4rem);
  border-radius: 50px;
  transition: background-color 0.3s ease;
  font-size: clamp(0.8rem, 2vw, 1rem);
  white-space: nowrap;
}

.btn-primary:hover {
  background-color: #0b5ed7;
}

/* ====== LISTES RESPONSIVE ====== */
ul {
  padding-left: clamp(1rem, 3vw, 1.2rem);
}

ul li {
  margin-bottom: clamp(0.2rem, 1vw, 0.4rem);
  font-size: clamp(0.85rem, 2vw, 0.95rem);
}

/* ====== BADGE OFFRE RECOMMANDÉE ====== */
.recommended-badge {
  position: absolute;
  top: -12px;
  right: clamp(8px, 2vw, 12px);
  background: #ffc107;
  color: #212529;
  font-size: clamp(0.7rem, 1.5vw, 0.8rem);
  font-weight: 700;
  padding: clamp(3px, 1vw, 4px) clamp(8px, 2vw, 10px);
  border-radius: 0.4rem;
  box-shadow: 0 0 5px rgb(0 0 0 / 0.15);
  user-select: none;
  white-space: nowrap;
}

/* ====== BOUTON CONTACT FIXE ====== */
.contact-btn-fixed {
  position: fixed;
  top: clamp(15px, 3vw, 20px);
  left: clamp(15px, 3vw, 20px);
  z-index: 1000;
}

.contact-btn {
  background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
  border: none;
  color: white;
  font-weight: 600;
  padding: clamp(0.4rem, 2vw, 0.6rem) clamp(0.8rem, 3vw, 1.2rem);
  border-radius: 25px;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
  font-size: clamp(0.7rem, 2vw, 0.9rem);
  display: inline-flex;
  align-items: center;
  gap: clamp(0.2rem, 1vw, 0.4rem);
  white-space: nowrap;
}

.contact-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13, 110, 253, 0.4);
  color: white;
  text-decoration: none;
}

/* ====== TOGGLE THÈME ====== */
.theme-toggle-fixed {
  position: fixed;
  top: clamp(15px, 3vw, 20px);
  right: clamp(15px, 3vw, 20px);
  z-index: 1000;
}

.theme-toggle-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 25px;
  width: clamp(50px, 8vw, 60px);
  height: clamp(25px, 4vw, 30px);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  position: relative;
  overflow: hidden;
  outline: none;
}

.theme-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(clamp(25px, 4vw, 30px) - 4px);
  height: calc(clamp(25px, 4vw, 30px) - 4px);
  background: white;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.toggle-icons {
  font-size: clamp(8px, 1.5vw, 10px);
  transition: all 0.3s ease;
}

.sun-icon {
  opacity: 1;
  transform: scale(1);
  transition: all 0.3s ease;
}

.moon-icon {
  opacity: 0;
  transform: scale(0);
  position: absolute;
  transition: all 0.3s ease;
}

body.dark-theme .theme-toggle-btn {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

body.dark-theme .toggle-slider {
  transform: translateX(calc(clamp(50px, 8vw, 60px) - clamp(25px, 4vw, 30px)));
  background: #f39c12;
}

body.dark-theme .sun-icon {
  opacity: 0;
  transform: scale(0);
}

body.dark-theme .moon-icon {
  opacity: 1;
  transform: scale(1);
}

/* ====== COMPARAISON AVANT/APRÈS ====== */
.compare-box {
  position: relative;
  width: 100%;
  max-width: min(800px, 90vw);
  height: clamp(200px, 40vw, 500px);
  margin: 0 auto 20px auto;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
  border-radius: 0.5rem;
}

.compare-box:hover {
  transform: scale(1.02);
}

.compare-box img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0.5rem;
}

#img-before { 
  z-index: 1; 
}

#img-after {
  z-index: 2;
  clip-path: inset(0 50% 0 0);
}

.compare-slider {
  width: 100%;
  max-width: min(800px, 90vw);
  margin: 10px auto 0 auto;
  display: block;
  height: clamp(20px, 3vw, 30px);
}

/* ====== MODAL RESPONSIVE ====== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: clamp(10px, 2vw, 20px);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  border-radius: clamp(8px, 2vw, 12px);
  max-width: min(95vw, 1200px);
  max-height: min(95vh, 800px);
  width: 100%;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalAppear 0.3s ease-out;
  position: relative;
}

@keyframes modalAppear {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  top: clamp(10px, 2vw, 20px);
  right: clamp(10px, 2vw, 20px);
  background: rgba(0, 0, 0, 0.7);
  border: none;
  font-size: clamp(20px, 4vw, 32px);
  color: white;
  cursor: pointer;
  padding: 0;
  width: clamp(35px, 6vw, 50px);
  height: clamp(35px, 6vw, 50px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  z-index: 25;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.9);
  color: #333;
}

.modal-body {
  padding: 0;
  height: min(95vh, 800px);
}

.image-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  height: 100%;
  min-height: clamp(300px, 60vh, 600px);
}

#modal-img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  border-radius: clamp(4px, 1vw, 8px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  transition: opacity 0.3s ease;
}

.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.7);
  color: white;
  border: none;
  font-size: clamp(16px, 3vw, 24px);
  padding: clamp(8px, 2vw, 15px) clamp(12px, 3vw, 20px);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.3s ease;
  z-index: 10;
  backdrop-filter: blur(5px);
}

.nav-btn:hover {
  background: rgba(0,0,0,0.9);
  transform: translateY(-50%) scale(1.1);
}

.nav-btn.prev {
  left: clamp(10px, 2vw, 20px);
}

.nav-btn.next {
  right: clamp(10px, 2vw, 20px);
}

/* ====== PROCESS STEPS ====== */
.step {
  padding: clamp(0.5rem, 2vw, 1rem);
  text-align: center;
}

.step div {
  font-size: clamp(1.5rem, 4vw, 2rem) !important;
  margin-bottom: clamp(0.3rem, 1vw, 0.5rem);
}

.step p {
  font-size: clamp(0.9rem, 2vw, 1rem);
  margin-bottom: clamp(0.2rem, 0.5vw, 0.3rem);
}

.step small {
  font-size: clamp(0.75rem, 1.5vw, 0.875rem);
}

/* ====== PROJETS EN CONSTRUCTION ====== */
.project-title-dark {
  color: inherit;
}

.project-subtitle {
  color: #6c757d;
}

[data-theme="dark"] .project-title-dark {
  color: #343a40 !important;
}

[data-theme="dark"] .project-subtitle {
  color: #495057;
}

/* ====== FOOTER RESPONSIVE ====== */
footer {
  padding: clamp(2rem, 5vw, 3rem) 0;
}

footer img {
  max-width: clamp(60px, 10vw, 80px);
  border-radius: 1rem;
}

footer a {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
}

/* ====== MEDIA QUERIES SPÉCIFIQUES ====== */

/* Mobile Portrait */
@media (max-width: 575.98px) {
  .col-md-6 {
    margin-bottom: 1rem;
  }
  
  .compare-box {
    height: 250px;
  }
  
  .card-body ul {
    font-size: 0.85rem;
  }
  
  .recommended-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
  }
  
  .contact-btn-fixed,
  .theme-toggle-fixed {
    top: 10px;
  }
  
  .contact-btn-fixed {
    left: 10px;
  }
  
  .theme-toggle-fixed {
    right: 10px;
  }
}

/* Mobile Landscape et Tablette Portrait */
@media (min-width: 576px) and (max-width: 991.98px) {
  .col-md-6 {
    flex: 0 0 auto;
    width: 100%;
    margin-bottom: 1.5rem;
  }
  
  .col-lg-4 {
    flex: 0 0 auto;
    width: 50%;
  }
  
  .compare-box {
    height: 350px;
  }
}

/* Tablette Landscape */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .col-lg-4 {
    flex: 0 0 auto;
    width: 33.333333%;
  }
}

/* Desktop Large */
@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
  
  .compare-box {
    max-width: 900px;
    height: 550px;
  }
}

/* Mode paysage mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .modal-content {
    max-height: 95vh;
  }
  
  .image-container {
    min-height: 300px;
  }
  
  #modal-img {
    max-height: 85%;
  }
  
  .contact-btn-fixed,
  .theme-toggle-fixed {
    top: 5px;
  }
}

/* Amélioration des performances sur mobile */
@media (max-width: 767.98px) {
  .card:hover {
    transform: none;
  }
  
  .compare-box:hover {
    transform: none;
  }
  
  .theme-toggle-btn:hover {
    transform: none;
  }
  
  .contact-btn:hover {
    transform: none;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .recommended-badge {
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
  }
  
  .card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
  }
}

/* Accessibilité - Réduction des mouvements */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .card:hover,
  .compare-box:hover,
  .theme-toggle-btn:hover,
  .contact-btn:hover {
    transform: none;
  }
}
/* Overlay plein écran */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Contenu centré et fluide */
.modal-content {
  position: relative;
  width: 100%;
  max-width: 900px; /* limite sur desktop */
  margin: 0 10px; /* petite marge latérale mobile */
}

/* Image responsive */
.modal-body .image-container img {
  width: 100%;
  height: auto;
  max-height: 80vh; /* évite de dépasser l’écran en hauteur */
  display: block;
  margin: 0 auto;
}

/* Boutons de navigation positionnés */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.7);
  border: none;
  font-size: 2rem;
  cursor: pointer;
}

.nav-btn.prev { left: 10px; }
.nav-btn.next { right: 10px; }

/* Bouton fermer */
.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: transparent;
  border: none;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
}

/* Adaptation tablette/smartphone */
@media (max-width: 768px) {
  .modal-content {
    max-width: 100%;
    margin: 0;
  }
  .nav-btn {
    font-size: 1.5rem;
  }
}
/* modal cachée par défaut */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* modal visible quand .active est ajouté */
.modal-overlay.active {
  display: flex;
}
.card {
  width: 100%;
  max-width: 600px; /* limite optionnelle pour éviter d'être trop large sur desktop */
  margin: 20px auto; /* centre la carte */
  display: block;
}
