/**
 * Styles Frontend - Références et Attributs WooCommerce Pro
 * 
 * @package RefAttrWooPro
 * @author Plugins-wp.fr
 * @copyright 2025 Cercle Carré
 */

/* ==========================================================================
   Tableau de comparaison des produits
   ========================================================================== */

.ref-attr-woo-table-wrapper {
    margin: 2rem 0;
    clear: both;
}

.woocommerce-price-suffix {
    color: #525252;
}

.product-comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 0;
}

.product-comparison-table thead {
    background: #363636;
    color: #fff;
}

.product-comparison-table th,
.product-comparison-table td {
    padding: 1rem;
    text-align: left;
    border: 1px solid #e1e1e1;
    vertical-align: middle;
}

.product-comparison-table th {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #fff;
}

/* Largeur adaptative pour la colonne Prix */
.product-comparison-table th.col-prix,
.product-comparison-table td.col-prix {
    white-space: nowrap;
    width: 1%;
    min-width: 120px;
}

.product-comparison-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.product-comparison-table tbody tr:hover {
    background: #f0f0f0;
}

/* Lien de référence */
.product-ref-link {
    color: #6F4706;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    transition: color 0.3s;
    font-size: 1rem;
}

.product-ref-link:hover {
    color: #363636;
    text-decoration: underline;
}

.product-designation {
    color: #6F4706;
    font-size: 0.95rem;
    margin-top: 0.25rem;
    font-weight: normal;
}

/* Statut de stock */
.stock-status {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    display: inline-block;
    margin-top: 0.5rem;
    font-weight: 600;
}

.stock-status.in-stock {
    background: #f9e7a8;
    color: #626262;
}

.stock-status.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

/* Contrôles de quantité */
.quantity-input {
    width: 60px !important;
    padding: 0.5rem !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    text-align: center !important;
    font-size: 1rem !important;
    -moz-appearance: textfield !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    margin: 0 !important;
    font-weight: 600;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

.quantity-controls {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    justify-content: center !important;
}

.qty-btn {
    background: #363636 !important;
    color: #fff !important;
    border: none !important;
    width: 50px !important;
    height: 32px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 1.2rem !important;
    line-height: 1 !important;
    transition: background 0.3s !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
}

.qty-btn:hover {
    background: #f39c12 !important;
}

.qty-btn:focus {
    outline: 2px solid #f39c12 !important;
    outline-offset: 2px !important;
}

/* Bouton d'ajout au panier */
.add-to-cart-btn {
    background: #f39c12;
    color: #363636;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    font-size: 0.95rem;
}

.add-to-cart-btn .dashicons {
    font-size: 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
}

.add-to-cart-btn:hover {
    background: #363636;
    color: #f39c12;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.add-to-cart-btn:focus {
    outline: 2px solid #f39c12;
    outline-offset: 2px;
}

.add-to-cart-btn:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.add-to-cart-btn:disabled:hover {
    background: #ccc;
    color: #666;
}

.add-to-cart-btn.loading-cart {
    opacity: 0.6;
    pointer-events: none;
}

/* ==========================================================================
   Styles pour les lots (WC Product Lots integration)
   ========================================================================== */

/* Badge de lot sous le prix */
.lot-info-badge {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.25rem 0.6rem;
    background: #ffc700;
    color: #363636;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Indication de quantité sous les contrôles */
.lot-quantity-hint {
    margin-top: 0.4rem;
    font-size: 0.7rem;
    color: #666;
    text-align: center;
    background: #f5f5f5;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    white-space: nowrap;
}

/* Animation de chargement */
@keyframes rotation {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.add-to-cart-btn .dashicons-update {
    animation: rotation 1s linear infinite;
}

/* Focus visible pour accessibilité */
.product-comparison-table a:focus,
.quantity-input:focus {
    outline: 2px solid #f39c12;
    outline-offset: 2px;
}

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

@media only screen and (max-width: 1200px) {
    .product-comparison-table {
        font-size: 0.9rem;
    }
    
    .product-comparison-table th,
    .product-comparison-table td {
        padding: 0.75rem 0.5rem;
    }
}

@media only screen and (max-width: 768px) {
    .product-comparison-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .product-comparison-table thead {
        display: none;
    }
    
    .product-comparison-table,
    .product-comparison-table tbody,
    .product-comparison-table tr,
    .product-comparison-table td {
        display: block;
        width: 100%;
    }
    
    .product-comparison-table tr {
        margin-bottom: 1.5rem;
        border: 2px solid #363636;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .product-comparison-table td {
        text-align: left;
        padding: 0.75rem;
        position: relative;
        border: none;
        border-bottom: 1px solid #e1e1e1;
    }
    
    .product-comparison-table td:last-child {
        border-bottom: none;
    }
    
    .product-comparison-table td:before {
        content: attr(data-label);
        font-weight: bold;
        display: block;
        margin-bottom: 0.5rem;
        color: #242955;
        text-transform: uppercase;
        font-size: 0.85rem;
    }
    
    .product-comparison-table td:first-child {
        background: #fff;
        color: #fff;
        font-weight: bold;
        font-size: 1.1rem;
    }
    
    .product-comparison-table td:first-child:before {
        color: #f39c12;
    }
    
    .add-to-cart-btn {
        width: 100%;
        justify-content: center;
    }
    
    .quantity-controls {
        justify-content: flex-start !important;
    }
    
    /* Responsive pour les lots */
    .lot-info-badge {
        display: block;
        width: fit-content;
        margin-top: 0.5rem;
    }
    
    .lot-quantity-hint {
        text-align: left;
        display: inline-block;
    }
}

@media only screen and (max-width: 480px) {
    .product-comparison-table th,
    .product-comparison-table td {
        padding: 0.5rem;
    }
    
    .product-ref-link {
        font-size: 0.95rem;
    }
    
    .product-designation {
        font-size: 0.85rem;
    }
    
    .qty-btn {
        width: 40px !important;
        height: 28px !important;
        font-size: 1rem !important;
    }
    
    .quantity-input {
        width: 50px !important;
        padding: 0.4rem !important;
        font-size: 0.9rem !important;
    }
    
    .add-to-cart-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}
