/* Tormami product/listing page shell
 * Keeps native AdForest/WooCommerce functionality while giving all product,
 * search, archive and taxonomy pages one consistent marketplace alignment.
 */

body.tormami-product-shell{
  --tm-product-navy:#102341;
  --tm-product-orange:#ff5a0a;
  --tm-product-text:#5f7087;
  --tm-product-muted:#8a97a8;
  --tm-product-line:#e4ebf3;
  --tm-product-bg:#f7f9fc;
  --tm-product-card:#ffffff;
  --tm-product-shadow:0 12px 32px rgba(16,35,65,.065);
  overflow-x:hidden;
  background:var(--tm-product-bg)!important;
  color:var(--tm-product-text);
}

body.tormami-product-shell *{
  box-sizing:border-box;
}

/* ---------------------------------------------------------
   Shared header / footer
   --------------------------------------------------------- */
body.tormami-product-shell .sb-header,
body.tormami-product-shell .adt-header-secondary,
body.tormami-product-shell .adt-header-primary,
body.tormami-product-shell .header-shadow.sb-header,
body.tormami-product-shell .viewport-lg.sb-header,
body.tormami-product-shell .sticky-header:not(.tormami-global-market-header){
  display:none!important;
}

body.tormami-product-shell .tormami-global-market-header{
  display:block!important;
  position:sticky!important;
  top:0!important;
  z-index:2147482000!important;
  width:100%!important;
}

body.admin-bar.tormami-product-shell .tormami-global-market-header{
  top:32px!important;
}

body.tormami-product-shell footer:not(.tormami-global-footer),
body.tormami-product-shell .footer:not(.tormami-global-footer),
body.tormami-product-shell .footer-area:not(.tormami-global-footer),
body.tormami-product-shell .footer-top:not(.tormami-global-footer),
body.tormami-product-shell .sb-footer:not(.tormami-global-footer),
body.tormami-product-shell #footer:not(.tormami-global-footer){
  display:none!important;
}

body.tormami-product-shell .tormami-global-footer{
  display:block!important;
  width:100%!important;
  margin-top:0!important;
}

/* ---------------------------------------------------------
   Global marketplace page width and spacing
   --------------------------------------------------------- */
body.tormami-product-shell main,
body.tormami-product-shell .main-content-area,
body.tormami-product-shell .content-area,
body.tormami-product-shell .single-ad-content,
body.tormami-product-shell .ad-detail-page,
body.tormami-product-shell .search-result-page{
  position:relative;
  min-width:0;
}

body.tormami-product-shell .adt-ads-with-filters,
body.tormami-product-shell .woocommerce-page main,
body.tormami-product-shell .woocommerce main{
  background:linear-gradient(180deg,#fbfdff 0%,#f7f9fc 100%);
}

body.tormami-product-shell .adt-ads-with-filters{
  padding:38px 0 72px!important;
}

body.tormami-product-shell .adt-ads-with-filters>.container,
body.tormami-product-shell .adt-ads-with-filters>.adt-container,
body.tormami-product-shell .adt-ads-with-filters .container.adt-container,
body.tormami-product-shell .woocommerce-page .container,
body.tormami-product-shell .woocommerce .container{
  width:min(1440px,calc(100% - 48px))!important;
  max-width:1440px!important;
  margin-left:auto!important;
  margin-right:auto!important;
  padding-left:0!important;
  padding-right:0!important;
}

body.tormami-product-shell .adt-ads-with-filters>.container>.row,
body.tormami-product-shell .adt-ads-with-filters .adt-container>.row{
  margin-left:0!important;
  margin-right:0!important;
}

body.tormami-product-shell .adt-ads-with-filters>.container>.row>.col-lg-12,
body.tormami-product-shell .adt-ads-with-filters .adt-container>.row>.col-lg-12{
  width:100%!important;
  max-width:none!important;
  padding-left:0!important;
  padding-right:0!important;
}

/* ---------------------------------------------------------
   Search / category / archive layout
   --------------------------------------------------------- */
body.tormami-product-shell .adt-ads-filter-content-wrapper{
  display:grid!important;
  grid-template-columns:286px minmax(0,1fr)!important;
  gap:28px!important;
  align-items:start!important;
  width:100%!important;
  max-width:none!important;
}

body.tormami-product-shell .adt-ads-filter-sidebar{
  width:auto!important;
  min-width:0!important;
  max-width:none!important;
  float:none!important;
  margin:0!important;
  position:sticky!important;
  top:112px!important;
}

body.tormami-product-shell .adt-ads-filter-content{
  width:auto!important;
  min-width:0!important;
  max-width:none!important;
  float:none!important;
  margin:0!important;
  padding:0!important;
}

/* Keep filter widgets visually aligned as one clean sidebar. */
body.tormami-product-shell .adt-ads-filter-sidebar .widget,
body.tormami-product-shell .adt-ads-filter-sidebar .panel,
body.tormami-product-shell .adt-ads-filter-sidebar .search-widget,
body.tormami-product-shell .adt-ads-filter-sidebar .sidebar-widget,
body.tormami-product-shell .adt-ads-filter-sidebar .ads-search-widget{
  width:100%!important;
  margin:0 0 16px!important;
  border:1px solid var(--tm-product-line)!important;
  border-radius:16px!important;
  background:#fff!important;
  box-shadow:0 8px 24px rgba(16,35,65,.045)!important;
  overflow:hidden;
}

/* Sort / result toolbar */
body.tormami-product-shell .adt-ads-sort-box{
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:20px!important;
  min-height:70px!important;
  margin:0 0 22px!important;
  padding:14px 18px!important;
  border:1px solid var(--tm-product-line)!important;
  border-radius:16px!important;
  background:#fff!important;
  box-shadow:0 8px 24px rgba(16,35,65,.045)!important;
}

body.tormami-product-shell .adt-ads-sort-box h3{
  margin:0!important;
  color:var(--tm-product-navy)!important;
  font-size:17px!important;
  line-height:1.35!important;
  font-weight:800!important;
}

body.tormami-product-shell .adt-ads-sort-box h3 span,
body.tormami-product-shell .adt-ads-sort-box h3 a{
  color:var(--tm-product-orange)!important;
  font-size:12px!important;
  font-weight:750!important;
}

body.tormami-product-shell .adt-sort-filters{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  flex-wrap:wrap!important;
  gap:10px!important;
  margin:0!important;
}

body.tormami-product-shell .adt-sort-filters form{
  margin:0!important;
}

body.tormami-product-shell .adt-sort-filters select,
body.tormami-product-shell .adt-sort-filters .default-select,
body.tormami-product-shell .adt-sort-filters .select2-selection{
  min-width:190px!important;
  min-height:42px!important;
  border:1px solid #dfe7f0!important;
  border-radius:10px!important;
  background:#fbfcfe!important;
  color:#334a66!important;
}

body.tormami-product-shell .adt-change-view-box{
  display:flex!important;
  align-items:center!important;
  gap:7px!important;
}

body.tormami-product-shell .adt-change-view-box .icon-box{
  width:42px!important;
  height:42px!important;
  display:grid!important;
  place-items:center!important;
  margin:0!important;
  border:1px solid #dfe7f0!important;
  border-radius:10px!important;
  background:#fff!important;
  color:#718197!important;
  transition:.2s ease!important;
}

body.tormami-product-shell .adt-change-view-box .icon-box.active,
body.tormami-product-shell .adt-change-view-box .icon-box:hover{
  border-color:#ffcbb2!important;
  background:#fff4ee!important;
  color:var(--tm-product-orange)!important;
}

/* Search tags, category expansion and alert strips should align with the listing column. */
body.tormami-product-shell .adt-ads-filter-content>.clearfix + .col-md-12,
body.tormami-product-shell .adt-ads-filter-content>.col-md-12,
body.tormami-product-shell .adt-ads-filter-content .expand-collapse,
body.tormami-product-shell .adt-ads-filter-content .ad-alert-box{
  max-width:100%!important;
}

body.tormami-product-shell .adt-ads-filter-content>.col-md-12{
  padding-left:0!important;
  padding-right:0!important;
}

/* General product/listing card polish without changing native interactions. */
body.tormami-product-shell .adt-ads-filter-content .ad-listing,
body.tormami-product-shell .adt-ads-filter-content .ads-listing,
body.tormami-product-shell .adt-ads-filter-content .ads-list-archive,
body.tormami-product-shell .adt-ads-filter-content .ad-grid-box,
body.tormami-product-shell .adt-ads-filter-content .category-grid-box,
body.tormami-product-shell .adt-ads-filter-content [class*="ad-grid-box"]{
  border:1px solid var(--tm-product-line)!important;
  border-radius:16px!important;
  background:#fff!important;
  box-shadow:var(--tm-product-shadow)!important;
  overflow:hidden!important;
}

body.tormami-product-shell .adt-ads-filter-content .ad-listing img,
body.tormami-product-shell .adt-ads-filter-content .ads-listing img,
body.tormami-product-shell .adt-ads-filter-content .ads-list-archive img,
body.tormami-product-shell .adt-ads-filter-content .ad-grid-box img,
body.tormami-product-shell .adt-ads-filter-content [class*="ad-grid-box"] img{
  max-width:100%!important;
  object-fit:cover!important;
}

/* ---------------------------------------------------------
   Single listing / product pages
   v6 already owns the approved layout; these rules only keep
   the outside shell aligned and prevent Bootstrap overflow.
   --------------------------------------------------------- */
body.tormami-product-shell.tormami-listing-detail-v6 .adt-ad-detail-section>.container,
body.tormami-product-shell.tormami-listing-detail-v6 .tormami-inner-hero__inner{
  margin-left:auto!important;
  margin-right:auto!important;
}

body.tormami-product-shell.tormami-listing-detail-v6 .adt-ad-detail-content-wrapper,
body.tormami-product-shell.tormami-listing-detail-v6 .ad-detail-middle-content,
body.tormami-product-shell.tormami-listing-detail-v6 .ad-right-sidebar{
  min-width:0!important;
}

/* ---------------------------------------------------------
   WooCommerce alignment, if products are enabled
   --------------------------------------------------------- */
body.tormami-product-shell.woocommerce-page .woocommerce,
body.tormami-product-shell .woocommerce{
  width:min(1440px,calc(100% - 48px));
  max-width:1440px;
  margin:0 auto;
  padding:38px 0 72px;
}

body.tormami-product-shell .woocommerce ul.products{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:22px!important;
  margin:0!important;
}

body.tormami-product-shell .woocommerce ul.products:before,
body.tormami-product-shell .woocommerce ul.products:after{
  display:none!important;
}

body.tormami-product-shell .woocommerce ul.products li.product{
  width:auto!important;
  float:none!important;
  margin:0!important;
  padding:0 0 18px!important;
  border:1px solid var(--tm-product-line)!important;
  border-radius:16px!important;
  background:#fff!important;
  box-shadow:var(--tm-product-shadow)!important;
  overflow:hidden!important;
}

body.tormami-product-shell .woocommerce ul.products li.product img{
  width:100%!important;
  aspect-ratio:4/3!important;
  object-fit:cover!important;
  margin:0 0 16px!important;
}

body.tormami-product-shell .woocommerce ul.products li.product .woocommerce-loop-product__title,
body.tormami-product-shell .woocommerce ul.products li.product .price,
body.tormami-product-shell .woocommerce ul.products li.product .button{
  margin-left:16px!important;
  margin-right:16px!important;
}

body.tormami-product-shell .woocommerce div.product{
  display:grid;
  grid-template-columns:minmax(0,1.12fr) minmax(340px,.88fr);
  gap:40px;
  align-items:start;
}

body.tormami-product-shell .woocommerce div.product div.images,
body.tormami-product-shell .woocommerce div.product div.summary{
  width:auto!important;
  float:none!important;
  margin:0!important;
}

/* ---------------------------------------------------------
   Responsive alignment
   --------------------------------------------------------- */
@media(max-width:1180px){
  body.tormami-product-shell .adt-ads-with-filters>.container,
  body.tormami-product-shell .adt-ads-with-filters>.adt-container,
  body.tormami-product-shell .adt-ads-with-filters .container.adt-container,
  body.tormami-product-shell .woocommerce-page .container,
  body.tormami-product-shell .woocommerce .container{
    width:min(100% - 36px,1180px)!important;
  }

  body.tormami-product-shell .adt-ads-filter-content-wrapper{
    grid-template-columns:250px minmax(0,1fr)!important;
    gap:20px!important;
  }

  body.tormami-product-shell .woocommerce ul.products{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
  }
}

@media(max-width:900px){
  body.tormami-product-shell .adt-ads-filter-content-wrapper{
    grid-template-columns:1fr!important;
  }

  body.tormami-product-shell .adt-ads-filter-sidebar{
    position:relative!important;
    top:auto!important;
  }

  body.tormami-product-shell .adt-ads-sort-box{
    align-items:flex-start!important;
    flex-direction:column!important;
  }

  body.tormami-product-shell .adt-sort-filters{
    width:100%!important;
    justify-content:space-between!important;
  }

  body.tormami-product-shell .woocommerce ul.products{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }

  body.tormami-product-shell .woocommerce div.product{
    grid-template-columns:1fr;
    gap:26px;
  }
}

@media(max-width:782px){
  body.admin-bar.tormami-product-shell .tormami-global-market-header{
    top:46px!important;
  }
}

@media(max-width:640px){
  body.tormami-product-shell .adt-ads-with-filters{
    padding:24px 0 48px!important;
  }

  body.tormami-product-shell .adt-ads-with-filters>.container,
  body.tormami-product-shell .adt-ads-with-filters>.adt-container,
  body.tormami-product-shell .adt-ads-with-filters .container.adt-container,
  body.tormami-product-shell .woocommerce-page .container,
  body.tormami-product-shell .woocommerce .container,
  body.tormami-product-shell.woocommerce-page .woocommerce,
  body.tormami-product-shell .woocommerce{
    width:calc(100% - 24px)!important;
  }

  body.tormami-product-shell .adt-ads-sort-box{
    min-height:0!important;
    padding:13px!important;
    border-radius:13px!important;
  }

  body.tormami-product-shell .adt-sort-filters,
  body.tormami-product-shell .adt-sort-filters form{
    width:100%!important;
  }

  body.tormami-product-shell .adt-sort-filters select,
  body.tormami-product-shell .adt-sort-filters .default-select,
  body.tormami-product-shell .adt-sort-filters .select2-selection{
    width:100%!important;
    min-width:0!important;
  }

  body.tormami-product-shell .woocommerce ul.products{
    grid-template-columns:1fr!important;
    gap:16px!important;
  }
}
