/* v5.1.30 — comprehensive mobile single-product repair */

@media (max-width: 782px) {
  html body.vlg-theme.single-product,
  html body.vlg-theme.single-product #page,
  html body.vlg-theme.single-product .site {
    overflow-x: hidden !important;
  }

  html body.vlg-theme.single-product .vlg-single-product-page {
    padding-left: 8px !important;
    padding-right: 8px !important;
    padding-bottom: calc(var(--vlg-mobile-appbar-h, 78px) + 30px + env(safe-area-inset-bottom)) !important;
  }

  html body.vlg-theme.single-product .vlg-product-detail,
  html body.vlg-theme.single-product .vlg-product-main-grid,
  html body.vlg-theme.single-product .vlg-product-left,
  html body.vlg-theme.single-product .vlg-product-right,
  html body.vlg-theme.single-product .summary,
  html body.vlg-theme.single-product .vlg-product-summary-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  html body.vlg-theme.single-product .vlg-product-main-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* --- Gallery --- */
  html body.vlg-theme.single-product .vlg-product-gallery-card {
    padding: 6px !important;
    margin: 0 0 10px !important;
    border-radius: 20px !important;
    background: #fff !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: hidden !important;
    box-shadow: 0 10px 26px rgba(18, 33, 56, 0.06) !important;
  }

  html body.vlg-theme.single-product .vlg-product-gallery-card::before {
    display: none !important;
  }

  html body.vlg-theme.single-product .vlg-product-gallery-media,
  html body.vlg-theme.single-product div.product div.images,
  html body.vlg-theme.single-product div.product div.woocommerce-product-gallery,
  html body.vlg-theme.single-product .woocommerce-product-gallery,
  html body.vlg-theme.single-product .woocommerce-product-gallery__wrapper,
  html body.vlg-theme.single-product .flex-viewport,
  html body.vlg-theme.single-product .flex-viewport .slides,
  html body.vlg-theme.single-product .flex-viewport .slides > li,
  html body.vlg-theme.single-product .woocommerce-product-gallery__image {
    display: block !important;
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    overflow: hidden !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  html body.vlg-theme.single-product .flex-viewport {
    aspect-ratio: 1 / 1 !important;
    min-height: clamp(220px, 74vw, 360px) !important;
    background: linear-gradient(180deg, #fbfbfc 0%, #f4f6f8 100%) !important;
    border-radius: 16px !important;
  }

  html body.vlg-theme.single-product .woocommerce-product-gallery__wrapper > *:not(:first-child):not(.flex-active-slide),
  html body.vlg-theme.single-product .flex-viewport .slides > li:not(:first-child):not(.flex-active-slide),
  html body.vlg-theme.single-product .flex-viewport .slides > li.clone {
    display: none !important;
  }

  html body.vlg-theme.single-product .woocommerce-product-gallery__image,
  html body.vlg-theme.single-product .woocommerce-product-gallery__image a,
  html body.vlg-theme.single-product .flex-viewport .slides > li,
  html body.vlg-theme.single-product .flex-viewport .slides > li > a,
  html body.vlg-theme.single-product .flex-viewport .slides > li > div {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: clamp(220px, 74vw, 360px) !important;
    height: 100% !important;
    background: transparent !important;
  }

  html body.vlg-theme.single-product .woocommerce-product-gallery__image img,
  html body.vlg-theme.single-product .woocommerce-product-gallery img.wp-post-image,
  html body.vlg-theme.single-product .vlg-product-gallery-card img,
  html body.vlg-theme.single-product .flex-viewport .slides img {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: clamp(210px, 68vw, 330px) !important;
    margin: 0 auto !important;
    padding: 0 !important;
    object-fit: contain !important;
    object-position: center center !important;
    background: transparent !important;
  }

  html body.vlg-theme.single-product .woocommerce-product-gallery .flex-control-thumbs,
  html body.vlg-theme.single-product .flex-control-thumbs,
  html body.vlg-theme.single-product ol.flex-control-nav.flex-control-thumbs {
    display: flex !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 8px !important;
    margin: 8px 0 0 !important;
    padding: 0 0 2px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
  }

  html body.vlg-theme.single-product .flex-control-thumbs li,
  html body.vlg-theme.single-product ol.flex-control-nav.flex-control-thumbs li {
    float: none !important;
    flex: 0 0 56px !important;
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 12px !important;
    background: #fff !important;
    border: 1px solid rgba(22, 35, 57, 0.08) !important;
    overflow: hidden !important;
  }

  html body.vlg-theme.single-product .flex-control-thumbs li img,
  html body.vlg-theme.single-product ol.flex-control-nav.flex-control-thumbs li img {
    width: 100% !important;
    height: 100% !important;
    padding: 6px !important;
    object-fit: contain !important;
  }

  html body.vlg-theme.single-product .vlg-single-image-energy {
    right: 8px !important;
    bottom: 8px !important;
    top: auto !important;
    left: auto !important;
    transform: scale(.66) !important;
    transform-origin: right bottom !important;
    z-index: 6 !important;
  }

  /* --- Summary --- */
  html body.vlg-theme.single-product .vlg-product-summary-card,
  html body.vlg-theme.single-product div.product .summary {
    padding: 14px !important;
    border-radius: 20px !important;
    margin: 0 !important;
  }

  html body.vlg-theme.single-product .vlg-product-excerpt:empty,
  html body.vlg-theme.single-product .woocommerce-product-details__short-description:empty {
    display: none !important;
  }

  html body.vlg-theme.single-product .vlg-pill {
    display: inline-flex !important;
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    line-height: 1.15 !important;
  }

  html body.vlg-theme.single-product .product_title,
  html body.vlg-theme.single-product div.product .product_title {
    width: 100% !important;
    max-width: 100% !important;
    margin: 8px 0 10px !important;
    font-size: clamp(18px, 5.8vw, 28px) !important;
    line-height: 1.14 !important;
    letter-spacing: -0.03em !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    hyphens: auto !important;
  }

  html body.vlg-theme.single-product .vlg-product-price,
  html body.vlg-theme.single-product div.product p.price,
  html body.vlg-theme.single-product div.product span.price {
    font-size: clamp(18px, 5vw, 26px) !important;
    line-height: 1.16 !important;
    word-break: break-word !important;
  }

  html body.vlg-theme.single-product .vlg-product-specs,
  html body.vlg-theme.single-product .vlg-product-meta-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  html body.vlg-theme.single-product .vlg-product-specs > div,
  html body.vlg-theme.single-product .vlg-product-meta-grid > * {
    min-width: 0 !important;
  }

  /* --- Buybox --- */
  html body.vlg-theme.single-product .vlg-product-buybox,
  html body.vlg-theme.single-product #vlg-product-buybox {
    display: block !important;
    margin: 14px 0 0 !important;
    padding: 12px !important;
    min-height: 0 !important;
    border-radius: 18px !important;
    overflow: hidden !important;
  }

  html body.vlg-theme.single-product .vlg-product-buybox .cart,
  html body.vlg-theme.single-product div.product form.cart,
  html body.vlg-theme.single-product form.cart {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  html body.vlg-theme.single-product form.cart:not(.variations_form),
  html body.vlg-theme.single-product .vlg-product-buybox form.cart:not(.variations_form) {
    display: grid !important;
    grid-template-columns: 78px minmax(0, 1fr) !important;
    gap: 8px !important;
    align-items: stretch !important;
  }

  html body.vlg-theme.single-product form.variations_form,
  html body.vlg-theme.single-product .vlg-product-buybox form.variations_form {
    display: block !important;
  }

  html body.vlg-theme.single-product form.variations_form table.variations,
  html body.vlg-theme.single-product form.variations_form table.variations tbody,
  html body.vlg-theme.single-product form.variations_form table.variations tr,
  html body.vlg-theme.single-product form.variations_form table.variations td,
  html body.vlg-theme.single-product form.variations_form table.variations th {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    text-align: left !important;
  }

  html body.vlg-theme.single-product form.variations_form table.variations tr {
    margin-bottom: 10px !important;
  }

  html body.vlg-theme.single-product form.variations_form table.variations td.label,
  html body.vlg-theme.single-product form.variations_form table.variations th.label,
  html body.vlg-theme.single-product form.variations_form table.variations label {
    margin-bottom: 6px !important;
    font-weight: 700 !important;
  }

  html body.vlg-theme.single-product form.variations_form table.variations td.value {
    display: grid !important;
    gap: 6px !important;
  }

  html body.vlg-theme.single-product form.variations_form table.variations select,
  html body.vlg-theme.single-product form.variations_form table.variations .select2,
  html body.vlg-theme.single-product form.variations_form table.variations .select2-selection,
  html body.vlg-theme.single-product form.cart select {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 46px !important;
  }

  html body.vlg-theme.single-product form.variations_form .single_variation_wrap,
  html body.vlg-theme.single-product form.variations_form .woocommerce-variation-add-to-cart {
    display: grid !important;
    grid-template-columns: 78px minmax(0, 1fr) !important;
    gap: 8px !important;
    align-items: stretch !important;
    width: 100% !important;
  }

  html body.vlg-theme.single-product form.cart .quantity,
  html body.vlg-theme.single-product .vlg-product-buybox form.cart .quantity {
    width: 78px !important;
    min-width: 78px !important;
    max-width: 78px !important;
    margin: 0 !important;
  }

  html body.vlg-theme.single-product form.cart .quantity .qty,
  html body.vlg-theme.single-product form.cart input.qty {
    width: 100% !important;
    min-height: 48px !important;
    max-width: 100% !important;
  }

  html body.vlg-theme.single-product form.cart .single_add_to_cart_button,
  html body.vlg-theme.single-product .vlg-product-buybox form.cart .single_add_to_cart_button {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
    margin: 0 !important;
    padding: 0 14px !important;
    white-space: normal !important;
    line-height: 1.15 !important;
    font-size: 15px !important;
  }

  html body.vlg-theme.single-product form.variations_form .reset_variations {
    display: inline-flex !important;
    margin-top: 4px !important;
  }

  /* --- Energy modal --- */
  .valgusallikad-energiasildid-modal,
  .fs-euel-modal {
    padding: 8px !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .valgusallikad-energiasildid-modal-dialog,
  .fs-euel-modal-dialog {
    width: min(94vw, 360px) !important;
    max-width: 94vw !important;
    max-height: calc(100dvh - 16px) !important;
    padding: 14px 12px 12px !important;
    border-radius: 20px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .valgusallikad-energiasildid-modal-title,
  .fs-euel-modal-title {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 44px 0 2px !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
    text-align: left !important;
    overflow-wrap: anywhere !important;
  }

  .valgusallikad-energiasildid-modal-close,
  .fs-euel-modal-close {
    top: 10px !important;
    right: 10px !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 14px !important;
  }

  .valgusallikad-energiasildid-modal-image,
  .fs-euel-modal-image {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 220px) !important;
    margin: 0 auto !important;
    object-fit: contain !important;
  }

  .valgusallikad-energiasildid-modal-filter,
  .fs-euel-modal-filter {
    width: 100% !important;
    min-height: 48px !important;
    margin: 0 !important;
    padding: 12px 14px !important;
    border-radius: 999px !important;
    text-align: center !important;
    white-space: normal !important;
    line-height: 1.2 !important;
    justify-content: center !important;
  }
}

@media (max-width: 390px) {
  html body.vlg-theme.single-product .product_title,
  html body.vlg-theme.single-product div.product .product_title {
    font-size: clamp(17px, 5.6vw, 24px) !important;
  }

  html body.vlg-theme.single-product .vlg-single-image-energy {
    transform: scale(.60) !important;
  }

  html body.vlg-theme.single-product form.cart:not(.variations_form),
  html body.vlg-theme.single-product form.variations_form .single_variation_wrap,
  html body.vlg-theme.single-product form.variations_form .woocommerce-variation-add-to-cart {
    grid-template-columns: 72px minmax(0, 1fr) !important;
  }

  html body.vlg-theme.single-product form.cart .quantity,
  html body.vlg-theme.single-product .vlg-product-buybox form.cart .quantity {
    width: 72px !important;
    min-width: 72px !important;
    max-width: 72px !important;
  }

  .valgusallikad-energiasildid-modal-dialog,
  .fs-euel-modal-dialog {
    width: calc(100vw - 14px) !important;
    max-width: calc(100vw - 14px) !important;
  }
}
