/* ═══════════════════════════════════════════════════════════
   LVE Comparateur 4.0 — feuille de style
   Chargée uniquement sur les pages qui contiennent un comparateur.
   Toutes les variables sont déclarées ici : plus de --lve-gray-300
   utilisée sans exister, comme dans la version 3.
   ═══════════════════════════════════════════════════════════ */

.lve {
  --lve-blue: #2670ff;
  --lve-blue-dark: #1a56d6;
  --lve-blue-soft: #eff5ff;
  --lve-green: #15803d;
  --lve-green-soft: #dcfce7;
  --lve-red: #dc2626;

  --lve-g50: #f9fafb;
  --lve-g100: #f3f4f6;
  --lve-g200: #e5e7eb;
  --lve-g300: #d1d5db;
  --lve-g400: #9ca3af;
  --lve-g500: #6b7280;
  --lve-g700: #374151;
  --lve-g900: #111827;

  --lve-r: 10px;
  --lve-shadow: 0 1px 3px rgba(17, 24, 39, .06), 0 4px 16px rgba(17, 24, 39, .05);
  --lve-shadow-lift: 0 8px 24px rgba(38, 112, 255, .14);
  --lve-t: .18s ease;

  font-size: 15px;
  line-height: 1.5;
  color: var(--lve-g900);
}

.lve *, .lve *::before, .lve *::after { box-sizing: border-box; }
.lve-empty {
  padding: 28px; text-align: center; font-size: 14px; color: var(--lve-g500);
  background: var(--lve-g50); border: 1px dashed var(--lve-g300); border-radius: var(--lve-r);
}

/* ── Boutons ─────────────────────────────────────────────── */
.lve-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border-radius: 7px; border: 1px solid transparent;
  font: inherit; font-size: 13px; font-weight: 700; line-height: 1;
  cursor: pointer; transition: background var(--lve-t), border-color var(--lve-t), transform var(--lve-t);
}
.lve-btn--ghost { background: var(--lve-g100); color: var(--lve-g700); border-color: var(--lve-g200); }
.lve-btn--ghost:hover { background: var(--lve-g200); }
.lve-btn--solid { background: #fff; color: var(--lve-blue); }
.lve-btn--solid:hover { background: var(--lve-blue-soft); }
.lve-btn--solid:disabled { opacity: .55; cursor: not-allowed; }
.lve-btn--ghost-light { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.35); }
.lve-btn--ghost-light:hover { background: rgba(255,255,255,.28); }
.lve :focus-visible { outline: 3px solid var(--lve-blue); outline-offset: 2px; }

/* ── Panneau de filtres ──────────────────────────────────── */
.lve-filters {
  background: #fff; border: 1px solid var(--lve-g200); border-radius: var(--lve-r);
  box-shadow: var(--lve-shadow); padding: 18px 20px; margin: 0 0 22px;
}
.lve-filters__head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--lve-g200);
}
.lve-filters__title {
  display: flex; align-items: center; gap: 8px; margin: 0;
  font-size: 15px; font-weight: 800;
}
.lve-filters__title svg { color: var(--lve-blue); }
.lve-filters__meta { display: flex; align-items: center; gap: 12px; }
.lve-filters__count { font-size: 13px; color: var(--lve-g500); }
.lve-filters__count strong { color: var(--lve-blue); font-weight: 800; }

.lve-filters__search { position: relative; margin-bottom: 16px; }
.lve-filters__search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--lve-g400); pointer-events: none;
}
.lve-filters__search input {
  width: 100%; padding: 10px 14px 10px 36px;
  font: inherit; font-size: 14px;
  border: 1px solid var(--lve-g300); border-radius: 8px;
  background: var(--lve-g50); color: var(--lve-g900);
  -webkit-appearance: none; appearance: none;
  transition: border-color var(--lve-t), box-shadow var(--lve-t);
}
.lve-filters__search input:focus {
  border-color: var(--lve-blue); background: #fff; outline: none;
  box-shadow: 0 0 0 3px rgba(38,112,255,.12);
}

.lve-filters__grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.lve-field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.lve-field__label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 700; color: var(--lve-g700);
}
.lve-field__value {
  font-size: 11px; font-weight: 700; color: var(--lve-blue);
  background: var(--lve-blue-soft); border-radius: 4px; padding: 2px 7px; white-space: nowrap;
}
.lve-select {
  padding: 9px 10px; font: inherit; font-size: 13px;
  border: 1px solid var(--lve-g300); border-radius: 7px;
  background: #fff; color: var(--lve-g900); cursor: pointer;
}
.lve-select:focus { border-color: var(--lve-blue); outline: none; }
.lve-range { width: 100%; cursor: pointer; accent-color: var(--lve-blue); }

/* ── Grille de cartes ────────────────────────────────────── */
.lve-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.lve-loading {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 54px 20px; color: var(--lve-g400); font-weight: 600;
}
.lve-spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 3px solid var(--lve-g200); border-top-color: var(--lve-blue);
  animation: lve-spin .7s linear infinite;
}
@keyframes lve-spin { to { transform: rotate(360deg); } }

/* ── Carte ───────────────────────────────────────────────── */
.lve-card {
  position: relative; display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--lve-g200); border-radius: var(--lve-r);
  box-shadow: var(--lve-shadow); overflow: hidden; cursor: pointer;
  transition: transform var(--lve-t), box-shadow var(--lve-t), border-color var(--lve-t);
}
.lve-card:hover { transform: translateY(-3px); border-color: var(--lve-blue); box-shadow: var(--lve-shadow-lift); }
.lve-card--selected { border-color: var(--lve-blue); box-shadow: 0 0 0 2px var(--lve-blue); }
.lve-card--stopped { background: var(--lve-g50); }
.lve-card--stopped .lve-card__img { opacity: .72; }

.lve-card__badges { position: absolute; top: 10px; left: 10px; z-index: 3; display: flex; flex-direction: column; gap: 4px; }
.lve-badge { font-size: 10px; font-weight: 800; letter-spacing: .02em; border-radius: 4px; padding: 3px 7px; white-space: nowrap; }
.lve-badge--stopped { background: var(--lve-red); color: #fff; }
.lve-badge--corner { position: absolute; top: 8px; left: 8px; z-index: 3; }

.lve-card__pick { position: absolute; top: 10px; right: 10px; z-index: 4; cursor: pointer; margin: 0; }
.lve-card__cb { position: absolute; opacity: 0; width: 0; height: 0; }
.lve-card__box {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px;
  background: #fff; border: 2px solid var(--lve-g300); color: transparent;
  transition: background var(--lve-t), border-color var(--lve-t), color var(--lve-t);
}
.lve-card__cb:checked + .lve-card__box { background: var(--lve-blue); border-color: var(--lve-blue); color: #fff; }
.lve-card__cb:focus-visible + .lve-card__box { outline: 3px solid var(--lve-blue); outline-offset: 2px; }
.lve-card:hover .lve-card__box { border-color: var(--lve-blue); }

.lve-card__img, .lve-mini__img {
  display: flex; align-items: center; justify-content: center;
  background: var(--lve-g50); border-bottom: 1px solid var(--lve-g200);
  min-height: 158px; padding: 10px;
}
.lve-card__img img, .lve-mini__img img {
  display: block; max-width: 100%; max-height: 150px; width: auto; height: auto; object-fit: contain;
}
.lve-thumb__fallback { color: var(--lve-g300); }

.lve-card__body { display: flex; flex-direction: column; gap: 9px; padding: 13px; flex: 1; }
.lve-card__title { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.35; color: var(--lve-g900); }
.lve-card:hover .lve-card__title { color: var(--lve-blue); }

.lve-card__tags { display: flex; flex-wrap: wrap; gap: 5px; }
.lve-tag {
  display: inline-flex; gap: 4px; align-items: baseline;
  font-size: 11px; line-height: 1.4; padding: 2px 7px;
  background: var(--lve-g100); border: 1px solid var(--lve-g200);
  border-radius: 4px; color: var(--lve-g700);
}
.lve-tag strong { color: var(--lve-blue); font-weight: 700; }

.lve-card__cta {
  display: block; margin-top: auto; padding: 9px; border-radius: 7px;
  border: 2px solid var(--lve-blue); color: var(--lve-blue);
  font-size: 13px; font-weight: 700; text-align: center; text-decoration: none;
  transition: background var(--lve-t), color var(--lve-t);
}
.lve-card__cta:hover { background: var(--lve-blue); color: #fff; }

/* ── Barre de sélection ──────────────────────────────────── */
.lve-tray {
  position: fixed; inset: auto 0 0 0; z-index: 9990;
  background: linear-gradient(135deg, var(--lve-blue), var(--lve-blue-dark));
  color: #fff; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(17, 24, 39, .22);
  animation: lve-up .22s ease;
}
.lve-tray[hidden] { display: none; }
/* Réserve la place de la barre pour que la dernière rangée reste cliquable. */
.lve--tray-open { padding-bottom: 92px; }
@keyframes lve-up { from { transform: translateY(100%); } }
.lve-tray__inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.lve-tray__slots { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; min-width: 0; }
.lve-tray__slot {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.28);
  border-radius: 7px; padding: 5px 8px; max-width: 220px;
}
.lve-tray__slot img { width: 32px; height: 32px; object-fit: contain; background: #fff; border-radius: 4px; }
.lve-tray__name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lve-tray__drop {
  flex-shrink: 0; width: 20px; height: 20px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.25); color: #fff; cursor: pointer; font-size: 12px; line-height: 1;
}
.lve-tray__drop:hover { background: rgba(0,0,0,.45); }
.lve-tray__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lve-tray__label { font-size: 13px; font-weight: 600; white-space: nowrap; }

/* ── Fenêtre de comparaison ──────────────────────────────── */
.lve-modal {
  width: min(1100px, calc(100vw - 32px));
  max-height: min(88vh, 900px);
  padding: 0; border: 0; border-radius: 14px;
  box-shadow: 0 24px 60px rgba(17, 24, 39, .35);
  color: var(--lve-g900);
}
.lve-modal::backdrop { background: rgba(17, 24, 39, .72); }
.lve-modal__head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px; background: #fff; border-bottom: 1px solid var(--lve-g200);
}
.lve-modal__title { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 17px; font-weight: 800; }
.lve-modal__title svg { color: var(--lve-blue); }
.lve-modal__close {
  flex-shrink: 0; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: var(--lve-g100); color: var(--lve-g700); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--lve-t), transform var(--lve-t);
}
.lve-modal__close:hover { background: var(--lve-g200); transform: rotate(90deg); }
.lve-modal__body { padding: 18px 20px 22px; }

/* ── Tableau de comparaison ──────────────────────────────── */
.lve-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lve-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.lve-th {
  position: sticky; top: 0; z-index: 2;
  background: var(--lve-blue); color: #fff; vertical-align: bottom;
  padding: 12px 10px; text-align: center; font-weight: 700;
  border-right: 1px solid rgba(255,255,255,.22);
}
.lve-th--label {
  left: 0; z-index: 3; background: var(--lve-g700); text-align: left;
  min-width: 120px;
}
.lve-th__thumb { display: flex; align-items: center; justify-content: center; height: 64px; margin-bottom: 8px; }
.lve-th__thumb img { max-height: 64px; max-width: 86px; object-fit: contain; background: #fff; border-radius: 5px; }
/*
 * Le titre de colonne est un lien : le thème lui applique sa propre
 * couleur de lien, bleu foncé, qui gagnait en spécificité sur un simple
 * « .lve-th__title ». Résultat : bleu sur bleu, illisible.
 * On remonte la spécificité et on verrouille les quatre états.
 */
.lve .lve-th .lve-th__title,
.lve .lve-th .lve-th__title:link,
.lve .lve-th .lve-th__title:visited,
.lve .lve-th .lve-th__title:hover,
.lve .lve-th .lve-th__title:focus,
.lve .lve-th .lve-th__title:active {
  display: block; font-size: 12px; font-weight: 700;
  color: #fff !important; text-decoration: none; line-height: 1.3;
}
.lve .lve-th .lve-th__title:hover,
.lve .lve-th .lve-th__title:focus { text-decoration: underline; }

.lve-tr:nth-child(even) .lve-td { background: var(--lve-g50); }
.lve-tr:hover .lve-td { background: var(--lve-blue-soft); }
.lve-td {
  padding: 10px 12px; text-align: center; color: var(--lve-g700);
  background: #fff; border-bottom: 1px solid var(--lve-g200);
  transition: background var(--lve-t);
}
.lve-td--label {
  position: sticky; left: 0; z-index: 1;
  text-align: left; font-weight: 700; color: var(--lve-g900);
  border-right: 1px solid var(--lve-g200);
}
.lve-tr:nth-child(even) .lve-td--label { background: var(--lve-g50); }
.lve-td--best { background: var(--lve-green-soft) !important; color: var(--lve-green); font-weight: 800; }
.lve-td--best::after { content: " ★"; font-size: 10px; }
.lve-na { color: var(--lve-g300); }
.lve-td__link { color: var(--lve-blue); font-weight: 700; text-decoration: none; }
.lve-td__link:hover { text-decoration: underline; }
.lve-static { margin: 26px 0; }

/* ── Grille compacte dans un article ─────────────────────── */
.lve-mini {
  background: #fff; border: 1px solid var(--lve-g200); border-radius: var(--lve-r);
  box-shadow: var(--lve-shadow); padding: 18px 20px; margin: 26px 0;
}
.lve-mini__title {
  margin: 0 0 15px; padding-bottom: 12px; border-bottom: 1px solid var(--lve-g200);
  font-size: 16px; font-weight: 800; line-height: 1.3;
}
.lve-mini__count { font-size: 12px; font-weight: 500; color: var(--lve-g400); }
.lve-mini__grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); }
.lve-mini__card {
  position: relative; display: flex; flex-direction: column;
  background: var(--lve-g50); border: 1px solid var(--lve-g200); border-radius: 8px;
  overflow: hidden; text-decoration: none; color: var(--lve-g900);
  transition: transform var(--lve-t), box-shadow var(--lve-t), border-color var(--lve-t);
}
.lve-mini__card:hover { transform: translateY(-2px); border-color: var(--lve-blue); box-shadow: var(--lve-shadow-lift); }
.lve-mini__card--stopped { opacity: .85; }
.lve-mini__img { background: #fff; min-height: 118px; }
.lve-mini__img img { max-height: 112px; }
.lve-mini__body { display: flex; flex-direction: column; gap: 7px; padding: 10px 11px; flex: 1; }
.lve-mini__name { font-size: 13px; font-weight: 700; line-height: 1.3; }
.lve-mini__card:hover .lve-mini__name { color: var(--lve-blue); }
.lve-mini__cta {
  display: block; margin-top: auto; padding: 7px; border-radius: 6px;
  background: var(--lve-blue); color: #fff; font-size: 12px; font-weight: 700; text-align: center;
}
.lve-mini__all { margin: 15px 0 0; padding-top: 13px; border-top: 1px solid var(--lve-g200); text-align: center; }
.lve-mini__all a {
  display: inline-block; padding: 9px 20px; border-radius: 7px;
  background: var(--lve-blue); color: #fff; font-size: 13px; font-weight: 700; text-decoration: none;
}
.lve-mini__all a:hover { background: var(--lve-blue-dark); }

/* ── Sélection simple ────────────────────────────────────── */
.lve-auto__head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 16px;
}
.lve-auto__hint { margin: 0; font-size: 14px; color: var(--lve-g500); }
.lve-auto__actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 22px 0 0; }
.lve-auto .lve-btn--solid { background: var(--lve-blue); color: #fff; }
.lve-auto .lve-btn--solid:hover:not(:disabled) { background: var(--lve-blue-dark); }

/* ── Adaptation aux petits écrans ────────────────────────── */
@media (max-width: 900px) {
  .lve-filters__grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 640px) {
  .lve-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .lve-mini__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lve-card__img, .lve-mini__img { min-height: 110px; }
  .lve-card__img img, .lve-mini__img img { max-height: 104px; }
  .lve-card__title { font-size: 13px; }
  .lve-tray__inner { flex-direction: column; align-items: stretch; }
  .lve--tray-open { padding-bottom: 152px; }
  .lve-tray__actions { justify-content: space-between; }
  .lve-modal { width: 100vw; max-width: 100vw; max-height: 100vh; border-radius: 0; margin: 0; }
  .lve-modal__body { padding: 14px; }
  .lve-th--label, .lve-td--label { min-width: 104px; font-size: 12px; }
}
@media (max-width: 380px) {
  .lve-grid, .lve-mini__grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .lve *, .lve *::before, .lve *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .lve-card:hover, .lve-mini__card:hover { transform: none; }
}

@media print {
  .lve-filters, .lve-tray, .lve-card__pick, .lve-mini__all { display: none !important; }
  .lve-table { font-size: 11px; }
}
