/* CSS UNIFIÉ - 8 PRODUITS POUR TOUS LES MODES */

/* ========================================
   GRILLE PRINCIPALE - BASE
======================================== */
.dislab-products-grid {
    display: grid !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* ========================================
   DESKTOP : 4 colonnes × 2 rangées = 8 produits
======================================== */
@media (min-width: 1025px) {
    .dislab-products-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 20px !important;
    }
}

/* ========================================
   TABLETTE : 4 colonnes × 2 rangées = 8 produits
======================================== */
@media (min-width: 769px) and (max-width: 1024px) {
    .dislab-products-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 18px !important;
    }
    
    /* Ajustement des cartes pour tablette */
    .dislab-product-card {
        padding: 15px !important;
    }
    
    .dislab-product-image {
        height: 250px !important;
        min-height: 250px !important;
        max-height: 250px !important;
        flex: 0 0 250px !important;
        padding: 15px !important;
    }
}

/* ========================================
   MOBILE : 2 colonnes × 4 rangées = 8 produits
======================================== */
@media (max-width: 768px) {
    /* Grille mobile FORCÉE en 2 colonnes */
    .dislab-products-grid,
    .dislab-produits-aleatoires .dislab-products-grid,
    div.dislab-products-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        padding: 0 8px !important;
        margin: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Conteneur principal mobile */
    .dislab-produits-aleatoires {
        padding: 0 8px !important;
        margin: 15px 0 !important;
    }
    
    .dislab-titre-section {
        font-size: 20px !important;
        margin-bottom: 15px !important;
    }
    
    /* Cartes ADAPTATIVES - hauteur selon contenu */
    .dislab-product-card,
    .dislab-produits-aleatoires .dislab-product-card,
    div.dislab-product-card {
        display: flex !important;
        flex-direction: column !important;
        padding: 10px !important;
        margin: 0 !important;
        border: 1px solid #e5e5e5 !important;
        border-radius: 8px !important;
        background: #ffffff !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
        transition: all 0.2s ease !important;
        position: relative !important;
        
        /* HAUTEUR AUTOMATIQUE selon le contenu */
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        
        /* Alignement optimal */
        align-items: stretch !important;
        justify-content: flex-start !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }
    
    .dislab-product-card:hover {
        transform: translateY(-1px) !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
        border-color: #d0d0d0 !important;
    }
    
    /* ========================================
       IMAGE MOBILE COMPACTE
    ======================================== */
    .dislab-product-image,
    .dislab-product-card .dislab-product-image {
        order: 1 !important;
        width: 100% !important;
        height: 120px !important;
        min-height: 120px !important;
        max-height: 120px !important;
        padding: 8px !important;
        margin: 0 0 8px 0 !important;
        flex: 0 0 120px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: transparent !important;
        position: relative !important;
        overflow: hidden !important;
    }
    
    .dislab-product-image img {
        max-width: 100% !important;
        max-height: 100% !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain !important;
    }
    
    .dislab-no-image {
        font-size: 10px !important;
        color: #999 !important;
    }
    
    /* ========================================
       RACCOURCIS MOBILE
    ======================================== */
    .dislab-product-shortcuts {
        position: absolute !important;
        top: 4px !important;
        right: 4px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 3px !important;
        opacity: 0 !important;
        transition: opacity 0.3s ease !important;
        z-index: 10 !important;
    }
    
    .dislab-product-card:hover .dislab-product-shortcuts {
        opacity: 1 !important;
    }
    
    .dislab-shortcut-btn {
        width: 24px !important;
        height: 24px !important;
        font-size: 11px !important;
        background: rgba(255, 255, 255, 0.9) !important;
        border: 1px solid #ddd !important;
        border-radius: 4px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: #666 !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
    }
    
    .dislab-shortcut-btn:hover {
        background: #1e88e5 !important;
        color: white !important;
        border-color: #1e88e5 !important;
    }
    
    /* ========================================
       TEXTES MOBILES COMPACTS
    ======================================== */
    
    /* Catégorie - compacte */
    .dislab-product-category-container {
        order: 2 !important;
        margin: 0 0 4px 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 0 0 auto !important;
        height: auto !important;
    }
    
    .dislab-product-category {
        font-size: 8px !important;
        padding: 2px 8px !important;
        background-color: #d6e9ff !important;
        color: #333 !important;
        font-weight: 600 !important;
        text-transform: uppercase !important;
        border-radius: 3px !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 90% !important;
        height: auto !important;
        min-height: auto !important;
        display: inline-block !important;
    }
    
    /* Marque - compacte */
    .dislab-product-brand {
        order: 3 !important;
        margin: 0 0 4px 0 !important;
        font-size: 9px !important;
        color: #1e88e5 !important;
        font-weight: 600 !important;
        text-transform: uppercase !important;
        text-align: center !important;
        line-height: 1.2 !important;
        flex: 0 0 auto !important;
        height: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Titre - adaptatif selon le contenu */
    .dislab-product-title {
        order: 4 !important;
        margin: 0 0 6px 0 !important;
        padding: 0 2px !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        color: #333 !important;
        line-height: 1.3 !important;
        text-align: center !important;
        word-wrap: break-word !important;
        
        /* HAUTEUR ADAPTATIVE selon le contenu */
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        flex: 0 0 auto !important;
        
        /* Gestion des débordements */
        overflow: hidden !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 3 !important;
        -webkit-box-orient: vertical !important;
    }
    
    .dislab-product-title a {
        color: #333 !important;
        text-decoration: none !important;
        font-weight: 600 !important;
    }
    
    .dislab-product-title a:hover {
        color: #1e88e5 !important;
    }
    
    /* ========================================
       PRIX MASQUÉS SUR MOBILE
    ======================================== */
    .dislab-product-price,
    .dislab-product-card .dislab-product-price,
    .dislab-price-amount {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        flex: 0 0 0 !important;
    }
    
    /* ========================================
       BOUTONS SUPPRIMÉS
    ======================================== */
    .dislab-product-button {
        display: none !important;
    }
}

/* ========================================
   STYLES DESKTOP/TABLETTE COMPLETS
======================================== */

/* CONTENEUR PRINCIPAL */
.dislab-produits-aleatoires {
    margin: 40px 0;
    padding: 0;
    background: transparent;
}

.dislab-titre-section {
    text-align: center;
    margin-bottom: 30px;
    font-size: 28px;
    color: #2c3e50;
    font-weight: 700;
}

.dislab-bouton-reload {
    text-align: center;
    margin-bottom: 30px;
}

.dislab-btn-reload {
    background: #1e88e5;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dislab-btn-reload:hover {
    background: #1565c0;
    transform: translateY(-2px);
}

/* Cartes produits DESKTOP/TABLETTE */
.dislab-product-card {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    margin: 0 !important;
    padding: 20px !important;
    border: 1px solid #d6e9ff !important;
    border-radius: 6px !important;
    background: #ffffff !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    list-style: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
    align-items: stretch !important;
}

.dislab-product-card:hover {
    border-color: #c4ddff !important;
    box-shadow: 0 4px 16px rgba(214, 233, 255, 0.2) !important;
    transform: translateY(-2px) !important;
}

/* Image DESKTOP */
.dislab-product-image {
    order: 1 !important;
    width: 100% !important;
    height: 300px !important;
    min-height: 300px !important;
    max-height: 300px !important;
    background: transparent !important;
    padding: 20px !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 0 12px 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 300px !important;
    overflow: hidden !important;
    position: relative !important;
}

.dislab-product-image img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    transition: transform 0.3s ease !important;
    border-radius: 0 !important;
    filter: none !important;
}

.dislab-product-card:hover .dislab-product-image img {
    transform: scale(1.05) !important;
}

.dislab-no-image {
    color: #ccc;
    font-style: italic;
    font-size: 14px;
}

/* Badges NOUVEAU et PROMO */
.dislab-nouveau-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    background: linear-gradient(135deg, #4CAF50, #45A049);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
    animation: nouveau-pulse 2s ease-in-out infinite;
}

.dislab-promo-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
    animation: promo-pulse 2s ease-in-out infinite;
}

/* Animations badges */
@keyframes nouveau-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 4px 12px rgba(76, 175, 80, 0.6); }
}

@keyframes promo-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 4px 12px rgba(220, 53, 69, 0.6); }
}

/* Raccourcis DESKTOP */
.dislab-product-shortcuts {
    position: absolute !important;
    top: 15px !important;
    left: 15px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    opacity: 0 !important;
    transition: all 0.3s ease !important;
    z-index: 10 !important;
    transform: translateY(-5px) !important;
}

.dislab-product-card:hover .dislab-product-shortcuts {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

.dislab-shortcut-btn {
    width: 32px !important;
    height: 32px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    color: #666 !important;
    font-size: 16px !important;
    text-decoration: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.dislab-shortcut-btn:hover {
    background: #1e88e5 !important;
    color: white !important;
    border-color: #1e88e5 !important;
    transform: scale(1.05) !important;
}

/* Catégorie DESKTOP */
.dislab-product-category-container {
    order: 2 !important;
    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    margin: 0 0 6px 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 28px !important;
}

.dislab-product-category {
    height: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
    margin: 0 !important;
    padding: 0 15px !important;
    font-size: 10px !important;
    color: #333 !important;
    background-color: #d6e9ff !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    line-height: 24px !important;
    border-radius: 0 !important;
    display: inline-block !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    box-shadow: none !important;
    width: auto !important;
    min-width: 60px !important;
    max-width: 150px !important;
}

/* Marque DESKTOP */
.dislab-product-brand {
    order: 3 !important;
    height: 18px !important;
    min-height: 18px !important;
    max-height: 18px !important;
    margin: 0 0 10px 0 !important;
    padding: 0 !important;
    font-size: 11px !important;
    color: #1e88e5 !important;
    background-color: transparent !important;
    font-weight: 600 !important;
    line-height: 18px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.3px !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    flex: 0 0 18px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* Titre DESKTOP */
.dislab-product-title {
    order: 4 !important;
    height: 33.6px !important;
    min-height: 33.6px !important;
    max-height: 33.6px !important;
    margin: 0 0 10px 0 !important;
    padding: 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #333 !important;
    line-height: 1.2 !important;
    overflow: hidden !important;
    text-align: center !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    flex: 0 0 33.6px !important;
    word-wrap: break-word !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
}

.dislab-product-title a {
    color: #333 !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    transition: color 0.3s ease !important;
}

.dislab-product-title a:hover {
    color: #1e88e5 !important;
}

/* Prix DESKTOP */
.dislab-product-price {
    order: 5 !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    margin: 10px 0 0 0 !important;
    padding: 0 !important;
    background: transparent !important;
    position: relative !important;
    z-index: 1 !important;
    flex: 0 0 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.dislab-price-amount {
    font-weight: 600 !important;
    font-size: 14px !important;
    color: #1e88e5 !important;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef) !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    display: inline-block !important;
    border: 1px solid #dee2e6 !important;
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.8),
        inset 0 -1px 0 rgba(0,0,0,0.1) !important;
    letter-spacing: 0.3px !important;
    min-width: fit-content !important;
    max-width: 100% !important;
    text-align: center !important;
    transition: all 0.2s ease !important;
}

.dislab-price-amount:hover {
    box-shadow: 
        0 3px 6px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.9),
        inset 0 -1px 0 rgba(0,0,0,0.1) !important;
}

.dislab-product-price:empty {
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    margin: 10px 0 0 0 !important;
    flex: 0 0 38px !important;
    display: flex !important;
}

.dislab-price-amount:empty {
    display: none !important;
}

/* Boutons supprimés */
.dislab-product-button {
    display: none !important;
}

/* Modal responsive */
.dislab-modal-open {
    overflow: hidden !important;
}

@media (max-width: 768px) {
    .dislab-modal-content {
        width: 98% !important;
        height: 95% !important;
        border-radius: 10px !important;
    }
    
    .dislab-modal-header,
    .dislab-modal-footer {
        padding: 12px 15px !important;
    }
    
    .dislab-modal-header h3 {
        font-size: 1rem !important;
    }
    
    .dislab-modal-footer {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .dislab-modal-footer a,
    .dislab-modal-footer button {
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
    }
}