/* ================================================================
   MOBILE PRODUCTS - products-list & product-detail
   Target: max-width 767px (Bootstrap xs)
   ================================================================ */

/* Hidden by default, shown only on mobile */
.mobile-sticky-cta { display: none; }

@media (max-width: 767px) {

  /* ---- BREADCRUMB compact ---- */
  .breadcrumb-bg .space-top-30 { height: 5px !important; min-height: 0 !important; }
  .breadcrumb-bg .space-80     { padding: 8px 0 !important; }
  .breadcrumb-bg .size-48      { font-size: 22px !important; margin-bottom: 4px !important; }

  /* ---- PRODUCT LIST: hide old filter trigger ---- */
  .nav-trigger-filters { display: none !important; }

  /* ---- FILTER DRAWER ---- */
  .sidebar.with-border {
    position: fixed !important;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    z-index: 1050;
    transform: translateY(110%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 20px 120px !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    float: none !important;
  }

  .sidebar.with-border.drawer-open {
    transform: translateY(0);
  }

  .filter-drawer-header {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0 14px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
  }

  .filter-drawer-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    color: #222;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .filter-drawer-close-btn {
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: #555;
    padding: 0 2px;
    -webkit-tap-highlight-color: transparent;
  }

  .drawer-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1049;
  }

  .drawer-backdrop.visible { display: block; }

  /* ---- SORT DRAWER ---- */
  .sort-drawer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-radius: 16px 16px 0 0;
    z-index: 1050;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
    max-height: 80vh;
    overflow-y: auto;
  }

  .sort-drawer.open { transform: translateY(0); }

  .sort-drawer-header {
    padding: 18px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
  }

  .sort-drawer-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    color: #222;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .sort-option {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    color: #333;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
  }

  .sort-option:active { background: #fafafa; }
  .sort-option.active { color: #c79900; font-weight: 700; }
  .sort-option.active::after { content: '✓'; font-weight: 700; color: #c79900; }

  /* ---- STICKY BOTTOM BAR (product list) ---- */
  .mobile-sticky-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 10px 15px;
    z-index: 1040;
    display: flex;
    gap: 10px;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  }

  .btn-mobile-filter,
  .btn-mobile-sort {
    flex: 1;
    height: 46px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
  }

  .btn-mobile-filter { background: #c79900; color: #fff; }
  .btn-mobile-filter:active { background: #a07800; }
  .btn-mobile-sort { background: #f5f5f5; color: #333; border: 1px solid #ddd; }
  .btn-mobile-sort:active { background: #ebebeb; }

  /* space for sticky bar */
  .wrapper .theme-container.container { padding-bottom: 70px; }

  /* ---- PRODUCT CARDS ---- */
  #grid-view .col-xs-6 { padding: 4px; }

  .thumbnail-wrap {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
    background: #fff;
    margin-bottom: 0;
  }

  .thumbnail {
    border-radius: 10px;
    overflow: hidden;
    border: none !important;
    margin-bottom: 0;
    padding-bottom: 0 !important;
  }

  .caption { padding: 8px 8px 10px; }

  .caption-title {
    height: auto !important;
    min-height: 40px;
  }

  .caption-title a h3 {
    font-size: 11px !important;
    line-height: 1.35;
    margin: 0 0 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 600;
  }

  .caption-text span[price] { font-size: 13px !important; font-weight: 700; }
  .caption-text del { font-size: 10px !important; }

  /* ---- PAGINATION ---- */
  .pagination-list li a {
    padding: 8px 10px !important;
    min-width: 36px;
    min-height: 36px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 6px !important;
  }

  /* ================================================================
     PRODUCT DETAIL
     ================================================================ */

  /* ---- Image Thumbnails ---- */
  .sync2 .item { text-align: center; }
  .sync2 .item img {
    width: 80px !important;
    height: 80px !important;
    object-fit: cover;
    border-radius: 4px;
  }
  .sync2 { padding: 8px 0; }

  /* ---- Price ---- */
  #price-container { font-size: 26px !important; }

  /* ---- Compact product title ---- */
  .show-result .section-title.color-ecommerce {
    font-size: 20px !important;
    padding: 5px 10px !important;
    margin-bottom: 8px !important;
  }

  /* ---- Product description ---- */
  .product-description p { font-size: 14px; line-height: 1.65; }

  /* ---- Sticky CTA ---- */
  .mobile-sticky-cta {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 10px 15px;
    z-index: 1040;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1);
  }

  .sticky-price {
    font-size: 18px;
    font-weight: 700;
    color: #222;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .sticky-add-btn {
    flex: 1;
    height: 48px;
    background: #c79900;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
  }

  .sticky-add-btn:active { background: #a07800; }

  /* space for sticky CTA */
  .prod-lay-5 { padding-bottom: 80px; }

  /* ---- Scroll-to-top: sposta sopra sticky bar ---- */
  /* Il JS imposta bottom:55px (visibile) o bottom:-150px (nascosto).
     Il selettore [style*] intercetta solo lo stato visibile. */
  #to-top[style*="bottom: 55px"] {
    bottom: 76px !important;
  }

  /* ---- Iubenda slot (in entrambe le barre, sempre a destra) ---- */
  .iub-bar-slot {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 6px;
    padding-left: 10px;
    border-left: 1px solid #e0e0e0;
    min-width: 36px;
    justify-content: center;
  }

  .iub-bar-slot:empty { display: none; }

  /* Reset posizionamento fixed dell'elemento Iubenda una volta spostato */
  .iub-bar-slot > * {
    position: static !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    width: auto !important;
    max-height: 46px;
    overflow: hidden;
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    box-shadow: none !important;
  }

}
