/* -------------
    WOOCOMMERCE — couche de surcharge basée sur les tokens
    Chargé conditionnellement (is_woocommerce / cart / checkout / account) — cf. functions.php.

    Principe : on garde les CSS natifs de Woo (classiques + Blocks) et on ne surcharge que
    la charte (couleurs, polices, formes) via les tokens de css/base/tokens.css.
    Les boutons Woo partagent le look .btn (css/components/buttons.css),
    les champs le look des formulaires (css/components/forms/forms.css),
    la carte produit le composant card (css/components/card.css).

    00 - Variables Woo → tokens
    01 - Typo & conteneurs Blocks
    02 - Messages système
    03 - Formulaires
    04 - Tableaux (panier, commande, compte)
    05 - Panier
    06 - Tunnel de commande (checkout)
    07 - Mon compte
    08 - Listing produits
    09 - Fiche produit (views/woocommerce/product/single-product)
------------- */


/* -------------
    00 - VARIABLES WOO → TOKENS
    (définies par woocommerce.css natif sur :root)
------------- */

:root {
    --woocommerce: var(--color-brand);
    --wc-primary: var(--color-brand);
    --wc-primary-text: var(--white);
    --wc-secondary: var(--color-surface-alt);
    --wc-secondary-text: var(--color-muted);
    --wc-highlight: var(--color-accent);
    --wc-highligh-text: var(--white);
    --wc-content-bg: var(--white);
    --wc-subtext: var(--gray-700);
    --wc-green: var(--color-success);
    --wc-orange: var(--color-warning);
    --wc-red: var(--color-error);
    --wc-destructive: var(--color-error);
    --wc-form-border-color: var(--input-border);
    --wc-form-border-radius: var(--input-radius);
    --wc-form-border-width: 1px;
    --wc-form-color-background: var(--input-bg);
    --wc-form-color-text: var(--color-muted);
    --wc-card-border-radius: var(--card-radius);
}


/* -------------
    01 - TYPO & CONTENEURS BLOCKS
------------- */

.woocommerce,
.woocommerce-page,
.wc-block-components-sidebar-layout,
.wc-block-cart,
.wc-block-checkout,
.wc-block-mini-cart__drawer {
    font-family: var(--font-primary);
    color: var(--color-muted);
}

.woocommerce h2,
.woocommerce h3,
.wc-block-components-title.wc-block-components-title {
    color: var(--color-heading);
    font-family: var(--font-primary);
}

.woocommerce a:not(.button):not(.btn) {
    color: var(--color-link);
}

.woocommerce a:not(.button):not(.btn):hover {
    color: var(--color-brand);
}

.wc-block-components-panel,
.wc-block-components-totals-wrapper,
.wc-block-components-order-summary {
    border-color: var(--color-border);
}

.wc-block-components-drawer__close {
    cursor: pointer;
}


/* -------------
    02 - MESSAGES SYSTÈME
------------- */

.woocommerce-message,
.woocommerce-info,
.woocommerce-error,
.wc-block-components-notice-banner {
    background-color: var(--color-surface);
    color: var(--color-muted);
    border-radius: var(--radius-s);
    margin-bottom: 30px;
}

.woocommerce-message,
.wc-block-components-notice-banner.is-success {
    border-top-color: var(--color-success);
    border-color: var(--color-success);
}

.woocommerce-info,
.wc-block-components-notice-banner.is-info {
    border-top-color: var(--color-brand);
    border-color: var(--color-brand);
}

.woocommerce-error,
.wc-block-components-notice-banner.is-error {
    border-top-color: var(--color-error);
    border-color: var(--color-error);
}

.woocommerce-message::before { color: var(--color-success); }
.woocommerce-info::before { color: var(--color-brand); }
.woocommerce-error::before { color: var(--color-error); }

.woocommerce-message .button,
.woocommerce-info .button {
    float: right;
}


/* -------------
    03 - FORMULAIRES
------------- */

.woocommerce form .form-row label,
.wc-block-components-text-input label,
.wc-block-components-combobox .wc-block-components-combobox-control label {
    color: var(--color-muted);
    font-weight: 600;
}

.woocommerce form .form-row .input-text,
.woocommerce form .form-row select,
.wc-block-components-text-input input,
.wc-block-components-combobox .wc-block-components-combobox-control input,
.wc-blocks-components-select .wc-blocks-components-select__select {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--input-radius);
    font-family: inherit;
}

.woocommerce form .form-row .input-text:focus,
.woocommerce form .form-row select:focus,
.wc-block-components-text-input input:focus {
    border-color: var(--input-border-focus);
    outline: none;
    box-shadow: 0 0 0 1px var(--input-border-focus);
}

.woocommerce form .form-row.woocommerce-invalid .input-text,
.wc-block-components-text-input.has-error input {
    border-color: var(--color-error);
}

.woocommerce form .form-row .required {
    color: var(--color-error);
}


/* -------------
    04 - TABLEAUX — même charte que css/base/tables.css (tokens --table-*)
    Woo impose border/radius/padding sur .shop_table : on les remappe.
------------- */

.woocommerce table.shop_table {
    border: var(--table-border);
    border-radius: var(--table-radius);
    overflow: hidden;
}

.woocommerce table.shop_table td,
.woocommerce table.shop_table th {
    border-color: var(--color-border);
    padding: var(--table-cell-padding);
}

.woocommerce table.shop_table thead th {
    background-color: var(--table-head-bg);
    color: var(--table-head-color);
}

.woocommerce table.shop_table tbody th,
.woocommerce table.shop_table tfoot th {
    color: var(--color-heading);
}


/* -------------
    05 - PANIER
------------- */

.woocommerce-cart .wc-proceed-to-checkout {
    display: flex;
    justify-content: flex-end;
}

.woocommerce-cart .wc-proceed-to-checkout a.checkout-button {
    margin-bottom: 0;
}

.woocommerce a.remove {
    color: var(--color-error) !important;
}

.woocommerce a.remove:hover {
    background-color: var(--color-error);
    color: var(--white) !important;
}


/* -------------
    06 - TUNNEL DE COMMANDE
------------- */

.woocommerce-checkout #payment,
.woocommerce-checkout #payment div.payment_box {
    background-color: var(--color-surface);
    border-radius: var(--radius-m);
}

.woocommerce-checkout #payment div.payment_box::before {
    border-bottom-color: var(--color-surface);
}

.woocommerce-checkout #payment ul.payment_methods {
    border-bottom-color: var(--color-border);
}

.wc-block-checkout__actions_row .wc-block-components-checkout-place-order-button,
.woocommerce #payment #place_order {
    width: 100%;
}

.wc-block-components-checkout-step__title,
.wc-block-components-checkout-step__heading-content {
    color: var(--color-heading);
}

.wc-block-components-checkout-step__container::after {
    border-color: var(--color-border);
}

.wc-block-components-radio-control__option-checked,
.wc-block-components-radio-control-accordion-option--checked-option-highlighted {
    border-color: var(--color-brand) !important;
    box-shadow: inset 0 0 0 1px var(--color-brand) !important;
}

.wc-block-components-radio-control__input:checked,
.wc-block-components-checkbox .wc-block-components-checkbox__input:checked {
    background-color: var(--color-brand);
    border-color: var(--color-brand);
}

@media (max-width: 991px) {
    .woocommerce #payment #place_order {
        margin-top: 15px;
    }
}


/* -------------
    07 - MON COMPTE
------------- */

.woocommerce-account .woocommerce-MyAccount-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.woocommerce-account .woocommerce-MyAccount-navigation li::before {
    display: none;
}

.woocommerce-account .woocommerce-MyAccount-navigation li a {
    display: block;
    border-radius: var(--radius-s);
    font-weight: 600;
    text-decoration: none;
    padding: 10px 14px;
}

.woocommerce-account .woocommerce-MyAccount-navigation li.is-active a,
.woocommerce-account .woocommerce-MyAccount-navigation li a:hover {
    background-color: var(--color-surface-alt);
    color: var(--color-brand);
}


/* -------------
    08 - LISTING PRODUITS — views/woocommerce/product/main-listing-product
    Carte : views/woocommerce/product/card-product (components/card)
------------- */

.products__listing {
    margin-bottom: 40px;
}

.woocommerce .star-rating span::before,
.wc-block-components-product-rating__stars span::before {
    color: var(--color-accent);
}


/* -------------
    09 - FICHE PRODUIT — views/woocommerce/product/single-product
------------- */

.single-product__layout {
    display: grid;
    gap: 30px;
}

@media (min-width: 992px) {
    .single-product__layout {
        grid-template-columns: 5fr 6fr;
        column-gap: calc(100% / 12);
    }
}

@media (max-width: 991px) {
    .single-product__summary {
        order: -1;
    }
}

/* Ratio explicite : l'img en .cover (height:100%) a besoin d'un parent de hauteur définie,
   sinon la ligne de grille est mal calculée et la galerie / description débordent dessous */
.single-product__picture {
    aspect-ratio: 4 / 5;
    background-color: var(--card-media-bg);
    border-radius: var(--radius-m);
    margin-bottom: 18px;
}

.single-product__picture img.woocommerce-placeholder,
.single-product__picture img[src*="placeholder"] {
    object-fit: contain;
}

.single-product__gallery {
    display: flex;
    justify-content: space-between;
    gap: 0 5px;
}

.single-product__gallery__picture {
    flex-grow: 1;
}

.single-product__description,
.single-product__short-description,
.single-product__label {
    margin-bottom: 30px;
}

.single-product__label {
    color: var(--color-accent);
    font-size: 1.4rem;
    font-weight: 700;
}

.single-product__suggestion {
    margin-top: 40px;
}

/* Variations (radio + radio couleur) : même look que les étiquettes */
.product-variation {
    margin-bottom: 30px;
}

.product-variation > div {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 15px;
}

.option input {
    display: none;
}

.option label {
    cursor: pointer;
    display: inline-block;
    background-color: var(--tag-bg);
    color: var(--color-brand);
    border: 2px solid transparent;
    border-radius: var(--tag-radius);
    font-weight: 700;
    line-height: 1;
    padding: 10px 30px;
    transition: background-color var(--transition), border-color var(--transition);
}

.option input:checked + label,
.option label:hover {
    background-color: var(--white);
    border-color: var(--color-brand);
}

.option input[disabled] + label {
    cursor: not-allowed;
    opacity: .5;
}

.option--color {
    line-height: 0;
}

.option--color label {
    padding: 0;
    width: 40px;
    height: 40px;
}

/* Quantité (+ / −) — mainJs */
.btn-quantity {
    cursor: pointer;
    background-color: var(--tag-bg);
    color: var(--color-brand);
    border: 2px solid transparent;
    border-radius: var(--radius-pill) 0 0 var(--radius-pill);
    font-size: 1.9rem;
    font-weight: 600;
    line-height: 1;
    width: 40px;
    height: 40px;
    transition: background-color var(--transition), border-color var(--transition);
}

.btn-quantity:hover {
    background-color: var(--white);
    border-color: var(--color-brand);
}

.btn-quantity--plus {
    border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
}

.woocommerce .quantity .qty {
    background-color: var(--white);
    border: 1px solid var(--color-border);
    font-weight: 600;
}

/* Masque les flèches natives de l'input number */
.woocommerce .quantity input[type='number']::-webkit-inner-spin-button,
.woocommerce .quantity input[type='number']::-webkit-outer-spin-button {
    appearance: none;
    margin: 0;
}

.woocommerce .quantity input[type='number'] {
    -moz-appearance: textfield;
}

/* Espacement du bouton « Ajouter au panier » */
.single-product__add-to-cart button.button.alt {
    margin-left: 10px;
}

@media (min-width: 992px) {
    .single-product__add-to-cart button.button.alt {
        margin-left: 30px;
    }
}
