/*
Theme Name:        Astra Child - Margin Flow
Theme URI:         https://wpastra.com/
Description:       Thème enfant personnalisé pour l'optimisation de la boutique WooCommerce.
Author:            Rémy
Author URI:        https://marginflow.fr
Template:          astra
Version:           1.0.0
License:           GNU General Public License v2 or later
License URI:       http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:       astra-child
*/

/* ==========================================================================
   COLLE TOUT TON CODE CSS PERSO CI-DESSOUS
   ========================================================================== */

/* --- 1. VARIABLES & FONDATIONS GLOBALES --- */
:root {
    --primary: #0274be;
    --bg-body: #f5f7fa; /* Bleu-gris léger officiel d'Astra */
    --bg-card: #ffffff;
    --text-main: #111111; /* Noir profond style Astra */
    --text-light: #414a52; /* Gris anthracite fin */
    --offset-horizontal: 9.5rem; /* Decalage depuis la gauche de 100px, pareil depuis la droite */
}

body {
    /* ✅ On laisse WooCommerce gérer son propre layout */
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh !important; /* ✅ Force la hauteur à 100% de la fenêtre */
    background-color: var(--bg-body) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    color: var(--text-main);
    margin: 0 !important;
    -webkit-font-smoothing: antialiased;
}

/* Le wrapper s'étire pour forcer le footer en bas */
.main-wrapper-content {
    flex: 1 !important; /* ✅ Prend tout l'espace disponible */
    background-color: var(--bg-body) !important;
    padding: 40px 0 !important;
    min-height: calc(100vh - 120px) !important; /* ✅ Évite les débordements */
}

/* Conteneur principal centré */
.container, 
.main-wrapper-content main.container,
.shop-content {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-wrapper-content main.container {
    display: block !important; /* Brise la grille par défaut sur les pages standards */
}

/* --- 2. EN-TÊTE (HEADER & NAVIGATION) --- */
header {
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
    padding: 20px 0 !important;
}

header .container {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100%;
}

header h1 { margin: 0; font-size: 24px; }
header h1 a { color: var(--text-main) !important; text-decoration: none !important; }

header .main-navigation ul {
    display: flex !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 20px !important;
}

header .main-navigation a {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    color: var(--text-light) !important;
    text-decoration: none !important;
    transition: color 0.2s;
}

header .main-navigation a:hover {
    color: var(--primary) !important;
}

/* --- 3. STYLE DE LA CARTE DE CONTENU (Pages standards comme l'Accueil) --- */
.type-page,
.hentry {
    /* background: #ffffff !important;*/
    /* padding: 40px !important;*/ 
    /* border-radius: 8px !important;*/
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03) !important;
    max-width: 77% !important; /* Aligne la carte sur la largeur du site */
    margin: 0px auto !important;  /* Centre la carte et l'isole du header/footer */
    box-sizing: border-box;
}

article {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}
/* article:hover { transform: translateY(-5px); } */
article h2 { margin-top: 0; font-size: 22px; color: #222; }
.entry-content { color: var(--text-light); font-size: 15px; }


/* --- 4. WOOCOMMERCE - ARCHIVES & GRILLE DE PRODUITS --- */
.woocommerce-page main.container {
    display: block;
    padding-top: 0px;
    padding-bottom: 20px;
}

/* Restauration du conteneur blanc global de la boutique */
.woocommerce-shop .shop-content,
.woocommerce-archive .shop-content {
    background: #ffffff !important;
    padding: 40px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03) !important;
    max-width: 1140px !important;
    margin: 5px auto !important;
    box-sizing: border-box;
    display: block !important;
    width: 100%;
}

/* Alignement parfait du compteur à gauche */
.woocommerce-result-count {
    float: left !important;
    display: inline-block !important;
    margin-top: 10px !important;
    margin-bottom: 25px !important;
    margin-left: var(--offset-horizontal) !important;
    font-size: 14px !important;
    color: var(--text-light) !important;
}

/* Force le menu de tri à rester à droite sans sauter de ligne */
.woocommerce-ordering {
    float: right !important;
    display: inline-block !important;
    clear: none !important; /* Neutralise le saut de ligne natif de WooCommerce */
    margin-top: 0 !important;
    margin-bottom: 25px !important;
    margin-right: var(--offset-horizontal)  !important; /* Ajuste la valeur selon tes besoins */
}

/* Nettoyage rigoureux des flux pour empêcher les débordements */
.woocommerce-shop .shop-content::after,
.woocommerce-archive .shop-content::after {
    content: "" !important;
    display: table !important;
    clear: both !important;
}

/* Grille de produits moderne (Neutralisation des floats natifs de WooCommerce) */
.woocommerce ul.products {
    clear: both !important;
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important; /* Ajustement précis de la grille */
    gap: 30px !important;
    margin: 20px 0 !important;
    padding: 0 !important;
    list-style: none !important;
    margin-left: var(--offset-horizontal)  !important;
}

.woocommerce ul.products::before, 
.woocommerce ul.products::after { 
    display: none !important; 
} 

/* Stylisation du bouton de tri style Astra */
.woocommerce .woocommerce-ordering select {
    padding: 10px 35px 10px 15px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    color: var(--text-light) !important;
    background-color: #ffffff !important;
    border: 1px solid #dddddd !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    outline: none !important;
    transition: border-color 0.2s ease !important;
    appearance: none !important; 
    -webkit-appearance: none !important;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path fill='%23414a52' d='M0 3h10L5 8z'/></svg>") !important;
    background-repeat: no-repeat !important;
    background-position: right 15px center !important;
}

.woocommerce .woocommerce-ordering select:focus {
    border-color: var(--primary) !important;
}

/* Fil d'Ariane (Breadcrumb) et Titre de la page */
.woocommerce-breadcrumb {
    font-size: 13px !important;
    color: #777777 !important;
    margin-top: 1rem !important;
    margin-left: var(--offset-horizontal)  !important; /* Ajuste la valeur (ex: 30px, 80px) */
    margin-bottom: 15px !important;
    font-weight: 400 !important;
    width: 100% !important;
    clear: both !important;
    float: none !important;
}

.woocommerce-breadcrumb a {
    color: var(--primary) !important;
    text-decoration: none !important;
}

.woocommerce-breadcrumb a:hover {
    text-decoration: underline !important;
}

.woocommerce-products-header__title.page-title,
h1.page-title {
    margin-top: 5px !important;
    margin-bottom: 20px !important;
    margin-left: var(--offset-horizontal) !important;
    font-size: 30px !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
    width: 100% !important;
    clear: both !important;
    float: none !important;
}

/* Cartes Produits Individuelles */
.woocommerce ul.products li.product {
    float: none !important; /* Supprime l'ancien alignement par float */
    width: 100% !important; /* Laisse CSS Grid piloter la largeur */
    margin: 0 !important;
    background: #fff !important;
    padding: 25px !important;
    border-radius: 12px !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    text-align: left !important;
    list-style-type: none !important;
    overflow: hidden !important; 
    box-sizing: border-box !important;
    transition: transform 0.3s ease !important;
}

/*.woocommerce ul.products li.product:hover {
    transform: translateY(-5px) !important;
}*/

.woocommerce ul.products li.product a {
    text-decoration: none !important;
}

.woocommerce ul.products li.product img {
    border-radius: 8px !important;
    margin: 0 auto 20px !important;
    width: 100% !important;
    height: 250px !important;    
    object-fit: cover !important; 
    display: block !important;
}

.woocommerce-loop-product__title {
    font-size: 18px !important;
    color: #222 !important;
    margin: 0 0 10px 0 !important;
    font-weight: 600 !important;
    transition: color 0.2s !important;
}
.woocommerce-loop-product__title:hover {
    color: var(--primary) !important;
}

/* Caractéristiques sous forme de liste */
.woocommerce ul.products li.product .description ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 15px 0 !important;
}

.woocommerce ul.products li.product .description li {
    font-size: 13px !important;
    color: #555555 !important;
    line-height: 1.6 !important;
    margin-bottom: 8px !important;
    position: relative !important;
    padding-left: 15px !important;
}

.woocommerce ul.products li.product .description li::before {
    content: "•" !important;
    position: absolute !important;
    left: 0 !important;
    color: var(--primary) !important;
    font-weight: bold !important;
}

.woocommerce ul.products li.product .price {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #111111 !important;
    margin: 10px 0 15px 0 !important;
    display: block !important;
}

.woocommerce ul.products li.product .button {
    background-color: var(--primary) !important;
    color: #fff !important;
    padding: 12px 20px !important;
    border-radius: 4px !important; 
    text-decoration: none !important;
    font-weight: 600 !important;
    text-align: center !important;
    display: block !important;
    transition: opacity 0.2s !important;
    margin-top: auto !important; /* Aligne le bouton en bas de carte */
}
.woocommerce ul.products li.product .button:hover { opacity: 0.9 !important; }



/* --- 5. WOOCOMMERCE - PAGE PRODUIT UNIQUE --- */

/* Sécurité d'affichage : empêche les paddings et bordures de faire grossir les blocs */
.woocommerce-page .product,
.woocommerce-page .product *,
.woocommerce-page .product ::before,
.woocommerce-page .product ::after {
    box-sizing: border-box !important;
}

/* Layout global de la page produit (Ajusté et centré sur 1140px comme le header) */
.woocommerce-page .product {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 4% !important; /* Espace central de sécurité */
    max-width: 1140px !important; /* Aligné sur la grille générale de ton site */
    margin: 30px auto !important;  /* Centre proprement tout le bloc sur l'écran */
    padding: 0 20px !important;    /* Marge de confort pour éviter de coller aux bords */
    align-items: flex-start !important;
    width: 100% !important;
}

/* Répartition stricte des largeurs sur ordinateur (48% + 48% + 4% gap = 100% pile, adieu l'ascenseur) */
@media (min-width: 769px) {
    .woocommerce-page .product .woocommerce-product-gallery {
        flex: 0 0 48% !important;
        max-width: 48% !important;
    }
    .woocommerce-page .product .summary,
    .woocommerce-page .product .summary.entry-summary {
        flex: 0 0 48% !important;
        max-width: 48% !important;
    }
}

/* --- LA GALERIE (Structure & Espacements) --- */
.woocommerce-page .product .woocommerce-product-gallery {
    margin: 0 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: row-reverse !important; /* Place les miniatures à gauche et la grande photo à droite */
    gap: 15px !important; /* Espace réduit et harmonieux entre miniatures et grande image */
    align-items: flex-start !important;
}

/* Conteneur de l'image principale (compatibilité script FlexSlider) */
.woocommerce-page .product .woocommerce-product-gallery > .flex-viewport,
.woocommerce-page .product .woocommerce-product-gallery > .woocommerce-product-gallery__wrapper {
    flex: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
}

.woocommerce-product-gallery__wrapper {
    margin: 0 !important;
}

.woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image img {
    border: none !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05) !important;
    border-radius: 8px !important;
    width: 100% !important;
    display: block !important;
}

/* --- LE CARROUSEL DES MINIATURES VERTICALES (Style carré visible) --- */
.woocommerce-page .product .woocommerce-product-gallery ol.flex-control-nav.flex-control-thumbs,
.woocommerce-page .product .woocommerce-product-gallery ol.flex-control-thumbs {
    flex: 0 0 85px !important; /* Taille agrandie des vignettes pour une meilleure visibilité */
    width: 85px !important;
    max-width: 85px !important;
    display: flex !important;
    flex-direction: column !important; /* Alignement vertical strict */
    gap: 10px !important; /* Espace vertical maîtrisé entre les carrés */
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.woocommerce-page .product .woocommerce-product-gallery ol.flex-control-thumbs li,
.woocommerce-page .product .woocommerce-product-gallery ol.flex-control-nav.flex-control-thumbs li {
    list-style: none !important;
    margin: 0 !important;
    width: 100% !important;
}

.woocommerce-page .product .woocommerce-product-gallery ol.flex-control-thumbs li img,
.woocommerce-page .product .woocommerce-product-gallery ol.flex-control-nav.flex-control-thumbs li img {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 1 / 1 !important; /* Force le ratio carré parfait du modèle de référence */
    object-fit: cover !important;    /* Découpe propre sans étirer ni déformer la photo */
    border-radius: 4px !important;
    cursor: pointer !important;
    opacity: 0.6 !important;
    transition: all 0.2s ease !important;
    border: 1px solid #eaeaea !important;
}

/* Effet de survol et style de la miniature active */
.woocommerce-page .product .woocommerce-product-gallery ol.flex-control-thumbs li img:hover,
.woocommerce-page .product .woocommerce-product-gallery ol.flex-control-thumbs li img.flex-active,
.woocommerce-page .product .woocommerce-product-gallery ol.flex-control-nav.flex-control-thumbs li img:hover,
.woocommerce-page .product .woocommerce-product-gallery ol.flex-control-nav.flex-control-thumbs li img.flex-active {
    opacity: 1 !important;
    border-color: var(--primary) !important;
    border-width: 2px !important;
}

/* --- LE RÉSUMÉ PRODUIT (Textes & Infos à droite) --- */
.woocommerce-page .product .summary {
    margin: 0 !important;
    padding-left: 10px !important;
    min-width: 0 !important;
    margin-bottom: 40px !important;
}

/* Titre du produit */
.woocommerce-page .product .summary .product_title {
    font-size: 32px !important;
    font-weight: 700 !important;
    color: #222 !important;
    margin-bottom: 15px !important;
    line-height: 1.2 !important;
}

/* Prix */
.woocommerce-page .product .summary .price {
    font-size: 24px !important;
    font-weight: 600 !important;
    color: var(--primary) !important;
    margin-bottom: 25px !important;
    border-bottom: 1px solid #e5e7eb !important;
    padding-bottom: 15px !important;
    display: block !important;
}

/* Avis (étoiles) */
.woocommerce-page .product .woocommerce-product-rating {
    margin-bottom: 20px !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}
.woocommerce-page .product .woocommerce-product-rating .star-rating {
    color: #ffc107 !important;
    font-size: 16px !important;
}

/* Description */
.woocommerce-page .product .summary .woocommerce-product-details__short-description {
    font-size: 15px !important;
    color: #555 !important;
    line-height: 1.7 !important;
    margin-bottom: 30px !important;
}

/* Caractéristiques */
.woocommerce-page .product .woocommerce-product-attributes-item {
    margin-bottom: 12px !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid #eee !important;
}
.woocommerce-page .product .woocommerce-product-attributes-item:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Bouton "Ajouter au panier" */
.woocommerce-page .product .summary .single_add_to_cart_button {
    width: 100% !important;
    padding: 12px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
}

/* Quantité */
.woocommerce-page .product .summary .quantity input.qty {
    width: 60px !important;
    height: 45px !important;
    padding: 0 5px !important;
    text-align: center !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 16px !important;
}

/* Masque l'onglet de description redondant en bas */
.woocommerce-tabs {
    display: none !important;
}


/* Emplacement pour 6. */


/* Réduire le tableau du panier à 2/3 de sa largeur */
/* contenu dans class=woocommerce-cart-form*/
/* .woocommerce table.shop-table {
    width: 66% !important;
}*/


/* div class=cart_total, contenu dans div class=cart-collaterals*/

/*.woocommerce table.cart_collaterals {
    width: 33% !important;
}*/


/* On dit au parent d'aligner ses enfants côte à côte */
.woocommerce-cart .woocommerce {
    display: flex !important;
    justify-content: space-between !important; /* Aligne un bloc à gauche, un bloc à droite */
    align-items: flex-start !important;
}


/* Gestion de l'affichage des "a été ajouté au panier" */
/* 1. On autorise les éléments flex à aller à la ligne */
.woocommerce-cart .woocommerce {
    flex-wrap: wrap !important;
}

ss* 2. On force la boîte de messages à prendre 100% de la largeur en haut */
.woocommerce-cart .woocommerce-notices-wrapper {
    width: 100% !important;
    margin-bottom: 30px !important; /* Crée un espace propre sous le message */
}


/* 2. Masquer UNIQUEMENT le message de succès "Ajouté au panier" */
.woocommerce-cart .woocommerce-message {
    display: none !important;
}

/* Le tableau prend 66% */
.woocommerce-cart .woocommerce-cart-form {
    width: 66% !important;
    margin-bottom: 0 !important;
}

/* Le bloc total prend 33% */
.woocommerce-cart .cart-collaterals {
    width: 33% !important;
    margin-top: 0 !important;
}

.woocommerce .cart-collaterals .cart_totals {
    width: 100% !important;
    float: none !important; /* On annule le float right qui ne sert plus en flexbox */
}



/* --- 7. FOOTER (PIED DE PAGE GLOBAL) --- */
footer, 
footer.site-footer {
    background-color: #ffffff !important;
    border-top: 1px solid #e2e8f0 !important;
    padding: 20px 0 !important;
    width: 100% !important;
    /* margin-top: auto !important; */
    margin-top: auto !important; /* ✅ On remet le "auto" pour le pousser en bas */
    /* margin-top: 0 !important; /* ✅ Réinitialise */
    flex-shrink: 0 !important; /* ✅ Empêche le footer de rétrécir */
}

footer.site-footer .footer-container {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    max-width: 1140px;
    margin: 0 auto !important;
    padding: 0 20px;
    flex-wrap: wrap !important;
    gap: 15px !important;
    min-height: 40px !important; /* Force une hauteur minimale propre */
}

footer.site-footer .footer-copyright p {
    margin: 0 !important;
    font-size: 14px !important;
    color: var(--text-light) !important;
}

footer.site-footer .footer-navigation ul {
    display: flex !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 20px !important;
}

footer.site-footer .footer-navigation a {
    font-size: 14px !important;
    color: var(--text-light) !important;
    text-decoration: none !important;
    transition: color 0.2s;
}

footer.site-footer .footer-navigation a:hover {
    color: var(--primary) !important;
}


/* --- 8. RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 920px) {
    .woocommerce-cart .woocommerce { 
        flex-direction: column !important; 
        gap: 30px; 
    }
    .woocommerce-cart .woocommerce-cart-form, 
    .woocommerce-cart .cart-collaterals { 
        flex: 0 0 100% !important; 
        max-width: 100% !important;
        width: 100% !important; 
    }
}



@media (max-width: 768px) {
    .woocommerce-page .product { flex-direction: column !important; gap: 30px; }
    .woocommerce-page .product .woocommerce-product-gallery, .woocommerce-page .product .summary { max-width: 100% !important; }
}

@media (max-width: 600px) {
    footer.site-footer .footer-container {
        flex-direction: column !important;
        text-align: center !important;
    }
    footer.site-footer .footer-navigation ul {
        flex-direction: column !important;
        gap: 10px !important;
    }
}


/* --- 9. BANDEAU DE COOKIES ULTRA-LIGHT --- */
.custom-cookie-banner {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    z-index: 99999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    max-width: 360px;
    box-sizing: border-box;
    display: none;
    flex-direction: column;
    gap: 15px;
}

.custom-cookie-banner.is-visible {
    display: flex;
}

.custom-cookie-banner .cookie-text p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-light);
}

.custom-cookie-banner .cookie-buttons {
    display: flex;
    gap: 10px;
}

.custom-cookie-banner .cookie-btn {
    flex: 1;
    height: 38px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.custom-cookie-banner .cookie-btn.accept {
    background-color: var(--primary);
    color: #ffffff;
}
.custom-cookie-banner .cookie-btn.accept:hover {
    opacity: 0.9;
}

.custom-cookie-banner .cookie-btn.deny {
    background-color: #f0f2f5;
    color: var(--text-light);
    border: 1px solid #e2e8f0;
}
.custom-cookie-banner .cookie-btn.deny:hover {
    background-color: #e2e8f0;
}

@media (max-width: 480px) {
    .custom-cookie-banner {
        bottom: 0;
        right: 0;
        left: 0;
        max-width: 100%;
        border-radius: 0;
        border-top: 1px solid #e2e8f0;
    }
}



/* Ecraseur de theme */

/* --- X. CORRECTION DES MARGES ASTRA --- */
/* le bandeau entre le menu du haut et l'item juste en dessous */

#primary {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}
