/**
 * @package     Wma.Component.Ristopizza
 * @subpackage  com_ristopizza
 *
 * @author      WMA Web Maker Agency
 * @copyright   (C) 2026 WMA Web Maker Agency
 * @license     GNU General Public License version 2 or later
 * @link        https://www.webmakeragency.com
 * @version     1.0.0
 * @date        03/04/2026
 * @file        media/css/sito-ordina.css
 *
 * Vista "Ordina" — griglia piatti e popup.
 * Tutte le classi usano il prefisso rp- per evitare conflitti
 * con Bootstrap, UIkit e altre estensioni.
 * Nessun uso della classe .btn o di classi di framework.
 */

/* ============================================================
   Variabili CSS
   I colori sono su :root così sono disponibili a popup,
   pannello carrello e toggle button (che vivono fuori dal
   contenitore principale).
   Le variabili di layout restano sul contenitore.
   ============================================================ */
:root {
    --rp-rosso:           #c0392b;
    --rp-rosso-scuro:     #a93226;
    --rp-testo:           #222;
    --rp-testo-secondario:#666;
    --rp-bordo:           #e0e0e0;
    --rp-sfondo-card:     #fff;
    --rp-sfondo-piede:    #fafafa;
    --rp-raggio:          8px;
}

.rp-contenitore-ordina {
    --rp-colonne: 4;
    --rp-gap:     1.25rem;
}

/* ============================================================
   Contenitore principale
   ============================================================ */
.rp-contenitore-ordina {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
}

/* ============================================================
   Griglia
   ============================================================ */
.rp-griglia {
    display: grid;
    grid-template-columns: repeat(var(--rp-colonne), 1fr);
    gap: var(--rp-gap);
}

/* ============================================================
   Card piatto
   ============================================================ */
.rp-piatto {
    background: var(--rp-sfondo-card);
    border: 1px solid var(--rp-bordo);
    border-radius: var(--rp-raggio);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
    transition: box-shadow .2s ease;
}

.rp-piatto:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, .13);
}

.rp-piatto--nascosto {
    display: none !important;
}

/* Immagine */
.rp-piatto-immagine {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f5f5f5;
    flex-shrink: 0;
}

.rp-piatto-immagine img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}

.rp-piatto:hover .rp-piatto-immagine img {
    transform: scale(1.05);
}

/* Corpo */
.rp-piatto-corpo {
    padding: .75rem 1rem .5rem;
    flex: 1;
}

.rp-piatto-titolo {
    margin: 0 0 .2rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--rp-testo);
    line-height: 1.3;
}

.rp-piatto-categoria {
    display: inline-block;
    font-size: .75rem;
    color: #999;
    font-style: italic;
    margin-bottom: .45rem;
}

/* Attributi (badge informativi) */
.rp-piatto-attributi {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin-top: .4rem;
}

.rp-attributo-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    background: #f3f3f3;
    border-radius: 20px;
    padding: .15rem .55rem;
    font-size: .7rem;
    color: #555;
    border: 1px solid #e8e8e8;
    line-height: 1.4;
}

.rp-attributo-icona {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Piede card: prezzo + pulsante */
.rp-piatto-piede {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .7rem 1rem;
    border-top: 1px solid #f0f0f0;
    background: var(--rp-sfondo-piede);
    gap: .5rem;
    flex-shrink: 0;
}

.rp-piatto-prezzo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--rp-rosso);
    white-space: nowrap;
}

/* Pulsante "Aggiungi" sulla card — nessuna classe .btn */
.rp-pulsante-aggiungi {
    background: var(--rp-rosso);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: .45rem 1rem;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s ease, transform .1s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.rp-pulsante-aggiungi:hover {
    background: var(--rp-rosso-scuro);
}

.rp-pulsante-aggiungi:active {
    transform: scale(.97);
}

/* ============================================================
   "Carica altri"
   ============================================================ */
.rp-carica-altri-contenitore {
    text-align: center;
    margin-top: 2.5rem;
    padding-bottom: 1rem;
}

.rp-pulsante-carica-altri {
    background: transparent;
    color: var(--rp-rosso);
    border: 2px solid var(--rp-rosso);
    border-radius: 6px;
    padding: .65rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

.rp-pulsante-carica-altri:hover {
    background: var(--rp-rosso);
    color: #fff;
}

/* ============================================================
   Nessun piatto
   ============================================================ */
.rp-nessun-piatto {
    text-align: center;
    padding: 4rem 1rem;
    color: #aaa;
    font-size: 1.1rem;
}

/* ============================================================
   Popup
   ============================================================ */
.rp-popup-sfondo {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .58);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

.rp-popup-sfondo--visibile {
    display: flex;
}

/* Blocca lo scroll del body quando il popup è aperto */
.rp-corpo-bloccato {
    overflow: hidden;
}

.rp-popup-contenitore {
    background: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .28);
    animation: rp-popup-entra .2s ease-out;
}

@keyframes rp-popup-entra {
    from {
        opacity: 0;
        transform: scale(.94) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Pulsante chiudi × */
.rp-popup-chiudi {
    position: absolute;
    top: .6rem;
    right: .7rem;
    background: rgba(0, 0, 0, .18);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: #fff;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease;
}

.rp-popup-chiudi:hover {
    background: rgba(0, 0, 0, .38);
}

/* Colonna sinistra: immagine */
.rp-popup-immagine {
    background: #f5f5f5;
    border-radius: 10px 0 0 10px;
    overflow: hidden;
}

.rp-popup-foto {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    min-height: 260px;
}

/* Colonna destra: dettagli */
.rp-popup-dettagli {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .7rem;
    overflow-y: auto;
}

.rp-popup-titolo {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--rp-testo);
    outline: none; /* focus programmatico per accessibilità */
}

.rp-popup-descrizione {
    margin: 0;
    font-size: .9rem;
    color: var(--rp-testo-secondario);
    line-height: 1.55;
}

/* Intestazione di sezione (Varianti / Condimenti) */
.rp-popup-sezione-titolo {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #aaa;
    margin: .3rem 0 .4rem;
}

/* Lista varianti */
.rp-popup-varianti-lista {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.rp-popup-variante-opzione {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    font-size: .9rem;
    padding: .3rem .5rem;
    border-radius: 5px;
    transition: background .1s ease;
    user-select: none;
}

.rp-popup-variante-opzione:hover {
    background: #f7f7f7;
}

.rp-popup-variante-opzione input[type="radio"] {
    accent-color: var(--rp-rosso);
    cursor: pointer;
    flex-shrink: 0;
}

/* Gruppi condimenti */
.rp-popup-condimenti-gruppo {
    margin-bottom: .5rem;
}

.rp-popup-condimenti-categoria {
    display: block;
    font-size: .73rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #bbb;
    margin-bottom: .3rem;
}

.rp-popup-condimento-opzione {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    font-size: .9rem;
    padding: .25rem .5rem;
    border-radius: 5px;
    transition: background .1s ease;
    user-select: none;
}

.rp-popup-condimento-opzione:hover {
    background: #f7f7f7;
}

.rp-popup-condimento-opzione input[type="checkbox"] {
    accent-color: var(--rp-rosso);
    cursor: pointer;
    flex-shrink: 0;
}

/* Piede popup: totale + (futuro) pulsante carrello */
.rp-popup-piede {
    margin-top: auto;
    padding-top: .75rem;
    border-top: 1px solid #f0f0f0;
}

.rp-popup-totale {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.rp-popup-totale-etichetta {
    font-weight: 600;
    color: var(--rp-testo-secondario);
    font-size: .95rem;
}

.rp-popup-totale-valore {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--rp-rosso);
}

/*
  Pulsante conferma — commentato fino all'implementazione del carrello.
  Quando verrà abilitato, usare questa classe:
*/
.rp-pulsante-conferma {
    width: 100%;
    background: var(--rp-rosso);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: .7rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: .75rem;
    transition: background .18s ease;
}

.rp-pulsante-conferma:hover {
    background: var(--rp-rosso-scuro);
}

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

/* Schermi medi: max 3 colonne */
@media (max-width: 1200px) {
    .rp-griglia {
        grid-template-columns: repeat(min(var(--rp-colonne), 3), 1fr);
    }
}

/* Tablet: 2 colonne, popup a colonna singola */
@media (max-width: 900px) {
    .rp-griglia {
        grid-template-columns: repeat(2, 1fr);
    }

    .rp-popup-contenitore {
        grid-template-columns: 1fr;
    }

    .rp-popup-immagine {
        border-radius: 10px 10px 0 0;
        max-height: 240px;
    }

    .rp-popup-foto {
        min-height: 200px;
    }
}

/* Smartphone: 1 colonna */
@media (max-width: 600px) {
    .rp-griglia {
        grid-template-columns: 1fr;
    }

    .rp-popup-contenitore {
        max-height: 96vh;
        border-radius: 10px 10px 0 0;
    }

    .rp-popup-sfondo {
        align-items: flex-end;
        padding: 0;
    }
}

/* ============================================================
   Selettore quantità nel popup
   ============================================================ */
.rp-popup-qty-wrap {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .75rem;
}

.rp-popup-qty-btn {
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    color: var(--rp-testo);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s ease;
}

.rp-popup-qty-btn:hover { background: #e0e0e0; }

.rp-popup-qty-valore {
    min-width: 32px;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
}

/* Errore variante obbligatoria */
.rp-popup-errore-variante {
    color: var(--rp-rosso);
    font-size: .82rem;
    margin: .3rem 0 0;
    padding: .3rem .55rem;
    background: #ffeaea;
    border-radius: 4px;
    display: none;
}

/* ============================================================
   Toast
   ============================================================ */
.rp-toast {
    position: fixed;
    bottom: 5.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #222;
    color: #fff;
    border-radius: 6px;
    padding: .55rem 1.25rem;
    font-size: .9rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    z-index: 10001;
    transition: opacity .22s ease, transform .22s ease;
}

.rp-toast--visibile {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
   Toggle button carrello (fisso in basso a destra)
   ============================================================ */
.rp-carrello-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9990;
    display: flex;
    align-items: center;
    gap: .45rem;
    background: var(--rp-rosso);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: .65rem 1.15rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .22);
    font-size: .9rem;
    font-weight: 600;
    transition: background .18s ease, transform .1s ease;
}

.rp-carrello-toggle:hover  { background: var(--rp-rosso-scuro); }
.rp-carrello-toggle:active { transform: scale(.96); }

.rp-carrello-toggle-icona {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.rp-carrello-toggle-icona svg {
    width: 20px;
    height: 20px;
}

.rp-carrello-badge {
    background: #fff;
    color: var(--rp-rosso);
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    font-size: .7rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    flex-shrink: 0;
    padding: 0 3px;
}

.rp-carrello-toggle-label {
    font-size: .85rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .rp-carrello-toggle-label { display: none; }
}

/* ============================================================
   Overlay
   ============================================================ */
.rp-carrello-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 9991;
}

.rp-carrello-overlay--visibile { display: block; }

/* ============================================================
   Pannello carrello
   ============================================================ */
.rp-carrello-pannello {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: 380px;
    max-width: 100vw;
    background: #fff;
    z-index: 9992;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0, 0, 0, .15);
    transform: translateX(105%);
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}

.rp-carrello-pannello--aperto { transform: translateX(0); }

/* Mobile: bottom sheet */
@media (max-width: 600px) {
    .rp-carrello-pannello {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 85dvh;
        border-radius: 16px 16px 0 0;
        transform: translateY(105%);
        box-shadow: 0 -4px 24px rgba(0, 0, 0, .15);
    }

    .rp-carrello-pannello--aperto { transform: translateY(0); }
}

/* Intestazione */
.rp-carrello-intestazione {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.rp-carrello-titolo {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--rp-testo);
}

.rp-carrello-chiudi {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #aaa;
    padding: 0 .25rem;
    transition: color .15s ease;
}

.rp-carrello-chiudi:hover { color: var(--rp-testo); }

/* Corpo scrollabile */
.rp-carrello-corpo {
    flex: 1;
    overflow-y: auto;
    padding: .75rem 1.25rem;
}

.rp-carrello-vuoto {
    text-align: center;
    padding: 3rem 1rem;
    color: #bbb;
    font-size: .95rem;
}

/* ============================================================
   Righe articoli nel pannello carrello
   ============================================================ */
.rp-cart-item {
    display: grid;
    grid-template-columns: 52px 1fr auto auto auto;
    align-items: center;
    gap: .55rem;
    padding: .65rem 0;
    border-bottom: 1px solid #f5f5f5;
}

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

.rp-cart-item-img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    background: #f5f5f5;
    flex-shrink: 0;
}

.rp-cart-item-info {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
}

.rp-cart-item-titolo {
    font-size: .88rem;
    font-weight: 600;
    color: var(--rp-testo);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rp-cart-item-dettagli {
    font-size: .75rem;
    color: var(--rp-testo-secondario);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rp-cart-item-qty {
    display: flex;
    align-items: center;
    gap: .25rem;
    flex-shrink: 0;
}

.rp-qty-btn {
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: .95rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s ease;
}

.rp-qty-btn:hover { background: #e0e0e0; }

.rp-qty-valore {
    min-width: 20px;
    text-align: center;
    font-size: .88rem;
    font-weight: 600;
}

.rp-cart-item-prezzo {
    font-size: .88rem;
    font-weight: 700;
    color: var(--rp-rosso);
    white-space: nowrap;
    flex-shrink: 0;
}

.rp-cart-item-rimuovi {
    background: none;
    border: none;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    color: #ccc;
    padding: 0 .2rem;
    flex-shrink: 0;
    transition: color .12s ease;
}

.rp-cart-item-rimuovi:hover { color: var(--rp-rosso); }

/* ============================================================
   Piede pannello carrello
   ============================================================ */
.rp-carrello-piede {
    padding: .75rem 1.25rem 1.5rem;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    flex-shrink: 0;
}

.rp-avviso-minimo,
.rp-avviso-consegna {
    font-size: .82rem;
    border-radius: 6px;
    padding: .45rem .75rem;
    text-align: center;
}

.rp-avviso-minimo {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.rp-avviso-consegna--info {
    background: #e8f4fd;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.rp-avviso-consegna--ok {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.rp-carrello-riga-totale {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .95rem;
    color: var(--rp-testo);
}

.rp-carrello-riga-totale strong {
    font-size: 1.1rem;
    color: var(--rp-rosso);
}

.rp-pulsante-checkout {
    width: 100%;
    background: var(--rp-rosso);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: .8rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s ease;
}

.rp-pulsante-checkout:hover:not(:disabled) { background: var(--rp-rosso-scuro); }

.rp-pulsante-checkout:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.rp-pulsante-svuota {
    background: none;
    border: none;
    color: #bbb;
    font-size: .8rem;
    cursor: pointer;
    text-align: center;
    text-decoration: underline;
    padding: 0;
    transition: color .12s ease;
}

.rp-pulsante-svuota:hover { color: var(--rp-rosso); }
