/* catalog.css - Catalogue (boutique / archives catégorie & marque)
   Réutilise le design system de theme.css, on aliase ici les tokens absents. */

/* Tokens absents du thème, aliasés (pas de duplication de valeurs).
   .cathead (en-tête partagé) est désormais dans theme.css. */
.catalog {
  --surf: var(--blanc);
  --line: var(--ligne);
  --ink:  var(--noir);
  --g900: var(--noir);
}

.catalog { padding: 32px 0 72px; }
.cat-grid { display: grid; grid-template-columns: 284px 1fr; gap: 34px; align-items: start; }

/* ============ SIDEBAR FILTRES ============ */
/* top = hauteur du header collant (hbar ~74px + catbar ~47px) + petit écart,
   sinon les filtres se glissent sous le header au défilement. */
.filters { background: var(--surf); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 20px 18px; position: sticky; top: calc(var(--header-h) + 8px); align-self: start; max-height: calc(100vh - var(--header-h) - 24px); overflow-y: auto; }
.filters-foot { display: none; } /* pied du tiroir : mobile uniquement */
.fh { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 4px; }
.fh h2 { font-size: 16px; font-weight: 800; }
.fclose { display: none; border: none; background: var(--g50); width: 34px; height: 34px; border-radius: 50%; color: var(--g700); }
.fclose svg { width: 18px; height: 18px; margin: auto; }
.clear-link { font-size: 12.5px; color: var(--muted); font-weight: 600; background: none; border: none; cursor: pointer; }
.clear-link:hover { color: var(--ink); }
.fgroup { border-top: 1px solid var(--line); padding: 16px 0; }
.fgroup h3 { font-size: 12.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--g700); margin-bottom: 12px; }
/* Têtes de groupe / accordéon (replié uniquement en mobile via JS) */
.fgroup-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; background: none; border: none; padding: 0; font-family: var(--f); cursor: default; text-align: left; }
.fg-title { font-size: 12.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--g700); }
.fg-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.fg-badge { background: var(--or); color: var(--noir); font-size: 10px; font-weight: 800; min-width: 18px; height: 18px; border-radius: 50px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.fg-badge[hidden] { display: none; }
.fg-chev { display: none; width: 18px; height: 18px; color: var(--muted); flex: 0 0 auto; transition: transform .2s; }
.fgroup-acc .fgroup-body { margin-top: 12px; }
.fsearch { width: 100%; border: 1.5px solid var(--line); border-radius: 50px; padding: 9px 14px; font-family: var(--f); font-size: 13px; margin-bottom: 10px; outline: none; }
.fsearch:focus { border-color: var(--g700); }
.flist { display: flex; flex-direction: column; max-height: 236px; overflow: auto; margin: 0 -8px; padding: 0 8px; }
.flist::-webkit-scrollbar { width: 7px; }
.flist::-webkit-scrollbar-thumb { background: #d8d8d8; border-radius: 50px; }
.fopt { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; cursor: pointer; color: var(--ink); }
.fopt:hover { color: var(--g900); }
.fopt input { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border: 1.5px solid #c8c8c8; border-radius: 5px; flex: 0 0 auto; display: grid; place-content: center; cursor: pointer; transition: .12s; }
.fopt input:checked { background: var(--or); border-color: var(--or); }
.fopt input:checked::after { content: ""; width: 9px; height: 5px; border-left: 2px solid var(--noir); border-bottom: 2px solid var(--noir); transform: rotate(-45deg) translateY(-1px); }
.fopt .c { margin-left: auto; color: var(--muted); font-size: 12.5px; font-weight: 600; }

.ftoggle { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
.ftoggle input { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 50px; background: #d6d6d6; position: relative; cursor: pointer; transition: .18s; flex: 0 0 auto; }
.ftoggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .18s; }
.ftoggle input:checked { background: var(--or); }
.ftoggle input:checked::after { left: 21px; }

.price-in { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.price-in input { width: 100%; border: 1.5px solid var(--line); border-radius: var(--rs); padding: 9px 10px; font-family: var(--f); font-size: 13.5px; outline: none; }
.price-in input:focus { border-color: var(--g700); }
.price-in span { color: var(--muted); }
.price-apply { margin-top: 4px; border: 1.5px solid var(--line); background: var(--surf); border-radius: 50px; padding: 8px 18px; font-family: var(--f); font-weight: 700; font-size: 13px; color: var(--ink); cursor: pointer; }
.price-apply:hover { border-color: var(--g700); }

/* Résultats, barre d'outils */
.rtoolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.rcount { font-size: 14px; color: var(--muted); }
.rcount b { color: var(--ink); }
.rtools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.selwrap { position: relative; }
.selwrap select { appearance: none; -webkit-appearance: none; border: 1.5px solid var(--line); background: var(--surf); border-radius: 50px; padding: 9px 36px 9px 15px; font-family: var(--f); font-weight: 700; font-size: 13.5px; color: var(--ink); cursor: pointer; outline: none; }
.selwrap select:hover { border-color: var(--g700); }
.selwrap .chev { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; pointer-events: none; color: var(--g600); }
.btn-filter { display: none; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: var(--surf); border-radius: 50px; padding: 9px 16px; font-family: var(--f); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.btn-filter svg { width: 16px; height: 16px; }

/* ============ Chips de filtres actifs ============ */
.achips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; min-height: 2px; align-items: center; }
.achip { display: inline-flex; align-items: center; gap: 8px; background: var(--g50); border: 1px solid var(--line); border-radius: 50px; padding: 6px 8px 6px 14px; font-size: 13px; font-weight: 600; }
.achip a { border: none; background: #e2e2e2; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #555; font-size: 12px; line-height: 1; text-decoration: none; }
.achip a:hover { background: var(--g700); color: #fff; }
.achip-clear { background: none; border: none; color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer; padding: 6px 4px; text-decoration: none; }
.achip-clear:hover { color: var(--ink); }

/* ============ Grille de cartes ============ */
.rgrid { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
.pcard { display: flex; flex-direction: column; background: var(--surf); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--sh-sm); transition: .18s; color: inherit; text-decoration: none; }
.pcard:hover { box-shadow: var(--sh-md); transform: translateY(-3px); }
.pc-img { aspect-ratio: 4/3; background: var(--g50); display: flex; align-items: center; justify-content: center; position: relative; }
.pc-img .pico { width: 34px; height: 34px; }
.pc-img > img { width: 100%; height: 100%; object-fit: cover; }
.pc-img .stock { position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,.95); color: var(--success); font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 50px; display: flex; align-items: center; gap: 6px; }
.pc-img .stock i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); display: block; }
.pc-img .stock.out { color: #c0392b; }
.pc-img .stock.out i { background: #c0392b; }
.pc-img .qadd { position: absolute; right: 12px; bottom: 12px; width: 40px; height: 40px; border-radius: 50%; background: var(--g700); color: #fff; border: none; display: flex; align-items: center; justify-content: center; opacity: 0; transform: translateY(6px); transition: .2s; cursor: pointer; }
.pcard:hover .qadd { opacity: 1; transform: none; }
.pc-img .qadd:hover { background: var(--or); color: var(--noir); }
.pc-img .qadd svg { width: 19px; height: 19px; }
.pc-body { padding: 16px 16px 18px; display: flex; flex-direction: column; flex: 1; }
.pc-body .sbrand { margin-bottom: 5px; }
.pc-body h3 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; line-height: 1.34; margin-bottom: 7px; }
.pc-desc { font-size: 13px; color: var(--muted); margin-bottom: 13px; line-height: 1.5; }
.pc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pc-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.pc-foot .pr { font-size: 18px; font-weight: 800; }
.pc-foot .see { color: var(--ink); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 5px; padding-bottom: 3px; transition: box-shadow .18s; }
.pc-foot .see svg { width: 14px; height: 14px; transition: .18s; }
.pcard:hover .pc-foot .see svg { transform: translateX(3px); }
.pcard:hover .pc-foot .see { box-shadow: inset 0 -3px 0 var(--or); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }

/* État de chargement AJAX (léger fondu + curseur d'attente) */
#catresults { position: relative; transition: opacity .15s; }
#catresults.is-loading { opacity: .45; pointer-events: none; }
#catresults.is-loading::after {
  content: ""; position: absolute; top: 80px; left: 50%; width: 34px; height: 34px;
  margin-left: -17px; border: 3px solid var(--line); border-top-color: var(--g700);
  border-radius: 50%; animation: schubnel-spin .7s linear infinite;
}
@keyframes schubnel-spin { to { transform: rotate(360deg); } }

/* ============ Pagination (classes WordPress) ============ */
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 44px; flex-wrap: wrap; }
.pager .page-numbers { min-width: 42px; height: 42px; border-radius: 50px; border: 1.5px solid var(--line); background: var(--surf); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: var(--ink); padding: 0 8px; text-decoration: none; }
.pager a.page-numbers:hover { border-color: var(--g700); }
.pager .current { background: var(--g900); color: #fff; border-color: var(--g900); }
.pager .dots { border: none; background: none; min-width: auto; }
.pager .prev svg, .pager .next svg { width: 18px; height: 18px; }

/* ============ Arbre de catégories ============ */
.ftree details { border-bottom: 1px solid var(--line); }
.ftree details:last-child { border-bottom: none; }
.ftree summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; font-size: 14px; font-weight: 700; color: var(--ink); }
.ftree summary::-webkit-details-marker { display: none; }
.ftree summary .ar { width: 16px; height: 16px; flex: 0 0 auto; color: var(--g600); transition: .2s; }
.ftree details[open] summary .ar { transform: rotate(180deg); }
.ftree summary:hover { color: var(--g900); }
.ftree .tlinks { display: flex; flex-direction: column; padding: 0 0 10px; }
.ftree .tlinks a { font-size: 13.5px; color: #555; padding: 5px 0 5px 10px; border-left: 2px solid transparent; transition: .12s; text-decoration: none; }
.ftree .tlinks a:hover { color: var(--ink); border-left-color: var(--or); }
.ftree .tlinks a.cur { color: var(--ink); border-left-color: var(--or); font-weight: 700; }
.ftree-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; font-size: 14px; font-weight: 700; color: var(--ink); border-bottom: 1px solid var(--line); text-decoration: none; }
.ftree-link:last-child { border-bottom: none; }
.ftree-link:hover, .ftree-link.cur { color: var(--g900); }
.ftree-link.cur { box-shadow: inset 2px 0 0 var(--or); padding-left: 8px; }
.ftree-link .c { color: var(--muted); font-size: 12.5px; font-weight: 600; }

/* ============ Responsive ============ */
.fback { display: none; }
@media (max-width: 1100px) { .rgrid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 920px) {
  .cat-grid { grid-template-columns: 1fr; }

  /* Panneau filtres plein écran (glisse depuis le bas) */
  .filters {
    position: fixed; inset: 0; z-index: 130; width: 100%; max-width: 100%; height: 100%;
    max-height: none; border: none; border-radius: 0; background: var(--surf);
    transform: translateY(100%); transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: none; overflow: hidden; padding: 0;
    display: flex; flex-direction: column;
  }
  .filters.open { transform: none; }

  /* En-tête fixe */
  .filters .fh { flex: 0 0 auto; margin: 0; padding: 16px 18px; border-bottom: 1px solid var(--line); }
  .filters .fh h2 { font-size: 18px; }

  /* Corps scrollable */
  .filters-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 0 18px; }
  .filters-body > .clear-link { display: none; }          /* réinitialiser est dans le pied */
  .filters .fgroup { padding: 0; }
  .filters .fgroup-flat { padding: 16px 0; border-top: none; }
  .filters .fgroup-acc { border-top: 1px solid var(--line); }
  .filters .fgroup-head { cursor: pointer; padding: 17px 0; }
  .filters .fg-title { font-size: 14px; }
  .filters .fg-chev { display: block; }
  .filters .fgroup-acc.is-collapsed .fgroup-body { display: none; }
  .filters .fgroup-acc:not(.is-collapsed) .fg-chev { transform: rotate(180deg); }
  .filters .fgroup-acc .fgroup-body { margin-top: 0; padding-bottom: 18px; }
  .filters .flist { max-height: none; overflow: visible; margin: 0; padding: 0; }
  .filters .fopt { padding: 10px 0; font-size: 15px; }
  .filters .fopt input { width: 20px; height: 20px; }
  .filters .ftoggle { font-size: 15px; }
  .filters .fsearch { padding: 11px 16px; font-size: 14px; }
  .filters .price-apply { display: none; }                /* le pied applique tout */

  /* Pied fixe */
  .filters-foot {
    flex: 0 0 auto; display: flex; align-items: center; gap: 12px;
    background: var(--surf); border-top: 1px solid var(--line);
    padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  }
  .ff-reset { font-size: 13.5px; font-weight: 700; color: var(--muted); white-space: nowrap; text-decoration: none; }
  .ff-reset:hover { color: var(--ink); }
  .ff-apply { flex: 1; background: var(--or); color: var(--noir); border: none; border-radius: 50px; padding: 15px 18px; font-family: var(--f); font-weight: 800; font-size: 15px; cursor: pointer; transition: background .15s; }
  .ff-apply:hover { background: var(--or-h); }

  .fclose { display: flex; }
  .fback { display: none; }                                /* panneau plein écran : pas de fond cliquable */
  .btn-filter { display: inline-flex; }
}
@media (max-width: 560px) {
  .rgrid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .pc-img .qadd { opacity: 1; transform: none; width: 34px; height: 34px; }
  .pc-body { padding: 12px; }
  .pc-desc { display: none; }                 /* trop tassé en 2 colonnes */
  .pcard h3 { font-size: 13.5px; line-height: 1.3; }
  .pc-chips { gap: 5px; }
  .pc-chips .chip { font-size: 10.5px; padding: 3px 7px; }
  .pc-foot { flex-direction: column; align-items: flex-start; gap: 6px; }
  .pc-foot .pr { font-size: 15px; }
  .pc-foot .see { font-size: 12px; }
  .pc-img .stock, .pc-img .stock.out { font-size: 10px; padding: 3px 8px; top: 8px; right: 8px; }
}
