/**
 * VPD Mobile Stability Fix
 * Empêche le scroll horizontal et le bouncing sur mobile
 * 
 * @package VPD
 * @since 2.1.1
 */

/* ========================================
   STABILITÉ MOBILE - FIX GLOBAL
   ======================================== */

html {
    overflow-x: hidden;
    max-width: 100%;
    position: relative;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
}

/* Containers principaux */
.vpd-digital-library,
.vpd-store-page,
.vpd-categories-page,
.vpd-vendors-page,
.vpd-page-content {
    max-width: 100%;
    overflow-x: hidden;
}

/* Images responsives */
img {
    max-width: 100%;
    height: auto;
}

/* Grilles */
.vpd-library-grid,
.vpd-categories-grid,
.vpd-vendors-grid,
.vpd-products-grid {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* ========================================
   TOUCH & MOBILE
   ======================================== */

* {
    touch-action: manipulation;
}

body {
    touch-action: pan-y;
    overscroll-behavior: none;
}

/* ========================================
   FIX ÉLÉMENTS
   ======================================== */

.vpd-download-btn,
.vpd-bulk-download-btn,
.vpd-btn-primary {
    max-width: 100%;
    box-sizing: border-box;
}

input,
textarea,
select {
    max-width: 100%;
    box-sizing: border-box;
}

/* ========================================
   MOBILE SPECIFIC
   ======================================== */

@media (max-width: 767px) {
    .vpd-digital-library,
    .vpd-page-content {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    
    * {
        max-width: 100%;
    }
}

/* ========================================
   iOS SPECIFIC
   ======================================== */

@supports (-webkit-touch-callout: none) {
    html,
    body {
        overscroll-behavior-y: none;
    }
}

/* ========================================
   SAFE AREA
   ======================================== */

@supports (padding: env(safe-area-inset-bottom)) {
    .vpd-library-content,
    .vpd-item-actions {
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }
}
