/* 
 * STEMTECH - Custom Cart Styles
 * File: carrello/custom-cart.css
 * Stili per il carrello personalizzato
 */

.custom-cart-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    font-family: Arial, sans-serif;
}

.cart-content {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

/* Sezione Prodotti */
.cart-products-section {
    flex: 2;
    background: #fff;
    border-radius: 8px;
    padding: 0;
}

.cart-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 30px 0;
    color: #333;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cart-item {
    display: flex;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid #f0f0f0;
    align-items: flex-start;
}

.cart-item:last-child {
    border-bottom: none;
}

/* Immagine Prodotto */
.product-image {
    flex-shrink: 0;
    width: 200px;
    height: 200px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

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

/* Dettagli Prodotto */
.product-details {
    flex: 1;
    display: flex;
    flex-direction: column; 
    margin-right: 30px;
}

.product-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #333;
    line-height: 1.4;
}

.product-info a {
    text-decoration: none;
    color: #333;
    font-size: 20px;
}

.product-info a:hover {
    color: #0073aa;
}

.product-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-code {
    font-size: 16px;
    color: #666;
    font-style: italic;
}

.product-attribute {
    font-size: 14px;
    color: #555;
}

.attribute-label {
    font-weight: 700;
}

/* Prezzo e Quantità */
.product-price-qty {
    display: flex;
    gap: 30px;
    align-items: center;
    padding-left: 530px;
}

.price-section,
.subtotal-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.price-section label,
.subtotal-section label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

.product-price,
.product-subtotal {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* Quantità */
.quantity-section {
    display: flex;
    align-items: center;
}

.quantity-section .qty {
    width: 60px;
    height: 36px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin: 0 5px;
}

.quantity-section .quantity-button {
    width: 30px;
    height: 36px;
    border: 1px solid #ddd;
    background: #f8f8f8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    border-radius: 4px;
}

.quantity-section .quantity-button:hover {
    background: #e8e8e8;
}

/* Azioni Prodotto */
.product-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 5px;
    padding-left: 640px;
}

.add-to-favorites {
    background: none;
    border: none;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    text-decoration: underline;
}

.add-to-favorites:hover {
    color: blue;
}


.remove-item {
    color: #666;
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
    margin-top: 1px;
}

.remove-item:hover {
    color: #e74c3c;
}

/* Sezione Riepilogo */
.cart-summary-section {
    flex: 1;
    min-width: 300px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
}

.cart-summary {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    width: 100%; /* Assicura che occupi tutta la colonna */
}

.summary-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: #333;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 0;
}

.summary-row.total-row {
    border-top: 2px solid #ddd;
    margin-top: 15px;
    padding-top: 15px;
    margin-bottom: 5px;
    justify-content: space-between;
    text-align: left;
}

.summary-row.total-row .summary-label {
    font-size: 16px;
    font-weight: 600;
}

.summary-row.total-row .summary-value {
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

.summary-label {
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.summary-value {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.total-amount {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.tax-notice {
    font-size: 11px;
    color: #666;
    display: block;
    text-align: right;
    margin-top: 2px;
}

/* Pulsanti Checkout */
.checkout-buttons {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkout-button,
.continue-shopping-button {
    padding: 14px 20px;
    border-radius: 6px;
    text-decoration: none;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: block;
}

.checkout-button.primary {
    background: #333;
    color: white;
    border: 2px solid #333;
}

.checkout-button.primary:hover {
    background: #555;
    border-color: #555;
}

.continue-shopping-button {
    background: transparent;
    color: #333;
    border: 1px solid #ddd;
}

.continue-shopping-button:hover {
    background: #f0f0f0;
}

/* Azioni Carrello */
.cart-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.cart-actions .button {
    background: #f0f0f0;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    color: #333;
    font-size: 14px;
}

.cart-actions .button:hover {
    background: #e0e0e0;
}

/* Carrello Vuoto */
.cart-empty {
    text-align: center;
    padding: 60px 20px;
}

.cart-empty p {
    font-size: 18px;
    color: #666;
    margin-bottom: 20px;
}

.cart-empty .button {
    background: #333;
    color: white;
    padding: 12px 30px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-block;
}

/* Responsive */
@media (max-width: 768px) {
    .cart-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .cart-item {
        flex-direction: column;
        gap: 15px;
    }
    
    .product-image {
        align-self: center;
    }
    
    .product-price-qty {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .product-actions {
        justify-content: center;
    }
    
    .cart-summary-section {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .custom-cart-container {
        padding: 10px;
    }
    
    .cart-summary {
        padding: 15px;
    }
    
    .product-price-qty {
        gap: 10px;
    }
}

/* Loader e Notifiche */
.cart-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.cart-notification.show {
    transform: translateX(0);
}

.notification-success {
    background: #28a745;
}

.notification-info {
    background: #17a2b8;
}

.notification-error {
    background: #dc3545;
}

.cart-item.hover-effect {
    background: #f8f9fa;
    transform: translateY(-2px);
    transition: all 0.3s ease;
}


/* ============================================================
   STEMTECH - MOBILE OPTIMIZATION
   Da aggiungere alla fine del file custom-cart.css
   ============================================================ */

@media (max-width: 768px) {

    /* 1. Contenitore e Layout Generale */
    .custom-cart-container {
        padding: 10px;
        margin-bottom: 60px; /* Spazio per evitare che il footer copra contenuti */
    }

    .cart-content {
        display: flex;
        flex-direction: column; /* Impila prodotti e riepilogo */
        gap: 20px;
    }

    .cart-products-section {
        width: 100%;
        border-radius: 0; /* Design più pulito su mobile */
        background: transparent;
    }

    .cart-title {
        font-size: 20px;
        margin-bottom: 20px;
        padding-left: 5px;
    }

    /* 2. Scheda Prodotto (Layout a "Card") */
    .cart-item {
        display: grid;
        grid-template-columns: 80px 1fr; /* Immagine fissa a sx, resto a dx */
        gap: 15px;
        background: #fff;
        padding: 15px;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Leggera ombra per separare le card */
        border: none;
        margin-bottom: 15px;
        align-items: start;
    }

    /* 3. Immagine piccola a sinistra */
    .product-image {
        width: 80px;
        height: 80px;
        align-self: flex-start;
        border: none;
    }
    
    .product-image img {
        border-radius: 4px;
    }

    /* 4. Dettagli Prodotto (Titolo e attributi) */
    .product-details {
        margin-right: 0;
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .product-info h3 {
        font-size: 15px;
        margin-bottom: 5px;
        padding-right: 20px; /* Spazio per eventuale icona rimuovi se posizionata absolute */
    }

    .product-meta {
        font-size: 13px;
        margin-bottom: 10px;
    }

    /* 5. Prezzo, Quantità e Subtotale */
    /* Resettiamo i padding enormi del desktop */
    .product-price-qty {
        padding-left: 0 !important; 
        margin-top: 10px;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        border-top: 1px dashed #eee;
        padding-top: 10px;
        gap: 10px;
    }

    /* Nascondiamo le label "Prezzo unitario" e "Subtotale" per risparmiare spazio, lasciamo solo i numeri */
    .price-section label, 
    .subtotal-section label {
        display: none;
    }

    .price-section {
        order: 1; /* Prezzo a sinistra */
    }

    .quantity-section {
        order: 2; /* Quantità a destra */
        margin: 0;
    }
    
    .quantity-section .qty {
        width: 40px; /* Input più compatto */
        height: 32px;
    }
    
    .quantity-section .quantity-button {
        width: 28px;
        height: 32px;
    }

    .subtotal-section {
        display: none; /* Su mobile spesso si nasconde il subtotale della riga per pulizia, o si mette sotto */
    }

    .product-price {
        font-size: 15px;
        color: #333;
    }

    /* 6. Azioni (Rimuovi / Preferiti) */
    .product-actions {
        padding-left: 0 !important;
        margin-top: 10px;
        justify-content: space-between;
        width: 100%;
        border-top: 1px solid #f9f9f9;
        padding-top: 8px;
    }

    .remove-item {
        font-size: 13px;
        color: #e74c3c;
        text-decoration: none;
        display: flex;
        align-items: center;
    }
    
    /* Aggiunge un'icona "X" visuale prima del testo Rimuovi */
    .remove-item::before {
        content: "✕";
        margin-right: 4px;
        font-weight: bold;
    }

    .add-to-favorites {
        font-size: 13px;
    }

    /* 7. Pulsanti Azione Carrello (Aggiorna/Svuota) */
    .cart-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .cart-actions .button {
        width: 100%;
        text-align: center;
        padding: 12px;
    }

    /* 8. Riepilogo Carrello (Summary) */
    .cart-summary-section {
        position: static; /* Non sticky su mobile per non coprire i prodotti */
        height: auto;
        margin-top: 0;
    }

    .cart-summary {
        padding: 20px;
        background: #f9f9f9;
        border: 1px solid #eee;
    }

    .checkout-buttons {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #fff;
        padding: 15px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    /* Per evitare che il bottone fisso copra l'ultimo pezzo del sito, diamo margine al footer del summary */
    .cart-summary {
        margin-bottom: 80px; 
    }

    .checkout-button.primary {
        background: #000; /* Nero standard elegante */
        color: #fff;
        font-size: 16px;
        padding: 15px;
        text-transform: uppercase;
        letter-spacing: 1px;
    }
    
    .continue-shopping-button {
        display: none; /* Nascondiamo "continua acquisti" nel footer fisso per pulizia */
    }
}