/* =====================================================
   Widget de location
   ===================================================== */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

.psf-rentpro-widget {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.psf-rentpro-header-title {
    font-family: 'Roboto', sans-serif !important;
    font-size: 18px;
    font-weight: 500;
    color: #7c3aed;
    margin: 0 0 8px 0;
}

.psf-rentpro-pricing-type {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
}

.psf-rentpro-date-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.psf-rentpro-field {
    display: flex;
    flex-direction: column;
}

.psf-rentpro-field label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
}

.psf-rentpro-field label .required {
    color: #e74c3c;
}

.psf-rental-datetime-input,
.psf-rental-quantity-input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.psf-rental-datetime-input:focus,
.psf-rental-quantity-input:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

.psf-rentpro-actions {
    text-align: center;
    margin: 15px 0;
}

.psf-rentpro-calculate-btn {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.psf-rentpro-calculate-btn:hover {
    background: #135e96;
}

.psf-rentpro-calculate-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Masquer le bouton "Ajouter au panier" standard pour les produits de location */
body.rental-product .single_add_to_cart_button {
    display: none !important;
}

/* Bouton dynamique - États de couleur */
.psf-rentpro-main-action-btn {
    background: #7c3aed; /* Violet pour calculer */
    color: #fff;
    border: none;
    padding: 16px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.psf-rentpro-main-action-btn:hover {
    background: #6d28d9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.psf-rentpro-main-action-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Mode calcul (violet) */
.psf-rentpro-main-action-btn.calculate-mode {
    background: #7c3aed;
}

.psf-rentpro-main-action-btn.calculate-mode:hover:not(:disabled) {
    background: #6d28d9;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

/* Mode ajout au panier (vert) */
.psf-rentpro-main-action-btn.add-to-cart-mode {
    background: #10b981;
}

.psf-rentpro-main-action-btn.add-to-cart-mode:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Mode non disponible (rouge doux)*/
.psf-rentpro-main-action-btn.unavailable-mode {
    background: #fef2f2;
    color:#ef4444;
    border: 1px solid #fecaca;
    cursor: not-allowed;
}

.psf-rentpro-main-action-btn.unavailable-mode:hover {
    background: #fef2f2; /* Pas de changement au hover */
    color:#ef4444;
    border: 1px solid #fecaca;
    transform: none;
    box-shadow: none;
}

/* Animation lors du changement d'état */
.psf-rentpro-main-action-btn.state-changing {
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* =====================================================
   qty fiche produit
   ===================================================== */

/* Masquer le champ quantité standard WooCommerce pour les produits de location */
body.rental-product .single-product div.product form.cart .quantity {
    display: none !important;
}

/* Au cas où le thème utilise d'autres sélecteurs */
body.rental-product .product .cart .quantity:not(.psf-rental-quantity-input) {
    display: none !important;
}

/* Styles Divi spécifiques */
body.rental-product .et_pb_wc_add_to_cart .quantity {
    display: none !important;
}

/* =====================================================
   Affichage du prix
   ===================================================== */

/* État disponible (vert) */
.psf-rentpro-price-display {
    background: #fff;
    border: 2px solid #4caf50;
    border-radius: 6px;
    padding: 15px;
    margin-top: 15px;
}

/* État non disponible (rouge) - NOUVEAU */
.psf-rentpro-price-display.unavailable {
    border-color: #ef4444;
    background: #fef2f2; /* Fond rouge très léger */
}

.psf-rentpro-price-display.unavailable .psf-rentpro-price-total {
    border-top-color: #ef4444;
    color: #dc2626; /* Texte rouge */
}

/* Détails prix */
.psf-rentpro-price-breakdown {
    margin-bottom: 10px;
}

.psf-rentpro-price-breakdown .price-detail {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 14px;
}

.psf-rentpro-price-breakdown .label {
    color: #666;
}

.psf-rentpro-price-breakdown .value {
    font-weight: 600;
    color: #333;
}

.psf-rentpro-price-total {
    border-top: 2px solid #4caf50;
    padding-top: 10px;
    margin-top: 10px;
    font-size: 18px;
    text-align: right;
    color: #2e7d32;
}

/* =====================================================
   Affichage prix sur grille de produits
   ===================================================== */

/* Prix avec unité */
.psf-rentpro-grid-price {
    display: block;
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.psf-rentpro-grid-price .amount {
    font-size: 20px;
    color: #7c3aed;
    font-weight: 700;
}

.psf-rentpro-grid-price .unit {
    font-size: 13px;
    color: #666;
    font-weight: 400;
    font-style: italic;
}

/* Badge "Location" (si mode badge_only) */
.psf-rentpro-price-badge {
    display: inline-block;
    background: #7c3aed;
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Compatibilité thème Divi */
.et_pb_module .psf-rentpro-grid-price {
    margin: 10px 0;
}

/* =====================================================
   Messages
   ===================================================== */

.psf-rentpro-messages {
    margin-top: 15px;
}

.psf-rentpro-message {
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 14px;
}

.psf-rentpro-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.psf-rentpro-error {
    background: #fef2f2; /* Rouge très doux */
    border: 1px solid #fecaca;
    color: #dc2626; /* Rouge pas agressif */
}

.psf-rentpro-price-notice {
    color: #666;
    font-size: 16px;
    font-style: italic;
    font-weight: normal;
}

/* Masquer complètement le prix pour éviter les fuites */
body.rental-product .product .price,
body.rental-product .woocommerce-variation-price,
body.rental-product .woocommerce-variation-availability {
    display: none !important;
}

/* Forcer le masquage dans le sélecteur de variations Divi */
body.rental-product .et_pb_wc_price .price,
body.rental-product .woocommerce-variation-price .price {
    display: none !important;
}



/* =====================================================
   panier
   ===================================================== */

/*   Bouton panier désactivé */
.single_add_to_cart_button.disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

/* Notice quantité fixe dans le panier */
.psf-rentpro-qty-notice {
    color: #666;
    font-style: italic;
}

/* Quantité en lecture seule dans le panier */
.woocommerce-cart-form .quantity span.quantity {
    display: inline-block;
    padding: 8px 12px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 40px;
    text-align: center;
}

/* =====================================================
   commande
   ===================================================== */

/* Affichage des meta-données dans confirmation de commande */
.woocommerce-order-details .wc-item-meta {
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-left: 3px solid #2271b1;
    font-size: 13px;
}

.woocommerce-order-details .wc-item-meta li {
    margin: 5px 0;
    list-style: none;
}

.woocommerce-order-details .wc-item-meta strong {
    color: #333;
    font-weight: 600;
}

.woocommerce-order-details .wc-item-meta p {
    margin: 0;
}

/* =====================================================
   Support modules Divi - Produits connexes
   ===================================================== */

/* Masquer le prix standard dans les modules Divi pour produits location */
/*.et_pb_wc_related_products .product .price:not(.psf-rentpro-grid-price),
.et_pb_wc_upsells .product .price:not(.psf-rentpro-grid-price),
.et_pb_wc_cross_sells .product .price:not(.psf-rentpro-grid-price) {
    display: none !important;
}*/


/* =====================================================
   Responsive
   ===================================================== */

@media (max-width: 768px) {
    .psf-rentpro-date-selection {
        grid-template-columns: 1fr;
    }
    
    .psf-rentpro-price-breakdown .price-detail {
        flex-direction: column;
        gap: 5px;
    }
}