/**
 * CSS pour le récapitulatif des articles du panier
 * Affichage en colonnes avec en-tête
 */

/* ========== Titre Récapitulatif panier ========== */

.cart-detailed-totals {
    background-color: #F9F7F6;
    padding: 20px 20px 0px 20px;
}

.cart-detailed-subtotals,
.cart-detailed-subtotals * {
    color: #163C5D !important;
    font-size: 14px !important;
    font-family: "Poppins", sans-serif !important;
    padding-top: 0px;
    padding-bottom: 0px;
}

.card-block.cart-summary-totals .cart-summary-line.cart-total .label {
    color: #163C5D !important;
    font-size: 15px !important;
    font-family: "Poppins", sans-serif !important;
    font-weight: 500 !important;
}

.card-block.cart-summary-totals .cart-summary-line.cart-total .value {
    color: #163C5D !important;
    font-size: 15px !important;
    font-family: "Poppins", sans-serif !important;
    font-weight: 600 !important;
    text-align: right;
}

.cart-summary-line .label {
    font-weight: 500;
}

.tax-included-notice {
    color: #54595F;
    font-family: "Poppins", sans-serif;
    font-size: 12px;
    font-weight: normal;
    margin-top: 5px;
}

.cart-toggle-icon {
    font-size: 1em;
    text-decoration: none !important;
    font-family: "Font Awesome 5 Free" !important;
}

.cart-totals-title {
    color: #163C5D;
    font-family: "Poppins", sans-serif;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    margin-top: 9.2px;
}

/* ========== En-tête des colonnes ========== */
.cart-grid-body .cart-overview {
    padding: 1rem 1rem 1rem 0;
}

.cart-grid {
    margin-bottom: 0 !important;
}

.cart-header-row {
    display: grid;
    grid-template-columns: 100px 2fr 120px 120px 120px 60px;
    gap: 15px;
    padding: 15px 20px;
    background: #F9F7F6;
    border-bottom: 2px solid #ddd;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 11px;
    color: #163C5D;
    margin-bottom: 10px;
}

.cart-header-image,
.cart-header-article,
.cart-header-unit-price,
.cart-header-quantity,
.cart-header-total,
.cart-header-delete {
    display: flex;
    align-items: center;
    text-transform: uppercase;
}

.cart-header-image {
    justify-content: center;
}

.cart-header-unit-price,
.cart-header-quantity,
.cart-header-total {
    justify-content: center;
}

.cart-header-delete {
    justify-content: center;
}

/* ========== Ligne produit ========== */

.cart-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cart-item {
    border-bottom: 1px solid #e5e5e5;
    padding: 15px 0;
}

.product-line-grid {
    display: grid;
    grid-template-columns: 100px 2fr 120px 120px 120px 60px;
    gap: 15px;
    padding: 0 20px;
    align-items: center;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: #163C5D;
}

/* ========== Colonnes individuelles ========== */

/* Colonne 1: Image */
.product-line-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.product-line-image a {
    display: block;
    overflow: hidden;
    border-radius: 4px;
}

.product-line-image img {
    max-width: 80px;
    height: auto;
    transition: transform 0.3s ease;
}

.product-line-image a:hover img {
    transform: scale(1.1);
}

/* Colonne 2: Article */
.product-line-article {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.product-line-article .label {
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    font-size: 16px;
    color: #163C5D;
    text-decoration: none;
}

.product-line-article .label:hover {
    color: #E84242 !important;
}

.product-line-article .product-attribute {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: #163C5D;
}

/* Colonne 3: Prix unitaire */
.product-line-unit-price {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.product-line-unit-price .product-price {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.product-line-unit-price .regular-price {
    text-decoration: line-through;
    color: #999;
    font-size: 12px;
}

.product-line-unit-price .discount {
    color: #e74c3c;
    font-size: 11px;
    font-weight: 600;
}

.product-line-unit-price .current-price {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: #163C5D;
}

/* Colonne 4: Quantité */
.product-line-quantity {
    display: flex;
    justify-content: center;
    align-items: center;
}

.product-line-quantity .quantity-wrapper {
    position: relative;
    display: inline-block;
    width: 80px;
    border: 1px solid #163C5D;
    border-radius: 6px;
    overflow: hidden;
}

.product-line-quantity input[type="number"] {
    width: 100%;
    text-align: center;
    padding: 8px 24px 8px 5px;
    border: none;
    border-radius: 0;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    color: #163C5D;
}

/* Masquer les flèches natives du navigateur */
.product-line-quantity input[type="number"]::-webkit-inner-spin-button,
.product-line-quantity input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.product-line-quantity input[type="number"] {
    -moz-appearance: textfield;
}

/* Container des flèches personnalisées */
.product-line-quantity .quantity-arrows {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 24px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #163C5D;
    z-index: 10;
}

/* Boutons flèches */
.product-line-quantity .quantity-arrow {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.15s ease;
    position: relative;
    z-index: 10;
}

.product-line-quantity .quantity-arrow:hover {
    background-color: #e5e7eb;
}

.product-line-quantity .quantity-up {
    border-top-right-radius: 0;
    border-bottom: 0.5px solid #163C5D;
}

.product-line-quantity .quantity-down {
    border-bottom-right-radius: 0;
}

/* SVG dans les boutons */
.product-line-quantity .quantity-arrow svg {
    width: 1.2rem;
    height: 1.2rem;
    color: #6b7280;
    pointer-events: none;
}

/* Hauteur de l'input dans le touchspin */
.bootstrap-touchspin input.form-control {
    height: 2.4rem;
}

/* Référence OEM */
.product-oem-ref {
    font-weight: 450;
    font-size: 12px;
    font-family: 'Poppins', sans-serif;
    color: #163C5D;
    margin-top: 0.25rem;
}

/* Colonne 5: Total HT */
.product-line-total {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.product-line-total .product-price {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: #163C5D;
}

/* Colonne 6: Supprimer */
.product-line-delete {
    display: flex;
    justify-content: center;
    align-items: center;
}

.product-line-delete .remove-from-cart {
    display: inline-block;
    color: #163C5D;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: "Roboto", sans-serif;
    font-weight: 500;
    font-size: 14px;
    background-color: #FFFFFF;
    border-radius: 3px;
    padding: 10px;
    text-decoration: none;
}

.product-line-delete .remove-from-cart:hover {
    background-color: #f0f0f0;
}

.product-line-delete .fa-trash-can {
    font-size: 14px;
}

/* ========== Message panier vide ========== */

.no-items {
    display: block;
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

.empty-cart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-cart-icon {
    font-size: 4em;
    color: #163C5D;
    margin-bottom: 20px;
}

.empty-cart-message {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    color: #163C5D;
    margin-bottom: 25px;
    margin-top: 0;
}

.empty-cart-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
}

.empty-cart-button {
    background-color: #163C5D !important;
    border-color: #163C5D !important;
    color: #fff !important;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 12px 30px;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.empty-cart-button:hover {
    background-color: #112A3F !important;
    border-color: #112A3F !important;
}

.empty-cart-login-button {
    width: 181.38px;
    background-color: #E84242 !important;
    border-color: #E84242 !important;
    color: #fff !important;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 12px 30px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.empty-cart-login-button:hover {
    background-color: #BE4142 !important;
    border-color: #BE4142 !important;
}

/* ========== Bouton validation panier ========== */

.checkout.cart-detailed-actions.card-block {
    padding-left: 0px;
    padding-right: 0px;
    padding-top: 15px;
    padding-bottom: 0;
}

/* ========== Bouton code promo ========== */

.block-promo .promo-code-button {
    font-size: 13px;
    font-family: "Poppins", sans-serif;
    text-align: left;
    color: #163C5D !important;
    text-decoration: none;
    display: inline-block;
    padding-bottom: 0px;
    cursor: pointer;
}

.block-promo .promo-code {
    padding: 0px !important;
}

.block-promo .promo-code form{
    text-align: left;
}

.block-promo .promo-input {
    border: 1px solid #163C5D;
    padding: 10px 15px;
    font-family: "Poppins", sans-serif;
    font-size: 14px;
    width: 75%;
    height: 44px;
    line-height: normal;
    border-radius: 4px 0 0 4px;
    border-right: none;
}

.block-promo .btn-primary {
    height: 44px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 4px 4px 0;
}

.block-promo .promo-input+button{
    margin-left: 0px;
    margin-top: -2px;
    box-shadow: none;
    border: 1px solid #163C5D;
}

.bouton-voucher {
    color: #FFF !important;
    font-family: "Poppins", sans-serif;
    font-size: 14px;
    line-height: 1;
}

.block-promo .promo-code-button:hover {
    color: #E84242 !important;
}

.collapse-button {
    text-decoration: underline;
    color: #163C5D !important;
}

.collapse-button:hover {
    color: #E84242 !important;
}

/* Désactiver l'animation du collapse pour le bloc promo */
#promo-code.collapse {
    transition: none !important;
}

#promo-code.collapsing {
    transition: none !important;
    height: auto !important;
}

/* Désactiver l'animation jQuery show/hide sur display-promo */
.promo-code-button.display-promo {
    transition: none !important;
    animation: none !important;
}

/* Message d'erreur voucher */
.erreur-voucher {
    display: block;
    color: #E84242 !important;
    font-family: "Poppins", sans-serif;
    font-size: 13px;
    margin-top: 5px;
}

/* ========== Code promo appliqué ========== */

.promo-name.card-block {
    padding-left: 0;
    padding-right: 0;
    border-top: 1px solid #e5e5e5;
    padding-top: 15px;
    margin-top: 15px;
}

#cart-subtotal-discount > span {
    color: #E84242 !important;
}

/* ========== Responsive ========== */

@media (min-width: 992px) {
    .col-lg-8 {
        width: 70%;
    }

    .col-lg-4 {
        width: 30%;
    }
}

/* Grille optimisée pour les écrans de moins de 1440px */
@media (max-width: 1439px) {
    .cart-header-row,
    .product-line-grid {
        grid-template-columns: 100px 1fr auto auto auto 32px;
        gap: 15px;
    }

    .cart-header-row {
        padding-left: 0;
        padding-right: 0;
    }

    .product-line-grid {
        padding-left: 0;
        padding-right: 0;
    }
}

@media (max-width: 991px) {
    .cart-header-row,
    .product-line-grid {
        grid-template-columns: 80px 2fr 100px 90px 100px 50px;
        gap: 10px;
    }

    .cart-header-row {
        font-size: 12px;
        padding: 10px 15px;
    }

    .product-line-grid {
        padding: 0 15px;
    }
}

/* Masquer le bloc mobile en desktop */
.product-line-mobile-details {
    display: none;
}

@media (max-width: 767px) {
    .cart-header-row {
        display: none;
    }

    /* Layout mobile : grille personnalisée */
    .product-line-grid {
        display: grid;
        grid-template-columns: 70px 1fr auto;
        grid-template-rows: auto auto;
        grid-template-areas:
            "image title delete"
            "image details details";
        gap: 5px 12px;
        padding: 0px;
        align-items: start;
    }

    /* Image : colonne gauche, sur 2 lignes */
    .product-line-image {
        grid-area: image;
        justify-content: flex-start;
        align-items: flex-start;
    }

    .product-line-image img {
        max-width: 70px;
    }

    /* Titre : en haut à droite de l'image */
    .product-line-article {
        grid-area: title;
        align-items: flex-start;
    }

    .product-line-article .label {
        font-size: 14px;
        line-height: 1.3;
    }

    /* Masquer la ref OEM dans la colonne article (on la déplace dans le bloc mobile) */
    .product-line-article .product-oem-ref {
        display: none;
    }

    /* Bouton supprimer : en haut à droite */
    .product-line-delete {
        grid-area: delete;
        justify-content: flex-end;
        align-items: flex-start;
    }

    .product-line-delete .remove-from-cart {
        padding: 5px;
    }

    /* Masquer les colonnes desktop */
    .product-line-total,
    .product-line-unit-price,
    .product-line-quantity {
        display: none;
    }

    /* Bloc mobile : Réf OEM, Prix, Quantité chacun sur sa propre ligne */
    .product-line-mobile-details {
        grid-area: details;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .product-line-mobile-details .mobile-oem-ref {
        font-family: 'Poppins', sans-serif;
        font-size: 11px;
        color: #163C5D;
        font-weight: 450;
    }

    .product-line-mobile-details .mobile-price {
        font-family: 'Poppins', sans-serif;
        font-size: 13px;
        color: #163C5D;
    }

    .product-line-mobile-details .mobile-price .price-label {
        font-weight: 400;
    }

    .product-line-mobile-details .mobile-price .price {
        font-weight: 600;
    }

    /* Quantité - reprise exacte du style desktop */
    .product-line-mobile-details .mobile-quantity .quantity-wrapper {
        position: relative;
        display: inline-block;
        width: 70px;
        border: 1px solid #163C5D;
        border-radius: 6px;
        overflow: hidden;
    }

    .product-line-mobile-details .mobile-quantity input[type="number"] {
        width: 100%;
        text-align: center;
        padding: 6px 22px 6px 5px;
        border: none;
        border-radius: 0;
        font-size: 13px;
        font-family: 'Poppins', sans-serif;
        color: #163C5D;
        -moz-appearance: textfield;
    }

    .product-line-mobile-details .mobile-quantity input[type="number"]::-webkit-inner-spin-button,
    .product-line-mobile-details .mobile-quantity input[type="number"]::-webkit-outer-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    .product-line-mobile-details .quantity-arrows {
        position: absolute;
        right: 0;
        top: 0;
        height: 100%;
        width: 22px;
        display: flex;
        flex-direction: column;
        border-left: 1px solid #163C5D;
        z-index: 10;
    }

    .product-line-mobile-details .quantity-arrow {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #f9f9f9;
        border: none;
        cursor: pointer;
        padding: 0;
        transition: background-color 0.15s ease;
    }

    .product-line-mobile-details .quantity-arrow:hover {
        background-color: #e5e7eb;
    }

    .product-line-mobile-details .quantity-up {
        border-bottom: 0.5px solid #163C5D;
    }

    .product-line-mobile-details .quantity-arrow svg {
        width: 14px;
        height: 14px;
        color: #6b7280;
        pointer-events: none;
    }

    /* Clearfix */
    .product-line-grid .clearfix {
        display: none;
    }

    .cart-grid-body .cart-overview {
        padding: 0;
    }

    .card.cart-container {
        margin-bottom: 0;
    }

    .cart-grid-body {
        margin-bottom: 0;
    }

    .cart-grid-body {
        padding-right: 0 !important;
        padding-left: 0 !important;
    }

    .cart-grid-right {
        padding-right: 0 !important;
        padding-left: 0 !important;
    }

    /* Popup confirmation suppression - version mobile */
    .remove-confirm-popup {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        bottom: auto !important;
        background-color: #fff !important;
        border: none !important;
        border-radius: 12px !important;
        padding: 30px !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
        z-index: 1001 !important;
        white-space: normal !important;
        margin-bottom: 0 !important;
        width: 90% !important;
        max-width: 350px !important;
    }

    /* Masquer les flèches du popup */
    .remove-confirm-popup::after,
    .remove-confirm-popup::before {
        display: none !important;
    }

    /* Overlay grisé */
    .remove-confirm-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }

    .remove-confirm-text {
        display: block !important;
        font-family: 'Poppins', sans-serif !important;
        font-size: 16px !important;
        color: #163C5D !important;
        text-align: center !important;
        margin-bottom: 25px !important;
    }

    .remove-confirm-buttons {
        display: flex !important;
        flex-direction: row !important;
        gap: 12px !important;
    }

    .remove-confirm-buttons button {
        display: block !important;
        flex: 1 !important;
        font-family: 'Poppins', sans-serif !important;
        font-size: 15px !important;
        padding: 15px 20px !important;
        border-radius: 8px !important;
        text-decoration: none !important;
        font-weight: 500 !important;
        cursor: pointer !important;
        border: none !important;
    }

    .remove-confirm-yes {
        background-color: #E84242 !important;
        color: #fff !important;
        text-decoration: none !important;
    }

    .remove-confirm-no {
        background-color: #163C5D !important;
        color: #fff !important;
        text-decoration: none !important;
    }

    .remove-confirm-yes:hover,
    .remove-confirm-no:hover {
        text-decoration: none !important;
        opacity: 0.9;
    }

    /* ========== Bloc sticky mobile panier ========== */
    .mobile-cart-sticky-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: #fff;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        z-index: 999;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        padding: 15px 20px;
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }

    .mobile-cart-sticky-bar.visible {
        transform: translateY(0);
    }

    .mobile-cart-sticky-content {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .mobile-cart-sticky-total {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
    }

    .mobile-cart-sticky-total .total-label {
        font-family: 'Poppins', sans-serif;
        font-size: 16px;
        font-weight: 600;
        color: #163C5D;
    }

    .mobile-cart-sticky-total .total-amount-wrapper {
        text-align: right;
    }

    .mobile-cart-sticky-total .total-amount {
        font-family: 'Poppins', sans-serif;
        font-size: 18px;
        font-weight: 600;
        color: #163C5D;
        display: block;
    }

    .mobile-cart-sticky-total .total-tax-notice {
        font-family: 'Poppins', sans-serif;
        font-size: 11px;
        font-weight: 400;
        color: #999;
        display: block;
        margin-top: 2px;
    }

    .mobile-cart-validate-btn {
        width: 100%;
        padding: 20px 20px;
        font-family: 'Poppins', sans-serif !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        text-transform: uppercase;
        background-color: #163C5D !important;
        border-color: #163C5D !important;
        border-radius: 6px;
    }

    .mobile-cart-validate-btn:hover {
        background-color: #112a3f !important;
        border-color: #112a3f !important;
    }

    /* Retirer box-shadow des boutons de navigation */
    #summary-trigger-addresses,
    #summary-trigger-delivery,
    #validate-cart-btn {
        box-shadow: none !important;
    }

    .empty-cart-buttons {
        flex-direction: column;
    }
}

/* Masquer le bloc sticky en desktop */
.mobile-cart-sticky-bar {
    display: none;
}

@media (max-width: 767px) {
    .mobile-cart-sticky-bar {
        display: block;
    }
}

/* ========== Popup confirmation suppression article ========== */

.remove-confirm-popup {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 100;
    white-space: nowrap;
    margin-bottom: 5px;
}

.remove-confirm-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #fff;
}

.remove-confirm-popup::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: #e0e0e0;
}

.remove-confirm-text {
    display: block;
    font-family: 'Poppins', sans-serif;
    font-size: 10px;
    color: #163C5D;
    text-align: center;
    margin-bottom: 6px;
}

.remove-confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.remove-confirm-buttons button {
    background: none;
    border: none;
    font-family: 'Poppins', sans-serif;
    font-size: 10px;
    cursor: pointer;
    padding: 2px 6px;
}

.remove-confirm-no {
    color: #163C5D;
    text-decoration: underline;
}

.remove-confirm-yes {
    color: #E84242;
    text-decoration: underline;
}

.remove-confirm-yes:hover {
    text-decoration: underline;
}
