/*
Theme Name: Blocksy Child OOBLIK
Theme URI: https://ooblik.com/
Description: Thème enfant personnalisé pour Blocksy avec logo OOBLIK
Author: Marc Tallec
Template: blocksy
Version: 2.1
*/

/* =================================================================
   1. UPLOAD WIDGET - Largeur et containment
   ================================================================= */

.single-product .ooblik-upload-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 20px 0 15px 0 !important;
    border-bottom: 2px solid #DC2626 !important;
    padding-bottom: 20px !important;
}

/* Empêcher le débordement des noms de fichiers longs */
.single-product .ooblik-file-info,
.single-product .ooblik-file-details {
    min-width: 0 !important;
    flex: 1 !important;
    overflow: hidden !important;
}

.single-product .ooblik-file-name,
.single-product .ooblik-file-size {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* =================================================================
   2. FORM.CART - Ordre des éléments dans le formulaire produit
   On ne touche PAS à .entry-summary (Blocksy gère le layout natif).
   On repositionne uniquement à l'intérieur de form.cart.

   IMPORTANT : div.wapf encapsule .wapf-wrapper ET .wapf-product-totals.
   display:contents l'aplatit pour que ses enfants deviennent des flex
   children directs de form.cart, permettant le réordonnancement.
   ================================================================= */

/* Aplatir le conteneur WAPF pour exposer ses enfants au flex parent */
.single-product form.cart > .wapf,
.single-product .variations_form > .wapf {
    display: contents;
}

/* Produits VARIABLES */
.single-product .variations_form {
    display: flex;
    flex-direction: column;
}

.single-product .variations_form table.variations       { order: 1; }
.single-product .variations_form .wapf-wrapper           { order: 2; }
.single-product .variations_form .ooblik-upload-wrapper  { order: 3; }
.single-product .variations_form .wapf-product-totals    { order: 4; }
.single-product .variations_form .single_variation_wrap  { order: 5; }
.single-product .variations_form .woocommerce-variation-add-to-cart { order: 6; }

/* Produits SIMPLES */
.single-product form.cart {
    display: flex;
    flex-direction: column;
}

.single-product form.cart .wapf-wrapper             { order: 1; }
.single-product form.cart .ooblik-upload-wrapper    { order: 2; }
.single-product form.cart .wapf-product-totals      { order: 3; }
.single-product form.cart .tooltip-container         { order: 3; } /* avec totals */
.single-product form.cart .ct-cart-actions           { order: 4; }

/* =================================================================
   3. WAPF (Advanced Product Fields) - Style cartouche brutaliste
   ================================================================= */

/* Reset arrondis WAPF pour style cartouche */
.single-product .wapf {
    --apf-radius: 0;
    --apf-card-radius: 0;
    --apf-cb-radius: 0;
    --apf-ts-radius: 0;
    --apf-radio-border: 2px solid #000;
    --apf-radio-bg-sel: #DC2626;
    --apf-radio-border-color-sel: #DC2626;
    --apf-cb-border: 2px solid #000;
    --apf-cb-bg-sel: #DC2626;
    --apf-input-border: 1px solid #000;
}

/* Titre du champ ("Choix du Carnet", "Papiers") : fond rouge, texte blanc */
.single-product .wapf-field-label label {
    border: 1px solid #000;
    padding: 8px 12px;
    background: #f15252;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

/* Texte des options radio plus grand et lisible */
.single-product .wapf-label-text {
    font-size: 16px;
    font-weight: 500;
}

/* Espacement entre les radios */
.single-product .wapf-radios {
    gap: 8px 1rem;
    padding: 12px 0;
}

/* Wrapper WAPF : espacement sans bordure (le trait rouge est sur .ooblik-upload-wrapper) */
.single-product .wapf-wrapper {
    padding-bottom: 15px;
    margin-bottom: 5px;
    width: 100%;
}

/* Total/prix : encadré noir, fond jaune, centré verticalement */
.single-product .wapf-product-totals .wapf--inner > div {
    border: 1px solid #000;
    padding: 16px 20px !important;
    font-size: 18px;
    font-weight: 700;
    background: #FEF9C3;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Neutraliser le float et margin/padding natifs des spans WAPF */
.single-product .wapf-product-totals .wapf--inner > div span {
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1;
}

/* =================================================================
   4. DESCRIPTION PRODUIT - Titres h3/h4 style cartouche
   ================================================================= */

#tab-description .entry-content h3,
#tab-description .entry-content h4 {
    border: 1px solid #000;
    padding: 8px 12px;
    margin-top: 24px;
    background: #fff;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 15px;
    letter-spacing: 0.5px;
}

/* =================================================================
   5. PAGE /print/ (SHOP ARCHIVE) - Espacement menu/contenu
   ================================================================= */

[data-prefix="woo_categories"] .ct-container {
    padding-top: 50px;
    padding-bottom: 50px;
}

/* =================================================================
   6. RESPONSIVE
   ================================================================= */

@media (max-width: 768px) {
    .single-product .ooblik-upload-wrapper {
        margin: 20px 0 !important;
        padding: 15px !important;
    }
}

/* =================================================================
   7. MEGA MENU (Max Mega Menu) - Images responsives
   ================================================================= */

/* Images du mega menu : s'adaptent à leur conteneur */
.mega-menu-item img {
    max-width: 100%;
    height: auto;
}

/* =================================================================
   8. BREADCRUMB CATÉGORIES - Pages catégories WooCommerce
   (réplique le style ct-breadcrumbs de Blocksy sur pages produit)
   ================================================================= */

[data-prefix="woo_categories"] .ooblik-category-breadcrumb {
    color: var(--theme-text-color, #000);
    text-align: center;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    margin-top: 0;
    margin-bottom: 1rem;
}

/* Le nav porte la couleur rouge = dernier item (texte brut sans <a>) */
[data-prefix="woo_categories"] .ooblik-category-breadcrumb .woocommerce-breadcrumb {
    color: #DC2626;
}

/* Les liens restent noirs */
[data-prefix="woo_categories"] .ooblik-category-breadcrumb .woocommerce-breadcrumb a {
    color: var(--theme-text-color, #000);
    text-decoration: none;
}

[data-prefix="woo_categories"] .ooblik-category-breadcrumb .woocommerce-breadcrumb a:hover {
    text-decoration: underline;
}

/* Séparateurs et trait noir */
[data-prefix="woo_categories"] .ooblik-category-breadcrumb .ct-separator {
    vertical-align: middle;
    margin: 0 4px;
    color: var(--theme-text-color, #000);
}

/* Trait noir pleine largeur */
[data-prefix="woo_categories"] .ooblik-category-breadcrumb::after {
    content: "";
    display: block;
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 100vw;
    height: 1px;
    background-color: var(--theme-text-color, #000);
    transform: translateX(-50%);
}

/* =================================================================
   9. BREADCRUMB PRODUIT - Pages produit (override Blocksy ct-breadcrumbs)
   ================================================================= */

.ct-breadcrumbs {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

/* Dernier item en rouge (page courante) */
.ct-breadcrumbs .last-item {
    color: #DC2626;
}

/* =================================================================
   10. ESPACEMENT GLOBAL CONTENU - Gap entre header et contenu
   Le réglage Blocksy est à 0 pour les pages hero (image plein bord).
   On rajoute un padding par défaut pour les pages sans hero.
   ================================================================= */

/* Par défaut : espacement pour toutes les pages WordPress standard */
[data-prefix="single_page"] main.site-main {
    padding-top: 50px;
    padding-bottom: 50px;
}

/* Exception haut : pages dont le premier bloc est un Cover (hero) */
[data-prefix="single_page"] main.site-main:has(.entry-content > .wp-block-cover:first-child) {
    padding-top: 0;
}

/* Exception bas : pages dont le dernier bloc est un Cover (CTA plein bord) */
[data-prefix="single_page"] main.site-main:has(.entry-content > .wp-block-cover:last-child) {
    padding-bottom: 0;
}

/* Pages produit WooCommerce : espacement bas uniquement (le haut est géré par Blocksy) */
[data-prefix="product"] main.site-main {
    padding-bottom: 50px;
}

/* =================================================================
   11. WPFORMS - Correction taille textarea
   WPForms applique max-width aux input.wpforms-field-medium mais pas
   aux textarea.wpforms-field-medium → le textarea déborde.
   ================================================================= */

.wpforms-form textarea.wpforms-field-medium {
    max-width: 60%;
}

/* reCAPTCHA et bouton Envoyer alignés à droite des champs (60%) */
.wpforms-form .wpforms-recaptcha-container,
.wpforms-form .wpforms-submit-container {
    max-width: 60%;
    display: flex;
    justify-content: flex-end;
}
