/**
 * Styles Front-end - Version Horizontale Épurée
 */

/* Conteneur global */
.tp-pricing-table-container {
    margin: 15px 0;
    padding: 10px;
    background: #ffffff;
    border: 1px solid #eeeeee;
    border-radius: 8px;
}

.tp-pricing-table-container h3 {
    margin-top: 0;
    font-size: 1.0em;
    color: #000;
    border-bottom: 2px solid #f1f1f1;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.tp-pricing-table-container td {
    white-space: nowrap; /* Évite que l'unité passe à la ligne */
}

.tp-unit-label {
    font-size: 0.8em;
    opacity: 0.8;
    margin-left: 3px;
}

.tp-unit-display {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.8em;
    color: #777;
    font-weight: normal;
    vertical-align: middle;
}
/* Structure du tableau Horizontal */
.tp-pricing-table.tp-horizontal {
    display: block;
    width: 100%;
    overflow-x: auto; /* Scroll sur mobile */
    white-space: nowrap;
    border-collapse: collapse;
    border: 1px solid #0e0000;
}

.tp-pricing-table.tp-horizontal th {
    background: #F8F8F8;
    position: sticky;
    left: 0; 
    z-index: 2;
    border: 1px solid #000000;
    min-width: 80px;
    padding: 10px;
    text-align: left;
    color: #000000;
    font-size: 0.8em;
}

.tp-pricing-table.tp-horizontal td {
    padding: 10px;
    text-align: center;
    border: 1px solid #000000;
    min-width: 80px;
    color: #000000;
}

/* --- Style de la Colonne Active --- */
/* On cible .tp-active-col qui est ajouté par le JS lors du calcul total */
/* On ajoute aussi .tp-active-column pour le clic manuel */

.tp-pricing-table td.tp-active-col,
.tp-pricing-table td.tp-active-column {
    background-color: var(--active-color, #CCECB4) !important;
    color: var(--active-text, #000000) !important;
    font-weight: bold;
    /* Une bordure un peu plus subtile que le noir pur pour un rendu plus pro */
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.2); 
    position: relative;
    transition: all 0.2s ease-in-out;
}

.tp-pricing-table.tp-all-columns-clickable td {
    cursor: pointer;
}

/* On s'assure que le prix barré change aussi de couleur dans la colonne active */
.tp-pricing-table td.tp-active-col del,
.tp-pricing-table td.tp-active-column del {
    color: var(--active-text, #000000) !important;
    opacity: 0.6;
}


/* Style pour indiquer que les colonnes de prix sont cliquables */
.tp-price-column {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* --- Effet au Survol (Hover) --- */
/* On force la variable active-color même si on survole la colonne déjà sélectionnée */
.tp-price-column.tp-active-col:hover,
.tp-price-column.tp-active-column:hover {
    background-color: var(--active-color, #CCECB4) !important;
    color: var(--active-text, #000000) !important;
}

/* On s'assure que la colonne active garde sa couleur même au survol */
.tp-p.tp-price-column.tp-active-column:hover {
    background-color: var(--active-color, #CCECB4) !important;
    color: var(--active-text, #000000) !important;
}

/* Bloc Total Dynamique */
.tp-total-price-display {
    margin-top: 10px;
    background: #f9f9f9;
    padding: 10px 10px;
    border-left: 4px solid #000;
    font-weight: bold;
    text-align: right;
}

.tp-dynamic-price {
    font-size: 1.2em;
    color: #000;
}

/* Badge page boutique */
.tp-shop-badge h2{
    font-family: "Verdana", "Geneva", "sans-serif";
    font-size: 0.7em;
    color: #000 !important;
    font-weight: 400;
    margin-bottom: 5px;
    display: block;
}

.tp-lowest-unit-price {
    display: block;
    margin: 4px 0;
    font-size: 0.9em;
    font-weight: 600;
}


/* --- Conteneur du formulaire de variations --- */
.tp-bulk-order-wrapper {
    margin: 20px 0;
    padding: 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.tp-bulk-order-wrapper h4 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.25em;
    color: #222;
    border-left: 4px solid #000;
    padding-left: 15px;
}

/* --- Style du tableau de saisie --- */
.tp-bulk-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

.tp-bulk-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tp-bulk-table.tp-bulk-table-transposed {
    min-width: max-content;
    display: table !important;
    table-layout: auto;
   /* border: 1px solid #efefef; */
    border: 1px solid #0e0000;
    background: #fff;
}

.tp-bulk-table.tp-bulk-table-transposed tbody {
    display: table-row-group !important;
}

.tp-bulk-table.tp-bulk-table-transposed tr {
    display: table-row !important;
}

.tp-bulk-table.tp-bulk-table-transposed tr {
    transition: background 0.2s;
}

.tp-bulk-table.tp-bulk-table-transposed tr:hover {
    background: #fcfcfc;
}

.tp-bulk-table.tp-bulk-table-transposed th,
.tp-bulk-table.tp-bulk-table-transposed td {
    display: table-cell !important;
    padding: 10px 8px;
    border: 1px solid #000000;
    vertical-align: middle;
    font-family: inherit;
    font-size: 0.8em;
    color: #000000;
}

.tp-bulk-table.tp-bulk-table-transposed th {
    background: #f8f9fa;
    text-align: left;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
    white-space: nowrap;
    min-width: 112px;
    position: sticky;
    left: 0;
    z-index: 1;
}

.tp-bulk-table.tp-bulk-table-transposed td {
    min-width: 160px;
    text-align: center;
}

/* --- Inputs de quantité (desktop) ---
   Bloc consolidé (équivalent au rendu final des règles précédentes). */
.tp-bulk-qty-input {
    width: 80px !important;
    height: 35px !important;
    padding: 8px !important;
    margin: 0 3px !important;
    text-align: center;
    font-weight: bold;
    border: 1px solid #d0d7de !important;
    border-radius: 6px !important;
    background: #ffffff !important;
    color: #111111 !important;
    transition: border-color 0.3s;
}

/* On masque les steppers natifs pour garder le stepper custom +/- cohérent */
.tp-bulk-qty-input::-webkit-outer-spin-button,
.tp-bulk-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tp-bulk-qty-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Focus : change la bordure quand l'input est focalisé pour indiquer l'état actif */
.tp-bulk-qty-input:focus {
    border-color: var(--active-color, #000) !important;
    outline: none;
}


/* --- Bouton Ajouter au Panier (Logique héritée du stepper) --- */
#tp-selected-items-count.tp-selected-items-count {
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
    justify-self: start;
}

.tp-add-to-cart-wrapper {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}

#tp-add-bulk-to-cart.elementor-button {
    grid-column: 2;
    justify-self: center;
    width: auto !important;
    min-height: 38px !important;
    padding: 8px 16px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin-top: 0 !important;
    cursor: pointer;
    border: none !important;
    
    /* Couleurs Globales Elementor */
    background-color: var(--e-global-color-primary, #000) !important;
    color: var(--e-global-color-secondary, #ffffff) !important;
    
    /* On laisse Elementor gérer l'arrondi (border-radius) tout seul */
    transition: all 0.3s ease;
}

#tp-add-bulk-to-cart.elementor-button:hover {
    background-color: var(--e-global-color-accent) !important;
    filter: brightness(1.1);
}

#tp-add-bulk-to-cart.elementor-button:active {
    transform: scale(0.95);
}

/* Conteneur Parent */
.tp-add-to-cart-container {
    clear: both !important;
    padding: 10px 0 !important;
    width: 100% !important;
    display: block !important;
}

/* Empêche les tableaux de compresser la description */
.tp-bulk-order-wrapper, 
.tp-pricing-table-container {
    clear: both !important; /* Force le retour à la ligne après les éléments flottants */
    width: 100% !important;
    margin-bottom: 30px !important;
    display: block !important;
}


/* Style du stepper (boutons +/-) */
.tp-qty-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px; /* Espace entre les boutons et l'input */
}

/* Style des boutons + et - qui s'adapte au thème */
.tp-qty-stepper button {
   min-width: 35px !important; /* Minimum pour rester cliquable */
    min-height: 35px !important;
    padding: 5px 5px !important; /* Laisse le bouton respirer */
    display: flex !important;
    align-items: center;
    justify-content: center;
    line-height: 1 !important;
    
    /* On supprime les couleurs forcées pour laisser Elementor agir */
    /* On ne touche PAS au border-radius ici pour que celui d'Elementor gagne */
}

/* Si Elementor est présent, on reprend ses couleurs globales pour nos boutons custom */
.tp-qty-stepper button.elementor-button {
    background-color: var(--e-global-color-primary, #000) !important;
    color: var(--e-global-color-secondary, #ffffff) !important;
    border: none !important;
}

/* État au survol (Hover) */
.tp-qty-stepper button.elementor-button:hover {
   
    /* On peut forcer la couleur de survol définie dans Elementor */
    background-color: var(--e-global-color-accent); 
    transition: all 0.3s ease;
}

/* État au clic (Active) */
.tp-qty-stepper button.elementor-button:active {
    /* Effet d'enfoncement visuel */
    transform: scale(0.92);
    filter: brightness(80%);
    transition: all 0.1s ease;
}

/* Desktop: revenir au stepper natif (Chrome/Edge/Safari/Firefox) */
@media (min-width: 768px) {
    .tp-bulk-order-wrapper .tp-bulk-qty-input::-webkit-outer-spin-button,
    .tp-bulk-order-wrapper .tp-bulk-qty-input::-webkit-inner-spin-button {
        -webkit-appearance: auto;
        opacity: 1;
        margin: 0;
    }

    .tp-bulk-order-wrapper .tp-bulk-qty-input[type=number] {
        -moz-appearance: auto;
        appearance: auto;
    }

    .tp-bulk-order-wrapper .tp-qty-stepper .tp-qty-plus,
    .tp-bulk-order-wrapper .tp-qty-stepper .tp-qty-minus {
        display: none !important;
    }

    form.cart .tp-simple-qty-stepper .tp-simple-qty-plus,
    form.cart .tp-simple-qty-stepper .tp-simple-qty-minus {
        display: none !important;
    }

    .tp-bulk-order-wrapper .tp-qty-stepper {
        gap: 0;
    }

    .tp-bulk-order-wrapper .tp-qty-stepper .tp-bulk-qty-input {
        margin: 0 !important;
    }
}


/* Masque les variations standards de WooCommerce pour ne garder que notre tableau */
.variations_form.cart .variations {
    display: none !important;
}
.variations_form.cart .single_variation_wrap {
    display: none !important;
}

/* Produits simples: hauteur uniforme qty <-> bouton panier (desktop + mobile) */
.single-product form.cart:not(.variations_form),
body.product form.cart:not(.variations_form) {
    --tp-simple-control-height: 44px;
}

.single-product form.cart:not(.variations_form) .single_add_to_cart_button,
.single-product form.cart:not(.variations_form) button[name="add-to-cart"],
body.product form.cart:not(.variations_form) .single_add_to_cart_button,
body.product form.cart:not(.variations_form) button[name="add-to-cart"] {
    min-height: var(--tp-simple-control-height) !important;
    height: var(--tp-simple-control-height) !important;

    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

/* Applique le style Elementor au bouton panier simple si la classe existe */
.single-product form.cart:not(.variations_form) .single_add_to_cart_button.elementor-button,
.single-product form.cart:not(.variations_form) button[name="add-to-cart"].elementor-button,
body.product form.cart:not(.variations_form) .single_add_to_cart_button.elementor-button,
body.product form.cart:not(.variations_form) button[name="add-to-cart"].elementor-button {
    background-color: var(--e-global-color-primary, currentColor) !important;
    color: var(--e-global-color-secondary, #ffffff) !important;
    border-color: transparent !important;
}

.single-product form.cart:not(.variations_form) .single_add_to_cart_button.elementor-button:hover,
.single-product form.cart:not(.variations_form) button[name="add-to-cart"].elementor-button:hover,
body.product form.cart:not(.variations_form) .single_add_to_cart_button.elementor-button:hover,
body.product form.cart:not(.variations_form) button[name="add-to-cart"].elementor-button:hover {
    background-color: var(--e-global-color-accent, var(--e-global-color-primary, currentColor)) !important;
}

.single-product form.cart:not(.variations_form) .tp-simple-qty-stepper input.qty,
body.product form.cart:not(.variations_form) .tp-simple-qty-stepper input.qty,
.single-product form.cart:not(.variations_form) .tp-simple-qty-stepper .tp-simple-qty-plus,
.single-product form.cart:not(.variations_form) .tp-simple-qty-stepper .tp-simple-qty-minus,
body.product form.cart:not(.variations_form) .tp-simple-qty-stepper .tp-simple-qty-plus,
body.product form.cart:not(.variations_form) .tp-simple-qty-stepper .tp-simple-qty-minus {
    height: var(--tp-simple-control-height) !important;
    min-height: var(--tp-simple-control-height) !important;
}

/* --- Responsive Mobile / tactile --- */
@media (max-width: 767px), (hover: none) and (pointer: coarse) {
    /* Produits simples: compteur +/- sur une ligne, bouton panier dessous */
    .single-product form.cart:not(.variations_form),
    body.product form.cart:not(.variations_form) {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .single-product form.cart:not(.variations_form) .quantity,
    body.product form.cart:not(.variations_form) .quantity {
        width: 100%;
        display: flex;
        justify-content: center;
        margin: 0 !important;
    }

    .single-product form.cart:not(.variations_form) .tp-simple-qty-stepper,
    body.product form.cart:not(.variations_form) .tp-simple-qty-stepper {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    .single-product form.cart:not(.variations_form) .single_add_to_cart_button,
    .single-product form.cart:not(.variations_form) button[name="add-to-cart"],
    body.product form.cart:not(.variations_form) .single_add_to_cart_button,
    body.product form.cart:not(.variations_form) button[name="add-to-cart"] {
        width: 100%;
        max-width: 360px;
        margin: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        align-self: center;
        display: inline-flex !important;
        clear: both;
        border: none !important;
        box-shadow: none !important;
    }

    form.cart .tp-simple-qty-stepper {
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }

    form.cart .tp-simple-qty-stepper .tp-simple-qty-plus,
    form.cart .tp-simple-qty-stepper .tp-simple-qty-minus {
        min-width: 32px !important;
        width: 32px;
        min-height: var(--tp-simple-control-height) !important;
        height: var(--tp-simple-control-height) !important;
        padding: 0 !important;
        margin: 0 !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        line-height: 1 !important;
        flex: 0 0 32px;
    }

    form.cart .tp-simple-qty-stepper input.qty {
        width: 48px !important;
        min-width: 48px;
        height: var(--tp-simple-control-height) !important;
        margin: 0 !important;
        padding: 2px !important;
        text-align: center;
        -moz-appearance: textfield;
        appearance: textfield;
    }

    form.cart .tp-simple-qty-stepper input.qty::-webkit-outer-spin-button,
    form.cart .tp-simple-qty-stepper input.qty::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    .tp-bulk-order-wrapper { padding-left: 8px; padding-right: 8px; box-sizing: border-box; overflow: visible; }

    .tp-bulk-table-scroll {
        width: 100%;
        overflow-x: auto !important;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .tp-add-to-cart-wrapper {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    #tp-selected-items-count.tp-selected-items-count {
        justify-self: center;
    }

    #tp-add-bulk-to-cart.elementor-button {
        justify-self: center;
    }

    .tp-bulk-table:not(.tp-bulk-table-transposed) {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        table-layout: fixed;
        border-collapse: collapse;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .tp-bulk-table:not(.tp-bulk-table-transposed) thead th {
        position: sticky;
        top: 0;
        z-index: 3;
        background: #f8f9fa;
        padding: 8px;
        font-size: 0.75em; /* Réduit la police des entêtes */
        text-align: left;
    }

    .tp-bulk-table:not(.tp-bulk-table-transposed) td {
        padding: 8px;
        font-size: 0.75em; /* Réduit la police des cellules */
        border-bottom: 1px solid #f1f1f1;
        text-align: left;
        white-space: normal; /* Autorise le retour à la ligne pour éviter le débordement */
        overflow: visible;
        text-overflow: initial;
    }

    .tp-bulk-table:not(.tp-bulk-table-transposed) td[data-label="Variation"] {
        word-break: break-word;
    }

    .tp-bulk-table:not(.tp-bulk-table-transposed) th,
    .tp-bulk-table:not(.tp-bulk-table-transposed) td {
        min-width: 60px; /* Réduit la taille minimale des colonnes */
    }

    .tp-bulk-table:not(.tp-bulk-table-transposed) td[data-label="Quantité"] {
        white-space: nowrap;
        min-width: 0;
        text-align: center;
    }

    .tp-bulk-table:not(.tp-bulk-table-transposed) td[data-label="Quantité"] .tp-unit-display {
        display: none;
    }

    .tp-bulk-table:not(.tp-bulk-table-transposed) td[data-label="Quantité"] .tp-qty-stepper {
        width: 100%;
        justify-content: center;
        flex-wrap: nowrap;
        gap: 3px;
    }

    .tp-bulk-table:not(.tp-bulk-table-transposed) td[data-label="Quantité"] .tp-qty-stepper button.elementor-button {
        min-width: 30px !important;
        width: 30px;
        min-height: 30px !important;
        height: 30px;
        padding: 0 !important;
        flex: 0 0 30px;
    }

    .tp-bulk-table:not(.tp-bulk-table-transposed) td[data-label="Quantité"] .tp-bulk-qty-input {
        width: 42px !important;
        min-width: 42px;
        height: 30px !important;
        margin: 0 !important;
        padding: 2px !important;
    }

    .tp-bulk-table:not(.tp-bulk-table-transposed) tbody {
        scrollbar-width: thin;
        scrollbar-color: rgba(0,0,0,0.32) #f7f7f7;
    }

    .tp-bulk-table.tp-bulk-table-transposed {
        width: max-content !important;
        max-width: none;
        table-layout: auto !important;
        margin: 0;
    }

    .tp-bulk-table.tp-bulk-table-transposed th,
    .tp-bulk-table.tp-bulk-table-transposed td {
        white-space: nowrap;
        min-width: 132px;
        text-align: center;
    }

    .tp-bulk-table.tp-bulk-table-transposed th {
        min-width: 96px;
        text-align: left;
        position: sticky;
        left: 0;
        z-index: 2;
    }

    .tp-bulk-table.tp-bulk-table-transposed td[data-label="Quantité"] .tp-unit-display {
        display: none;
    }

    .tp-bulk-table.tp-bulk-table-transposed td[data-label="Quantité"] .tp-qty-stepper {
        justify-content: center;
        flex-wrap: nowrap;
        gap: 3px;
    }

    .tp-bulk-table.tp-bulk-table-transposed td[data-label="Quantité"] .tp-qty-stepper button.elementor-button {
        min-width: 30px !important;
        width: 30px;
        min-height: 30px !important;
        height: 30px;
        padding: 0 !important;
        flex: 0 0 30px;
    }

    .tp-bulk-table.tp-bulk-table-transposed td[data-label="Quantité"] .tp-bulk-qty-input {
        width: 42px !important;
        min-width: 42px;
        height: 30px !important;
        margin: 0 !important;
        padding: 2px !important;
    }

    

    /* Scrollbar plus visible (mobile) - track clair, thumb visible pour état inactif */
    .tp-bulk-table:not(.tp-bulk-table-transposed) tbody::-webkit-scrollbar {
        width: 12px;
    }
    .tp-bulk-table:not(.tp-bulk-table-transposed) tbody::-webkit-scrollbar-track {
        background: #f7f7f7;
        border-radius: 8px;
    }
    .tp-bulk-table:not(.tp-bulk-table-transposed) tbody::-webkit-scrollbar-thumb {
        background: rgba(0,0,0,0.32);
        border-radius: 8px;
        border: 3px solid #ffffff;
    }
    .tp-bulk-table:not(.tp-bulk-table-transposed) tbody::-webkit-scrollbar-thumb:hover {
        background: rgba(0,0,0,0.5);
    }
}

    /* --- Très petits écrans (320-375px) --- */
    @media (max-width: 420px) {
        .tp-bulk-table.tp-bulk-table-transposed th,
        .tp-bulk-table.tp-bulk-table-transposed td {
            min-width: 108px;
            padding: 8px 6px;
            font-size: 0.72em;
        }

        .tp-bulk-table.tp-bulk-table-transposed th {
            min-width: 84px;
        }

        .tp-bulk-table.tp-bulk-table-transposed td[data-label="Quantité"] .tp-qty-stepper {
            gap: 2px;
        }

        .tp-bulk-table.tp-bulk-table-transposed td[data-label="Quantité"] .tp-qty-stepper button.elementor-button {
            min-width: 26px !important;
            width: 26px;
            min-height: 26px !important;
            height: 26px;
            flex: 0 0 26px;
            font-size: 0.85em;
        }

        .tp-bulk-table.tp-bulk-table-transposed td[data-label="Quantité"] .tp-bulk-qty-input {
            width: 36px !important;
            min-width: 36px;
            height: 26px !important;
            padding: 1px !important;
            font-size: 0.85em;
        }
    }
