/*
 * GRATINEO — CSS GLOBAL ORGANISÉ
 * Remplace le CSS global fourni, sans remplacer le CSS local des widgets.
 * Couleurs : rouge #d93336 ; survol #b9282c ; crème #faf8f5 ; bordure #ded5c9.
 * Les !important utiles face à Astra, Elementor et WooCommerce sont conservés.
 */

/* 1. AFFICHAGE GÉNÉRAL ET FENÊTRES MODALES */

/* Empêche le débordement horizontal et conserve le défilement vertical.
 * Ces correctifs globaux sont conservés car leur utilité dépend du site réel. */
html, body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
}

/* Largeur de la barre de défilement dans les navigateurs compatibles. */
body::-webkit-scrollbar, html::-webkit-scrollbar {
    width: 10px;
}

/* Maintient les fenêtres Elementor en position fixe avec la barre admin. */
body.admin-bar .elementor-popup-modal {
    position: fixed !important;
}

/* 2. ARTICLES ET RECETTES */

/* Masque le bloc de métadonnées Astra visé par ce sélecteur. */
.single-post .ast-single-post-meta {
    display: none;
}

/* 3. WOOCOMMERCE — MESSAGES ET MON COMPTE */

/* Bordure et icône rouges des messages d'information et de confirmation. */
.woocommerce-info, .woocommerce-message {
    border-top-color: #d93336 !important;
}
.woocommerce-info::before, .woocommerce-message::before {
    color: #d93336 !important;
}

/* Boutons du compte client : fond rouge, texte blanc, angles arrondis. */
.woocommerce-account .woocommerce a.button,
.woocommerce-account .woocommerce button.button,
.woocommerce-account .woocommerce input.button {
    background: #d93336 !important;
    border: 1px solid #d93336 !important;
    color: #fff !important;
    border-radius: 6px;
}

/* Survol des boutons du compte client. */
.woocommerce-account .woocommerce a.button:hover,
.woocommerce-account .woocommerce button.button:hover,
.woocommerce-account .woocommerce input.button:hover {
    background: #b9282c !important;
    border-color: #b9282c !important;
}

/* Liens rouges dans le compte et les messages, hors boutons. */
.woocommerce-account .woocommerce a:not(.button),
.woocommerce-info a:not(.button),
.woocommerce-message a:not(.button) {
    color: #d93336;
}

/* 4. FICHE PRODUIT — COUVERTURE ET ACHAT */

/* Retire la loupe et l'image de zoom de la couverture de l'ebook. */
.single-product .woocommerce-product-gallery__trigger,
.single-product .woocommerce-product-gallery .zoomImg {
    display: none !important;
}

/* Bouton Ajouter au panier lorsqu'il est affiché seul.
 * Les règles du groupe d'achat ci-dessous adaptent sa largeur et ses marges. */
body.single-product .single_add_to_cart_button {
    display: block !important;
    float: none !important;
    width: fit-content;
    margin: 15px auto !important;
    background: #d93336 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px;
    padding: 14px 24px !important;
}
body.single-product .single_add_to_cart_button:hover {
    background: #b9282c !important;
}

/* Place Ajouter au panier et Acheter maintenant sur deux colonnes égales. */
body.single-product .gratineo-boutons-achat {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
    margin: 15px 0 0 !important;
}

/* Cache le sélecteur de quantité dans le groupe d'achat des ebooks. */
body.single-product .gratineo-boutons-achat .quantity {
    display: none !important;
}

/* Même largeur et hauteur pour les deux boutons d'achat de la fiche produit. */
body.single-product .gratineo-boutons-achat button.button {
    min-width: 0;
    width: 100% !important;
    height: 48px !important;
    box-sizing: border-box;
    margin: 0 !important;
    padding: 0 8px !important;
    float: none !important;
    background: #d93336 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1.2;
}
body.single-product .gratineo-boutons-achat button.button:hover {
    background: #b9282c !important;
}

/* 5. FICHE PRODUIT — ONGLETS, AVIS ET ÉTOILES */

/* Barre rouge au-dessus de l'onglet actif. */
body.single-product .woocommerce-tabs ul.tabs li.active::before {
    background: #d93336 !important;
    border-color: #d93336 !important;
}

/* Bouton de publication d'un avis produit. */
body.single-product #review_form #submit {
    background: #d93336 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px;
}
body.single-product #review_form #submit:hover {
    background: #b9282c !important;
}

/* Aligne le libellé de la note et les étoiles, avec retour à la ligne possible. */
body.single-product #review_form .comment-form-rating {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}
body.single-product #review_form .comment-form-rating label,
body.single-product #review_form p.stars {
    margin: 0 !important;
}

/* Décalage vertical choisi pour les étoiles et maintien de leur couleur jaune. */
body.single-product #review_form p.stars {
    line-height: 1;
    transform: translateY(-9px);
}
body.single-product #review_form p.stars a {
    color: #f5b301 !important;
}

/* 6. CATALOGUE EBOOKS — DEUX BOUTONS D'ACHAT */

/* Grille à deux colonnes et suppression des marges du formulaire d'achat direct. */
.gratineo-boutons-catalogue {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 15px;
}
.gratineo-boutons-catalogue form {
    margin: 0 !important;
    padding: 0 !important;
}

/* Boutons uniformes du catalogue, avec texte centré et retour à la ligne possible. */
.woocommerce .gratineo-boutons-catalogue .button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    min-height: 48px;
    margin: 0 !important;
    padding: 8px !important;
    background: #d93336 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px;
    font-size: 14px !important;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
}
.woocommerce .gratineo-boutons-catalogue .button:hover {
    background: #b9282c !important;
}

/* Le lien Voir le panier après ajout occupe toute la ligne. */
.gratineo-boutons-catalogue .added_to_cart {
    grid-column: 1 / -1;
}

/* 7. PAGE PANIER */

/* Boutons rouges du panier et apparence des boutons désactivés. */
body.woocommerce-cart .woocommerce .button {
    background: #d93336 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
}
body.woocommerce-cart .woocommerce .button:hover {
    background: #b9282c !important;
}
body.woocommerce-cart .woocommerce .button:disabled {
    opacity: 0.5;
}

/* Nom des produits sombre, puis rouge au survol. */
body.woocommerce-cart .product-name a {
    color: #222 !important;
}
body.woocommerce-cart .product-name a:hover {
    color: #d93336 !important;
}

/* Croix de suppression rouge ; fond rouge et croix blanche au survol. */
body.woocommerce-cart .woocommerce a.remove {
    color: #d93336 !important;
    border-color: #d93336 !important;
}
body.woocommerce-cart .woocommerce a.remove:hover {
    background: #d93336 !important;
    color: #fff !important;
}

/* À partir de 768 px, centre les colonnes et le sélecteur de quantité.
 * Ce seuil concerne le tableau WooCommerce, pas le basculement du header. */
@media (min-width: 768px) {
    body.woocommerce-cart .shop_table.cart th,
    body.woocommerce-cart .shop_table.cart td.product-name,
    body.woocommerce-cart .shop_table.cart td.product-price,
    body.woocommerce-cart .shop_table.cart td.product-quantity,
    body.woocommerce-cart .shop_table.cart td.product-subtotal {
        text-align: center !important;
        vertical-align: middle;
    }
    body.woocommerce-cart .shop_table.cart .quantity {
        margin: 0 auto !important;
    }
}

/* Centre le titre et l'ensemble du cadre Total panier. */
body.woocommerce-cart .cart_totals > h2 {
    text-align: center !important;
}
body.woocommerce-cart .cart-collaterals .cart_totals {
    float: none !important;
    margin: 30px auto 0 !important;
}

/* Aligne le champ code promo et son bouton. */
body.woocommerce-cart .woocommerce .cart .coupon {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Champ code promo : largeur, fond crème et angles arrondis. */
body.woocommerce-cart .woocommerce #coupon_code {
    width: 250px !important;
    max-width: 100%;
    margin: 0 !important;
    padding: 0 14px !important;
    border: 1px solid #ded5c9 !important;
    border-radius: 8px !important;
    background: #faf8f5 !important;
}

/* Typographie et espacement des boutons Appliquer et Mettre à jour. */
body.woocommerce-cart .woocommerce button[name="apply_coupon"],
body.woocommerce-cart .woocommerce button[name="update_cart"] {
    padding: 0 16px !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
}

/* Hauteur extérieure identique pour le champ et les deux boutons. */
body.woocommerce-cart .woocommerce #coupon_code,
body.woocommerce-cart .woocommerce button[name="apply_coupon"],
body.woocommerce-cart .woocommerce button[name="update_cart"] {
    box-sizing: border-box !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Mobile : le champ s'adapte à la largeur disponible et le total prend toute la ligne. */
@media (max-width: 767px) {
    body.woocommerce-cart .woocommerce .cart .coupon {
        width: 100%;
    }
    body.woocommerce-cart .woocommerce #coupon_code {
        flex: 1;
        width: 0 !important;
        min-width: 0;
    }
    body.woocommerce-cart .woocommerce button[name="apply_coupon"] {
        width: auto !important;
        flex: 0 1 auto;
    }
    body.woocommerce-cart .cart-collaterals .cart_totals {
        width: 100% !important;
    }
}

/* 8. VALIDATION DE COMMANDE */

/* Bouton Commander rouge avec espace au-dessus. */
body.woocommerce-checkout #place_order {
    background: #d93336 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px;
    margin-top: 20px !important;
}
body.woocommerce-checkout #place_order:hover {
    background: #b9282c !important;
}

/* Espace sous les moyens de paiement, notamment sous le bouton PayPal. */
body.woocommerce-checkout #order_review {
    padding-bottom: 20px !important;
}

/* 9. CONFIRMATION DE COMMANDE ET TÉLÉCHARGEMENTS */

/* Couleur du texte et carte de confirmation centrée. */
body.woocommerce-order-received .woocommerce-order {
    color: #222;
}
body.woocommerce-order-received .woocommerce-thankyou-order-received {
    padding: 20px;
    margin-bottom: 25px;
    background: #faf8f5;
    border-radius: 10px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: #222;
}

/* Liens rouges de la confirmation de commande. */
body.woocommerce-order-received .woocommerce-order a {
    color: #d93336;
}
body.woocommerce-order-received .woocommerce-order a:hover {
    color: #b9282c;
}

/* Bouton de téléchargement avec titre du fichier pouvant passer sur plusieurs lignes. */
body.woocommerce-order-received .woocommerce-order a.button {
    background: #d93336 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px;
    padding: 14px 20px;
    text-align: center;
    white-space: normal;
    line-height: 1.4;
}
body.woocommerce-order-received .woocommerce-order a.button:hover {
    background: #b9282c !important;
}

/* Bordures et arrondis des tableaux et de l'adresse de facturation. */
body.woocommerce-order-received .woocommerce table.shop_table,
body.woocommerce-order-received .woocommerce-customer-details address {
    border-color: #ded5c9;
    border-radius: 10px;
    overflow: hidden;
}
body.woocommerce-order-received .woocommerce table.shop_table th,
body.woocommerce-order-received .woocommerce table.shop_table td {
    border-color: #ded5c9;
    vertical-align: middle;
}

/* Titres des sections de confirmation. */
body.woocommerce-order-received .woocommerce-order h2 {
    color: #222;
    margin-top: 30px;
    margin-bottom: 20px;
}

/* Raccord du titre Détails de la commande avec son tableau : un seul cadre. */
body.woocommerce-order-received .woocommerce-order-details__title {
    border-radius: 10px 10px 0 0 !important;
    border-color: #ded5c9 !important;
    margin-bottom: 0 !important;
}
body.woocommerce-order-received .woocommerce table.woocommerce-table--order-details {
    border-radius: 0 0 10px 10px !important;
    border-top: 0 !important;
}

/* Fond crème uniforme des titres encadrés et des en-têtes des tableaux. */
body.woocommerce-order-received .woocommerce-order-details__title,
body.woocommerce-order-received .woocommerce-column__title,
body.woocommerce-order-received .woocommerce table.shop_table thead,
body.woocommerce-order-received .woocommerce table.shop_table thead th {
    background: #faf8f5 !important;
}

/* 10. COMMENTAIRES DES ARTICLES ET RECETTES */

/* Texte sombre et liens rouges dans la zone des commentaires. */
body.single-post .comments-area {
    color: #222;
}
body.single-post .comments-area a {
    color: #d93336;
}
body.single-post .comments-area a:hover {
    color: #b9282c;
}

/* Carte compacte du commentaire ; espace inférieur réservé à la date. */
body.single-post .comments-area .ast-comment {
    position: relative;
    background: #faf8f5;
    border: 1px solid #ded5c9;
    border-radius: 12px;
    padding: 16px !important;
    padding-bottom: 35px !important;
    margin-bottom: 18px;
}

/* Avatar rond de 40 px, avec pseudo placé à 10 px à sa droite. */
body.single-post .comments-area .avatar {
    border-radius: 50%;
}
body.single-post .ast-comment-info {
    display: grid !important;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
}
body.single-post .ast-comment-avatar-wrap {
    width: 40px !important;
    padding: 0 !important;
}
body.single-post .ast-comment-avatar-wrap .avatar {
    width: 40px;
    height: 40px;
}

/* Neutralise la largeur et les espacements Astra du contenu du commentaire. */
body.single-post .ast-comment-data-wrap {
    flex: 1;
    min-width: 0;
    width: auto !important;
    padding: 0 !important;
}
body.single-post .ast-comment-meta-wrap {
    flex: 1;
    min-width: 0;
}

/* En-tête du commentaire et remise à zéro des décalages du pseudo. */
body.single-post .ast-comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start !important;
    gap: 4px 14px;
}
body.single-post .ast-comment-meta-wrap,
body.single-post .ast-comment-meta,
body.single-post .ast-comment-cite-wrap,
body.single-post .ast-comment-cite-wrap cite,
body.single-post .ast-comment-cite-wrap .fn {
    position: static !important;
    float: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
}
body.single-post .ast-comment-cite-wrap {
    flex: 0 1 auto !important;
}

/* Couleur du pseudo lorsqu'il est présenté sous forme de lien. */
body.single-post .ast-comment-cite-wrap a {
    color: #222 !important;
}

/* Texte du commentaire et lien Répondre sans espacements excessifs. */
body.single-post .comments-area .ast-comment-content {
    color: #222;
}
body.single-post .ast-comment-content {
    padding: 0 !important;
    margin: 0 !important;
}
body.single-post .ast-comment-content p {
    margin: 0 0 8px !important;
}
body.single-post .ast-comment-edit-reply-wrap {
    padding: 0 !important;
    margin: 0 !important;
}
body.single-post .ast-comment-edit-reply-wrap a {
    display: inline-block;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 13px;
}

/* Petit message de modération ; les marges existantes sont conservées. */
body.single-post .comment-awaiting-moderation {
    margin-top: 8px !important;
    font-size: 12px;
    color: #777;
}

/* Date en bas à droite. Son format jj/mm/aa reste géré par l'extrait PHP/JS. */
body.single-post .comments-area .ast-comment-time {
    position: absolute !important;
    top: auto !important;
    left: auto !important;
    right: 16px !important;
    bottom: 12px !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
}
body.single-post .comments-area .ast-comment-time a,
body.single-post .comments-area .ast-comment-time time {
    font-size: 13px !important;
    line-height: 1.4 !important;
    color: #777 !important;
}

/* 11. FORMULAIRE DE COMMENTAIRE */

/* Cadre crème du formulaire. */
body.single-post .comments-area .comment-respond {
    margin-top: 30px;
    padding: 25px;
    background: #faf8f5;
    border: 1px solid #ded5c9;
    border-radius: 12px;
}

/* Champ de commentaire : fond blanc et bordure arrondie. */
body.single-post .comments-area textarea {
    background: #fff;
    color: #222;
    border: 1px solid #ded5c9;
    border-radius: 8px;
    padding: 15px;
    min-height: 150px;
}

/* Champ principal réduit à 100 px et agrandissable verticalement. */
body.single-post .comments-area textarea#comment {
    height: 100px !important;
    min-height: 100px !important;
    padding: 12px 15px !important;
    box-sizing: border-box;
    resize: vertical;
}

/* Contour visible pendant la saisie et la navigation au clavier. */
body.single-post .comments-area textarea:focus {
    border-color: #d93336;
    outline: 2px solid #d93336;
    outline-offset: 2px;
}

/* Masque les deux abonnements Jetpack et leurs libellés. */
body.single-post .comments-area .comment-subscription-form,
body.single-post .comments-area #subscribe_comments,
body.single-post .comments-area #subscribe_blog {
    display: none !important;
}

/* Centre la ligne du bouton Publier. */
body.single-post .comments-area .form-submit {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
    margin: 20px 0 0 !important;
    padding: 0 !important;
}
body.single-post .comments-area .form-submit input[type="submit"] {
    float: none !important;
    width: auto !important;
    margin: 0 !important;
}

/* Apparence du bouton Publier un commentaire. */
body.single-post .comments-area #submit {
    background: #d93336 !important;
    color: #fff !important;
    border: none;
    border-radius: 6px;
    padding: 14px 22px;
}
body.single-post .comments-area #submit:hover {
    background: #b9282c !important;
}

/* Mobile : réduit la marge intérieure du formulaire.
 * La carte du commentaire conserve 16 px et la place réservée à sa date. */
@media (max-width: 767px) {
    body.single-post .comments-area .comment-respond {
        padding: 16px;
    }
}

/* Fiche produit : espace sous le header mobile et tablette */
@media (max-width: 1400px) {
    body.single-product #content {
        padding-top: 30px !important;
    }
}