/**
 * PRODUCTS.CSS - Styles produits centralisés
 * Fichier créé lors du nettoyage CSS Phase 2
 *
 * Remplace les définitions dupliquées dans :
 * - panier.css
 * - compte.css
 * - commande_show.css
 * - checkout.css
 * - confirmation.css
 * - avis.css
 * - home.css
 * - produit_home.css
 */

/* ===== IMAGES PRODUITS (aspect-ratio responsive) ===== */

.product-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3; /* Ratio responsive au lieu de height fixe */
    overflow: hidden;
    border-radius: var(--border-radius-sm);
    background-color: var(--light-gray);
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.4s ease;
}

.product-image:hover,
.product-card:hover .product-image {
    transform: scale(var(--art-zoom));
}

/* ===== VARIANTES DE TAILLES ===== */

/* Thumbnail (petite) - panier, commandes */
.product-image--thumbnail {
    aspect-ratio: 1 / 1;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

/* Small - listings, avis */
.product-image--small {
    aspect-ratio: 1 / 1;
    width: 120px;
    height: 120px;
}

/* Medium - panier détaillé */
.product-image--medium {
    aspect-ratio: 4 / 3;
    width: 200px;
}

/* Large - page produit */
.product-image--large {
    aspect-ratio: 4 / 3;
    max-width: 600px;
}

/* ===== CARDS PRODUITS ===== */

.product-card {
    position: relative;
    background: white;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-art-hover);
}

/* ===== INFO PRODUIT ===== */

.product-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-description {
    font-size: 0.9rem;
    color: var(--text-medium);
    line-height: 1.5;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: auto;
}

.product-price-old {
    font-size: 0.9rem;
    color: var(--text-medium);
    text-decoration: line-through;
    margin-right: 10px;
}

.product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 12px;
    background-color: var(--color-danger);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 15px;
    z-index: 10;
}

.product-badge--new {
    background-color: var(--color-success);
}

.product-badge--sale {
    background-color: var(--color-warning);
    color: var(--text-dark);
}

/* ===== ITEM PRODUIT (liste/panier) ===== */

.product-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: var(--border-radius-sm);
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
}

.product-item:hover {
    box-shadow: var(--shadow-md);
}

.product-item-image {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
}

.product-item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-item-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.product-item-specs {
    font-size: 0.85rem;
    color: var(--text-medium);
    margin-bottom: 10px;
}

.product-item-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: auto;
}

.product-item-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ===== GRILLE PRODUITS ===== */

.products-grid {
    display: grid;
    gap: 30px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Desktop large (1200px+): 4 colonnes */
@media (min-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
        width: 95%;
        max-width: 1400px;
    }
}

/* Desktop (1024px - 1199px): 3 colonnes */
@media (min-width: 1024px) and (max-width: 1199px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        width: 95%;
        gap: 25px;
    }
}

/* Tablet (768px - 1023px): 2 colonnes */
@media (min-width: 768px) and (max-width: 1023px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        width: 90%;
        gap: 20px;
    }
}

/* Mobile (< 768px): 1 colonne */
@media (max-width: 767px) {
    .products-grid {
        grid-template-columns: 1fr;
        width: 85%;
        gap: 25px;
    }

    .product-item {
        flex-direction: column;
    }

    .product-item-image {
        width: 100%;
        max-width: 200px;
        height: auto;
        aspect-ratio: 4 / 3;
        margin: 0 auto;
    }

    .product-title {
        font-size: 1rem;
    }

    .product-price {
        font-size: 1.1rem;
    }

    .product-info {
        padding: 12px;
    }
}

/* Très petit mobile (< 480px): pleine largeur */
@media (max-width: 480px) {
    .products-grid {
        width: 95%;
        gap: 20px;
    }
}
