/* ============================================================
   ASTRA SHOP - DESIGN UNIFIÉ (MOBILE IMMERSIF & PC ÉPURÉ)
   Fichier : /hook/ast.listview.css
   ============================================================ */

/* ------------------------------------------------------------
   1. PARTIE MOBILE (Écrans jusqu'à 768px)
   ------------------------------------------------------------ */
@media (max-width: 768px) {

    .ast-container, .ast-woocommerce-container, #content .ast-container {
        padding-left: 8px !important;
        padding-right: 8px !important;
        width: 100% !important;
    }

    body.ast-woocommerce-shop-page-list-view ul.products,
    body.ast-woocommerce-shop-page-list-view .woocommerce ul.products {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        margin: 0 !important;
        width: 100% !important;
    }

    body.ast-woocommerce-shop-page-list-view ul.products li.product {
        width: 100% !important;
        height: 320px !important; 
        position: relative !important;
        overflow: hidden !important;
        border-radius: 12px !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 0 20px 0 !important;
        background-color: #000 !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.15) !important;
        display: block !important; 
    }

    /* --- CORRECTIF CLIC MOBILE --- */
    /* On force le lien principal à recouvrir TOUTE la carte par-dessus le texte */
    body.ast-woocommerce-shop-page-list-view ul.products li.product .woocommerce-LoopProduct-link::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 20; /* Plus haut que le texte (z-index 10) */
    }

    body.ast-woocommerce-shop-page-list-view ul.products li.product .astra-shop-thumbnail-wrap {
        position: absolute !important;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100% !important;
        height: 100% !important;
        z-index: 1;
    }

    body.ast-woocommerce-shop-page-list-view ul.products li.product .astra-shop-thumbnail-wrap img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        opacity: 0.95;
    }

    body.ast-woocommerce-shop-page-list-view ul.products li.product .astra-shop-summary-wrap {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        padding: 20px !important;
        z-index: 10;
        background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%) !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important;
        align-items: flex-start !important;
        min-height: 50% !important;
        pointer-events: none; /* Laisse passer le clic vers le lien du dessous */
    }

    body.ast-woocommerce-shop-page-list-view .woocommerce-loop-product__title,
    body.ast-woocommerce-shop-page-list-view .price,
    body.ast-woocommerce-shop-page-list-view .price span,
    body.ast-woocommerce-shop-page-list-view .ast-woo-product-category {
        color: #ffffff !important;
        text-align: left !important;
        text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    }

    body.ast-woocommerce-shop-page-list-view .ast-woo-shop-product-description {
        display: none !important;
    }
}

/* --- FIX FINAL BADGE RUPTURE (Évite le bloc géant) --- */
body.ast-woocommerce-shop-page-list-view ul.products li.product .ast-shop-product-out-of-stock {
    /* 1. On le sort du flux et on le place en haut à droite */
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    left: auto !important;
    
    /* 2. TRÈS IMPORTANT : On limite sa taille au texte */
    bottom: auto !important; /* Empêche le fond de descendre jusqu'en bas */
    width: auto !important;   /* Empêche de masquer le côté droit */
    height: auto !important;  /* Empêche de prendre toute la hauteur */
    display: inline-block !important; 
    
    /* 3. Style visuel du badge */
    background-color: #444444 !important; /* Gris foncé propre */
    color: #ffffff !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
    font-size: 11px !important;
    font-weight: bold !important;
    text-transform: uppercase !important;
    
    /* 4. On le fait passer devant tout */
    z-index: 50 !important; 
    box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
    line-height: 1.2 !important;
}

/* --- HARMONISATION DU BADGE PROMO (GAUCHE) --- */
body.ast-woocommerce-shop-page-list-view ul.products li.product .onsale {
    position: absolute !important;
    top: 15px !important;
    left: 15px !important;
    right: auto !important;
    bottom: auto !important;
    width: auto !important;
    height: auto !important;
    min-width: unset !important;
    min-height: unset !important;
    padding: 6px 12px !important;
    font-size: 11px !important;
    border-radius: 4px !important;
    z-index: 50 !important;
}

/* ------------------------------------------------------------
   2. PARTIE PC / DESKTOP (Écrans à partir de 922px)
   ------------------------------------------------------------ */
@media (min-width: 922px) {

    /* --- MASQUER LE SÉLECTEUR DE VUE SUR PC --- */
    .ast-shop-toolbar-aside-wrap .ast-products-view {
        display: none !important;
    }

    body:not(.ast-woocommerce-shop-page-list-view) .ast-woo-shop-product-description {
        display: none !important;
    }

    body.ast-woocommerce-shop-page-list-view .astra-shop-summary-wrap {
        text-align: left !important;
        align-items: flex-start !important;
        justify-content: flex-start !important; 
        padding-top: 15px !important;
        padding-bottom: 0px !important;
        height: auto !important;
    }

    body.ast-woocommerce-shop-page-list-view .woocommerce-loop-product__title {
        margin-bottom: 0px !important;
        text-align: left !important;
        margin-left: 0 !important;
    }

    body.ast-woocommerce-shop-page-list-view .price {
        margin-bottom: 10px !important;
        padding-bottom: 0 !important;
        line-height: 1 !important;
        display: flex !important;
        justify-content: flex-start !important;
    }

    body.ast-woocommerce-shop-page-list-view .ast-woo-shop-product-description {
        display: block !important;
        margin-left: 45px !important; 
        margin-top: 5px !important;
        margin-bottom: 20px !important;
        background: #ffffff !important;
        border: 1px solid #e5e5e5 !important;
        padding: 25px !important;
        border-radius: 10px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03) !important;
        width: auto !important;
        max-width: 800px;
        text-align: left !important;
    }

    body.ast-woocommerce-shop-page-list-view ul.products li.product {
        height: auto !important;
        align-items: flex-start !important;
        padding-bottom: 10px !important;
    }
}