/* GreenForge - Product Selector Widget CSS */

/* ========================================== */
/* Product Selector Widget Styles */
/* ========================================== */

.greenforge-product-widget {
    background: #fff;
    border-radius: 10px;
}

/* Composition Title - Fixed height with fade transition */
.composition-title-main,
.composition-title-fallback {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    min-height: 2.6em; /* Fixed height for 2 lines */
    max-height: 2.6em;
    overflow: hidden;
}

.composition-title-main .composition-name-text {
    display: block;
    opacity: 1;
    transition: opacity 0.25s ease-in-out;
}

/* Fade transition when changing title */
.composition-title-main.is-changing .composition-name-text {
    opacity: 0;
}

/* Description fade-in animation */
.composition-description {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.composition-description.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================== */
/* Modern Pills Variant Selector */
/* ========================================== */

.gf-variant-selector {
    margin-bottom: 0.5rem;
}

.gf-variant-selector .mb-3 {
    margin-bottom: 0.5rem !important;
}

.gf-pills-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.4rem;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    padding: 6px 4px; /* Prevent clipping of pills and focus outline */
    margin: -6px -4px; /* Compensate padding */
}

.gf-pills-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Hide the actual radio input */
.gf-pill-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Pill label styling */
.gf-pill-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #495057;
    background-color: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    min-width: 2.5rem;
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.gf-pill-label:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

/* Selected state - GreenForge green */
.gf-pill-input:checked + .gf-pill-label {
    color: #fff;
    background-color: #225627;
    border-color: #225627;
    box-shadow: 0 2px 4px rgba(34, 86, 39, 0.3);
}

/* Focus state for accessibility */
.gf-pill-input:focus + .gf-pill-label {
    outline: 2px solid rgba(34, 86, 39, 0.5);
    outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .gf-pill-label {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .gf-pills-container {
        gap: 0.4rem;
    }
}

/* Composition Kit Grid - Layout amélioré et responsive */
.composition-kit-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Par défaut 2 colonnes */
    gap: 0.625rem;
    margin-top: 0.5rem;
    padding-left: 0; /* Aligner à gauche */
    padding-top: 8px; /* Décaler les items de quelques pixels vers le bas */
}

/* Desktop: 3 colonnes x 2 lignes (hauteur fixe pour 6 items max) */
@media (min-width: 992px) {
    .composition-kit-grid {
        grid-template-columns: repeat(3, 1fr) !important; /* 3 colonnes pour 6 items max */
        grid-template-rows: repeat(2, 85px); /* Hauteur fixe par ligne */
        gap: 0.625rem;
        height: calc(2 * 85px + 0.625rem); /* 2 lignes de 85px + 1 gap */
        overflow: hidden; /* Cacher les items au-delà de 6 */
        padding-left: 0;
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }
    
    /* Aligner les items à gauche */
    .seasonal-bom-container {
        padding-left: 0;
        margin-left: 0;
    }
    
    .bom-lines-container {
        padding-left: 0;
        margin-left: 0;
    }
}

/* Tablet: 2 colonnes */
@media (min-width: 768px) and (max-width: 991px) {
    .composition-kit-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.625rem;
        height: auto; /* Pas de hauteur fixe sur tablette */
    }
    
    .bom-lines-container {
        height: auto !important;
    }
}

.composition-kit-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
    height: 85px; /* Hauteur fixe pour calculer la hauteur du grid */
    position: relative;
    overflow: visible; /* Permet au badge de dépasser */
}

.composition-kit-item:hover {
    background: #e9ecef;
    border-color: #225627;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 86, 39, 0.15);
}

.kit-image-wrapper {
    position: relative;
    flex-shrink: 0;
}

.kit-image-container {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e9ecef;
    flex-shrink: 0;
}

.kit-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kit-image-placeholder {
    background: #e9ecef;
    color: #6c757d;
    font-size: 1.5rem;
}

/* Placeholder pour l'image principale */
.product-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 3rem;
    border-radius: 0.375rem;
}

.product-image-placeholder i {
    opacity: 0.5;
}

/* Style pour image avec erreur de chargement */
.product-main-image[data-error="true"] {
    display: none;
}

.kit-content {
    flex: 1;
    min-width: 0; /* Permet le truncate */
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
}

.kit-product-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kit-latin-name {
    font-size: 0.8rem;
    font-style: italic;
    color: #6c757d;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kit-quantity-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    background: #225627;
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.8rem;
    position: absolute;
    top: -6px;
    left: -6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 10;
    line-height: 1;
    padding: 0;
    box-sizing: border-box;
}

/* Mobile responsive */
@media (max-width: 767px) {
    /* Fix layout mobile - empiler les colonnes */
    .greenforge-product-widget .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    .greenforge-product-widget .col-md-4,
    .greenforge-product-widget .col-md-8 {
        padding-left: 15px;
        padding-right: 15px;
        margin-bottom: 0.75rem; /* Marges harmonisées */
    }
    
    /* Réduire l'espace sous l'image sur mobile */
    .greenforge-product-widget .product-image-container {
        margin-bottom: 0.75rem !important; /* Harmoniser avec les autres marges */
    }
    
    /* Harmoniser les marges du widget */
    .greenforge-product-widget {
        padding: 1rem !important; /* Réduire le padding général */
    }
    
    /* Harmoniser les marges des sections */
    .greenforge-product-widget .product-info-container {
        margin-top: 0.5rem;
    }
    
    .greenforge-product-widget .product-price {
        margin-bottom: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    .greenforge-product-widget .mb-3,
    .greenforge-product-widget .mb-4 {
        margin-bottom: 0.75rem !important;
    }
    
/* Image format 2:1 forcé avec crop */
.product-image-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    height: 0; /* Important pour que padding-bottom fonctionne */
}

/* Desktop: format 2:1 forcé */
@media (min-width: 768px) {
    .product-image-container {
        padding-bottom: 50% !important; /* 2:1 aspect ratio (50% = 1/2) */
        height: 0 !important;
    }
    
    .product-main-image {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important; /* Crop si nécessaire pour remplir */
        object-position: center !important; /* Centre l'image lors du crop */
        max-width: none !important;
        max-height: none !important;
        /* Surcharger img-fluid de Bootstrap */
        display: block !important;
    }
    
    /* Surcharger img-fluid qui peut empêcher le crop */
    .product-image-container .img-fluid {
        width: 100% !important;
        height: 100% !important;
        max-width: none !important;
        max-height: none !important;
    }
}

/* Mobile: format adaptatif mais avec crop si nécessaire */
@media (max-width: 767px) {
    .product-image-container {
        padding-bottom: 75% !important; /* Format plus carré sur mobile */
        height: 0 !important;
    }
    
    .product-main-image {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important; /* Crop si nécessaire */
        object-position: center !important;
        max-width: none !important;
        max-height: none !important;
        display: block !important;
    }
    
    /* Surcharger img-fluid qui peut empêcher le crop */
    .product-image-container .img-fluid {
        width: 100% !important;
        height: 100% !important;
        max-width: none !important;
        max-height: none !important;
    }
}
    
    .composition-kit-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
        margin-top: 0.5rem;
    }
    
    .composition-kit-item {
        padding: 0.75rem;
        min-height: 80px;
        height: auto;
        width: 100%;
        max-width: 100%;
    }
    
    .kit-image-wrapper {
        position: relative;
    }
    
    .kit-image-container {
        width: 55px;
        height: 55px;
    }
    
    .kit-quantity-badge {
        min-width: 24px;
        height: 24px;
        font-size: 0.7rem;
        top: -4px;
        left: -4px;
        line-height: 1;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }
    
    .kit-product-name {
        font-size: 0.9rem;
        line-height: 1.3;
    }
    
    .kit-latin-name {
        font-size: 0.75rem;
        line-height: 1.2;
    }
    
    .kit-content {
        gap: 0.2rem;
    }
    
    /* Pas de scroll */
    .greenforge-product-widget {
        overflow: visible;
        padding: 1rem !important;
    }
    
    .seasonal-bom-container {
        overflow: visible;
        margin-bottom: 0.75rem !important; /* Harmoniser avec les autres marges */
        margin-top: 0.75rem !important;
        padding-left: 0;
        padding-right: 0;
    }
    
    .bom-lines-container {
        overflow: visible;
        min-height: auto !important;
        height: auto !important; /* Pas de hauteur fixe sur mobile */
    }
    
    /* Harmoniser les marges du séparateur */
    .greenforge-product-widget hr {
        margin-top: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Fix actions row sur mobile - garder sur la même ligne et centrer */
    .greenforge-product-widget .d-flex.justify-content-end {
        flex-direction: row !important;
        gap: 0.5rem;
        align-items: center !important;
        flex-wrap: nowrap;
        justify-content: center !important; /* Centrer sur mobile */
    }
    
    .greenforge-product-widget .add-to-cart-btn {
        width: auto;
        min-width: auto;
        font-size: 0.85rem !important;
        padding: 0.5rem 1rem !important;
        white-space: nowrap;
        flex-shrink: 1;
    }
    
    .greenforge-product-widget .add-to-cart-btn i {
        font-size: 0.8rem;
        margin-right: 0.25rem !important;
    }
    
    /* Réduire la taille du sélecteur de quantité sur mobile */
    .greenforge-product-widget .product-qty {
        max-width: 60px !important;
        font-size: 0.9rem;
        padding: 0.375rem 0.5rem;
    }
    
    .greenforge-product-widget .qty-btn-minus,
    .greenforge-product-widget .qty-btn-plus {
        font-size: 1.25rem !important;
        padding: 0.25rem !important;
    }
}

/* Ajuster l'espacement pour éviter le scroll */
.seasonal-bom-container {
    margin-bottom: 0.75rem;
    margin-top: 0.5rem; /* Espace réduit entre le séparateur et la BOM */
}

.text-greenforge {
    color: #2d5016 !important;
}

.btn-greenforge {
    background-color: #d85a3c;
    color: white;
    border: none;
    font-weight: 600;
    padding: 12px 24px;
    transition: all 0.3s ease;
}

/* Quick add adjustments - styles removed, using .gf-quick-add-pill.btn-group instead */

.gf-cart-indicator {
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 1050;
    background: rgba(45, 80, 22, 0.95);
    color: #fff;
    border-radius: 999px;
    padding: 10px 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.gf-cart-indicator--visible {
    opacity: 1;
    transform: translateY(0);
}

.gf-cart-indicator__inner {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.bom-lines-container {
    overflow: visible; /* Pas de scroll */
    min-height: calc(2 * 85px + 0.625rem); /* Hauteur fixe pour 2 lignes */
    padding-top: 4px; /* Décaler le contenu pour éviter que l'animation coupe le haut */
}

/* Desktop: hauteur fixe pour éviter le saut */
@media (min-width: 992px) {
    .bom-lines-container {
        height: calc(2 * 85px + 0.625rem + 4px); /* Hauteur fixe + padding pour éviter le saut */
        padding-top: 4px; /* Décaler le contenu */
    }
}

/* Noble fade transition classes */
.noble-fade-wrapper {
    transition: opacity 0.4s ease-in-out;
}

.noble-fade-out {
    opacity: 0.3;
}

.noble-fade-in {
    animation: nobleFadeIn 0.5s ease-out forwards;
}

@keyframes nobleFadeIn {
    from {
        opacity: 0.3;
        transform: translateY(3px); /* Réduire le déplacement pour éviter de couper le haut */
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* S'assurer que le conteneur a assez d'espace pour l'animation */
.bom-lines-container.noble-fade-wrapper {
    overflow: visible;
    padding-top: 8px; /* Espace pour l'animation */
}

/* Style pour la description ecommerce */
.composition-description-text {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #6c757d;
}