* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --verde: #6DFE9B;
    --verde-agua: #C7FFD9;
    --branco: #fff;
    --preto: #000;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--verde-agua);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    justify-content: center;
    align-items: center;
}

#contener {
    background-color: var(--branco);
    width: 850px;
    height: 650px;
    padding: 20px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    font-size: 20px;
    color: var(--verde);
}

main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    width: 100%;
}

#productForm {
    width: 100%;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
}

#productForm .input {
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 5px;
}

input {
    border: 2px solid transparent;
    padding: 8px;
    outline: none;
    overflow: hidden;
    background-color: #F3F3F3;
    border-radius: 8px;
    transition: all 0.5s;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

input:hover,
input:focus {
    border: 2px solid var(--verde);
    box-shadow: 0px 0px 0px 7px #c7ffd980;
    background-color: transparent
}

button {
    width: 97%;
    display: block;
    margin: 0 auto;
    margin-top: 20px;
    background-color: var(--verde);
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.5s;
}

button:hover,
button:focus {
    box-shadow: 0px 0px 0px 7px #6dfe9b70;
    background-color: transparent
}


section {
    width: 98%;
    margin-top: 20px;
    margin-left: 7px;
    padding: 0 30px; 
}

table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden; 
max-height: 150px; /* Define a altura máxima que a lista pode ter (ajuste este valor) */
    overflow-y: auto; /* Adiciona a barra de rolagem vertical APENAS quando o conteúdo exceder a altura máxima */
    overflow-x: hidden; /* Garante que não haja rolagem horizontal desnecessária */
    
    /* Importante para a tabela ficar fixa dentro da área de rolagem */
    display: block;
}

thead th {
    color: var(--preto); 
    text-align: center; 
    padding: 10px;
    font-weight: bold;
    border: none;
    font-size: 1em;
    border-bottom: 2px solid var(--verde);
}

thead tr th:nth-child(1) {
    text-align: left;
    width: 45%; 
}

thead tr th:nth-child(2) { 
    width: 25%;
}

thead tr th:nth-child(3) { 
    width: 30%;
}

thead tr th:nth-child(4) { 
    width: 5%; 
    padding: 0;
}

#shoppingListBody td {
    padding: 8px 10px;
    border-bottom: 2px solid var(--verde); 
    font-size: 0.95em;
    text-align: center; 
}

#shoppingListBody tr td:nth-child(1) {
    text-align: left;
}

#shoppingListBody tr td:nth-child(3) {
    text-align: right;
}


.total-row {
    /* Garante que a linha de total fique no final */
    font-weight: bold;
    background-color: var(--branco); 
}

.total-row td { 
    font-weight: bold;
    padding: 8px 10px;
    border-top: none; 
    background-color: var(--branco);
    
    /* ⭐️ NOVO: Borda Verde Forte abaixo da linha do Total (como no anexo 1) ⭐️ */
    border-bottom: 3px solid var(--verde); 
}

/* Alinhar o texto "Total:" à esquerda na primeira célula */
.total-row td:first-child {
    text-align: left; 
}

/* O conteúdo das outras colunas (onde o R$ vai) é alinhado à direita */
.total-row td:last-child {
    text-align: right; 
}

#finishPurchaseButton {
    width: 100%;
}

footer {
    align-items: center;
    padding: 20px;
}