#lfe-af-root,
#lfe-af-root * {
  box-sizing: border-box;
}

.lfe-af-floating-button {
  position: fixed;
  z-index: 99990;
  right: 22px;
  bottom: 22px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--lfe-af-primary, #1f4f7a);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.28);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

#lfe-af-root[data-position="left"] .lfe-af-floating-button {
  right: auto;
  left: 22px;
}

.lfe-af-floating-button:hover,
.lfe-af-floating-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.34);
}

.lfe-af-floating-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  font-size: 18px;
}

.lfe-af-floating-copy {
  display: grid;
  gap: 1px;
}

.lfe-af-floating-subtext {
  font-size: 12px;
  line-height: 1.1;
  opacity: 0.82;
}

.lfe-af-floating-text {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.15;
}

.lfe-af-overlay {
  position: fixed;
  inset: 0;
  z-index: 99991;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.54);
}

.lfe-af-overlay.is-open {
  display: flex;
}

.lfe-af-modal {
  width: min(760px, 100%);
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 26px;
  background: #ffffff;
  color: #1f2937;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
}

.lfe-af-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.lfe-af-modal-title {
  margin: 0;
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1.15;
  color: #111827;
}

.lfe-af-modal-intro {
  margin: 8px 0 0;
  max-width: 620px;
  color: #64748b;
  font-size: 15px;
}

.lfe-af-close {
  width: 40px;
  height: 40px;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  background: #f8fafc;
  color: #111827;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.lfe-af-modal-body {
  overflow: auto;
  padding: 24px 26px;
}

.lfe-af-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.lfe-af-progress-bar {
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.lfe-af-progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--lfe-af-accent, #38a169);
  transition: width 180ms ease;
}

.lfe-af-question-title {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.2;
  color: #111827;
}

.lfe-af-question-help {
  margin: 0 0 18px;
  color: #64748b;
}

.lfe-af-options {
  display: grid;
  gap: 10px;
}

.lfe-af-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  background: #fff;
  color: #1f2937;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.lfe-af-option:hover,
.lfe-af-option:focus-visible {
  border-color: var(--lfe-af-primary, #1f4f7a);
  background: #f8fafc;
}

.lfe-af-option.is-selected {
  border-color: var(--lfe-af-primary, #1f4f7a);
  background: rgba(31, 79, 122, 0.08);
}

.lfe-af-option-dot {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border: 2px solid #cbd5e1;
  border-radius: 50%;
}

.lfe-af-option.is-selected .lfe-af-option-dot {
  border-color: var(--lfe-af-primary, #1f4f7a);
  background: radial-gradient(circle, var(--lfe-af-primary, #1f4f7a) 0 45%, transparent 49%);
}

.lfe-af-error {
  margin-top: 12px;
  color: #b91c1c;
  font-size: 14px;
  font-weight: 700;
}

.lfe-af-modal-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 26px 24px;
  border-top: 1px solid #e5e7eb;
}

.lfe-af-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #1f2937;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  text-decoration: none;
}

.lfe-af-btn-primary {
  border-color: var(--lfe-af-primary, #1f4f7a);
  background: var(--lfe-af-primary, #1f4f7a);
  color: #fff;
}

.lfe-af-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.lfe-af-results-header {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.lfe-af-results-header h3 {
  margin: 0;
  font-size: 24px;
}

.lfe-af-results-header p {
  margin: 0;
  color: #64748b;
}

.lfe-af-result-list {
  display: grid;
  gap: 14px;
}

.lfe-af-product-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  background: #fff;
}

.lfe-af-product-image {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 14px;
  background: #f8fafc;
}

.lfe-af-badge {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(56, 161, 105, 0.12);
  color: #166534;
  font-size: 12px;
  font-weight: 800;
}

.lfe-af-product-card h4 {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 1.3;
}

.lfe-af-product-reference {
  display: grid;
  gap: 2px;
  margin: 8px 0 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
}

.lfe-af-product-reference strong {
  color: #111827;
  font-size: 14px;
  letter-spacing: 0.01em;
}

.lfe-af-product-price,
.lfe-af-product-stock {
  display: inline-flex;
  align-items: center;
}

.lfe-af-product-reason {
  margin: 0 0 8px;
  color: #64748b;
  font-size: 13px;
}

.lfe-af-product-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  color: #111827;
  font-weight: 700;
}

.lfe-af-product-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lfe-af-advice {
  margin-top: 14px;
  padding: 14px 16px;
  border-left: 4px solid #f59e0b;
  border-radius: 12px;
  background: #fffbeb;
  color: #78350f;
  font-size: 14px;
}

.lfe-af-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 0;
  color: #64748b;
  font-weight: 700;
}

.lfe-af-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--lfe-af-primary, #1f4f7a);
  border-radius: 50%;
  animation: lfe-af-spin 800ms linear infinite;
}

@keyframes lfe-af-spin {
  to { transform: rotate(360deg); }
}

@media (min-width: 760px) {
  .lfe-af-overlay {
    align-items: center;
  }
}

@media (max-width: 640px) {
  .lfe-af-floating-button {
    right: 12px;
    bottom: 12px;
    min-height: 52px;
    padding: 10px 14px;
  }

  #lfe-af-root[data-position="left"] .lfe-af-floating-button {
    left: 12px;
  }

  .lfe-af-floating-subtext {
    display: none;
  }

  .lfe-af-overlay {
    padding: 0;
  }

  .lfe-af-modal {
    max-height: 92vh;
    border-radius: 24px 24px 0 0;
  }

  .lfe-af-modal-header,
  .lfe-af-modal-body,
  .lfe-af-modal-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .lfe-af-modal-footer {
    position: sticky;
    bottom: 0;
    background: #fff;
  }

  .lfe-af-product-card {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 12px;
  }

  .lfe-af-product-image {
    width: 78px;
    height: 78px;
  }
}

.lfe-af-multi-note {
  margin: -8px 0 14px;
  color: var(--lfe-af-primary, #1f4f7a);
  font-size: 13px;
  font-weight: 800;
}

.lfe-af-result-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e5e7eb;
}

.lfe-af-result-section h4 {
  margin: 0 0 6px;
  color: #111827;
  font-size: 18px;
}

.lfe-af-result-section > p {
  margin: 0 0 12px;
  color: #64748b;
  font-size: 14px;
}

.lfe-af-modal-results {
  width: min(1180px, calc(100vw - 28px));
  max-height: min(94vh, 920px);
}

.lfe-af-modal-results .lfe-af-modal-body {
  padding: 20px;
}

.lfe-af-results-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.lfe-af-answer-summary {
  position: sticky;
  top: 0;
}

.lfe-af-summary-card {
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  background: #f8fafc;
}

.lfe-af-summary-card h4 {
  margin: 0 0 12px;
  color: #111827;
  font-size: 17px;
}

.lfe-af-summary-card ul {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.lfe-af-summary-card li {
  display: grid;
  gap: 3px;
}

.lfe-af-summary-card li strong {
  color: #334155;
  font-size: 12px;
  line-height: 1.25;
}

.lfe-af-summary-card li span {
  color: #0f172a;
  font-size: 13px;
  line-height: 1.35;
}

.lfe-af-link-button {
  display: inline-flex;
  width: 100%;
  justify-content: center;
  margin-top: 8px;
  padding: 9px 12px;
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  background: #fff;
  color: var(--lfe-af-primary, #1f4f7a);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.lfe-af-link-danger {
  color: #b91c1c;
}

.lfe-af-results-main {
  min-width: 0;
}

.lfe-af-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.lfe-af-result-grid .lfe-af-product-card {
  grid-template-columns: 82px minmax(0, 1fr);
  min-height: 100%;
}

.lfe-af-product-content {
  min-width: 0;
}

.lfe-af-product-content h4 {
  overflow-wrap: anywhere;
}

.lfe-af-more-wrap {
  display: flex;
  justify-content: center;
  margin: 20px 0 6px;
}

@media (max-width: 860px) {
  .lfe-af-modal-results {
    width: 100vw;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }

  .lfe-af-results-layout {
    grid-template-columns: 1fr;
  }

  .lfe-af-answer-summary {
    position: static;
  }

  .lfe-af-result-grid {
    grid-template-columns: 1fr;
  }
}

/* V1.5.0 — résultats plus grands, plus lisibles, pagination 15 produits/page */
.lfe-af-modal-results {
  width: min(1480px, calc(100vw - 18px));
  height: min(96vh, 980px);
  max-height: 96vh;
  border-radius: 24px;
}

.lfe-af-modal-results .lfe-af-modal-header {
  padding: 22px 30px 16px;
}

.lfe-af-modal-results .lfe-af-modal-body {
  flex: 1 1 auto;
  padding: 22px 28px;
  overflow: auto;
}

.lfe-af-results-layout {
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 26px;
}

.lfe-af-result-grid {
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 18px;
}

.lfe-af-result-grid .lfe-af-product-card {
  grid-template-columns: 92px minmax(0, 1fr);
  padding: 16px;
  border-radius: 20px;
}

.lfe-af-result-grid .lfe-af-product-image {
  width: 92px;
  height: 92px;
}

.lfe-af-product-content h4 {
  font-size: 17px;
  line-height: 1.28;
}

.lfe-af-product-reason {
  font-size: 13px;
  line-height: 1.45;
}

.lfe-af-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 22px 0 8px;
}

.lfe-af-pagination span {
  color: #475569;
  font-weight: 800;
}

@media (max-width: 980px) {
  .lfe-af-modal-results {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .lfe-af-results-layout {
    grid-template-columns: 1fr;
  }
}

/* V1.6.0 — fenêtre résultats plus grande et cartes plus lisibles */
.lfe-af-modal-results {
  width: min(1660px, calc(100vw - 10px));
  height: min(98vh, 1120px);
  max-height: 98vh;
  border-radius: 22px;
}

.lfe-af-modal-results .lfe-af-modal-header {
  padding: 24px 32px 18px;
}

.lfe-af-modal-results .lfe-af-modal-body {
  padding: 24px 30px;
}

.lfe-af-modal-results .lfe-af-modal-footer {
  padding: 16px 30px 22px;
}

.lfe-af-results-layout {
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 30px;
}

.lfe-af-result-grid {
  grid-template-columns: repeat(auto-fill, minmax(305px, 1fr));
  gap: 20px;
}

.lfe-af-result-grid .lfe-af-product-card {
  grid-template-columns: 105px minmax(0, 1fr);
  padding: 18px;
}

.lfe-af-result-grid .lfe-af-product-image {
  width: 105px;
  height: 105px;
}

.lfe-af-product-card h4 {
  font-size: 17px;
}

.lfe-af-product-reason {
  font-size: 14px;
}

@media (max-width: 860px) {
  .lfe-af-modal-results {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .lfe-af-modal-results .lfe-af-modal-body {
    padding: 18px;
  }

  .lfe-af-results-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .lfe-af-result-grid {
    grid-template-columns: 1fr;
  }
}


/* LFE AF 1.6.2 — nettoyage défensif des anciens éléments de matching visibles si un cache sert encore un ancien HTML. */
.lfe-af-product-card .lfe-af-badge,
.lfe-af-product-card .lfe-af-product-badge,
.lfe-af-product-card .lfe-af-product-badges,
.lfe-af-product-card .lfe-af-product-reason,
.lfe-af-product-card .lfe-af-product-reasons,
.lfe-af-product-card .lfe-af-match-reasons {
  display: none !important;
}

.lfe-af-product-reference {
  border: 1px solid #e5e7eb;
  background: #f8fafc;
}

.lfe-af-product-reference span {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
