/**
 * CSS ULTRA-AGRESSIF - Force l'affichage même si parent caché
 * Version ULTIMATE
 */

/* ========================================
   FORCER LE PARENT À S'AFFICHER
   ======================================== */

/* Si .product-quantity contient le conteneur décimal, le forcer à s'afficher */
.product-quantity:has(.product-decimal-container) {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Fallback pour navigateurs sans :has() */
.product-quantity.decimal-hidden-standard {
    display: block !important;
}

/* MAIS cacher les enfants du parent sauf le conteneur décimal */
.product-quantity .qty.decimal-hidden-standard {
    display: none !important;
}

.product-quantity .qty.decimal-hidden-standard .bootstrap-touchspin {
    display: none !important;
}

/* ========================================
   FORCER LE CONTENEUR DÉCIMAL À S'AFFICHER
   ======================================== */

.product-decimal-container {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 100 !important;
}

/* Tous les sélecteurs possibles */
div.product-decimal-container,
.integrated-to-form.product-decimal-container,
.product-quantity .product-decimal-container,
.decimal-hidden-standard .product-decimal-container {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-height: none !important;
    overflow: visible !important;
}

/* S'assurer que tous les enfants sont visibles aussi */
.product-decimal-container * {
    visibility: visible !important;
}

/* ========================================
   MASQUER LES SÉLECTEURS STANDARD
   ======================================== */

.decimal-hidden-standard .qty {
    display: none !important;
}

.decimal-hidden-standard .input-group.bootstrap-touchspin {
    display: none !important;
}

#quantity_wanted_p {
    display: none !important;
}

.product-quantities {
    display: none !important;
}

/* ========================================
   CONTENEUR PRINCIPAL INTÉGRÉ
   ======================================== */

.product-decimal-container.integrated-to-form {
    margin: 20px 0;
    padding: 0;
    background: none;
    border: none;
}

/* Badge "Vendu au poids" */
.decimal-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #d26203 0%, #ee5204 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
   /* box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);*/
}

.decimal-badge .material-icons {
    font-size: 18px;
}

/* ========================================
   INFORMATIONS STOCK ET MINIMUM
   ======================================== */

.decimal-stock-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 14px;
}

.decimal-stock-info .stock-label {
    /*color: #666;*/
}

.decimal-stock-info .stock-value {
    font-weight: bold;
    /*color: #28a745;*/
    font-size: 16px;
}

.decimal-stock-info.out-of-stock .stock-label {
    color: #dc3545;
    font-weight: bold;
}

.decimal-min-info {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #666;
}

.decimal-min-info .material-icons {
    font-size: 16px;
    color: #d94e15;
}

/* ========================================
   SÉLECTEUR DE QUANTITÉ
   ======================================== */

.product-decimal-quantity-selector {
    margin: 15px 0;
}

.decimal-qty-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 16px;
    color: #333;    text-align: left;
}

/* Input de quantité avec boutons +/- */
.decimal-qty-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.decimal-qty-input {
    flex: 0 0 150px;
    padding: 12px 15px;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid #00aff0;
    border-radius: 8px;
    text-align: center;
    background: white;
    transition: all 0.2s;
}

.decimal-qty-input:focus {
    outline: none;
    border-color: #0088cc;
    box-shadow: 0 0 0 3px rgba(0, 175, 240, 0.1);
}

.decimal-qty-input:disabled {
    background: #e9ecef;
    cursor: not-allowed;
    border-color: #ccc;
}

/* Boutons +/- */
.qty-decimal-decrease,
.qty-decimal-increase {
    width: 44px;
    height: 44px;
    border: 2px solid #00aff0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.qty-decimal-decrease:hover,
.qty-decimal-increase:hover {
    background: #ab3607;
    color: white;
    transform: scale(1.05);
}

.qty-decimal-decrease:active,
.qty-decimal-increase:active {
    transform: scale(0.95);
}

.qty-decimal-decrease .material-icons,
.qty-decimal-increase .material-icons {
    font-size: 24px;
}

/* Label unité */
.decimal-unit-label {
    font-weight: bold;
    color: #00aff0;
    font-size: 16px;
    min-width: 40px;
    text-align: center;
}

/* ========================================
   SUGGESTIONS RAPIDES
   ======================================== */

.decimal-qty-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.qty-suggestion {
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.qty-suggestion:hover {
    background: #ab3607;
    border-color: #ab3607;
    color: white;
    transform: translateY(-2px);
   /* box-shadow: 0 2px 8px rgba(0, 175, 240, 0.3);*/
}

/* ========================================
   CALCULATEUR DE PRIX
   ======================================== */

.decimal-price-calculator {
    background: #f8f7f5;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.decimal-price-calculator .unit-price,
.decimal-price-calculator .total-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.decimal-price-calculator .total-price {
    margin-bottom: 0;
    padding-top: 8px;
    border-top: 2px solid #f4e5db;
}

.decimal-price-calculator .label {
    font-size: 14px;
    color: #666;
}

.decimal-price-calculator .value {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.decimal-price-calculator .total-price .value {
    font-size: 20px;
    color: #d94e15;
}

/* ========================================
   MESSAGES
   ======================================== */

.decimal-message {
    display: none;
    padding: 10px 15px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 14px;
    align-items: center;
    gap: 8px;
}

.decimal-message .material-icons {
    font-size: 20px;
}

.decimal-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.decimal-message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.decimal-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .decimal-qty-input-wrapper {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .decimal-qty-input {
        flex: 1 1 100%;
        order: 3;
        margin-top: 10px;
    }
    
    .qty-decimal-decrease {
        order: 1;
    }
    
    .decimal-unit-label {
        order: 2;
    }
    
    .qty-decimal-increase {
        order: 3;
    }
    
    .decimal-qty-suggestions {
        justify-content: center;
    }
    
    .decimal-price-calculator {
        padding: 12px;
    }
}

@media (max-width: 576px) {
    .decimal-badge {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .decimal-qty-input {
        font-size: 16px;
        padding: 10px;
    }
    
    .qty-decimal-decrease,
    .qty-decimal-increase {
        width: 40px;
        height: 40px;
    }
    
    .qty-suggestion {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* ========================================
   INTÉGRATION THÈME PRESTASHOP
   ======================================== */

/* S'intègre au design du thème Classic */
.product-add-to-cart .product-decimal-container {
    margin-bottom: 20px;
}

/* Alignement avec les autres éléments du formulaire */
.product-decimal-container .decimal-qty-input-wrapper {
    max-width: 100%;
}

/* Animation lors de l'affichage */
.product-decimal-container {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   ÉTATS DÉSACTIVÉS
   ======================================== */

.product-decimal-container.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.qty-decimal-decrease:disabled,
.qty-decimal-increase:disabled,
.qty-suggestion:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.qty-decimal-decrease:disabled:hover,
.qty-decimal-increase:disabled:hover {
    background: white;
    color: inherit;
    transform: none;
}

/* ========================================
   DARK MODE (optionnel)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .product-decimal-container.integrated-to-form {
        color: #e9ecef;
    }
    
    .decimal-stock-info .stock-label,
    .decimal-min-info {
        color: #adb5bd;
    }
    
    .decimal-qty-input {
        /*background: #2d3748;border-color: #4a5568;*/
        color: #e9ecef;       
    }
    
    .qty-decimal-decrease,
    .qty-decimal-increase {
        background: #d94e15;
        border-color: #d94e15;
        color: #e9ecef;
    }
    
    .qty-suggestion {
       /* background: #2d3748;
        border-color: #4a5568;*/
        color: #d94e15;
    }
    
    .decimal-price-calculator {
       /* background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);*/
    }
}
span.decimal-quantity {
    font-weight: bold;
    color: #d94e15;
}
