/* ==========================================================================
   CSS COMPLETO E FINAL DO CARRINHO DE ORÇAMENTO (v.2025)
   ========================================================================== */

/* --- 1. Estilos Gerais do Offcanvas e Responsividade --- */

/* BASE (Mobile): Ocupa 100% da tela por padrão */
.offcanvas.offcanvas-end {
    --bs-offcanvas-width: 100%; /* Em telas de celular, ocupa a largura total */
    border-left: none; /* Remove a borda quando está em tela cheia */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* TABLETS E DESKTOPS (Telas > 768px): Volta a ser uma barra lateral */
@media (min-width: 768px) {
    .offcanvas.offcanvas-end {
        --bs-offcanvas-width: 420px; /* Largura fixa e confortável para telas maiores */
        border-left: 1px solid #dee2e6; /* Readiciona a borda para separar do conteúdo */
    }
}

.offcanvas-header {
    border-bottom: 1px solid #e9ecef;
}
.offcanvas-title {
    font-weight: 600;
    color: #212529;
}
.offcanvas-body {
    padding: 0;
    display: flex;
    flex-direction: column;
}


/* --- 2. Layout do Carrinho (Rodapé Fixo e Conteúdo Rolável) --- */
.carrinho-container {
    display: flex;
    flex-direction: column;
    height: 100%; /* Ocupa toda a altura do offcanvas-body */
    width: 100%;
    background-color: #f8f9fa; /* Fundo leve para a área dos itens */
}

.carrinho-lista {
    flex-grow: 1; /* Faz esta área crescer e ocupar o espaço disponível */
    overflow-y: auto; /* Adiciona scroll SÓ AQUI quando necessário */
    padding: 1rem;
}


/* --- 3. Estilo de cada Item do Carrinho --- */
.carrinho-item {
    display: grid;
    grid-template-columns: 65px 1fr auto; /* Colunas: Imagem, Informações, Preço/Remover */
    gap: 1rem;
    align-items: center;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid #e9ecef;
    background-color: #fff;
}
.carrinho-item:first-child {
    border-top: 1px solid #e9ecef;
}

.carrinho-item__imagem {
    width: 65px;
    height: 65px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #f1f3f5;
}

.carrinho-item__info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* Espaço entre o nome e os controles */
    /* **NOVO** Impede que o container seja forçado a alargar por um texto longo */
    min-width: 0;
}

.carrinho-item__nome {
    font-weight: 500;
    color: #343a40;
    line-height: 1.3;
    margin: 0;
    /* **NOVO** Adiciona as regras de quebra de linha para nomes longos */
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.carrinho-item__preco-e-remover {
    text-align: right;
}

.carrinho-item__preco {
    font-weight: 600;
    color: #212529;
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.excluirItem__carrinho {
    background: none;
    border: none;
    color: #adb5bd;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
}
.excluirItem__carrinho:hover {
    color: #dc3545;
}


/* --- 4. Controles de Quantidade --- */
.carrinho__descricao__quantidade {
    display: flex;
    align-items: center;
    border: 1px solid #ced4da;
    border-radius: 6px;
    width: fit-content;
}
.controle__quantidade {
    border: none; 
    background: transparent; 
    padding: 0.1rem 0.8rem; /* Aumenta a área de clique */
    font-size: 1.4rem; 
    cursor: pointer; 
    color: #495057;
}
.controle__contador {
    width: 2.5em; 
    text-align: center; 
    border: none; 
    background: transparent;
    font-weight: 500; 
    border-left: 1px solid #ced4da; 
    border-right: 1px solid #ced4da;
    color: #212529;
    padding: 0;
}


/* --- 5. Rodapé Fixo do Carrinho --- */
.carrinho-footer {
    padding: 1rem 1.5rem;
    background-color: #fff;
    border-top: 1px solid #e9ecef;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
    /* Garante que o rodapé não encolha */
    flex-shrink: 0;
}
.subtotal-linha {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
.subtotal-linha span:first-child {
    color: #495057;
}
.subtotal-linha span:last-child {
    font-size: 1.25rem;
}


/* --- 6. Botão Principal (WhatsApp) --- */
.botao-whatsapp-full {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.85rem;
    background-color: #25D366;
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.botao-whatsapp-full:hover {
    background-color: #1EBE57;
}

.carrinho-vazio {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #6c757d;
    padding: 2rem;
}
.carrinho-vazio p {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
}