/* file css/style */
/* style.css - Versione Responsive Completa */

/* ========= STILI GENERALI (BASE) ========= */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: #f4f1e9;
    color: #333;
    line-height: 1.6;
}

header {
    background-color: #d35400;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Permette di andare a capo se lo spazio non basta */
}

header h1 {
    margin: 0;
    font-size: 1.8rem;
}

header nav a {
    color: white;
    text-decoration: none;
    margin-left: 20px;
    font-weight: bold;
}

main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

button {
    background-color: #e67e22;
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 10px;
    transition: background-color 0.2s;
}
button:hover {
    background-color: #d35400;
}



/* ========= MENU DEI PRODOTTI ========= */
.categoria-titolo {
    width: 100%;
    text-align: center;
    font-size: 2.5rem;
    color: #c0392b;
    margin-top: 40px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e67e22;
    padding-bottom: 10px;
}

.menu-categoria {
    display: grid;
    /* Questa riga è già ottima per la responsività! */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 2rem;
    margin-bottom: 40px;
}

.prodotto-item {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}
.prodotto-item img {
    max-width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 5px;
}
.prodotto-item .prezzo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #c0392b;
    margin-top: auto; /* Spinge il prezzo in basso */
}
.quantita-input {
    width: 60px;
    padding: 8px;
    text-align: center;
}

/* ========= CARRELLO E CHECKOUT ========= */
.carrello-container, .checkout-form {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}
th, td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #ddd;
}
th {
    background-color: #f2f2f2;
}
.riepilogo-carrello {
    text-align: right;
}
.btn-checkout, .btn-delivery {
    display: inline-block;
    color: white;
    padding: 15px 30px;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1.2rem;
    width: 100%; /* I bottoni principali occupano tutta la larghezza sui dispositivi mobili */
    box-sizing: border-box; /* Assicura che padding non alteri la larghezza */
    text-align: center;
}
.btn-checkout { background-color: #27ae60; }
.btn-checkout:hover { background-color: #229954; }

.btn_paypal_acquisto {
    width: 100%;
    background-color: #0070ba;
    font-size: 1.1rem;
    padding: 15px;
}
.btn_paypal_acquisto:hover { background-color: #005ea6;}

.btn-delivery {
    width: 100%;
    background-color: #3498db;
    font-size: 1.1rem;
    padding: 15px;
}
.btn-delivery:hover { background-color: #2980b9;}

.checkout-form label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: bold;
}
.checkout-form input, .checkout-form textarea, .checkout-form select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Cruciale per la responsività */
}
.payment-options {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr; /* Due colonne su schermi grandi */
    gap: 2rem;
}
.payment-method {
    border: 1px solid #ddd;
    padding: 1.5rem;
    border-radius: 5px;
}

/*anteprima prodotto carrello*/
.prodotto-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.img-carrello {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
}

/* Aggiungi alla fine di style.css */

.text-center {
    text-align: center;
}

.resoconto-ordine {
    max-width: 600px;
    margin: 2rem auto 0 auto;
    padding: 1.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-align: left;
    background-color: #fff;
}

.resoconto-ordine h3 {
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
    margin-top: 0;
}

.resoconto-ordine table {
    margin-top: 1rem;
}

.resoconto-ordine table tfoot {
    font-weight: bold;
}

.resoconto-ordine .totale-label {
    font-size: 1.2rem;
}

.resoconto-ordine .totale-importo {
    font-size: 1.3rem;
    color: #c0392b;
}

.dettagli-principali p {
    margin: 0.5rem 0;
}

/* =============================================================== */
/* ========= 🚀 MEDIA QUERIES PER LA RESPONSIVITÀ 🚀 ========= */
/* =============================================================== */

/* Stili per tablet e dispositivi più piccoli (fino a 768px) */
@media (max-width: 768px) {
    
    header {
        /* flex-direction: column;  Mette il logo sopra la navigazione 
        text-align: center;*/
    }
    header nav {
        margin-top: 15px;
    }
    header nav a {
        margin-top: 15px;
    }
    main {
        padding: 1rem; /* Riduci lo spazio ai lati */
    }

    .categoria-titolo {
        font-size: 25px;
    }

    /* Trasforma la tabella del carrello in un elenco a "schede" */
    .carrello-container table thead {
        display: none; /* Nasconde l'intestazione della tabella */
    }
    .carrello-container table, 
    .carrello-container table tbody, 
    .carrello-container table tr, 
    .carrello-container table td {
        display: block; /* Ogni cella diventa un blocco */
        width: 100% !important;
        box-sizing: border-box;
    }
    .carrello-container table tr {
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: 5px;
        padding: 1rem;
    }
    .carrello-container table td {
        text-align: right; /* Allinea il contenuto a destra */
        padding-left: 50%; /* Lascia spazio per l'etichetta */
        position: relative;
        border-bottom: 0;
    }
    .carrello-container table td::before {
        content: attr(data-label); /* Usa l'attributo per creare l'etichetta */
        position: absolute;
        left: 10px;
        font-weight: bold;
        text-align: left;
    }
    /* Per far funzionare il trucco di prima, dobbiamo modificare carrello.php */

    .payment-options {
        grid-template-columns: 1fr; /* Una sola colonna per le opzioni di pagamento */
    }
}

/* Stili specifici per telefoni molto piccoli (fino a 480px) */
@media (max-width: 480px) {
    header h1 {
        font-size: 25px;
    }
    .menu-categoria {
        grid-template-columns: 1fr; /* Una sola colonna per il menu */
    }
}

/* Sostituisci questo blocco alla fine del tuo file style.css */

/* ===================================== */
/* Stili per Menu Hamburger Responsive   */
/* ===================================== */

/* AGGIORNATO: Stile del link della categoria attiva */
nav a.link-attivo {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    color: #ffdd57; /* Un colore giallo per evidenziare */
}

nav .carrello-link {
    background-color: #e67e22;
    padding: 8px 8px;
    border-radius: 5px;
}

/* Stile del bottone Hamburger (nascosto su desktop) */
#hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

#hamburger-btn span {
    width: 30px;
    height: 3px;
    background-color: white;
    border-radius: 5px;
    transition: all 0.3s ease-in-out;
}

/* Animazione del bottone in una "X" quando ha la classe .active */
#hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
#hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}
#hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}


/* Media Query per schermi piccoli (es. fino a 768px) */
@media (max-width: 768px) {
    
    #hamburger-btn {
        display: flex;
    }

    #main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 250px;
        height: 100vh;
        background-color: #333;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        transition: right 0.4s ease-in-out;
        z-index: 1000;
    }

    /* AGGIORNATO: il selettore ora usa la nuova classe '.menu-aperto' */
    #main-nav.menu-aperto {
        right: 0;
    }

    #main-nav a {
        color: white;
        font-size: 1.5rem;
        margin-bottom: 7px;
    }

    #main-nav .carrello-link {
        background-color: #d35400;
    }
}

