/* Estilos gerais da página do carrinho */
#carrinho-container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff; /* Fundo branco, como solicitado */
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

/* Layout principal: Itens à esquerda, resumo à direita */
.carrinho-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

/* Responsividade para telas menores */
@media (max-width: 992px) {
    .carrinho-grid {
        grid-template-columns: 1fr; /* Coluna única */
    }
}

.carrinho-itens {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ======================================================= */
/* LAYOUT DO ITEM INDIVIDUAL (CORRIGIDO COM FLEXBOX)       */
/* ======================================================= */
.carrinho-item {
    display: flex;         /* USA FLEXBOX PARA O LAYOUT HORIZONTAL */
    align-items: center;   /* Alinha todos os elementos verticalmente ao centro */
    gap: 1.5rem;           /* Espaço entre os elementos */
    padding: 1.5rem;
    border: 1px solid #eee;
    border-radius: 8px;
    transition: background-color 0.2s, opacity 0.2s;
}

/* 1. Checkbox */
.carrinho-item-selecao {
    display: flex;
    align-items: center;
}

/* 2. Imagem */
.carrinho-item-img img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
}

/* 3. Informações do produto (nome, preço, quantidade) */
.carrinho-item-info {
    flex-grow: 1;          /* Faz esta div ocupar todo o espaço, empurrando o botão "remover" para a direita */
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Garante que o texto comece na esquerda */
    gap: 0.25rem;
}

.carrinho-item-nome {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    text-align: left; /* Garante alinhamento à esquerda */
}

.carrinho-item-nome a {
    color: #333;
    text-decoration: none;
}
.carrinho-item-nome a:hover {
    text-decoration: underline;
}

.carrinho-item-preco {
    font-size: 1rem;
    color: #555;
    margin: 0;
}

.carrinho-item-quantidade {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.carrinho-item-quantidade button {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    width: 30px;
    height: 30px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 1.2rem;
    line-height: 1;
}

.carrinho-item-quantidade input {
    width: 45px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.5rem;
    /* Remove as setas de incremento/decremento */
    -moz-appearance: textfield; /* Firefox */
    appearance: textfield; /* Padrão (embora a implementação varie) */
}
.carrinho-item-quantidade input::-webkit-outer-spin-button,
.carrinho-item-quantidade input::-webkit-inner-spin-button {
    -webkit-appearance: none; /* Chrome, Safari, Edge, Opera */
    appearance: none; /* Padrão para navegadores WebKit */
    margin: 0;
}

/* 4. Botão Remover */
.carrinho-item-remover button {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px;
    transition: color 0.2s;
}
.carrinho-item-remover button:hover {
    color: #c0392b;
}

/* =================================== */
/* ESTILOS PARA A SELEÇÃO              */
/* =================================== */

.carrinho-header-selecao {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    background-color: #fdfdfd;
}

.carrinho-header-selecao label {
    margin-left: 12px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    user-select: none;
}

.item-checkbox, #select-all-checkbox {
    transform: scale(1.4);
    margin: 0;
    cursor: pointer;
    accent-color: #007bff;
}

/* Efeito visual para itens não selecionados */
.carrinho-item:not(.selected) {
    background-color: #fafafa;
}

.carrinho-item:not(.selected) > * {
    opacity: 0.6;
}

/* =================================== */
/* RESUMO, CHECKOUT E CARRINHO VAZIO   */
/* =================================== */

.carrinho-resumo {
    background-color: #f9f9f9;
    padding: 2rem;
    border-radius: 8px;
    align-self: flex-start; /* Alinha o resumo no topo da grid */
}

.carrinho-resumo h2 {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

.resumo-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.resumo-total {
    font-weight: 700;
    font-size: 1.2rem;
    border-top: 1px solid #eee;
    padding-top: 1rem;
    margin-top: 1rem;
}

.checkout-btn {
    display: block;
    width: 100%;
    background-color: #2ecc71;
    color: #fff;
    text-align: center;
    padding: 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 2rem;
    transition: background-color 0.3s, opacity 0.3s;
    border: none;
}

.checkout-btn:hover {
    background-color: #27ae60;
}

.checkout-btn.disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.7;
}

.carrinho-vazio {
    text-align: center;
    padding: 4rem 2rem;
}

.carrinho-vazio h2 {
    font-size: 2rem;
    color: #555;
}

.carrinho-vazio p {
    font-size: 1.2rem;
    color: #777;
    margin-bottom: 2rem;
}

.carrinho-vazio .btn-continuar {
    background-color: #3498db;
    color: #fff;
    padding: 1rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 1.2rem;
    transition: background-color 0.3s;
}

.carrinho-vazio .btn-continuar:hover {
    background-color: #2980b9;
}
