/* LISTA */
.cart-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ITEM */
.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr 120px 120px 140px 100px;
    align-items: center;
    gap: 15px;

    padding: 15px;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #fff;
}

.cart-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* IMAGEM */
.cart-img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
}

/* INFO */
.cart-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}


/* TAMANHO */
.cart-info div {
    font-size: 14px;
    color: #555;
}

/* QUANTIDADE */
.cart-qtd {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: fit-content;
    padding: 5px;
    border: 1px solid #d8e0ea;
    border-radius: 8px;
    justify-self: center;
}

.cart-qtd button {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 5px;
    background: var(--primary-blue);
    color: #fff;
    cursor: pointer;
}

.cart-qtd button:hover {
    background: #000;
    color: #fff;
}

.cart-qtd span {
    min-width: 25px;
    text-align: center;
    font-weight: bold;
}

/* PREÇO */
.cart-info div strong {
    font-size: 15px;
    color: #000;
}

.cart-actions {
    display: flex;
    gap: 10px;
}

.btn-limpar {
    background: var(--primary-blue);
    border: 1px solid var(--primary-blue);
    color: #fff;

    padding: 10px 15px;
    border-radius: 8px;

    cursor: pointer;
    transition: 0.2s;

    font-size: 14px;
}

.btn-limpar:hover {
    background: var(--secondary-blue);
}


/* BOTÃO REMOVER */

.btn-remover:hover {
    text-decoration: underline;
}

/* TOTAL GERAL */

.cart-total h3 {
    margin: 0;
    font-size: 20px;
}

.cart-nome {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cart-categoria {
    color: #6b7280;
    font-size: 14px;
}

.cart-unit,
.cart-total-item {
    text-align: center;
    font-size: 14px;
}

.cart-total-item {
    font-weight: bold;
}

.cart-remove {
    text-align: center;
}

.btn-remover {
    display: inline-block;
    padding: 8px 16px;
    border: 0;
    border-radius: 6px;
    background: #dc3545;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

.btn-remover:hover {
    background: #b02a37;
    color: #fff;
    text-decoration: none;
}

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    padding: 35px 20px;
    margin: 20px 0;
    border: 1px dashed #c7d2df;
    border-radius: 14px;
    background: #f7faff;
    text-align: center;
}

.cart-empty i {
    margin-bottom: 14px;
    color: var(--primary-blue);
    font-size: 42px;
}

.cart-empty h2 {
    margin: 0 0 8px;
    color: var(--primary-blue);
}

.cart-empty p {
    margin: 0 0 20px;
    color: #667384;
}

.cart-empty .btn-secondary {
    width: auto;
}

.toast-carrinho {
    position: fixed;
    z-index: 10000;
    right: 24px;
    bottom: 24px;
    max-width: min(360px, calc(100vw - 32px));
    padding: 14px 18px;
    border: 1px solid #9ccfe3;
    border-radius: 8px;
    background: #d9edf7;
    color: #000;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

.toast-carrinho.visivel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cart-total {
    margin-top: 20px;
    padding: 20px;

    border: 1px solid #eee;
    border-radius: 12px;
    background: #fff;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.btn-cancelar {
    width: 100%;
    margin-top: 10px;

    padding: 12px;
    border-radius: 8px;

    border: none;
    background: var(--primary-blue);

    color: #fff;
    font-size: 14px;
    font-weight: 500;

    cursor: pointer;
    transition: 0.2s;
}

.btn-cancelar:hover {
    background: var(--secondary-blue);
}

.btn-cancelar::before {
    content: "✖ ";
}

/* TEXTO DO TOTAL */
.cart-total-info {
    display: flex;
    flex-direction: column;
}

.cart-total-info span {
    font-size: 13px;
    color: #666;
}

.cart-total-info strong {
    font-size: 22px;
    color: #000;
}

/* BOTÃO */
#btn-whatsapp {
    background: #25D366;
    color: #000;

    border: none;
    padding: 12px 20px;

    font-size: 14px;
    border-radius: 8px;

    cursor: pointer;
    transition: 0.2s;

    width: auto;
    /* 🔥 remove largura total */
    min-width: 200px;
}

#btn-whatsapp:hover {
    background: #1ebe5d;
    color: #000;
}

#btn-whatsapp i {
    margin-right: 7px;
}

/* FUNDO ESCURO */
#modal-lojas {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    background: rgba(0, 0, 0, 0.5);

    display: none;
    /* começa escondido */

    align-items: center;
    justify-content: center;

    z-index: 9999;
}

/* CAIXA */

#modal-lojas {
    opacity: 0;
    transition: opacity 0.2s ease;
}

#modal-lojas.ativo {
    display: flex;
    opacity: 1;
}

#modal-lojas .modal-content {
    transform: scale(0.9);
    transition: transform 0.2s ease;
}

#modal-lojas.ativo .modal-content {
    transform: scale(1);
}


#modal-lojas .modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    width: 320px;
    max-width: 90%;
}

/* BOTÕES */
#lista-lojas button {
    width: 100%;
    padding: 12px;

    border-radius: 8px;
    border: 1px solid #eee;

    background: #fff;
    cursor: pointer;

    transition: 0.2s;
}

#lista-lojas button:hover {
    background: #000;
    color: #fff;
}

@media (max-width: 768px) {

    .cart-page,
    body > .container {
        width: calc(100% - 24px);
        max-width: none;
        padding-left: 0;
        padding-right: 0;
    }

    body > .container > h1 {
        font-size: 1.8rem;
        margin: 22px 0 16px;
    }

    .cart-item {
        grid-template-columns: 20% minmax(0, 1fr) auto;
        grid-template-areas:
            "imagem info quantidade"
            "imagem unit total"
            "remover remover remover";
        align-items: center;
        gap: 8px 10px;
        padding: 12px;
    }

    .cart-img {
        grid-area: imagem;
        width: 100%;
        height: auto;
        max-height: 90px;
        object-fit: cover;
    }

    .cart-nome { grid-area: info; min-width: 0; }
    .cart-qtd { grid-area: quantidade; justify-content: flex-end; }
    .cart-unit { grid-area: unit; text-align: left; }
    .cart-total-item { grid-area: total; text-align: right; }
    .cart-remove { grid-area: remover; text-align: right; }

    .cart-nome strong {
        display: block;
        overflow-wrap: anywhere;
    }

    .cart-qtd {
        gap: 4px;
    }

    .cart-qtd button {
        width: 28px;
        height: 28px;
    }

    .cart-total {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    #btn-whatsapp {
        width: 100%;
    }

    .cart-actions {
        width: 100%;
        flex-direction: column;
    }

    .btn-limpar,
    #btn-whatsapp {
        width: 100%;
    }

    .cart-remove {
        text-align: center;
    }

    .cart-empty {
        min-height: 240px;
        margin: 12px 0;
    }

    .toast-carrinho {
        right: 16px;
        bottom: 16px;
        left: 16px;
        max-width: none;
        text-align: center;
    }

    #modal-lojas .modal-content {
        width: calc(100% - 32px);
        max-width: none;
        max-height: 80vh;
        overflow-y: auto;
        box-sizing: border-box;
    }

}
