/* ============================================
   BMX RACING - VARIANTS CSS
   Classes préfixées bmx- pour éviter conflits
   ============================================ */

/* ============================================
   HEADER PRODUIT (Titre + Marque)
   ============================================ */

#product .infos-produit {
    gap: 0 !important;
}

.bmx-product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 10px;
}

.bmx-product-header h1 {
    flex: 1;
    margin: 0;
}

.bmx-product-header .product-brand {
    flex-shrink: 0;
}

.bmx-product-header .product-brand img {
    max-height: 40px;
    width: auto;
}

/* ============================================
   ENCADREMENT COLONNE DROITE
   ============================================ */

#product .product-actions {
    background: #f8f8f8;
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
}

/* ============================================
   META (Référence + Stock)
   ============================================ */

.bmx-product-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.bmx-reference {
    font-size: 13px;
    color: #9ca3af;
}

.bmx-stock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}

.bmx-stock.in-stock {
    color: #16a34a;
}

.bmx-stock.low-stock {
    color: #ea580c;
}

.bmx-stock.out-of-stock {
    color: #dc2626;
}

.bmx-stock-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

/* ============================================
   PRIX (en haut, hors du form)
   ============================================ */

.bmx-prices {
    margin-bottom: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e5e5;
}

.bmx-prices-line {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bmx-prices-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bmx-price {
    font-size: 26px;
    font-weight: 700;
    color: #ff6b00;
}

.bmx-price-ttc {
    font-size: 14px;
    font-weight: 600;
    color: #ff6b00;
}

.bmx-price-old {
    font-size: 16px;
    color: #9ca3af;
    text-decoration: line-through;
}

.bmx-badge {
    display: inline-block;
    padding: 3px 8px;
    background: #ff6b00;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 4px;
}

.bmx-shipping-info {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    color: #16a34a;
}

.bmx-shipping-info svg {
    flex-shrink: 0;
}

.bmx-shipping-info span,
.bmx-shipping-info strong {
    color: #16a34a;
}

/* ============================================
   ALMA WIDGET (sous le bouton panier)
   ============================================ */

.bmx-alma-widget,
#alma-widget-container,
#product .bmx-alma-widget,
#product #alma-widget-container,
.bmx-add-to-cart .bmx-alma-widget,
.bmx-add-to-cart #alma-widget-container {
    margin-top: 20px !important;
    padding-top: 0 !important;
    text-align: center;
    width: 100%;
    flex-basis: 100%;
}

.bmx-alma-widget > div,
#alma-widget-container > div,
#alma-widget-container .alma-payment-plans-container {
    border: 1px solid #e5e5e5 !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    background: #fff !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Forcer Alma sur une seule ligne */
#alma-widget-container .alma-payment-plans-container,
#alma-widget-container [class*="alma"] {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
}

#alma-widget-container .alma-payment-plans-container > *,
#alma-widget-container [class*="alma"] > * {
    margin: 0 !important;
}

/* Cacher les éléments sur plusieurs lignes */
#alma-widget-container br {
    display: none !important;
}

/* Style compact */
#alma-widget-container .alma-payment-plans-container {
    font-size: 14px !important;
    line-height: 1.4 !important;
}

/* ============================================
   QUANTITÉ + PANIER
   ============================================ */

.bmx-add-to-cart {
    margin-top: 15px;
    padding-top: 0;
    border-top: none;
    display: flex;
    flex-direction: column;
}

.bmx-cart-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 0;
}

#product .bmx-cart-row {
    margin-bottom: 0 !important;
}

.bmx-qty {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.bmx-qty-btn {
    width: 40px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: #6b7280;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bmx-qty-btn:hover {
    background: #f5f5f5;
    color: #1a1a1a;
}

.bmx-qty-input,
input.bmx-qty-input,
input#quantity_wanted,
#product .bmx-qty input#quantity_wanted,
#product .bootstrap-touchspin input#quantity_wanted,
#product .input-group input#quantity_wanted {
    width: 45px !important;
    height: 44px !important;
    text-align: center !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #1a1a1a !important;
    background: #fff !important;
    border: none !important;
    border-left: 1px solid #e5e5e5 !important;
    border-right: 1px solid #e5e5e5 !important;
    -moz-appearance: textfield !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: static !important;
    float: none !important;
    flex: none !important;
}

input#quantity_wanted::-webkit-outer-spin-button,
input#quantity_wanted::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
    display: none !important;
}

.bmx-qty-input::-webkit-outer-spin-button,
.bmx-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.bmx-cart-btn,
.bmx-cart-btn.add-to-cart,
.bmx-add-to-cart .add-to-cart {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 24px;
    background: #ff6b00;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.15s ease;
}

#product .bmx-cart-btn,
#product .bmx-cart-btn.add-to-cart,
.bmx-cart-row .bmx-cart-btn,
.bmx-cart-row .add-to-cart {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: none !important;
}

.bmx-cart-btn:hover {
    background: #e55d00;
}

.bmx-cart-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.bmx-cart-btn svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* Disponibilité */
.bmx-availability {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 5px;
}

.bmx-availability.low-stock {
    color: #ea580c;
    background: #fff7ed;
}

.bmx-availability.out-of-stock {
    color: #dc2626;
    background: #fef2f2;
}

/* CACHER LES DOUBLONS DU THÈME (mais PAS notre quantité custom) */
/* Utiliser visibility au lieu de display pour éviter les sauts */
#product .product-add-to-cart:not(.bmx-add-to-cart),
#product .product-quantity:not(.bmx-qty):not(:has(.bmx-qty-input)),
#product .qty:not(.bmx-qty),
#product .product-prices__right,
#product .current-price-without-taxes,
#product .product-prices-add-to-cart,
#product .product-availability,
#product #product-availability,
#product .product-minimal-quantity,
#product .bmx-availability {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Cacher les éléments bootstrap-touchspin ajoutés par JS */
#product .bmx-qty .bootstrap-touchspin-prefix,
#product .bmx-qty .bootstrap-touchspin-postfix,
#product .bmx-qty .input-group-btn-vertical,
#product .bmx-qty .btn-touchspin,
#product .bmx-qty .js-touchspin {
    display: none !important;
}

/* Réinitialiser le wrapper bootstrap-touchspin */
#product .bmx-qty .bootstrap-touchspin,
#product .bmx-qty .input-group {
    display: contents !important;
}

/* Exclure explicitement notre bloc de la règle de masquage */
#product .bmx-add-to-cart {
    display: flex !important;
    flex-direction: column !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#product .bmx-qty,
#product .bmx-cart-row {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* === CONTAINER === */
.bmx-variants {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Écraser la grille 2 colonnes du thème */
#product .bmx-variants,
#product .product-variants,
.product-variants.bmx-variants {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    grid-template-columns: none !important;
    gap: 16px !important;
    width: 100% !important;
}

/* === CHAQUE LIGNE === */
.bmx-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 0;
}

/* Écraser le CSS du thème */
#product .product-variants-item.bmx-row {
    border: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    height: auto !important;
    justify-content: flex-start !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    margin-bottom: 0 !important;
}

/* === LABEL === */
.bmx-label {
    font-size: 12px;
    font-weight: 700;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === OPTIONS CONTAINER === */
.bmx-options {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

#product .bmx-options {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    width: auto !important;
}

/* === COULEURS === */
.bmx-color {
    position: relative;
    cursor: pointer;
}

.bmx-color input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.bmx-color .swatch {
    display: block;
    width: 28px;
    height: 28px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    background-size: cover;
    transition: all 0.15s ease;
}

.bmx-color:hover .swatch {
    border-color: #ff6b00;
}

.bmx-color.active .swatch {
    border-color: #ff6b00;
    box-shadow: 0 0 0 2px rgba(255, 107, 0, 0.25);
}

/* === BOUTONS RADIO === */
.bmx-btn {
    position: relative;
    cursor: pointer;
}

.bmx-btn input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.bmx-btn span {
    display: inline-block;
    padding: 8px 14px;
    background: #e8e8e8;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1a;
    transition: all 0.15s ease;
}

.bmx-btn:hover span {
    background: #ddd;
}

.bmx-btn.active span {
    background: #1a1a1a;
    color: #fff;
}

/* === SELECT === */
.bmx-select {
    padding: 8px 14px;
    background: #1a1a1a;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    min-width: 120px;
}

/* ============================================
   FORCE AFFICHAGE QUANTITÉ - EN DERNIER
   ============================================ */

#product .bmx-qty,
.bmx-qty {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#product .bmx-qty input,
#product .bmx-qty .bmx-qty-input,
#product input#quantity_wanted,
.bmx-qty input,
.bmx-qty-input,
input#quantity_wanted.bmx-qty-input {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 45px !important;
    height: 44px !important;
    position: static !important;
    clip: auto !important;
    clip-path: none !important;
    overflow: visible !important;
    border: none !important;
    border-left: 1px solid #e5e5e5 !important;
    border-right: 1px solid #e5e5e5 !important;
}

/* Éviter les sauts au chargement */
#product .product-actions,
#product .infos-produit {
    min-height: auto;
}

#product .product-actions * {
    transition: none !important;
}

/* Stabiliser la hauteur du conteneur */
#product .product-informations,
#product .product-container,
#product .pb-center-column {
    contain: layout;
}

/* Cacher immédiatement les doublons pour éviter les sauts */
.product-prices,
.product-add-to-cart:not(.bmx-add-to-cart),
.product-quantity:not(.bmx-qty),
#product-availability,
.product-availability {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
}

/* ============================================
   BLOC DESCRIPTION PRODUIT
   ============================================ */

#product .product-description__custom {
    background: #f8f8f8;
    border-radius: 12px;
    padding: 24px;
    margin-top: 30px;
}

#product .product-description__custom h2 {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 16px 0;
    text-transform: uppercase;
}

#product .product-description__custom .product-description {
    font-size: 14px;
    line-height: 1.6;
    color: #4b5563;
}

#product .product-description__custom .product-description p {
    margin-bottom: 12px;
}

#product .product-description__custom .product-description ul {
    padding-left: 20px;
    margin-bottom: 12px;
}

#product .product-description__custom .product-description li {
    margin-bottom: 6px;
}

#product .product-description__custom .product-description hr {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 20px 0;
}

#product .product-description__custom table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 12px;
}

#product .product-description__custom table th,
#product .product-description__custom table td {
    padding: 10px 8px;
    border: 1px solid #e5e5e5;
    text-align: left;
}

#product .product-description__custom table th {
    background: #1a1a1a;
    color: #fff;
    font-weight: 600;
}

#product .product-description__custom table tr:nth-child(even) td {
    background: #fff;
}

#product .product-description__custom table tr:nth-child(odd) td {
    background: #f0f0f0;
}

/* Alma - forcer layout une ligne */
#alma-widget-container .alma-widget-container,
#alma-widget-container .alma-eligibility-widget,
#alma-widget-container [data-alma-widget] {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
}

#alma-widget-container .alma-widget-container > div,
#alma-widget-container .alma-eligibility-widget > div {
    display: inline-flex !important;
    align-items: center !important;
}

/* FORCE ESPACEMENT ALMA */
#product .bmx-add-to-cart .bmx-alma-widget,
#product .bmx-add-to-cart #alma-widget-container,
html body #product .bmx-alma-widget,
html body #product #alma-widget-container {
    margin-top: 20px !important;
    display: block !important;
}

/* ============================================
   RÉASSURANCES
   ============================================ */

.bmx-reassurance {
    margin-top: 20px;
    width: 100%;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.bmx-reassurance .blockreassurance_product {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    align-items: flex-start !important;
    gap: 15px;
}

.bmx-reassurance .blockreassurance_product > div {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center;
    flex: 1;
}

.bmx-reassurance .blockreassurance_product .item-product {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.bmx-reassurance .blockreassurance_product svg {
    width: 28px !important;
    height: 28px !important;
}

.bmx-reassurance .blockreassurance_product .block-title {
    font-size: 12px !important;
    font-weight: 500 !important;
    color: #4b5563 !important;
    margin: 0 !important;
    line-height: 1.3;
}

.bmx-reassurance .blockreassurance_product .clearfix {
    display: none !important;
}

/* Fixer le margin du header pour éviter le saut au scroll */
body.page-product #header {
    margin-bottom: 60px !important;
}

/* ============================================
   PAGE FABRICANTS - Cacher descriptions
   ============================================ */

.brand-infos p {
    display: none !important;
}

/* ============================================
   BMX Racing - Styles bouton panier désactivé
   À ajouter à ton CSS existant
   ============================================ */

/* Bouton panier désactivé */
.bmx-cart-btn:disabled,
.bmx-cart-btn.bmx-btn-disabled {
    background-color: #9ca3af !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
}

.bmx-cart-btn:disabled:hover,
.bmx-cart-btn.bmx-btn-disabled:hover {
    background-color: #9ca3af !important;
    transform: none !important;
}

/* Stock hors stock - pastille rouge */
.bmx-stock.out-of-stock .bmx-stock-dot {
    background-color: #dc2626 !important;
}

.bmx-stock.out-of-stock {
    color: #dc2626 !important;
}

/* Stock en stock - pastille verte */
.bmx-stock.in-stock .bmx-stock-dot {
    background-color: #16a34a !important;
}

.bmx-stock.in-stock {
    color: #16a34a !important;
}

/* Stock bas - pastille orange */
.bmx-stock.low-stock .bmx-stock-dot {
    background-color: #f59e0b !important;
}

.bmx-stock.low-stock {
    color: #f59e0b !important;
}

/* Désactivation du grid */
@media screen and (min-width: 768px) {
    .page-category .block-category {
        display: block !important;
    }
}

/* Collapse description */
.category-description-wrapper {
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.category-description-wrapper.collapsed {
    max-height: 7.5em; /* environ 5 lignes (1.5em line-height x 5) */
}

.category-description-wrapper.expanded {
    max-height: 2000px; /* valeur arbitraire haute */
}

/* Bouton Lire la suite */
.btn-read-more {
    background: none;
    border: none;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    padding: 10px 0;
    text-decoration: underline;
}

.btn-read-more:hover {
    color: #000;
}

/* Cache le bouton si la description est courte (géré en JS) */
.btn-read-more.hidden {
    display: none;
}

/* Reset et hover image swap */
.product-thumbnail {
    position: relative !important;
    display: block !important;
    overflow: hidden;
}

.product-thumbnail img.first-image {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    display: block !important;
}

.product-thumbnail img.second-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    opacity: 0;
    z-index: 2;
    transition: opacity 0.3s ease;
}

.product-thumbnail:hover img.second-image {
    opacity: 1;
}
/* Bouton retour en haut */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    background-color: #555;
}