/* ── Global ──────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }
body { overflow-x: hidden; }

/* ── Layout ──────────────────────────────────────────────────── */
.det-wrap  { display: flex; gap: 24px; align-items: flex-start; }
.det-left  { flex: 1; min-width: 0; }
.det-right { width: 320px; flex-shrink: 0; }
/* Sticky ONLY on desktop — avoids iOS/Android sticky-in-flex bugs */
@media(min-width:901px){
  .det-right { position: sticky; top: calc(var(--nav-h) + 16px); align-self: flex-start; }
}
/* Tablet + mobile: stacked column */
@media(max-width:900px){
  .det-wrap  { flex-direction: column; }
  .det-right { width: 100%; position: static; }
}

/* ── Carousel ────────────────────────────────────────────────── */
.det-carousel { border-radius: 16px; overflow: hidden; background: #f1f5f9; position: relative; }
.det-carousel .carousel-item img { width:100%; height: 420px; object-fit: cover; }
.det-thumbs { display: flex; gap: 6px; padding: 8px; background: rgba(0,0,0,.38); overflow-x: auto; scrollbar-width: none; }
.det-thumbs::-webkit-scrollbar { display: none; }
.det-thumb { width: 64px; height: 48px; border-radius: 6px; object-fit: cover; cursor: pointer; flex-shrink: 0; border: 2px solid transparent; opacity: .55; transition: opacity .15s, border-color .15s; }
.det-thumb.active, .det-thumb:hover { opacity: 1; border-color: var(--accent); }
.photo-counter { position: absolute; bottom: 62px; right: 12px; background: rgba(0,0,0,.55); color: white; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 20px; pointer-events: none; }
@media(max-width:640px){ .det-carousel .carousel-item img { height: 260px; } .det-thumb { width: 52px; height: 39px; } }

/* ── Price hero ───────────────────────────────────────────────── */
.det-price { font-size: 2rem; font-weight: 900; color: var(--primary); line-height: 1; }
@media(max-width:480px){ .det-price { font-size: 1.6rem; } }

/* ── Spec grid ───────────────────────────────────────────────── */
.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); gap: 10px; }
.spec-item { background: var(--bg); border-radius: 10px; padding: 11px 14px; }
.spec-lbl  { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); margin-bottom: 4px; }
.spec-val  { font-size: .9rem; font-weight: 800; color: var(--text); }
@media(max-width:400px){ .spec-grid { grid-template-columns: 1fr 1fr; } }

/* ── Seller card ─────────────────────────────────────────────── */
.seller-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.contact-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 13px; border-radius: 11px; font-weight: 800; font-size: .95rem; text-decoration: none; border: none; cursor: pointer; font-family: inherit; transition: opacity .15s, transform .1s; }
.contact-btn:hover { opacity: .9; transform: translateY(-1px); }
.contact-btn-phone { background: var(--primary); color: white; }
.contact-btn-wa    { background: #25d366; color: white; }
.contact-btn-ghost { background: var(--card); color: var(--text); border: 1.5px solid var(--border); }

/* ── Phone list ──────────────────────────────────────────────── */
.phone-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; }
.phone-row .icon { font-size: 1.2rem; width: 24px; text-align: center; }
.phone-row .num   { font-weight: 700; font-size: .9rem; }
.phone-row .lbl   { font-size: .7rem; color: var(--text-muted); }
.phone-row .acts  { margin-left: auto; display: flex; gap: 4px; }
.phone-row .acts a { padding: 4px 8px; border-radius: 6px; font-size: .72rem; font-weight: 700; text-decoration: none; }

/* ── Section cards ───────────────────────────────────────────── */
.det-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin-bottom: 16px; }
.det-card-head { padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--bg); font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); }
.det-card-body { padding: 18px; }

/* ── Card badge overlays (shared with feed) ──────────────────── */
.img-tl,.img-tr,.img-bl,.img-br { position:absolute; display:flex; gap:4px; }
.img-tl { top:7px; left:7px; flex-wrap:wrap; max-width:62%; }
.img-tr { top:7px; right:7px; flex-direction:column; align-items:flex-end; }
.img-bl { bottom:7px; left:7px; }
.img-br { bottom:7px; right:7px; }
.badge-fuel  { padding:2px 7px; border-radius:100px; font-size:.6rem; font-weight:800; backdrop-filter:blur(4px); box-shadow:0 1px 4px rgba(0,0,0,.2); }
.fuel-essence,.fuel-sp95,.fuel-sp98 { background:rgba(254,243,199,.95); color:#92400e; }
.fuel-diesel,.fuel-gasoil            { background:rgba(219,234,254,.95); color:#1e40af; }
.fuel-gpl                             { background:rgba(220,252,231,.95); color:#166534; }
.fuel-hybride                         { background:rgba(240,253,244,.95); color:#15803d; }
.fuel-electrique                      { background:rgba(237,233,254,.95); color:#6b21a8; }
.badge-views  { background:rgba(0,0,0,.58); color:#fff; border-radius:100px; padding:2px 7px; font-size:.6rem; display:flex; align-items:center; gap:3px; backdrop-filter:blur(4px); }
.badge-neg    { background:var(--green,#16a34a); color:#fff; border-radius:6px; padding:2px 6px; font-size:.58rem; font-weight:800; }
.etat-badge   { padding:2px 7px; border-radius:100px; font-size:.6rem; font-weight:700; }
.etat-excellent,.etat-tres_bon,.etat-neuf,.etat-comme_neuf { background:rgba(220,252,231,.92); color:#166534; }
.etat-bon     { background:rgba(254,243,199,.92); color:#92400e; }
.etat-acceptable,.etat-correct { background:rgba(255,237,213,.92); color:#9a3412; }
.etat-mauvais,.etat-pour_pieces { background:rgba(254,226,226,.92); color:#991b1b; }

/* ── Similaires grid ─────────────────────────────────────────── */
.sim-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
@media(max-width:900px){ .sim-grid { grid-template-columns: repeat(2,1fr); } }
@media(max-width:480px){ .sim-grid { grid-template-columns: 1fr; gap: 8px; } }

/* ── Feed-style listing card (reused for similaires) ─────────── */
.sim-card {
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(15,39,68,.07),0 1px 2px rgba(15,39,68,.04);
  transition: transform .18s, box-shadow .18s;
  text-decoration: none;
  height: 100%;
}
.sim-card:hover   { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(15,39,68,.13); }
.sim-card:active  { transform: scale(.977); }
.sim-card .card-img-wrap  { position: relative; overflow: hidden; aspect-ratio: 16/10; flex-shrink: 0; width: 100%; }
.sim-card .annonce-img    { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.sim-card:hover .annonce-img { transform: scale(1.04); }
.sim-card .card-body  { padding: 9px 11px 11px; display: flex; flex-direction: column; flex: 1; }
.sim-card .annonce-price { font-family: 'Space Grotesk',sans-serif; font-size: .95rem; font-weight: 900; color: var(--primary); line-height: 1.2; margin-bottom: 4px; }
.sim-card .annonce-title  { font-size: .8rem; font-weight: 700; color: var(--text); line-height: 1.35; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sim-card .spec-row  { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 6px; }
.sim-card .spec-chip { display: inline-flex; align-items: center; gap: 3px; background: var(--bg); color: var(--text-muted); border-radius: 6px; padding: 2px 6px; font-size: .63rem; font-weight: 600; }
.sim-card .card-foot { display: flex; align-items: center; gap: 5px; padding-top: 6px; border-top: 1px solid var(--border); margin-top: auto; }
.sim-card .av-round  { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.sim-card .seller-lbl { font-size: .62rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.sim-card .card-time  { font-size: .6rem; color: var(--text-muted); flex-shrink: 0; margin-left: auto; }

/* ── Mobile sticky CTA ───────────────────────────────────────── */
.mobile-cta { display: none; padding: 10px 0 4px; }
.mobile-cta-inner { display: flex; gap: 8px; max-width: 540px; margin: 0 auto; align-items: center; }

/* ── Mobile seller strip (hidden on desktop) ─────────────────── */
.mob-seller-strip { display: none; }

@media(max-width:768px){
  /* Show mobile elements */
  .mobile-cta { display: block; }

  /* Hide right sidebar — CTA handles contact on mobile */
  .det-right { display: none !important; }
  .det-wrap { flex-direction: column; }

  /* Show mobile seller strip */
  .mob-seller-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 11px 14px;
    margin-bottom: 12px;
    text-decoration: none;
    color: inherit;
  }
  .mob-seller-strip img {
    width: 46px; height: 46px;
    border-radius: 50%; object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
  }
  .mob-seller-strip .mss-info { flex: 1; min-width: 0; }
  .mob-seller-strip .mss-name { font-weight: 800; font-size: .92rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mob-seller-strip .mss-meta { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }
  .mob-seller-strip .mss-arrow { font-size: .9rem; color: var(--text-muted); flex-shrink: 0; }

  /* Breadcrumb → compact back button on mobile */
  .mob-back-btn { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; color: var(--primary); text-decoration: none; padding: 6px 0; }
  .mob-breadcrumb-full { display: none; }

  /* Description: minimum readable size */
  .det-card-body p { font-size: 15px; line-height: 1.75; }

}

/* ── Tablet (600–900px) ──────────────────────────────────────── */
@media(max-width:900px) and (min-width:769px){
  .det-card-body { padding:14px; }
  .spec-grid { grid-template-columns: repeat(auto-fill,minmax(110px,1fr)); gap:8px; }
  .det-carousel .carousel-item img { height: 320px; }
  .sim-grid { grid-template-columns: repeat(auto-fill,minmax(140px,1fr)); }
}

/* ── Mid-phones (481–768px) ──────────────────────────────────── */
@media(max-width:768px) and (min-width:376px){
  .det-carousel .carousel-item img { height: 260px; }
  .det-price { font-size: 1.55rem; }
  .spec-grid { grid-template-columns: 1fr 1fr; gap:8px; }
  .det-card-body { padding:12px; }
  .det-card-head { padding:10px 12px; }
  .contact-btn { font-size:.9rem; padding:13px 10px; }
  .mobile-cta-inner { gap:8px; }
}

/* ── Small phones (≤375px) ───────────────────────────────────── */
@media(max-width:375px){
  .det-carousel .carousel-item img { height: 210px; }
  .det-price { font-size: 1.35rem; }
  .spec-grid { grid-template-columns: 1fr 1fr; }
  .det-thumb { width: 44px; height: 33px; }
  .contact-btn { font-size:.84rem; padding:12px 8px; }
  .mob-seller-strip { padding: 10px 12px; gap: 10px; }
  .mob-seller-strip img { width: 40px; height: 40px; }
}

@media(min-width:769px){
      .mob-back-btn { display: none !important; }
      .mob-breadcrumb-full { display: flex !important; }
    }

@media(max-width:768px){
              /* Hide fav+compare from title card — they're in the sticky CTA */
              .det-fav-form, .det-cmp-form { display: none; }
            }