/*
 * EDC mobile MVP overrides for Sellegance.
 * Scope is intentionally narrow: category/catalog, FilterVier, mobile header.
 */

@media only screen and (max-width: 767px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body.responsive.boxed_layout,
  body.responsive.boxed_layout .topcanvas,
  body.responsive.boxed_layout .container,
  body.responsive.boxed_layout .container-inner {
    width: 100% !important;
    max-width: 100% !important;
  }

  .container,
  .container-inner {
    padding-left: 14px;
    padding-right: 14px;
  }

  .row {
    margin-left: -8px;
    margin-right: -8px;
  }

  [class*="col-"] {
    padding-left: 8px;
    padding-right: 8px;
  }

  #content.category {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 8px;
    padding-right: 8px;
  }

  #content.category .mainborder {
    min-width: 0;
    overflow: visible;
  }

  .category .category-description,
  .category .category-info,
  .category .category-details {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .category h1 {
    font-size: 24px;
    line-height: 1.25;
    margin-top: 18px;
    margin-bottom: 16px;
  }

  /* FilterVier: keep the existing logic, make the collapsed entry touch-safe. */
  #block_filter_vier {
    width: 100%;
    max-width: 100%;
    margin: 0 0 12px;
  }

  #name_filter .heading-title {
    min-height: 48px;
    margin: 0;
    padding: 13px 44px 13px 14px;
    font-size: 16px;
    line-height: 20px;
    text-align: center;
    border: 1px solid #d8d8d8;
    background: #fff;
  }

  #name_filter .arrow_n_f {
    right: 14px;
  }

  #filter_vier,
  #block_filter_vier .box-content {
    max-width: 100%;
  }

  #filter_vier input,
  #filter_vier select,
  #filter_vier button,
  #filter_vier .button,
  #button_price input {
    min-height: 44px;
  }

  /* Catalog toolbar. */
  .category .product-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    margin: 0 0 14px;
    padding: 0 0 12px;
    border-bottom: 1px solid #e5e5e5;
  }

  .category .product-filter .display {
    display: flex;
    flex: 0 0 auto;
  }

  .category .product-filter .display .btn,
  .category .product-filter .product-compare .btn,
  .category .product-filter #input-sort,
  .category .product-filter #input-limit {
    min-height: 42px;
    padding: 9px 12px;
    font-size: 13px;
    line-height: 20px;
  }

  .category .product-filter .product-compare {
    display: none;
  }

  .category .product-filter .list-options {
    display: flex;
    flex: 1 1 220px;
    min-width: 0;
    justify-content: flex-end;
    gap: 8px;
  }

  .category .product-filter .sort,
  .category .product-filter .limit {
    display: flex;
    align-items: center;
    min-width: 0;
  }

  .category .product-filter .sort {
    flex: 1 1 auto;
  }

  .category .product-filter .limit {
    flex: 0 0 auto;
  }

  .category .product-filter .sort > .fa {
    flex: 0 0 auto;
    margin-right: 6px;
  }

  .category .product-filter .dropdown,
  .category .product-filter #input-sort {
    width: 100%;
    max-width: 100%;
  }

  .category .product-filter #input-sort {
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .category .product-filter .dropdown-menu {
    max-width: calc(100vw - 28px);
    white-space: normal;
  }

  /* Product grid: explicit mobile columns without horizontal overflow. */
  .category .product-listing {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: auto;
    max-width: none;
    margin-left: -6px;
    margin-right: -6px;
  }

  .category .product-layout.product-grid {
    float: none !important;
    display: flex;
    width: 50% !important;
    max-width: 50%;
    min-width: 0;
    padding-left: 6px;
    padding-right: 6px;
    margin-bottom: 22px;
  }

  .category .product-thumb {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    min-width: 0;
  }

  .category .product-thumb .image,
  .category .product-thumb .front-image,
  .category .product-thumb .front-image a {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .category .product-thumb .image {
    height: auto !important;
    overflow: visible;
  }

  .category .product-thumb .back-image {
    display: none !important;
  }

  .category .product-thumb .image img {
    display: block;
    width: 100%;
    max-width: 100% !important;
    height: auto;
    margin: 0 auto;
  }

  .category .product-thumb .caption {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .category .product-thumb h4.name {
    min-height: 44px;
    margin: 10px 0 7px;
    font-size: 14px;
    line-height: 1.25;
    text-align: center;
  }

  .category .product-thumb h4.name a {
    display: -webkit-box;
    overflow: hidden;
    color: #111;
    text-decoration: none;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .category .product-thumb .description {
    display: none;
  }

  .category .product-thumb .price {
    margin: auto 0 8px;
    font-size: 19px;
    line-height: 1.25;
    text-align: center;
  }

  .category .product-thumb .cart {
    width: 100%;
    margin-top: 0;
    padding-top: 8px;
    border-top: 1px solid #e2e2e2;
  }

  .category .product-thumb .cart .btn-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px 38px;
    gap: 4px;
    width: 100%;
  }

  .category .product-thumb .cart .btn {
    min-width: 0;
    min-height: 40px;
    margin: 0;
    padding: 8px 6px;
    line-height: 18px;
  }

  .category .product-thumb .cart .btn-cart,
  .category .product-thumb .cart .btn-preorder {
    width: 100%;
    font-weight: 700;
  }

  .category .product-thumb .cart .wishlist,
  .category .product-thumb .cart .compare {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    padding-left: 0;
    padding-right: 0;
  }

  .category .pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .category .pagination > li > a,
  .category .pagination > li > span {
    min-width: 40px;
    min-height: 40px;
    padding: 9px 12px;
    text-align: center;
  }
}

@media only screen and (max-width: 359px) {
  .category .product-layout.product-grid {
    width: 100% !important;
    max-width: 100%;
  }

  .category .product-filter .list-options {
    flex-basis: 100%;
    justify-content: stretch;
  }
}

