:root {
  --bg: #0b1020;
  --card: #121a33;
  --text: #e8ecff;
  --muted: #aab3d6;
  --accent: #7aa2ff;
  --danger: #ff6b6b;
  --ok: #2dd4bf;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
.container { max-width: 960px; margin: 0 auto; padding: 24px; }

.card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 16px;
}

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
input, select, button {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text);
}
button { cursor: pointer; background: rgba(122,162,255,0.2); border-color: rgba(122,162,255,0.5); }
button:hover { background: rgba(122,162,255,0.28); }
.small { color: var(--muted); font-size: 14px; }

.list { display: grid; gap: 10px; margin-top: 12px; }
.item{
  display:block;                 /* IMPORTANT */
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid rgba(255,255,255,0.12); }
.badge.ok { border-color: rgba(45,212,191,0.6); color: var(--ok); }
.badge.danger { border-color: rgba(255,107,107,0.6); color: var(--danger); }

.nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.nav .right { display: flex; gap: 10px; align-items: center; }
hr { border: none; border-top: 1px solid rgba(255,255,255,0.08); margin: 16px 0; }


/* Grille catalogue */
.grid{
  display: grid;
  gap: 14px;
  margin-top: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 980px){
  .grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px){
  .grid{ grid-template-columns: 1fr; }
}

/* Carte produit */
.pcard{
  position: relative;
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  min-height: 120px;
  transition: transform .12s ease, border-color .12s ease;
}

.pcard:hover{
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.14);
}

.pcard:focus-within{
  outline: 2px solid rgba(96,165,250,0.8);
  outline-offset: 2px;
}

.pcardTop{
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
}

.pimg{
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: contain;
  background: rgba(255,255,255,0.06);
}

.ptitle{
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.pmeta{
  margin-top: 6px;
}

/* Le lien couvre toute la carte */
.pcardLink{
  position: relative;
  z-index: 2;
  color: inherit;
  text-decoration: none;
}
.pcardLink::before{
  content: "";
  position: absolute;
  inset: -14px; /* couvre la carte */
  z-index: 1;
}


.priceCol{ text-align:right; display:flex; flex-direction:column; gap:4px; align-items:flex-end; }
.priceText{ font-weight:700; font-size:16px; color:#7dd3fc; } /* bleu clair */
.trend{ font-size:12px; padding:2px 8px; border-radius:999px; border:1px solid rgba(255,255,255,0.12); }
.trendDown{ color:#34d399; border-color: rgba(52,211,153,0.35); background: rgba(52,211,153,0.08); }
.trendUp{ color:#f87171; border-color: rgba(248,113,113,0.35); background: rgba(248,113,113,0.08); }
.trendFlat{ color:#e5e7eb; opacity:0.8; }

.userLink{
  background: transparent;
  border: 0;
  padding: 0;
  color: #93c5fd;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.userPopover{
  position: fixed;
  z-index: 50;
  min-width: 220px;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
}

.userPopover .title{ font-weight: 700; margin-bottom: 4px; }
.userPopover .muted{ opacity: .85; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modalContent {
  width: min(560px, 100%);
  background: #111827;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px;
}

.modalHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.btn {
  display: inline-block;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  text-decoration: none;
  color: inherit;
}

.readonlyInput,
input[readonly],
select:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Header colonnes */
.pricesHeader{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:6px 2px 10px;
}
.pricesHeaderRight{
  display:flex;
  align-items:center;
  gap:16px;
  min-width:240px;
  justify-content:flex-end;
}
.pricesHeaderActions{ width:64px; }

/* Ligne magasin */
.priceRow{
  display:flex;
  justify-content:space-between;
  gap:14px;
  align-items:center;
}

.storeLeft{
  display:flex;
  gap:12px;
  align-items:center;
  min-width:0;
}
.chainLogo{
  width:44px;
  height:44px;
  border-radius:12px;
  object-fit:cover;
  background:#0b1220;
  flex:0 0 auto;
}
.storeMain{ min-width:0; }
.storeNameLine{
  display:flex;
  gap:10px;
  align-items:baseline;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.bestBadge{
  font-size:12px;
  opacity:.85;
}
.storeSubLine{
  opacity:.75;
}

.rightCols .priceText{ min-width:76px; text-align:right; }
.rightCols .trend{ min-width:70px; text-align:right; }

/* Fiabilité : petit trigger + popover */
.reliabilityTrigger{
  display:inline-block;
  padding:6px 10px;
  border-radius:10px;
  background:rgba(255,255,255,.06);
  cursor:default;
}
.reliabilityPopover{
  width:240px;
}
.reliabilityBar{
  height:10px;
  border-radius:999px;
  background:linear-gradient(90deg,#ef4444,#f59e0b,#22c55e);
  position:relative;
  overflow:hidden;
  margin:8px 0 6px;
}
.reliabilityKnob{
  position:absolute;
  top:-4px;
  width:12px;
  height:18px;
  border-radius:8px;
  background:#fff;
  opacity:.9;
  transform:translateX(-50%);
}
.reliabilityLink{
  display:inline-block;
  margin-top:6px;
  text-decoration:underline;
  cursor:pointer;
}

/* Validation (coeur) */
.voteWrap{
  position:relative;
  width:64px;
  display:flex;
  justify-content:flex-end;
}
.voteBtn{
  display:flex;
  align-items:center;
  gap:6px;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.04);
  cursor:pointer;
}
.voteMenu{
  position:absolute;
  right:0;
  top:42px;
  display:none;
  gap:10px;
  padding:10px;
  border-radius:12px;
  background:#0b1220;
  border:1px solid rgba(255,255,255,.10);
  z-index:50;
}
.voteMenu{ display:none; }
.voteWrap.isOpen .voteMenu{ display:flex; }
.voteAction{
  padding:8px 10px;
  border-radius:10px;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.08);
  cursor:pointer;
  white-space:nowrap;
}


/* Colonne droite : tout aligné à droite */
.rightCols{
  display:flex;
  align-items:center;
  gap:16px;
  justify-content:flex-end;
  min-width:320px;            /* un peu plus large car on a Prix + 30j + fiabilité + coeur */
  text-align:right;
}

.rightCols > div{
  display:flex;
  justify-content:flex-end;
}

/* Variation : plus de “pill”/badge */
.trendUp{ color:#22c55e; font-weight:600; }
.trendDown{ color:#34d399; font-weight:600; } /* tu peux mettre rouge si tu préfères ↓ en rouge */
.trendFlat{ color:rgba(255,255,255,.65); font-weight:600; }

/* Force le texte du prix bien à droite */
.priceText{
  min-width:84px;
  text-align:right;
}

.chainLogoWrap{
  width:44px;
  height:44px;
  border-radius:12px;
  background:#0b1220;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  flex:0 0 auto;
}
.chainLogoImg{
  width:100%;
  height:100%;
  object-fit:contain;
  background:#0b1220;
}
.chainLogoFallbackText{
  display:none;
  font-weight:700;
  color:rgba(255,255,255,.85);
}
.chainLogoWrap.chainLogoFallback .chainLogoFallbackText{ display:block; }


.rightCols{
  display:grid;                  /* IMPORTANT */
  grid-template-columns: 90px 70px 62px 64px; /* Prix | 30j | fiabilité | coeur */
  align-items:center;
  justify-content:end;
  column-gap:16px;
  text-align:right;
  min-width:0;
}

/* Chaque "cellule" à droite */
.rightCols > div{ justify-self:end; }

.pricesHeaderRight{
  display:grid;
  grid-template-columns: 90px 70px 62px 64px;
  justify-content:end;
  column-gap:16px;
  min-width:0;
  text-align:right;
}
.pricesHeaderRight > div{ justify-self:end; }
