/**
 * Archives boutique / catégories — filtres + toolbar + tiroir mobile.
 *
 * Pas de page-id, pas de #place_order / #vdp_delivery_date.
 */

body.vdp-is-archive {
  --vdp-filter-width: 260px;
}

body.vdp-is-archive #content-wrap.container,
body.woocommerce-shop #content-wrap.container,
body.tax-product_cat #content-wrap.container,
body.tax-product_tag #content-wrap.container,
body.post-type-archive-product #content-wrap.container,
body.search.woocommerce #content-wrap.container {
  width: min(var(--vdp-container, 1200px), calc(100% - 24px));
  max-width: var(--vdp-container, 1200px);
  margin-inline: auto;
  padding-left: 0;
  padding-right: 0;
  box-sizing: border-box;
}

/* Breadcrumb + titre */
body.woocommerce .woocommerce-breadcrumb,
.vdp-archive-breadcrumb,
.woocommerce .woocommerce-breadcrumb {
  margin: var(--vdp-space-3, 16px) 0 var(--vdp-space-2, 12px);
  font-family: var(--vdp-font, Inter, system-ui, sans-serif);
  font-size: 0.8125rem;
  color: var(--vdp-text-secondary, #666);
}

.woocommerce .woocommerce-breadcrumb a {
  color: var(--vdp-text-secondary, #666);
  text-decoration: none;
}

.woocommerce .woocommerce-breadcrumb a:hover {
  color: var(--vdp-red, #a30e16);
}

.woocommerce .woocommerce-products-header {
  margin: 0 0 var(--vdp-space-4, 24px);
  padding: 0;
  border: 0;
}

.woocommerce .woocommerce-products-header__title,
.woocommerce-products-header .page-title {
  margin: 0 0 var(--vdp-space-2, 12px) !important;
  font-family: var(--vdp-font-display, "Cormorant Garamond", Georgia, serif) !important;
  font-size: clamp(1.75rem, 3vw, 2.35rem) !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  color: var(--vdp-black, #111) !important;
  text-transform: none !important;
}

.woocommerce .term-description,
.woocommerce .woocommerce-products-header .term-description {
  max-width: 42rem;
  margin: 0;
  color: var(--vdp-text-secondary, #666);
  font-family: var(--vdp-font, Inter, system-ui, sans-serif);
  font-size: 0.95rem;
  line-height: 1.5;
}

.woocommerce .term-description p {
  margin: 0;
}

body.vdp-is-archive .oceanwp-grid-list {
  display: none !important;
}
.vdp-archive-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin: 0 0 var(--vdp-space-4, 24px);
  padding: 0 0 var(--vdp-space-3, 16px);
  border-bottom: 1px solid var(--vdp-border, #e5e2de);
}

.vdp-filter-open {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--vdp-border, #e5e2de);
  border-radius: var(--vdp-radius, 8px);
  background: var(--vdp-white, #fff);
  color: var(--vdp-black, #111);
  font-family: var(--vdp-font, Inter, system-ui, sans-serif);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.vdp-filter-open__icon {
  font-size: 1rem;
  line-height: 1;
}

.vdp-archive-toolbar__meta {
  margin-right: auto;
  font-family: var(--vdp-font, Inter, system-ui, sans-serif);
  font-size: 0.8125rem;
  color: var(--vdp-text-secondary, #666);
}

.vdp-archive-toolbar .woocommerce-result-count {
  margin: 0;
  padding: 0;
  float: none;
  font-size: inherit;
}

.vdp-archive-toolbar__sort {
  margin-left: auto;
}

.vdp-archive-toolbar .woocommerce-ordering {
  margin: 0;
  float: none;
}

.vdp-archive-toolbar .woocommerce-ordering select {
  min-height: 44px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--vdp-border, #e5e2de);
  border-radius: var(--vdp-radius, 8px);
  background: var(--vdp-white, #fff);
  font-family: var(--vdp-font, Inter, system-ui, sans-serif);
  font-size: 0.875rem;
  color: var(--vdp-black, #111);
}

/* Desktop : filtres à gauche, grille à droite */
@media (min-width: 1024px) {
  body.has-sidebar.content-left-sidebar.woocommerce.archive #content-wrap,
  body.has-sidebar.content-left-sidebar.woocommerce-shop #content-wrap,
  body.has-sidebar.content-right-sidebar.woocommerce.archive #content-wrap,
  body.has-sidebar.vdp-is-archive #content-wrap {
    display: grid !important;
    grid-template-columns: var(--vdp-filter-width) minmax(0, 1fr) !important;
    gap: var(--vdp-space-5, 32px) !important;
    align-items: start;
  }

  body.has-sidebar.vdp-is-archive #right-sidebar {
    grid-column: 1;
    grid-row: 1;
    width: 100% !important;
    max-width: none !important;
    float: none !important;
    margin: 0 !important;
  }

  body.has-sidebar.woocommerce.archive #primary,
  body.has-sidebar.woocommerce-shop #primary,
  body.has-sidebar.vdp-is-archive #primary {
    grid-column: 2;
    grid-row: 1;
    width: 100% !important;
    max-width: none !important;
    float: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .vdp-filter-drawer__head {
    display: none;
  }
}

/* Sidebar / filtres */
body.vdp-is-archive #right-sidebar {
  background: var(--vdp-white, #fff);
  border: 1px solid var(--vdp-border, #e5e2de);
  border-radius: var(--vdp-radius-lg, 16px);
  padding: var(--vdp-space-4, 24px) !important;
  box-sizing: border-box;
}

body.vdp-is-archive #right-sidebar .sidebar-box {
  margin: 0 0 var(--vdp-space-4, 24px) !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.vdp-is-archive #right-sidebar .sidebar-box:last-child {
  margin-bottom: 0 !important;
}

body.vdp-is-archive #right-sidebar .widget-title {
  margin: 0 0 12px !important;
  padding: 0 0 8px !important;
  border-bottom: 1px solid var(--vdp-border, #e5e2de);
  font-family: var(--vdp-font, Inter, system-ui, sans-serif) !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em;
  text-transform: uppercase !important;
  color: var(--vdp-black, #111) !important;
}

body.vdp-is-archive #right-sidebar .product-categories {
  list-style: none;
  margin: 0;
  padding: 0;
}

body.vdp-is-archive #right-sidebar .product-categories li {
  margin: 0;
  padding: 0;
  list-style: none;
}

body.vdp-is-archive #right-sidebar .product-categories a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  color: var(--vdp-black, #111);
  font-family: var(--vdp-font, Inter, system-ui, sans-serif);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--vdp-radius-sm, 6px);
}

body.vdp-is-archive #right-sidebar .product-categories a:hover,
body.vdp-is-archive #right-sidebar .product-categories .current-cat > a {
  color: var(--vdp-red, #a30e16);
  background: var(--vdp-background-soft, #f2f0ec);
}

/* Mobile / tablette : tiroir */
@media (max-width: 1023px) {
  .vdp-filter-open {
    display: inline-flex;
  }

  body.has-sidebar.woocommerce.archive #primary,
  body.has-sidebar.woocommerce-shop #primary,
  body.has-sidebar.vdp-is-archive #primary,
  body.has-sidebar.woocommerce.archive #right-sidebar,
  body.has-sidebar.woocommerce-shop #right-sidebar,
  body.has-sidebar.vdp-is-archive #right-sidebar {
    width: 100% !important;
    float: none !important;
    margin: 0 !important;
  }

  body.vdp-is-archive #right-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    z-index: var(--vdp-z-drawer, 300);
    width: min(100%, 380px) !important;
    max-width: 100%;
    margin: 0 !important;
    padding: 0 20px 24px !important;
    border-radius: 0;
    border: 0;
    border-left: 1px solid var(--vdp-border, #e5e2de);
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.12);
    transform: translateX(110%);
    transition: transform 220ms ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.vdp-filters-open.vdp-is-archive #right-sidebar {
    transform: translateX(0);
  }

  .vdp-filter-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1;
    margin: 0 -20px 16px;
    padding: 16px 20px;
    background: var(--vdp-white, #fff);
    border-bottom: 1px solid var(--vdp-border, #e5e2de);
  }

  .vdp-filter-drawer__title {
    margin: 0;
    font-family: var(--vdp-font-display, "Cormorant Garamond", Georgia, serif);
    font-size: 1.35rem;
    font-weight: 600;
  }

  .vdp-filter-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--vdp-black, #111);
    cursor: pointer;
  }

  .vdp-filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 290;
    background: rgba(17, 17, 17, 0.45);
  }

  body.vdp-filters-open .vdp-filter-overlay {
    display: block;
  }

  body.vdp-filters-open {
    overflow: hidden;
  }
}

@media (min-width: 1024px) {
  .vdp-filter-overlay {
    display: none !important;
  }
}

@media (max-width: 600px) {
  .vdp-archive-toolbar {
    gap: 8px;
  }

  .vdp-archive-toolbar__meta {
    width: 100%;
    order: 3;
    margin: 0;
  }

  .vdp-archive-toolbar__sort {
    flex: 1 1 auto;
    margin: 0;
  }

  .vdp-archive-toolbar .woocommerce-ordering,
  .vdp-archive-toolbar .woocommerce-ordering select {
    width: 100%;
  }

  body.vdp-is-archive #right-sidebar {
    width: 100% !important;
    border-left: 0;
    border-radius: 16px 16px 0 0;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 88vh;
    transform: translateY(110%);
  }

  body.vdp-filters-open.vdp-is-archive #right-sidebar {
    transform: translateY(0);
  }
}
