/* ========================================
   CART.CSS - Carrello e Checkout
   ======================================== */

/* CONTENITORE CARRELLO */
.carrello-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 16px;
}

.carrello-header {
    position: sticky;
    top: var(--header-height);
    background: #fff;
    z-index: 9;
    padding: 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
}

.carrello-layout {
    display: flex;
    align-items: flex-start;
    gap: 32px;
    margin-top: 20px;
}

.carrello-titolo {
    font-size: 22px;
    margin-bottom: 16px;
    color: #333;
}

.carrello-articoli {
    flex: 2;
}

.carrello-riepilogo {
    flex: 1;
    position: relative;
}

.sticky {
    position: sticky;
    top: calc(var(--header-height) + 30px);
    z-index: 10;
}

/* BOX E CONTENUTO */
.carrello-box {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 16px;
}

.carrello-riga {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    align-items: flex-start;
}

.carrello-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 10px 0;
}

/* IMMAGINE PRODOTTO */
.item-foto {
    width: 185px;
    height: 139px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.item-foto img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* DATI ARTICOLO */
.item-dati {
    flex: 1;
    overflow: hidden;
}

.descrizione {
    font-size: 16px;
    font-weight: 600;
    margin: 4px 0;
}

.info-piccole {
    font-size: 13px;
    color: #777;
    margin-bottom: 4px;
}

/* QUANTITÀ */
.input-quantita {
    width: 50px;
    text-align: center;
    padding: 5px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.input-quantita::-webkit-outer-spin-button,
.input-quantita::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-quantita {
    -moz-appearance: textfield;
}

.btn-meno,
.btn-piu,
.btn-x {
    width: 28px;
    height: 28px;
    font-size: 18px;
    font-weight: bold;
    border: 1px solid #ccc;
    background-color: #f9f9f9;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-x {
    color: red;
    background: transparent;
    border: none;
}

.btn-piu:disabled,
.btn-meno:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.popup-btn-ok {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    font-size: 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.popup-btn-ok:hover {
    background-color: #0056b3;
}

/* FORM RIEPILOGO */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 6px 8px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    margin-top: 4px;
    margin-bottom: 10px;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #999;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

/* TOTALE RIGA */
.totale-riga {
    font-weight: bold;
    margin-top: 8px;
    font-size: 15px;
    color: #333;
}

/* SELECT E RIEPILOGO */
.styled-select {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #bbb;
    font-size: 14px;
    background-color: #f9f9f9;
    margin-top: 4px;
}

.styled-select option {
    white-space: pre-wrap;
}

.spiegazione {
    font-size: 0.9em;
    color: #555;
    font-style: italic;
}

.totali {
    border-top: 1px solid #ccc;
    margin-top: 16px;
    padding-top: 12px;
}

.totali p {
    margin: 4px 0;
    font-size: 15px;
}

.totali h3 {
    margin-top: 8px;
    font-size: 18px;
    font-weight: bold;
}

/* BOTTONE E MESSAGGIO ERRORE */
.btn-conferma {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background: #007bff;
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}

.btn-conferma:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.msg-errore {
    margin-top: 10px;
    color: red;
    font-size: 14px;
    text-align: center;
}

/* POPUP ALERT CARRELLO */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-box {
    background: #fff;
    padding: 24px;
    border-radius: 10px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    font-size: 16px;
}

.popup-btns {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-popup {
    flex: 1;
    padding: 12px;
    font-size: 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    height: 44px;
    line-height: 1;
    box-sizing: border-box;
}

.btn-annulla {
    background: #ccc;
    color: #333;
}

.btn-conferma-elimina {
    background: #d9534f;
    color: white;
}

