/* =========================================
   RESET BÁSICO E CONFIGURAÇÕES GLOBAIS
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Arial', sans-serif;
    background-color: #f4f7f6; /* Um cinza bem claro */
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: #2c5e1a; /* Verde principal */
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* =========================================
   CABEÇALHO (HEADER)
   ========================================= */
header {
    background-color: #ffffff;
    padding: 20px 0;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 a {
    color: #222;
    text-decoration: none;
}

#user-welcome span {
    font-weight: bold;
    margin-right: 10px;
}

#user-welcome a {
    font-weight: bold;
}

#user-welcome button {
    background-color: #dc3545; /* Vermelho para "Sair" */
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
#user-welcome button:hover {
    background-color: #c82333;
}

/* =========================================
   LAYOUT DA LOJA (PRODUTOS + CARRINHO)
   ========================================= */
.store-container {
    display: flex;
    flex-wrap: wrap; /* Permite que o carrinho vá para baixo em telas pequenas */
    margin-top: 30px;
    gap: 30px; /* Espaço entre produtos e carrinho */
}

main {
    flex: 3; /* Ocupa 3/4 do espaço */
    min-width: 300px; /* Largura mínima */
}

main h2 {
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

/* =========================================
   GRID DE PRODUTOS
   ========================================= */
.product-list {
    display: grid;
    /* Grid responsivo:
       - Tenta criar colunas de no mínimo 250px
       - Cria quantas colunas couberem, com tamanho igual
    */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.product-card {
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    padding: 20px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px); /* Efeito de "levantar" */
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.product-card img {
    max-width: 100%;
    height: 200px; /* Altura fixa para alinhar */
    object-fit: cover; /* Garante que a imagem cubra a área sem distorcer */
    margin-bottom: 15px;
    border-radius: 4px;
}

.product-card h3 {
    font-size: 1.25rem;
    margin-bottom: 10px;
}

.product-card .price {
    font-size: 1.15rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

.add-to-cart-btn {
    background-color: #2c5e1a; /* Verde principal */
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    width: 100%;
    transition: background-color 0.3s ease;
}
.add-to-cart-btn:hover {
    background-color: #1e4212; /* Verde mais escuro */
}

/* =========================================
   CARRINHO (SIDEBAR)
   ========================================= */
.cart-section {
    flex: 1; /* Ocupa 1/4 do espaço */
    min-width: 280px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    padding: 20px;
    /* 'self-start' faz o carrinho parar no topo e não descer com o scroll */
    align-self: flex-start; 
}

.cart-section h2 {
    text-align: center;
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed #eee;
    padding: 10px 0;
}
.cart-item:last-child {
    border-bottom: none;
}

.cart-item-info span {
    display: block;
}
.cart-item-info span:first-child {
    font-weight: bold;
}

.remove-item-btn {
    background-color: #ffc107; /* Amarelo alerta */
    color: #333;
    border: none;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}
.remove-item-btn:hover {
    background-color: #e0a800;
}

.cart-total {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #333;
    text-align: right;
    font-size: 1.25rem;
}

.btn-checkout {
    background-color: #28a745; /* Verde sucesso (mais claro) */
    color: white;
    border: none;
    padding: 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    width: 100%;
    margin-top: 20px;
    transition: background-color 0.3s ease;
}
.btn-checkout:hover {
    background-color: #218838;
}
.btn-checkout:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* =========================================
   RODAPÉ (FOOTER)
   ========================================= */
footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px;
    background: #e9ecef;
    color: #666;
    border-top: 1px solid #ddd;
}
/* Estilo para o link do card de produto */
.product-link {
    text-decoration: none;
    color: inherit; /* Herda a cor do texto normal */
}
.product-link:hover h3 {
    text-decoration: underline; /* Sublinha o nome ao passar o mouse */
}