/**
 * FIX ULTIME 280px - MOBILE CARDS FLEXIBLES
 * Fichier chargé en dernier (zzzzzz_) pour annuler TOUTES les hauteurs fixes
 * Priorité absolue avec spécificité maximale
 */

/* ========================================
   SUPPRESSION TOTALE DES HAUTEURS 280px EN MOBILE
   ======================================== */
@media screen and (max-width: 768px) {
    /* ANNULATION COMPLETE de toutes les hauteurs fixes - SPÉCIFICITÉ MAXIMALE */
    html body div#ps-chatbot-search-modal div.ps-chatbot-modal-content div.ps-chatbot-modal-body div.ps-chatbot-products-grid .ps-chatbot-product-card,
    html body div#ps-chatbot-search-modal div.ps-chatbot-modal-content div.ps-chatbot-modal-body div.ps-chatbot-products-grid div.ps-chatbot-product-card,
    html body #ps-chatbot-search-modal .ps-chatbot-modal-content .ps-chatbot-modal-body .ps-chatbot-products-grid .ps-chatbot-product-card,
    div#ps-chatbot-search-modal .ps-chatbot-products-grid .ps-chatbot-product-card,
    #ps-chatbot-search-modal .ps-chatbot-products-grid .ps-chatbot-product-card,
    #ps-chatbot-search-modal .ps-chatbot-product-card,
    .ps-chatbot-modal .ps-chatbot-product-card,
    .ps-chatbot-skeleton-card,
    div.ps-chatbot-skeleton-card,
    #ps-chatbot-search-modal .ps-chatbot-skeleton-card,
    div#ps-chatbot-search-modal .ps-chatbot-skeleton-card {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        background: white !important;
        border: 1px solid #e5e5e5 !important;
        border-radius: 8px !important;
    }

    /* Suppression spécifique de 280px partout */
    html body #ps-chatbot-search-modal [style*="height: 280px"],
    html body #ps-chatbot-search-modal [style*="height:280px"],
    html body #ps-chatbot-search-modal .ps-chatbot-skeleton-card,
    html body #ps-chatbot-search-modal *[class*="skeleton"] {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
    }

    /* Forcer le flex sur les conteneurs d'image */
    html body #ps-chatbot-search-modal .ps-chatbot-product-image-container,
    html body #ps-chatbot-search-modal .ps-chatbot-product-card > a:first-child,
    html body #ps-chatbot-search-modal .ps-chatbot-product-card > div:first-child,
    #ps-chatbot-search-modal .ps-chatbot-product-image-container,
    #ps-chatbot-search-modal .ps-chatbot-product-card > a:first-child,
    #ps-chatbot-search-modal .ps-chatbot-product-card > div:first-child {
        position: relative !important;
        width: 100% !important;
        padding-top: 75% !important;
        overflow: hidden !important;
        flex-shrink: 0 !important;
        height: auto !important;
    }

    /* Image absolue dans le container */
    html body #ps-chatbot-search-modal .ps-chatbot-product-image,
    html body div#ps-chatbot-search-modal .ps-chatbot-product-image,
    #ps-chatbot-search-modal .ps-chatbot-product-image,
    div#ps-chatbot-search-modal .ps-chatbot-product-image {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    /* Informations produit flexibles */
    html body #ps-chatbot-search-modal .ps-chatbot-product-info,
    html body div#ps-chatbot-search-modal .ps-chatbot-product-info,
    #ps-chatbot-search-modal .ps-chatbot-product-info,
    div#ps-chatbot-search-modal .ps-chatbot-product-info {
        flex: 1 1 auto !important;
        padding: 8px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        min-height: 50px !important;
        height: auto !important;
        box-sizing: border-box !important;
    }

    /* Nom et prix optimisés */
    #ps-chatbot-search-modal .ps-chatbot-product-name {
        font-size: 13px !important;
        line-height: 1.4 !important;
        margin-bottom: 8px !important;
        height: auto !important;
        overflow: hidden !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
    }

    #ps-chatbot-search-modal .ps-chatbot-product-price {
        font-size: 14px !important;
        font-weight: bold !important;
        margin: 0 !important;
        margin-top: auto !important;
        flex-shrink: 0 !important;
    }
}

/* ========================================
   GRILLE ADAPTATIVE MOBILE
   ======================================== */
@media screen and (max-width: 768px) {
    #ps-chatbot-search-modal .ps-chatbot-products-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        padding: 10px !important;
    }
}

/* ========================================
   DEBUG et MARQUES VISUELLES
   ======================================== */
@media screen and (max-width: 768px) {
    /* Marque visuelle pour identifier l'application du CSS */
    #ps-chatbot-search-modal .ps-chatbot-product-card::before {
        content: "✓ Mobile Fix" !important;
        position: absolute !important;
        top: 2px !important;
        left: 2px !important;
        background: rgba(0, 255, 0, 0.8) !important;
        color: white !important;
        font-size: 8px !important;
        padding: 1px 4px !important;
        border-radius: 2px !important;
        z-index: 1000 !important;
        pointer-events: none !important;
    }
}