/* ============================================================
   Configurateur APF — styles
   Couleur principale : #004f8b
   ============================================================ */

/* ── Reset ───────────────────────────────────────────────── */

[x-cloak] {
  display: none !important;
}

#apf-configurateur {
  font-family: inherit;
  box-sizing: border-box;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0;
  overflow-anchor: none; /* empêche le navigateur de corriger le scroll quand le contenu change */
}

#apf-configurateur *,
#apf-configurateur *::before,
#apf-configurateur *::after {
  box-sizing: inherit;
}

/* ── Écran (transition fade partagée) ───────────────────── */

.cfg-screen {
  animation: cfgFadeIn 0.25s ease;

  border: solid 1px #dbdbdb;
  padding: 30px;
  border-radius: 30px;
}

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

/* ── Écran 0 — Accueil ──────────────────────────────────── */

.cfg-home-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.cfg-home-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #004f8b;
  margin: 0 0 0.5rem;

  font-family: var(--e-global-typography-secondary-font-family), Sans-serif;
  font-size: var(--e-global-typography-secondary-font-size);
  font-weight: var(--e-global-typography-secondary-font-weight);
  text-transform: var(--e-global-typography-secondary-text-transform);
  line-height: var(--e-global-typography-secondary-line-height);
}

.cfg-home-subtitle {
  font-size: 1rem;
  color: #555;
  margin: 0;
}

/* ── Cards ──────────────────────────────────────────────── */

.cfg-cards {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.cfg-card {
  width: 350px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #e0e4ea;
  background: #fff;
  cursor: pointer;
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    transform 0.15s;
  outline: none;
  padding: 10px;
}

.cfg-card:hover,
.cfg-card:focus-visible {
  border-color: #004f8b;
  box-shadow: 0 6px 20px rgba(26, 46, 74, 0.12);
  transform: translateY(-2px);
}

.cfg-card--selected {
  border-color: #004f8b !important;
  box-shadow: 0 6px 20px rgba(26, 46, 74, 0.18) !important;
}

/* Couverture : coming soon — curseur normal, légèrement atténuée */
.cfg-card--coming-soon {
  opacity: 0.85;
}

/* ── Image de la card ───────────────────────────────────── */

.cfg-card-image {
  position: relative;
  height: 180px;
  background: #e8edf3;
  background-size: cover !important;
  background-position: center !important;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
}

/*
 * Remplacez ces dégradés par des background-image: url(...)
 * pointant vers vos visuels produits.
 */
.cfg-card-image--revetement {
  background: linear-gradient(135deg, #004f8b 0%, #2e5fa3 100%);
}

.cfg-card-image--couverture {
  background: linear-gradient(135deg, #3d5a7a 0%, #6b8ea8 100%);
  filter: grayscale(0.4);
}

/* ── Badge "Bientôt disponible" ─────────────────────────── */

.cfg-badge-soon {
  display: inline-block;
  background: rgba(255, 255, 255, 0.9);
  color: #004f8b;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
}

/* ── Footer de la card (check + label) ─────────────────── */

.cfg-card {
  padding: 15px;
}

.cfg-card-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;

  flex-direction: row-reverse;
  justify-content: space-between;
  padding: 0.8rem 0 0 0;
}

/* ── Check circle partagé : cards étape 0, rendu cards, pills ── */

.cfg-card-check,
.cfg-pill-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #c5ccd7;
  background: #fff;
  transition: border-color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Coche toujours visible, grise par défaut */
.cfg-card-check::after,
.cfg-pill-check::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border-right: 2px solid #c5ccd7;
  border-bottom: 2px solid #c5ccd7;
  transform: rotate(45deg) translateY(-1px);
  background: transparent;
  transition: border-color 0.2s;
}

/* État actif : bordure + coche bleues */
.cfg-card-check--active,
.cfg-pill-check--active {
  border-color: #004f8b;
}

.cfg-card-check--active::after,
.cfg-pill-check--active::after {
  border-right-color: #004f8b;
  border-bottom-color: #004f8b;
}

/* Dans un pill actif (fond bleu) → check en blanc */
.cfg-pill--active .cfg-pill-check {
  border-color: rgba(255, 255, 255, 0.55);
}

.cfg-pill--active .cfg-pill-check::after {
  border-right-color: rgba(255, 255, 255, 0.55);
  border-bottom-color: rgba(255, 255, 255, 0.55);
}

.cfg-pill--active .cfg-pill-check--active {
  border-color: #fff;
}

.cfg-pill--active .cfg-pill-check--active::after {
  border-right-color: #004f8b;
  border-bottom-color: #004f8b;
}

.cfg-card-label {
  font-size: 1rem;
  font-weight: 600;
  color: #004f8b;
}

/* ── Notice / message ───────────────────────────────────── */

.cfg-notice {
  margin: 1.25rem auto 0;
  max-width: 480px;
  text-align: center;
  font-size: 0.9rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
}

.cfg-notice--info {
  background: #eef2f8;
  color: #004f8b;
  border: 1px solid #c5d0e0;
}

/* ── Actions / boutons ──────────────────────────────────── */

.cfg-home-actions {
  margin-top: 2rem;
  text-align: center;
}

.cfg-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  padding: 0.75rem 2rem !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  border-radius: 50px !important;
  border: 1px solid transparent !important;
  cursor: pointer !important;
  transition:
    background 0.2s,
    color 0.2s,
    border-color 0.2s,
    opacity 0.2s !important;
  text-decoration: none !important;
  font-family: inherit !important;
  line-height: 1 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  box-shadow: none !important;
}

.cfg-btn--primary {
  background: #0f0f0f !important;
  color: #fff !important;
  border-color: #0f0f0f !important;
}

.cfg-btn--primary:hover:not(:disabled) {
  background: #0f0f0f !important;
  border-color: #0f0f0f !important;
  color: #fff !important;
}

.cfg-btn--primary:disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
}

.cfg-btn--secondary {
  background: transparent !important;
  color: #0f0f0f !important;
  border-color: #0f0f0f !important;
}

.cfg-btn--secondary:hover {
  background: #0f0f0f !important;
  color: #fff !important;
}

/* ============================================================
   Wizard — breadcrumb
   ============================================================ */

.cfg-wizard-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #6b7a8d;
  margin-bottom: 1.5rem;
}

.cfg-breadcrumb-sep {
  font-size: 1rem;
  color: #c5ccd7;
}

/* ============================================================
   Wizard — layout 2 colonnes
   ============================================================ */

.cfg-wizard-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 5rem;
  align-items: start;
}

/* ============================================================
   Récapitulatif (colonne gauche)
   ============================================================ */

.cfg-recap {
  background: #f1f1f1;
  /* border: 1px solid #e0e4ea; */
  border-radius: 12px;
  padding: 1.25rem;
  position: sticky;
  top: 100px;
  /* nécessaire pour que le highlight soit positionné relativement */
  overflow: hidden;
}

/* Fond blanc glissant sur l'étape active */
.cfg-recap-highlight {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 0;
  height: 0; /* Le JS fixe la hauteur via :style — avant hydration = invisible */
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(26, 46, 74, 0.08);
  pointer-events: none;
  z-index: 0;
  transition:
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.cfg-recap-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6b7a8d;
  margin: 0 0 0.75rem;
}

.cfg-recap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0rem 0.65rem 0.5rem;
  position: relative;
  z-index: 1;
}

.cfg-recap-row:last-child {
  border-bottom: none;
}

.cfg-recap-row--active .cfg-recap-label {
  color: #004f8b;
}

.cfg-recap-content {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.cfg-recap-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8a98a8;
}

.cfg-recap-row--active .cfg-recap-label,
.cfg-recap-row--completed .cfg-recap-label {
  color: #3d5a7a;
}

.cfg-recap-value {
  font-size: 0.9rem;
  font-weight: 400;
  color: #929292;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cfg-recap-value--empty {
  color: #a0aab8;
  font-style: italic;
  font-weight: 400;
}

p.cfg-step-label {
  margin-bottom: 5px;
}

.cfg-recap-edit {
  flex-shrink: 0 !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 6px !important;
  border: 1px solid #c5ccd7 !important;
  background: #fff !important;
  color: #004f8b !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s !important;
  padding: 0 !important;
  box-shadow: none !important;
  line-height: 1 !important;
}

.cfg-recap-edit:hover {
  background: #004f8b !important;
  border-color: #004f8b !important;
  color: #fff !important;
}

/* ============================================================
   Stepper (colonne droite)
   ============================================================ */

.cfg-stepper {
  display: flex;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
}

.cfg-stepper-item {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 1rem;
}

.cfg-stepper-item:last-child {
  flex: 0 0 auto;
}

.cfg-step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px dashed #d8d8d8;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #c5ccd7;
  flex-shrink: 0;
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s;
}

.cfg-step-circle--done {
  background: #004f8b;
  border-color: #004f8b;
  border-style: solid;
  color: #fff;
}

.cfg-step-circle--active {
  border-color: #004f8b;
  color: #004f8b;
  background: #fff;
}

.cfg-step-line {
  flex: 1;
  height: 2px;
  background: #e0e4ea;
  transition: background 0.2s;
}

.cfg-step-line--done {
  background: #004f8b;
}

/* ============================================================
   Question + Pills
   ============================================================ */

.cfg-wizard-step {
  min-height: 140px;
}

.cfg-step-question {
  font-size: 1.1rem;
  font-weight: 600;
  color: #004f8b;
  margin: 0 0 1.5rem;
  line-height: 1.4;
}

.cfg-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.cfg-pill {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.75rem !important;
  padding: 0.65rem 1rem 0.65rem 1.25rem !important;
  border-radius: 8px !important;
  border: 1px solid #c5ccd7 !important;
  background: #fafafa !important;
  color: #3d5a7a !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition:
    border-color 0.15s,
    background 0.15s,
    color 0.15s !important;
  font-family: inherit !important;
  line-height: 1 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  box-shadow: none !important;
  text-decoration: none !important;
}

.cfg-pill:hover {
  border-color: #004f8b !important;
  color: #004f8b !important;
  background: #f7f9fc !important;
}

.cfg-pill--active {
  background: #004f8b !important;
  border-color: #004f8b !important;
  color: #fff !important;
}

/* ============================================================
   Rendu en eau — cards dans le wizard
   ============================================================ */

.cfg-rendu-cards {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.cfg-rendu-card {
  width: calc(33% - 1rem);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #e0e4ea;
  background: #fafafa;
  cursor: pointer;
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    transform 0.15s;
  outline: none;
  padding: 10px;
}

.cfg-rendu-card:hover,
.cfg-rendu-card:focus-visible {
  border-color: #004f8b;
  box-shadow: 0 4px 14px rgba(26, 46, 74, 0.12);
  transform: translateY(-2px);
}

.cfg-rendu-card--selected {
  border-color: #004f8b !important;
  box-shadow: 0 4px 14px rgba(26, 46, 74, 0.18) !important;
}

.cfg-rendu-card-image {
  height: 100px;
  background: #e8edf3;
  background-size: cover !important;
  background-position: center !important;
  border-radius: 4px;
}

@media (max-width: 767px) {
  .cfg-rendu-cards {
    justify-content: center;
  }

  .cfg-rendu-card {
    width: 100%;
  }

  .cfg-rendu-card-image {
    height: 120px;
  }
}

/* ============================================================
   Navigation wizard
   ============================================================ */

.cfg-wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
}

/* ============================================================
   Écran résultats
   ============================================================ */

.cfg-stepper--done {
  margin-bottom: 2rem;
}

.cfg-results-header {
  text-align: center;
  margin-bottom: 2rem;
}

.cfg-results-title {
  font-size: 1.3rem;
  font-weight: 500;
  color: #414141;
  margin: 0 0 0.5rem;
}

.cfg-results-subtitle {
  font-size: 0.95rem;
  color: #6b7a8d;
  margin: 0;
}

/* Spinner */
.cfg-results-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 0;
  color: #6b7a8d;
  font-size: 0.9rem;
}

.cfg-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e0e4ea;
  border-top-color: #004f8b;
  border-radius: 50%;
  animation: cfgSpin 0.75s linear infinite;
}

@keyframes cfgSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Grille */
.cfg-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin: 0 0 2rem;
}

/* Card coloris — disposition horizontale */
.cfg-result-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  border-radius: 14px;
  border: 1px solid #e0e4ea;
  background: #fff;
  text-decoration: none !important;
  color: inherit;
  transition:
    box-shadow 0.2s,
    transform 0.15s;
  padding: 12px;
}

.cfg-result-card:hover {
  box-shadow: 0 6px 20px rgba(26, 46, 74, 0.12);
  transform: translateY(-2px);
}

.cfg-result-card-image {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #e8edf3;
  background-size: cover;
  background-position: center;
}

.cfg-result-card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  padding: 0rem 1rem;
  min-width: 0; /* nécessaire pour que l'ellipsis fonctionne dans un flex */
}

.cfg-result-card-produit {
  font-size: 1rem;
  font-weight: 700;
  color: #004f8b;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cfg-result-card-categorie {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: normalize;
  letter-spacing: 0.04em;
  font-style: italic;
  color: #707070;
  margin-top: 2px;
  margin-bottom: 1px;
  line-height: 1.25em;
}

.cfg-result-card-coloris {
  font-size: 0.85rem;
  font-weight: 400;
  font-style: italic;
  color: #6b7a8d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cfg-result-card-link {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #a0aab8;
  white-space: nowrap;
}

/* Notice erreur */
.cfg-notice--error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Actions */
.cfg-results-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 1rem;
}

.cfg-wizard-main {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* background-color:#e7dfed; */
}

.cfg-recap-row .cfg-recap-edit {
  display: none !important;
}

.cfg-recap-row--completed .cfg-recap-edit {
  display: flex !important;
}

/* ============================================================
   Responsive
   ============================================================ */

/* ── Tablette (≤ 900px) ──────────────────────────────────── */

@media (max-width: 900px) {
  .cfg-wizard-layout {
    grid-template-columns: 220px 1fr;
    gap: 2rem;
  }

  /* Cards étape 0 : 2 par ligne */
  .cfg-card {
    width: calc(50% - 0.75rem);
    min-width: 220px;
  }
}

/* ── Mobile (≤ 680px) ────────────────────────────────────── */

@media (max-width: 680px) {
  /* Layout */
  .cfg-wizard-layout {
    grid-template-columns: 1fr;
  }

  .cfg-recap {
    order: 2;
  }

  .cfg-wizard-main {
    order: 1;
  }

  /* Écran */
  .cfg-screen {
    padding: 20px;
    border-radius: 20px;
  }

  /* Accueil */
  .cfg-home-title {
    font-size: 1.35rem;
  }

  .cfg-home-header {
    margin-bottom: 1.75rem;
  }

  /* Cards étape 0 : 1 par ligne */
  .cfg-cards {
    flex-direction: column;
    align-items: center;
  }

  .cfg-card {
    width: 100%;
    max-width: 420px;
  }

  .cfg-card-image {
    height: 150px;
  }

  /* Stepper */
  .cfg-stepper {
    gap: 0.4rem;
    margin-bottom: 1.25rem;
  }

  .cfg-stepper-item {
    gap: 0.4rem;
  }

  .cfg-step-circle {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  /* Pills : pleine largeur (meilleure cible tactile) */
  .cfg-pills {
    flex-direction: column;
  }

  .cfg-pill {
    width: 100% !important;
  }

  /* Rendu en eau */
  .cfg-rendu-cards {
    justify-content: center;
  }

  /* Navigation : boutons empilés, pleine largeur */
  .cfg-wizard-nav {
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 1.75rem;
    padding-top: 1rem;
  }

  .cfg-wizard-nav .cfg-btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Récap plus compact sur mobile */
  .cfg-recap {
    padding: 0.85rem;
    border-radius: 10px;
  }

  .cfg-recap-row {
    padding: 0.45rem 0.35rem 0.45rem 0.35rem;
  }

  .cfg-recap-value {
    font-size: 0.82rem;
  }

  /* Breadcrumb */
  .cfg-wizard-breadcrumb {
    font-size: 0.78rem;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  /* Résultats : 1 colonne */
  .cfg-results-grid {
    grid-template-columns: 1fr;
  }

  .cfg-results-actions {
    flex-direction: column;
    align-items: center;
  }

  .cfg-results-actions .cfg-btn {
    width: 100% !important;
    max-width: 360px;
  }

  /* Header résultats */
  .cfg-results-title {
    font-size: 1.2rem;
  }
}

/* ── Petit mobile (≤ 420px) ──────────────────────────────── */

@media (max-width: 420px) {
  .cfg-screen {
    padding: 15px;
    border-radius: 16px;
  }

  .cfg-step-circle {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }

  .cfg-step-line {
    height: 1px;
  }

  /* Card résultat : image légèrement réduite */
  .cfg-result-card-image {
    width: 66px;
    height: 66px;
    border-radius: 6px;
  }

  .cfg-result-card-body {
    padding: 0.6rem 0.75rem;
  }

  .cfg-result-card-produit {
    font-size: 0.92rem;
    white-space: normal;
  }

  /* Rendu en eau */
  .cfg-rendu-card {
    width: 100%;
  }

  .cfg-rendu-card-image {
    height: 110px;
  }
}

#apf-configurateur {
  font-family: var(--e-global-typography-text-font-family), Sans-serif;
}

@media all and (min-width: 1024px) {
  span.mm-products-open__icon {
    margin-bottom: 5px;
  }
}
