/* =========================================================
   v2.4.7 — Category dropdown hardening + mobile shop polish
   ---------------------------------------------------------
   - Header category dropdown stays above hero/product content.
   - Mobile category accordion has reliable open/closed states.
   - Shop/category pages get a cleaner app-like mobile layout.
   ========================================================= */

body.vlg-theme .vlg-site-header,
body.vlg-theme .vlg-nav,
body.vlg-theme .vlg-nav-inner,
body.vlg-theme .vlg-category-menu {
  overflow: visible !important;
}

body.vlg-theme .vlg-category-menu {
  isolation: isolate;
}

body.vlg-theme .vlg-category-menu.is-open {
  z-index: 260;
}

body.vlg-theme .vlg-category-dropdown {
  z-index: 9999 !important;
  pointer-events: none;
}

body.vlg-theme .vlg-category-menu.is-open .vlg-category-dropdown,
body.vlg-theme .vlg-category-dropdown.is-open,
body.vlg-theme .vlg-category-button[aria-expanded="true"] + .vlg-category-dropdown {
  pointer-events: auto;
}

@media (min-width: 901px) {
  body.vlg-theme .vlg-category-dropdown {
    display: none !important;
    min-width: 330px;
    max-height: min(70vh, 620px);
    overflow: auto;
    overscroll-behavior: contain;
  }

  body.vlg-theme .vlg-category-menu.is-open .vlg-category-dropdown,
  body.vlg-theme .vlg-category-button[aria-expanded="true"] + .vlg-category-dropdown {
    display: block !important;
  }
}

@media (max-width: 900px) {
  body.vlg-theme .vlg-nav.is-open .vlg-category-dropdown {
    pointer-events: auto !important;
  }

  body.vlg-theme .vlg-nav.is-open .vlg-category-menu:not(.is-open) .vlg-category-dropdown {
    pointer-events: none !important;
  }

  body.vlg-theme .vlg-nav.is-open .vlg-category-button[aria-expanded="true"] + .vlg-category-dropdown {
    pointer-events: auto !important;
  }
}

@media (max-width: 991px) {
  body.vlg-theme.post-type-archive-product,
  body.vlg-theme.tax-product_cat,
  body.vlg-theme.tax-product_tag,
  body.vlg-theme.search-results {
    background: #f5f7fb;
  }

  body.vlg-theme .vlg-shop-page {
    width: 100%;
    padding-top: 12px !important;
    padding-bottom: 34px !important;
  }

  body.vlg-theme .vlg-breadcrumbs {
    margin: 0 0 10px !important;
    padding: 0 2px !important;
    font-size: 12px !important;
    white-space: nowrap;
    overflow: auto;
    scrollbar-width: none;
  }

  body.vlg-theme .vlg-breadcrumbs::-webkit-scrollbar {
    display: none;
  }

  body.vlg-theme .vlg-shop-head {
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
    gap: 14px !important;
    margin: 0 0 12px !important;
    padding: 16px !important;
    border-radius: 22px !important;
    background:
      radial-gradient(circle at 100% 0, rgba(242,138,0,.14), transparent 36%),
      #fff !important;
    box-shadow: 0 12px 30px rgba(7,18,36,.06) !important;
  }

  body.vlg-theme .vlg-shop-head h1 {
    margin: 0 !important;
    font-size: clamp(24px, 7vw, 34px) !important;
    line-height: 1.05 !important;
    letter-spacing: -.045em !important;
  }

  body.vlg-theme .vlg-shop-head .term-description,
  body.vlg-theme .vlg-shop-head .page-description {
    margin-top: 8px !important;
    font-size: 14px !important;
    line-height: 1.48 !important;
    color: #64748b !important;
  }

  body.vlg-theme .vlg-shop-tools,
  body.vlg-theme .woocommerce-notices-wrapper + .vlg-shop-tools {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 9px !important;
    width: 100% !important;
  }

  body.vlg-theme .woocommerce-result-count {
    display: inline-flex !important;
    align-items: center;
    min-height: 36px;
    width: fit-content;
    margin: 0 !important;
    padding: 0 12px !important;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #f8fafc;
    color: #64748b !important;
    font-size: 12px !important;
    font-weight: 850 !important;
  }

  body.vlg-theme .woocommerce-ordering {
    margin: 0 !important;
    width: 100% !important;
  }

  body.vlg-theme .woocommerce-ordering select {
    width: 100% !important;
    min-height: 46px !important;
    padding: 0 40px 0 13px !important;
    border: 1px solid #dbe5f1 !important;
    border-radius: 15px !important;
    background-color: #fff !important;
    color: #0f172a !important;
    font-size: 14px !important;
    font-weight: 850 !important;
    box-shadow: 0 8px 18px rgba(15,23,42,.04) !important;
  }

  body.vlg-theme .vlg-filter-toggle {
    position: sticky;
    top: calc(var(--vlg-mobile-header-height, 72px) + 8px);
    z-index: 120;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px !important;
    margin: 0 0 12px !important;
    border-color: rgba(242,138,0,.24) !important;
    border-radius: 16px !important;
    background: #fff !important;
    color: #071224 !important;
    font-size: 14px !important;
    box-shadow: 0 12px 26px rgba(7,18,36,.08) !important;
  }

  body.vlg-filter-open.vlg-theme .vlg-filter-toggle,
  body.vlg-theme .vlg-filter-toggle.is-open {
    background: #071224 !important;
    color: #fff !important;
  }

  body.vlg-theme .vlg-filter-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    display: block;
    width: 100%;
    min-height: 100dvh;
    border: 0;
    padding: 0;
    background: rgba(7,18,36,.42);
    backdrop-filter: blur(5px);
    z-index: 7100;
    cursor: pointer;
  }

  body.vlg-theme .vlg-shop-sidebar#vlgShopSidebar {
    position: fixed !important;
    left: 10px !important;
    right: 10px !important;
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
    display: block !important;
    width: auto !important;
    max-height: min(78dvh, 680px) !important;
    margin: 0 !important;
    padding: 12px !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #dbe5f1 !important;
    border-radius: 24px 24px 18px 18px !important;
    background: rgba(255,255,255,.98) !important;
    box-shadow: 0 -18px 70px rgba(7,18,36,.28) !important;
    transform: translate3d(0, 112%, 0) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: transform .28s cubic-bezier(.32,.72,0,1), opacity .2s ease, visibility .28s !important;
    z-index: 7110 !important;
  }

  body.vlg-theme .vlg-shop-sidebar#vlgShopSidebar.is-open {
    transform: translate3d(0, 0, 0) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  body.vlg-theme .vlg-filter-drawer-head {
    position: sticky;
    top: -12px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 54px;
    margin: -12px -12px 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(10px);
  }

  body.vlg-theme .vlg-filter-drawer-head strong {
    color: #071224;
    font-size: 18px;
    letter-spacing: -.035em;
  }

  body.vlg-theme .vlg-filter-close {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid #dbe5f1;
    border-radius: 14px;
    background: #f8fafc;
    color: #071224;
    font-size: 28px;
    line-height: 1;
    font-weight: 800;
    cursor: pointer;
  }

  body.vlg-theme .vlg-shop-layout {
    display: block !important;
  }

  body.vlg-theme .vlg-shop-products {
    min-width: 0 !important;
  }

  body.vlg-theme.post-type-archive-product .vlg-shop-products ul.products,
  body.vlg-theme.tax-product_cat .vlg-shop-products ul.products,
  body.vlg-theme.tax-product_tag .vlg-shop-products ul.products,
  body.vlg-theme.search-results .vlg-shop-products ul.products {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 11px !important;
    align-items: stretch !important;
    margin: 0 !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-product-card.product,
  body.vlg-theme.post-type-archive-product ul.products .vlg-product-card.product,
  body.vlg-theme.tax-product_cat ul.products .vlg-product-card.product,
  body.vlg-theme.tax-product_tag ul.products .vlg-product-card.product {
    width: auto !important;
    min-width: 0 !important;
    border-radius: 18px !important;
    box-shadow: 0 10px 24px rgba(7,18,36,.055) !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-product-link {
    min-width: 0;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-image-wrap {
    aspect-ratio: 1 / .96 !important;
    padding: 9px !important;
    border-bottom: 1px solid #eef3f8;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-image-wrap img,
  body.vlg-theme .vlg-shop-products .vlg-card-image-wrap .wp-post-image {
    width: 100% !important;
    max-width: 132px !important;
    max-height: 128px !important;
    object-fit: contain !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-content {
    padding: 10px 10px 5px !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-category {
    display: block !important;
    max-width: 100%;
    margin-bottom: 5px !important;
    overflow: hidden;
    color: #f28a00 !important;
    font-size: 10px !important;
    line-height: 1.15 !important;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-content h2,
  body.vlg-theme .vlg-shop-products .woocommerce-loop-product__title {
    min-height: 38px !important;
    margin-bottom: 7px !important;
    color: #071224 !important;
    font-size: 13px !important;
    line-height: 1.22 !important;
    letter-spacing: -.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-price,
  body.vlg-theme .vlg-shop-products .price {
    font-size: 14px !important;
    line-height: 1.15 !important;
    font-weight: 950 !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 7px !important;
    padding: 8px 10px 10px !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-quickqty {
    display: grid !important;
    grid-template-columns: 34px 1fr 34px !important;
    min-height: 36px !important;
    border-radius: 13px !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-qty-btn {
    min-width: 34px !important;
    min-height: 34px !important;
    border-radius: 12px !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-qty-input {
    min-height: 34px !important;
    font-size: 14px !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-cart,
  body.vlg-theme .vlg-shop-products .vlg-card-actions .button,
  body.vlg-theme .vlg-shop-products .vlg-card-actions .added_to_cart {
    min-height: 40px !important;
    padding: 8px 9px !important;
    border-radius: 14px !important;
    font-size: 12.5px !important;
    line-height: 1.1 !important;
    white-space: normal !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-actions .button::before,
  body.vlg-theme .vlg-shop-products .vlg-card-cart::before,
  body.vlg-theme .vlg-shop-products .vlg-card-actions .button::after,
  body.vlg-theme .vlg-shop-products .vlg-card-cart::after {
    display: none !important;
  }
}

@media (max-width: 360px) {
  body.vlg-theme.post-type-archive-product .vlg-shop-products ul.products,
  body.vlg-theme.tax-product_cat .vlg-shop-products ul.products,
  body.vlg-theme.tax-product_tag .vlg-shop-products ul.products,
  body.vlg-theme.search-results .vlg-shop-products ul.products {
    grid-template-columns: 1fr !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-image-wrap img,
  body.vlg-theme .vlg-shop-products .vlg-card-image-wrap .wp-post-image {
    max-width: 170px !important;
    max-height: 160px !important;
  }
}
