/* ========================================================================================
   css_2026_Carrello_libri.css
   Pagina /libri/carrello — carrello, suggeriti, overlay ricerca, toast
   Allineato allo stile del carrello corsi (css_2026_Form-iscrizione.css)
   ======================================================================================== */


/* ----------------------------------------------------------------
   CARRELLO CONTAINER
   ---------------------------------------------------------------- */

.cl-carrello {
    width: 100%;
    margin-bottom: 30px;
}

.cl-carrello-vuoto {
    text-align: center;
    padding: 30px 20px;
    color: var(--nsf-red);
    font-size: 18px;
    font-style: italic;
}


/* ----------------------------------------------------------------
   CARRELLO LISTA
   ---------------------------------------------------------------- */

.cl-carrello-lista {
    width: 100%;
    background: var(--nsf-white);
    font-size: 16px;
    font-weight: 500;
}


/* ----------------------------------------------------------------
   CARRELLO ITEM — DESKTOP
   ---------------------------------------------------------------- */

.cl-item {
    display: grid;
    grid-template-columns: 100px 1fr auto auto;
    gap: 20px;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--nsf-gray-300);
}

.cl-item:last-child {
    border-bottom: 1px solid var(--nsf-gray-500);
}


/* ----------------------------------------------------------------
   IMMAGINE COPERTINA
   ---------------------------------------------------------------- */

.cl-item-img-link {
    display: block;
    flex-shrink: 0;
}

.cl-item-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    object-position: center;
    border: 1px solid var(--nsf-gray-300);
    background: var(--nsf-white);
}


/* ----------------------------------------------------------------
   INFO (titolo, autore, qty)
   ---------------------------------------------------------------- */

.cl-item-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.cl-item-titolo {
    font-weight: 600;
    color: var(--nsf-black-pure);
    font-size: 20px;
    letter-spacing: 0.85px;
}

.cl-item-titolo a {
    color: inherit;
    text-decoration: none;
}

.cl-item-titolo a:hover {
    text-decoration: underline;
}

.cl-item-autore {
    font-size: 14px;
    color: var(--nsf-black-soft);
    font-weight: 400;
}


/* ----------------------------------------------------------------
   QUANTITÀ: label + input + pulsante aggiorna
   ---------------------------------------------------------------- */

.cl-item-qty-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.cl-item-qty-label {
    font-size: 13px;
    color: var(--nsf-gray-600);
    font-weight: 400;
}

.cl-item-qty {
    width: 52px !important;
    padding: 5px 6px !important;
    border: 1px solid var(--nsf-gray-300) !important;
    border-radius: 3px !important;
    text-align: center !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    background: var(--nsf-white) !important;
    height: auto !important;
    min-width: 0 !important;
    max-width: 52px !important;
    box-shadow: none !important;
    outline: none !important;
    margin: 0 !important;
}

.cl-item-qty:focus {
    outline: none !important;
    border-color: var(--nsf-info) !important;
    box-shadow: none !important;
}

.cl-item-qty-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.cl-item-qty-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--nsf-gray-750);
    transition: fill 0.2s ease;
}

.cl-item-qty-btn:hover {
    transform: scale(1.15);
}

.cl-item-qty-btn:hover svg {
    fill: var(--nsf-info);
}


/* ----------------------------------------------------------------
   PREZZO
   ---------------------------------------------------------------- */

.cl-item-prezzo {
    color: var(--nsf-black-soft);
    font-weight: 400;
    white-space: nowrap;
    font-size: 14px;
    text-align: right;
}


/* ----------------------------------------------------------------
   PULSANTE RIMUOVI (stile carrello corsi)
   ---------------------------------------------------------------- */

.cl-item-rimuovi {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.cl-item-rimuovi svg {
    width: 24px;
    height: 24px;
    fill: var(--nsf-black-soft);
    transition: fill 0.2s ease, transform 0.2s ease;
}

.cl-item-rimuovi:hover svg {
    fill: var(--nsf-red);
    transform: scale(1.3);
}


/* ----------------------------------------------------------------
   ANIMAZIONE PREZZO
   ---------------------------------------------------------------- */

@keyframes prezzo-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.cl-item-prezzo.pulse {
    animation: prezzo-pulse 0.3s ease-out;
}


/* ----------------------------------------------------------------
   TOTALE
   ---------------------------------------------------------------- */

.cl-carrello-totale {
    padding: 15px 0;
    border-top: 1px solid var(--nsf-gray-400);
    border-bottom: 1px solid var(--nsf-black-60);
    font-weight: 400;
}

.cl-totale-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--nsf-gray-200);
}

.cl-totale-row:last-child {
    border-bottom: none;
}

.cl-totale-row-finale {
    padding-top: 10px !important;
    border-bottom: none;
}

.cl-totale-label {
    font-size: 14px;
    color: var(--nsf-black-soft);
    text-align: right;
    padding-right: 15px;
}

.cl-totale-value {
    color: var(--nsf-black-pure);
    display: inline-block;
    font-weight: 400;
    font-size: 14px;
    width: 100px;
    text-align: right;
}

.cl-totale-row-finale .cl-totale-label {
    font-weight: 600;
}

.cl-totale-row-finale .cl-totale-value {
    font-weight: 600;
    font-size: 16px;
}


/* ----------------------------------------------------------------
   MOBILE CARRELLO
   ---------------------------------------------------------------- */

@media (max-width: 767px) {

    .cl-item {
        grid-template-columns: 70px 1fr 40px;
        grid-template-rows: auto auto auto auto;
        grid-template-areas:
            "img    nome    bin"
            "img    autore  bin"
            "img    prezzo  bin"
            "img    qty     .";
        gap: 4px 12px;
        padding: 14px 0;
    }

    .cl-item-img-link {
        grid-area: img;
        align-self: start;
        padding-top: 2px;
    }

    .cl-item-img {
        width: 70px;
        height: 70px;
    }

    .cl-item-info {
        display: contents;
    }

    .cl-item-titolo {
        grid-area: nome;
        font-size: 15px;
        align-self: end;
        line-height: 1.3;
    }

    .cl-item-autore {
        grid-area: autore;
        font-size: 13px;
        align-self: start;
    }

    .cl-item-prezzo {
        grid-area: prezzo;
        text-align: left;
        align-self: center;
        margin-top: 0;
        font-size: 15px;
        font-weight: 500;
        color: var(--nsf-black-pure);
    }

    .cl-item-qty-wrap {
        grid-area: qty;
        margin-top: 2px;
    }

    .cl-item-rimuovi {
        grid-area: bin;
        width: 40px;
        height: 40px;
        align-self: start;
        padding-top: 2px;
    }

    .cl-item-rimuovi svg {
        width: 22px;
        height: 22px;
    }

}


/* ----------------------------------------------------------------
   SUGGERITI HEADER
   ---------------------------------------------------------------- */

.cl-suggeriti-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 40px;
    margin-bottom: 16px;
}

.cl-suggeriti-titolo {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.cl-ricerca-toggle {
    background: none;
    border: 1px solid var(--nsf-gray-300);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.cl-ricerca-toggle:hover {
    background: var(--nsf-gray-100);
}

.cl-ricerca-toggle svg {
    width: 20px;
    height: 20px;
    fill: var(--nsf-black);
}


/* ----------------------------------------------------------------
   SUGGERITI CAROUSEL — card compatte, senza autore
   ---------------------------------------------------------------- */

.cl-suggeriti-carousel {
    margin-bottom: 40px;
}

.cl-sug-card {
    width: 160px;
    margin-right: 12px;
    border: 1px solid var(--nsf-gray-300);
    background: var(--nsf-white);
    cursor: pointer;
    position: relative;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.cl-sug-card:hover {
    transform: scale(1.06) translateY(-8px);
    box-shadow: 0 12px 28px var(--nsf-black-20);
    z-index: 10;
}

.cl-sug-img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.cl-sug-info {
    padding: 8px;
}

.cl-sug-titolo {
    font-size: 12px;
    font-weight: 600;
    color: var(--nsf-black-pure);
    line-height: 1.3;
    margin-bottom: 6px;
    min-height: 32px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cl-sug-autore {
    display: none;
}

.cl-sug-prezzo {
    font-weight: 600;
    font-size: 14px;
    color: var(--nsf-black-pure);
    margin-bottom: 8px;
}

.cl-sug-btn {
    width: 100%;
    padding: 7px 8px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--nsf-black-pure);
    background: var(--nsf-white);
    color: var(--nsf-black);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.cl-sug-btn svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

@media (max-width: 767px) {

    .cl-sug-card {
        width: 130px;
        margin-right: 8px;
    }

    .cl-sug-img {
        aspect-ratio: 1 / 1;
    }

    .cl-sug-titolo {
        font-size: 11px;
        min-height: 28px;
    }

    .cl-sug-prezzo {
        font-size: 13px;
    }

    .cl-sug-btn {
        padding: 6px;
        font-size: 11px;
    }

    .cl-sug-btn svg {
        width: 11px;
        height: 11px;
    }

}


/* ----------------------------------------------------------------
   OVERLAY RICERCA
   ---------------------------------------------------------------- */

.cl-ricerca-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.cl-ricerca-overlay.aperto {
    opacity: 1;
    pointer-events: all;
}

.cl-ricerca-container {
    background: var(--nsf-white);
    width: min(600px, 95vw);
    max-height: 80vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

.cl-ricerca-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    opacity: 0.5;
    z-index: 2;
}

.cl-ricerca-close:hover {
    opacity: 1;
}

.cl-ricerca-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--nsf-gray-200);
}

.cl-ricerca-icon-logo {
    width: 24px;
    height: 24px;
}

.cl-ricerca-icon-search {
    width: 18px;
    height: 18px;
    fill: var(--nsf-gray-400);
    flex-shrink: 0;
}

.cl-ricerca-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
}

.cl-ricerca-clear {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--nsf-gray-500);
    display: none;
    padding: 4px;
}

.cl-ricerca-results {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}


/* ----------------------------------------------------------------
   RICERCA RISULTATI
   ---------------------------------------------------------------- */

.cl-ricerca-vuoto {
    padding: 30px 20px;
    text-align: center;
    color: var(--nsf-gray-600);
}

.cl-ricerca-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--nsf-gray-100);
    transition: background 0.15s;
}

.cl-ricerca-item:hover {
    background: var(--nsf-gray-50, #fafafa);
}

.cl-ricerca-item-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}

.cl-ricerca-item-info {
    flex: 1;
    min-width: 0;
}

.cl-ricerca-item-titolo {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
}

.cl-ricerca-item-autore {
    font-size: 12px;
    color: var(--nsf-gray-600);
}

.cl-ricerca-item-prezzo {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.cl-ricerca-item-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    flex-shrink: 0;
}

.cl-ricerca-item-btn:hover {
    background: var(--nsf-gray-200);
}

.cl-ricerca-item-btn svg {
    width: 22px;
    height: 22px;
    fill: var(--nsf-black);
}

.cl-ricerca-item-btn.nel-carrello svg {
    fill: var(--nsf-success-alt);
}

.cl-ricerca-item-btn.nel-carrello {
    cursor: default;
}


/* ----------------------------------------------------------------
   RICERCA RISULTATI — ITEM NEL CARRELLO
   Allineato al catalogo corsi: display: none immediato
   ---------------------------------------------------------------- */

.rcs-item.rcs-nel-carrello {
    display: none;
}


/* ----------------------------------------------------------------
   RICERCA FOOTER
   ---------------------------------------------------------------- */

.cl-ricerca-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--nsf-gray-200);
}

.cl-ricerca-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--nsf-black);
    text-decoration: none;
}

.cl-ricerca-footer-link:hover {
    text-decoration: underline;
}

.cl-ricerca-footer-link svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}


/* ----------------------------------------------------------------
   TOAST
   ---------------------------------------------------------------- */

.cl-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--nsf-success);
    color: var(--nsf-white);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 10000;
    max-width: 90vw;
    text-align: center;
}

.cl-toast.visibile {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* ----------------------------------------------------------------
   MOBILE OVERLAY RICERCA
   ---------------------------------------------------------------- */

@media (max-width: 767px) {

    .cl-ricerca-container {
        max-height: 90vh;
        border-radius: 0;
        height: 100%;
    }

    .cl-ricerca-overlay {
        padding-top: 0;
    }

}