/* ==========================================================================
   DiaMétal - Composants Spécifiques & Interactifs
   WhatsApp Flottant, Modales, Avant/Après, Devis Multi-Étapes, Toast & Responsive
   ========================================================================== */

/* --- Bouton WhatsApp Flottant Permanent --- */
.whatsapp-float-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.whatsapp-bubble {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md) var(--radius-md) 2px var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: all var(--transition-normal);
  white-space: nowrap;
}

.whatsapp-float-container:hover .whatsapp-bubble,
.whatsapp-bubble.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.whatsapp-float-btn {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-full);
  background: var(--whatsapp-color);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-whatsapp);
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.whatsapp-float-btn:hover {
  transform: scale(1.08);
  background: var(--whatsapp-hover);
}

.whatsapp-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  border: 2px solid var(--whatsapp-color);
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  pointer-events: none;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* --- Modale Générique & Modale Projet --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 760px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(15px) scale(0.98);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 10;
}

.modal-close-btn:hover {
  background: var(--accent-spark);
  color: #fff;
  border-color: var(--accent-spark);
}

/* --- Slider Avant / Après (Before/After) --- */
.before-after-wrapper {
  position: relative;
  width: 100%;
  max-width: 860px;
  margin-inline: auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.before-after-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.before-after-overlay {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 50%;
  overflow: hidden;
  z-index: 2;
  border-right: 2px solid var(--accent-spark);
}

.before-after-overlay img {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: auto;
  min-width: 100%;
  max-width: none;
  object-fit: cover;
}

.before-after-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--accent-spark);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(255, 87, 34, 0.5);
  z-index: 3;
  cursor: ew-resize;
  pointer-events: none;
}

.before-badge, .after-badge {
  position: absolute;
  top: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-xS);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  z-index: 4;
}

.before-badge {
  left: 0.75rem;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
}

.after-badge {
  right: 0.75rem;
  background: var(--accent-spark);
  color: #fff;
}

/* --- Formulaire Devis Multi-Étapes --- */
.devis-wizard-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.wizard-steps-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  margin-bottom: 2.25rem;
  gap: 0.5rem;
}

.wizard-steps-indicator::before {
  content: '';
  position: absolute;
  top: 17px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-subtle);
  z-index: 1;
}

.step-indicator-item {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
}

.step-number {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  border: 2px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.step-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.step-indicator-item.active .step-number {
  background: var(--accent-spark);
  border-color: var(--accent-spark);
  color: #ffffff;
  box-shadow: var(--shadow-spark);
}

.step-indicator-item.active .step-label {
  color: var(--text-primary);
}

.step-indicator-item.completed .step-number {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
}

.wizard-step-pane {
  display: none;
  animation: fadeIn 0.25s ease;
}

.wizard-step-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Grille de sélection des projets (Step 1) */
.project-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.project-type-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 0.85rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.project-type-card:hover {
  border-color: var(--metal-400);
  transform: translateY(-2px);
}

.project-type-card.selected {
  border-color: var(--accent-spark);
  background: rgba(255, 87, 34, 0.08);
  box-shadow: var(--shadow-spark);
}

.project-type-card svg {
  margin-inline: auto;
  margin-bottom: 0.5rem;
  color: var(--accent-spark);
}

.project-type-card h4 {
  font-size: 0.92rem;
  font-weight: 700;
}

/* Form inputs */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  font-size: 0.92rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Carte Interactive / Map Component */
.interactive-map-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  min-height: 420px;
}

.map-svg-container {
  width: 100%;
  height: 420px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.map-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  cursor: pointer;
  transition: transform var(--transition-fast);
  z-index: 5;
}

.map-pin:hover {
  transform: translate(-50%, -108%) scale(1.1);
  z-index: 15;
}

.map-pin-badge {
  background: var(--accent-spark);
  color: #ffffff;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xS);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--shadow-spark);
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--success);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  z-index: 3000;
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--transition-normal);
  max-width: calc(100vw - 3rem);
  font-size: 0.88rem;
}

.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

/* --- Bouton Loading Spinner --- */
.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: var(--radius-full);
  animation: spin-loader 0.65s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}
@keyframes spin-loader {
  to { transform: rotate(360deg); }
}
/* --- Feedback Bannière de Chargement / Statut --- */
.submission-status-banner {
  display: none;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-spark);
  border-radius: var(--radius-md);
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  animation: fadeIn 0.25s ease;
}
.submission-status-banner.loading {
  display: flex;
  border-left-color: var(--accent-spark);
}
.submission-status-banner.error {
  display: flex;
  border-left-color: var(--danger);
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
}


/* Exit Intent Modal */
.exit-modal-card {
  max-width: 480px;
  text-align: center;
}

.exit-icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-full);
  background: rgba(37, 211, 102, 0.12);
  color: var(--whatsapp-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem auto;
}

/* ==========================================================================
   RESPONSIVE COMPOSANTS (Tablette & Mobile)
   ========================================================================== */

@media (max-width: 768px) {
  .whatsapp-float-container {
    bottom: 1rem;
    right: 1rem;
  }
  .whatsapp-float-btn {
    width: 46px;
    height: 46px;
  }
  .whatsapp-bubble {
    display: none;
  }
  .modal-card {
    padding: 1.5rem 1rem;
    border-radius: var(--radius-md);
  }
  .devis-wizard-container {
    padding: 1.25rem 0.95rem;
    border-radius: var(--radius-md);
  }
  .wizard-steps-indicator {
    margin-bottom: 1.5rem;
  }
  .step-number {
    width: 28px;
    height: 28px;
    font-size: 0.78rem;
  }
  .step-label {
    font-size: 0.68rem;
  }
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .before-badge, .after-badge {
    top: 0.4rem;
    font-size: 0.65rem;
    padding: 0.15rem 0.45rem;
  }
  .before-badge { left: 0.4rem; }
  .after-badge { right: 0.4rem; }

  #mapInfoPanel {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0.75rem;
  }
  .interactive-map-box {
    min-height: auto;
  }
}
