/* ==========================================================================
   STYLES SPÉCIFIQUES À LA PAGE PANIER (CART)
   ========================================================================== */

/* 1. Conteneur et Mise en Page
------------------------------------------*/
.cart-container {
    padding-top: 3rem;
    padding-bottom: 4rem;
}

.cart-container h1 {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-dark);
}

.cart-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
    align-items: flex-start; /* Aligne le haut des colonnes */
}

.cart-items-list {
    flex: 2.5; /* La liste des produits prend plus de place */
    min-width: 320px;
}

.order-summary {
    flex: 1;
    background-color: #FFFFFF;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    position: sticky;
    top: 120px;
}

/* 2. Tableau des Articles du Panier
------------------------------------------*/
/* Utilisation de CSS Grid pour un alignement parfait */
.cart-header,
.cart-item-row {
    display: grid;
    /* Colonnes : Produit, Prix, Quantité, Sous-total, Action */
    grid-template-columns: 3fr 1fr 1.2fr 1fr 0.5fr;
    gap: 1.5rem;
    align-items: center;
    padding: 1rem 0;
}

.cart-header {
    color: var(--text-subtle);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    border-bottom: 2px solid #eee;
    margin-bottom: 1rem;
}

.cart-item-row {
    border-bottom: 1px solid #eee;
}

/* Infos du produit (image + nom) */
.cart-product-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cart-product-info img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-product-info a {
    font-weight: 600;
    color: var(--text-dark);
    display: block; /* Pour que le margin s'applique */
    margin-bottom: 0.25rem;
}

.cart-product-info a:hover {
    color: var(--primary-orange);
    text-decoration: none;
}

.cart-product-info small {
    color: var(--text-subtle);
    font-size: 0.85rem;
}

/* Colonnes Prix et Sous-total */
.cart-item-price,
.cart-item-subtotal {
    font-weight: 500;
}

/* Champ de quantité */
.cart-quantity-input {
    width: 70px;
    padding: 0.6rem;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: var(--font-primary);
    font-size: 1rem;
}
.cart-quantity-input:focus {
    outline: none;
    border-color: var(--primary-orange);
}

/* Bouton de suppression */
.remove-from-cart-btn {
    background: none;
    border: none;
    color: var(--text-subtle);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.remove-from-cart-btn:hover {
    color: #e74c3c; /* Rouge pour la suppression */
    transform: scale(1.1);
}

/* 3. Résumé de la Commande
------------------------------------------*/
.order-summary h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.order-summary hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 1.5rem 0;
}

/* 4. Panier Vide
------------------------------------------*/
.cart-empty {
    text-align: center;
    padding: 4rem 2rem;
    background-color: #fff;
    border-radius: 12px;
    border: 2px dashed #eee;
}

.cart-empty h2 {
    color: var(--primary-orange);
    margin-bottom: 1rem;
}

/* 5. Responsive
------------------------------------------*/
@media (max-width: 992px) {
    .cart-layout {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    /* Cache l'en-tête du tableau sur mobile */
    .cart-header {
        display: none;
    }

    /* Transforme chaque ligne en une "carte" */
    .cart-item-row {
        grid-template-columns: 80px 1fr; /* Image | Contenu */
        grid-template-rows: auto;
        gap: 0.5rem 1.5rem; /* Espace vertical et horizontal */
        padding: 1.5rem 0;
    }

    .cart-product-info {
        grid-column: 1 / -1; /* L'info produit prend toute la largeur */
    }

    /* Utilise les pseudo-éléments pour recréer les en-têtes */
    .cart-item-price::before,
    .cart-item-quantity::before,
    .cart-item-subtotal::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-subtle);
        margin-right: 1rem;
    }
    
    /* Place chaque élément sur sa propre ligne, aligné avec du texte */
    .cart-item-price,
    .cart-item-quantity,
    .cart-item-subtotal {
        grid-column: 1 / -1; /* Prend toute la largeur */
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border-top: 1px solid #f5f5f5;
    }

    .cart-product-info {
        border: none;
    }

    .cart-item-remove {
        grid-column: 1 / -1;
        text-align: right;
    }
}