/* Mars 1.3.1 — My Account controls + mobile shop/filter alignment */

/* Keep controls visually centered even when WooCommerce injects legacy button rules. */
body.woocommerce-account .woocommerce-MyAccount-content a.button,
body.woocommerce-account .woocommerce-MyAccount-content button.button,
body.woocommerce-account .woocommerce-MyAccount-content input.button,
body.woocommerce-account .woocommerce-info .button,
body.woocommerce-account .woocommerce-message .button,
body.woocommerce-account .woocommerce-error .button,
body.woocommerce-account .mars-account-empty-orders .mars-button,
body.woocommerce-account .mars-account-shop-link,
body.woocommerce-account .mars-account-order-action{
  box-sizing:border-box!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:7px!important;
  height:auto!important;
  min-height:40px!important;
  padding:9px 15px!important;
  margin:0!important;
  line-height:1.2!important;
  vertical-align:middle!important;
  text-align:center!important;
  white-space:nowrap!important;
  overflow:visible!important;
  text-indent:0!important;
}
body.woocommerce-account .woocommerce-info .button,
body.woocommerce-account .woocommerce-message .button,
body.woocommerce-account .woocommerce-error .button{
  float:none!important;
  align-self:center!important;
}
body.woocommerce-account .woocommerce-MyAccount-content .button::before,
body.woocommerce-account .woocommerce-MyAccount-content .button::after{line-height:1!important}

/* Account notices must not collapse or clip their action buttons. */
body.woocommerce-account .woocommerce-info,
body.woocommerce-account .woocommerce-message,
body.woocommerce-account .woocommerce-error{
  overflow:visible!important;
  min-width:0!important;
}
body.woocommerce-account .woocommerce-info>*:not(.button),
body.woocommerce-account .woocommerce-message>*:not(.button),
body.woocommerce-account .woocommerce-error>*:not(.button){min-width:0!important}

/* Product-card typography: Poppins is the theme default and product names stay medium. */
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product .woocommerce-loop-product__title a,
.mars-product-card .woocommerce-loop-product__title,
.mars-product-card .woocommerce-loop-product__title a{
  font-family:var(--mars-font,"Poppins",sans-serif)!important;
  font-weight:500!important;
  letter-spacing:0!important;
  overflow-wrap:anywhere!important;
}

@media(max-width:980px){
  /* Shop/category content occupies the full container; no left-biased narrow grid. */
  body.woocommerce-shop .mars-shop-layout,
  body.tax-product_cat .mars-shop-layout,
  body.post-type-archive-product .mars-shop-layout{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
  }
  body.woocommerce-shop .mars-shop-results,
  body.tax-product_cat .mars-shop-results,
  body.post-type-archive-product .mars-shop-results{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
  }
  body.woocommerce-shop ul.products,
  body.tax-product_cat ul.products,
  body.post-type-archive-product ul.products{
    box-sizing:border-box!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0 auto!important;
    padding:0!important;
    justify-content:stretch!important;
    align-items:stretch!important;
  }
  body.woocommerce-shop ul.products>li.product,
  body.tax-product_cat ul.products>li.product,
  body.post-type-archive-product ul.products>li.product{
    box-sizing:border-box!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
  }

  /* The drawer is portaled to body by v131.js, so it cannot be clipped by the shop container. */
  body .mars-shop-sidebar[data-mars-shop-sidebar]{
    position:fixed!important;
    inset:0 auto 0 0!important;
    top:0!important;
    bottom:0!important;
    left:0!important;
    width:min(92vw,390px)!important;
    max-width:390px!important;
    height:100dvh!important;
    max-height:100dvh!important;
    margin:0!important;
    padding:max(18px,env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom))!important;
    border:0!important;
    border-radius:0 16px 16px 0!important;
    background:#fff!important;
    box-shadow:18px 0 50px rgba(5,24,45,.20)!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    transform:translate3d(-104%,0,0)!important;
    transition:transform .25s ease!important;
    z-index:10060!important;
    visibility:visible!important;
  }
  body.mars-filters-open .mars-shop-sidebar[data-mars-shop-sidebar]{transform:translate3d(0,0,0)!important}
  body.mars-filters-open{overflow:hidden!important;touch-action:none}
  body.mars-filters-open::before{
    content:""!important;
    position:fixed!important;
    inset:0!important;
    display:block!important;
    background:rgba(7,27,49,.48)!important;
    backdrop-filter:blur(1px)!important;
    z-index:10050!important;
  }
  .mars-shop-sidebar__mobile-head{
    position:sticky!important;
    top:0!important;
    z-index:3!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    min-height:58px!important;
    margin:0 -18px 16px!important;
    padding:10px 18px!important;
    background:#fff!important;
    border-bottom:1px solid var(--mars-border)!important;
  }

  /* Filter + sorting are two truly equal controls. */
  .mars-shop-toolbar{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    gap:8px!important;
    align-items:stretch!important;
    justify-content:stretch!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    min-height:0!important;
    margin:0 0 14px!important;
  }
  .mars-filter-open,
  .mars-toolbar-order,
  .mars-toolbar-order .woocommerce-ordering,
  .mars-toolbar-order select{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
  }
  .mars-filter-open{
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:7px!important;
    height:44px!important;
    padding:0 10px!important;
    border:1px solid #d9dfe8!important;
    border-radius:7px!important;
    background:#fff!important;
    color:var(--mars-text)!important;
    font-size:11px!important;
    font-weight:500!important;
  }
  .mars-toolbar-order .woocommerce-ordering{float:none!important;display:block!important}
  .mars-toolbar-order select{
    display:block!important;
    height:44px!important;
    padding:0 34px 0 10px!important;
    border:1px solid #d9dfe8!important;
    border-radius:7px!important;
    background-color:#fff!important;
    color:var(--mars-text)!important;
    font-family:var(--mars-font,"Poppins",sans-serif)!important;
    font-size:10px!important;
    font-weight:500!important;
  }
  .mars-toolbar-count{display:none!important}
}

@media(max-width:700px){
  /* Consistent mobile container and centered two-column grid. */
  body.woocommerce-shop .mars-container,
  body.tax-product_cat .mars-container,
  body.post-type-archive-product .mars-container{
    width:calc(100% - 20px)!important;
    max-width:calc(100% - 20px)!important;
    margin-left:auto!important;
    margin-right:auto!important;
    padding-left:0!important;
    padding-right:0!important;
  }
  body.woocommerce-shop ul.products,
  body.tax-product_cat ul.products,
  body.post-type-archive-product ul.products{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    column-gap:10px!important;
    row-gap:12px!important;
  }
  body.woocommerce-shop .mars-product-card,
  body.tax-product_cat .mars-product-card,
  body.post-type-archive-product .mars-product-card{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
  }

  /* Requested mobile product-title ceiling: 9px, medium, two clean lines. */
  .woocommerce ul.products li.product .woocommerce-loop-product__title,
  .woocommerce ul.products li.product .woocommerce-loop-product__title a,
  .mars-product-card .woocommerce-loop-product__title,
  .mars-product-card .woocommerce-loop-product__title a{
    font-size:9px!important;
    font-weight:500!important;
    line-height:1.4!important;
  }
  .woocommerce ul.products li.product .woocommerce-loop-product__title,
  .mars-product-card .woocommerce-loop-product__title{
    display:-webkit-box!important;
    -webkit-line-clamp:2!important;
    -webkit-box-orient:vertical!important;
    overflow:hidden!important;
    min-height:25px!important;
    max-height:25px!important;
    margin:0 0 5px!important;
  }

  /* Account buttons: full text stays vertically centered on small screens too. */
  body.woocommerce-account .woocommerce-info,
  body.woocommerce-account .woocommerce-message,
  body.woocommerce-account .woocommerce-error{
    align-items:stretch!important;
  }
  body.woocommerce-account .woocommerce-info .button,
  body.woocommerce-account .woocommerce-message .button,
  body.woocommerce-account .woocommerce-error .button,
  body.woocommerce-account .mars-account-empty-orders .mars-button,
  body.woocommerce-account .mars-account-shop-link{
    width:100%!important;
    min-height:42px!important;
    padding:10px 12px!important;
    line-height:1.25!important;
  }
}
