/* ———————————————————————————————————————————————
   Paibo — Catalog (visual only)
   - Look & feel marketplace clair/premium
   - Accents dynamiques : offer = vert / demand = rouge
   - 100% responsive + animations douces
   - Compatible avec le JS existant (ids/classes conservés)
   ——————————————————————————————————————————————— */

/* Design tokens (light) */
:root{
  --bg-app:#f6f7fb;
  --bg-surface:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e5e7eb;
  --ring:#94a3b8;
  --shadow-lg:0 20px 45px rgba(16,24,40,.08), 0 2px 8px rgba(16,24,40,.06);
  --shadow-md:0 10px 25px rgba(16,24,40,.07), 0 1px 4px rgba(16,24,40,.06);
  --radius:18px;

  /* accent défaut (fallback) */
  --accent:#22c55e;
  --accent-50:#ecfdf5;
  --accent-100:#d1fae5;
  --accent-600:#16a34a;
  --accent-700:#15803d;
}

/* Accent dynamique par page */
body[data-kind="offer"]{
  --accent:#22c55e; --accent-50:#ecfdf5; --accent-100:#d1fae5; --accent-600:#16a34a; --accent-700:#15803d;
}
body[data-kind="demand"]{
  --accent:#ef4444; --accent-50:#fef2f2; --accent-100:#fee2e2; --accent-600:#dc2626; --accent-700:#b91c1c;
}

/* Base */
*{ box-sizing:border-box; }
html,body{ height:100%; margin:0; }
body{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial;
  color:var(--text);
  background:
    radial-gradient(900px 600px at 0% -10%, rgba(99,102,241,.06), transparent 60%) fixed,
    radial-gradient(900px 600px at 100% 110%, rgba(34,197,94,.06), transparent 60%) fixed,
    var(--bg-app);
}

/* ——— Topbar ——— */
.topbar{
  position:sticky; top:0; z-index:50;
  backdrop-filter:saturate(140%) blur(10px);
  background:rgba(255,255,255,.75);
  border-bottom:1px solid rgba(15,23,42,.06);
}
.tb-row{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; min-height:68px; padding:10px 16px;
}
.logo{
  display:inline-flex; align-items:center; gap:10px; text-decoration:none;
  font-weight:900; letter-spacing:.2px; color:var(--text);
}
.logo-dot{ width:12px; height:12px; border-radius:50%; background:var(--accent); box-shadow:0 0 0 5px var(--accent-100); }
.logo-word{ font-size:18px; }

/* Hamburger summary (CSS only) */
.tb-center{ position:relative; }
.tb-center > summary{
  list-style:none; cursor:pointer; display:inline-flex; align-items:center; gap:10px;
  border:1px solid var(--border); background:var(--bg-surface); height:44px;
  padding:0 14px; border-radius:999px; font-weight:800; color:var(--text);
  transition:transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.tb-center > summary::-webkit-details-marker{ display:none; }
.tb-center > summary:hover{ box-shadow:var(--shadow-md); }
.tb-center > summary:focus-visible{ outline:3px solid var(--accent-100); }
.burger{ display:inline-grid; gap:3px; }
.burger i{ width:14px; height:2px; background:currentColor; border-radius:2px; display:block; opacity:.8; }
.chev{ opacity:.7; }

.tb-right{ display:flex; align-items:center; gap:10px; }

/* Menu (dropdown / sheet) */
.menu{
  position:absolute; top:60px; left:0; right:0; margin:0 auto; width:320px;
  display:flex; flex-direction:column; gap:8px; padding:10px;
  background:var(--bg-surface); border:1px solid var(--border); border-radius:16px; box-shadow:var(--shadow-lg);
}
.menu a{
  text-decoration:none; color:var(--text); font-weight:700;
  border:1px solid var(--border); border-radius:12px; padding:12px 14px;
  background:linear-gradient(180deg,#fff,#fafafa);
  transition:transform .12s ease, box-shadow .2s ease, border-color .2s ease;
}
.menu a[aria-current="page"]{
  border-color:var(--accent-100); box-shadow:0 0 0 3px var(--accent-50) inset;
}
.menu a:hover{ transform:translateY(-1px); box-shadow:var(--shadow-md); }

.tb-center:not([open]) .menu{ display:none; }

/* Mobile = sheet plein écran */
@media (max-width: 720px){
  .menu{
    position:fixed; inset:auto 12px 12px 12px; top:76px; width:auto;
    border-radius:18px; padding:12px;
  }
}

/* Segments / boutons topbar */
.seg{
  display:inline-flex; align-items:center; gap:10px; cursor:pointer; user-select:none;
  height:44px; padding:0 14px; border-radius:999px; font-weight:800;
  border:1px solid var(--border); background:var(--bg-surface); color:var(--text);
  transition:transform .15s ease, box-shadow .2s ease, border-color .2s ease;
  text-decoration:none;
}
.seg:hover{ transform:translateY(-1px); box-shadow:var(--shadow-md); }
.seg--title{ background:linear-gradient(180deg,#fff,#fafafa); }
.seg--ghost{ background:linear-gradient(180deg,#fff,#fafafa); }
.seg--outline{ background:transparent; }
.seg--accent{ background:var(--accent); color:white; border-color:transparent; }

/* ——— Filtres ——— */
.filters{
  position:sticky; top:68px; z-index:40;
  border-bottom:1px solid var(--border);
  background:linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.86));
  backdrop-filter:blur(8px) saturate(130%);
}
.filters-row{
  display:flex; flex-wrap:wrap; gap:12px; align-items:center; justify-content:space-between;
  padding:14px 16px;
}
.search{
  flex:1 1 360px; display:flex; align-items:center; gap:10px;
  background:var(--bg-surface); border:1px solid var(--border); border-radius:14px;
  padding:12px 14px; box-shadow:var(--shadow-md);
}
.search input{
  width:100%; background:transparent; border:0; outline:0; color:var(--text);
  font:600 14px/1.2 inherit;
}
.selects{ display:flex; gap:12px; align-items:center; }
.selects label{ display:flex; flex-direction:column; gap:6px; font-size:12px; color:var(--muted); }
.selects select{
  min-width:170px; height:40px; border-radius:12px; appearance:none;
  background:var(--bg-surface); color:var(--text);
  border:1px solid var(--border); padding:0 12px; font-weight:700;
  box-shadow:var(--shadow-md);
}

/* Chips */
.chips{ padding:8px 16px 14px; display:flex; gap:8px; }
.scroll-x{ overflow:auto; -webkit-overflow-scrolling:touch; }
.chip{
  padding:8px 12px; border-radius:999px; font-size:13px; font-weight:800; cursor:pointer;
  color:var(--text); background:#fff; border:1px solid var(--border);
  white-space:nowrap; transition:box-shadow .2s ease, transform .12s ease, border-color .2s ease;
}
.chip:hover{ box-shadow:var(--shadow-md); transform:translateY(-1px); }
.chip.on{
  color:var(--accent-700); background:linear-gradient(180deg,#fff,var(--accent-50));
  border-color:var(--accent-100); box-shadow:0 0 0 3px var(--accent-50);
}

/* ——— Liste ——— */
.catalog{ padding:18px 16px 36px; }
.catalog-head{ display:flex; align-items:center; gap:12px; justify-content:space-between; margin-bottom:10px; }
.link{ background:none; border:0; color:var(--accent-700); font-weight:900; cursor:pointer; }

.grid{
  display:grid; gap:16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Carte */
.card{
  background:var(--bg-surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow-lg);
  padding:14px;
  display:flex; flex-direction:column; gap:10px;
  transition:transform .18s ease, box-shadow .25s ease, border-color .2s ease;
}
.card:hover{ transform:translateY(-2px); box-shadow:0 30px 60px rgba(16,24,40,.1), 0 2px 8px rgba(16,24,40,.06); border-color:var(--accent-100); }

.card-h{ display:flex; align-items:center; gap:12px; }
.avatar{
  width:44px; height:44px; border-radius:14px; display:grid; place-items:center; font-weight:900; color:#0f172a;
  background:linear-gradient(180deg,#f8fafc,#eef2ff);
  border:1px solid var(--border);
  box-shadow:inset 0 -1px 0 rgba(0,0,0,.04);
}
.title{ margin:0; font-size:17px; font-weight:900; letter-spacing:.2px; }
.sub{ color:var(--muted); font-size:12px; }
.excerpt{ margin:0; color:#1f2937; line-height:1.55; max-height:4.4em; overflow:hidden; }
.tags{ display:flex; flex-wrap:wrap; gap:6px; }
.tag{
  font-size:12px; padding:6px 9px; border-radius:999px;
  background:linear-gradient(180deg,#fff,#fafafa);
  border:1px solid var(--border); color:#0f172a; font-weight:700;
}

/* Footer actions */
.card-f{ display:flex; gap:8px; margin-top:auto; }
.pill{
  height:36px; padding:0 13px; display:inline-flex; align-items:center; gap:8px; border-radius:999px;
  border:1px solid var(--border); background:linear-gradient(180deg,#fff,#fafafa);
  color:var(--text); cursor:pointer; font-weight:900; text-decoration:none;
  transition:transform .12s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
.pill:hover{ transform:translateY(-1px); box-shadow:var(--shadow-md); }
.pill.msg{ background:linear-gradient(180deg, var(--accent), var(--accent-600)); color:#fff; border-color:transparent; }
.pill.msg:hover{ background:linear-gradient(180deg, var(--accent-600), var(--accent-700)); }
.pill.map{ color:var(--accent-700); border-color:var(--accent-100); background:linear-gradient(180deg,#fff,var(--accent-50)); }

/* Pager */
.pager{ display:grid; place-items:center; margin-top:18px; }
.pager .seg{
  background:linear-gradient(180deg, var(--accent), var(--accent-600)); color:#fff; border-color:transparent;
}

/* Squelettes */
.skel{
  height:172px; border-radius:var(--radius);
  background:linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size:200% 100%; animation:sh 1.1s linear infinite;
  border:1px solid var(--border); box-shadow:var(--shadow-lg);
}
@keyframes sh { to{ background-position:-200% 0; } }

.empty,.error{ margin:26px auto; text-align:center; color:#334155; opacity:.95; font-weight:800; }

/* Responsive */
@media (max-width: 1024px){
  .selects select{ min-width:150px; }
}
@media (max-width: 720px){
  .tb-row{ gap:8px; padding:8px 12px; min-height:64px; }
  .seg,.tb-center>summary{ height:42px; }
  .seg span{ display:none; }       /* garde les icônes/compacité sur mobile */
  .seg svg{ margin:0; }
  .filters{ top:64px; }
  .filters-row{ padding:12px; }
  .selects{ width:100%; justify-content:space-between; }
  .selects select{ min-width:138px; }
  .grid{ gap:14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* Focus visible global */
:where(a,button,[role="button"],summary,select,input):focus-visible{
  outline:3px solid var(--accent-100);
  outline-offset:2px;
  border-radius:12px;
}
