/* =========================================
   1. CONFIGURAÇÕES GLOBAIS E VARIÁVEIS
   ========================================= */
:root {
    /* Cores Principais */
    --bg-page: #f4f7f6; /* Cor de fundo da página (clara) */
    --bg-card: #ffffff; /* Cor de fundo dos cartões (branca) */
    --border-color: #eeeeee; /* Cor das bordas sutis */
    
    /* Cores de Texto */
    --text-main: #333333; /* Texto principal (escuro) */
    --text-light: #777777; /* Texto secundário (cinza) */
    
    /* Cor de Ação Uniforme (Laranja Pedido) */
    --primary-action: #ff5722; /* Laranja vibrante */
    --primary-text: #ffffff;   /* Texto branco sobre laranja */
    
    /* Cor de Perigo (Para o 'X') */
    --danger: #dc3545; /* Vermelho */
    
    /* Outros */
    --shadow: 0 4px 6px rgba(0,0,0,0.05); /* Sombra suave */
    --radius: 8px; /* Bordas arredondadas */
    --transition: all 0.3s ease; /* Transição suave para hovers */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* Garante que o padding não quebre o layout */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    padding: 20px;
}

a { text-decoration: none; transition: var(--transition); }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; } /* Imagens responsivas */

/* =========================================
   2. LAYOUT E GRADE DE PRODUTOS
   ========================================= */
.main-content {
    max-width: 1200px;
    margin: 0 auto; /* Centraliza a área de conteúdo */
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.content-header h1 {
    font-size: 2rem;
    font-weight: 700;
}

/* A Grade de Produtos (3 colunas no desktop) */
.product-grid {
    display: grid;
    /* Define o layout responsivo: mínimo 300px por card */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 
    gap: 25px; /* Espaço entre os cartões */
}

/* =========================================
   3. ESTILO DO CARTÃO DO PRODUTO (CARD)
   ========================================= */
.product-card, .product-item {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 25px;
    display: flex;
    flex-direction: column;
    position: relative; /* Importante para o botão 'X' */
    transition: var(--transition);
    border: 1px solid transparent;
}

.product-card:hover, .product-item:hover {
    transform: translateY(-5px); /* Efeito de elevação ao passar o mouse */
    border-color: #e0e0e0;
}

/* Área da Foto no Card */
.card-photo, .product-img-container {
    width: 100%;
    height: 300px; /* Altura fixa para a área da foto */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    overflow: hidden;
    background-color: #f9f9f9; /* Fundo cinza claro para fotos vazias */
    border-radius: 4px;
}

.product-img {
    max-height: 100%; /* Imagem não corta e mantém proporção */
    object-fit: contain;
}

/* Título e Detalhes no Card */
.product-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-main);
    text-align: center;
}

/* Seção de Links no Card */
.links-section { margin-top: auto; /* Empurra para o final do card */ }

.links-section h4 {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Container de Botões (O pedido principal: um abaixo do outro) */
.links-buttons, .purchase-buttons, .links-container {
    display: flex;
    flex-direction: column; /* FORÇA O EMPILHAMENTO VERTICAL */
    gap: 10px; /* Espaço entre os botões */
}

/* =========================================
   4. ESTILO DOS BOTÕES (Laranjas com texto branco)
   ========================================= */

/* Botões de Ação Comuns e de Compra (Laranjas) */
.btn-nav, .btn-submit, .btn-add-product, .buy-btn, .link-btn, .shop-link {
    background-color: var(--primary-action) !important; /* Laranja FORÇADO */
    color: var(--primary-text) !important; /* Texto branco FORÇADO */
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: none;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 2px 4px rgba(255, 87, 34, 0.2); /* Sombra laranja sutil */
}

.btn-nav:hover, .btn-submit:hover, .btn-add-product:hover, .buy-btn:hover, .link-btn:hover, .shop-link:hover {
    opacity: 0.9; /* Efeito visual simples no hover */
    transform: translateY(-2px);
}

/* Mantém os ícones brancos dentro dos botões */
.link-btn i, .shop-link i { color: white; }

/* =========================================
   5. BOTÃO DE REMOVER ('X')
   ========================================= */
.btn-remove, .btn-delete {
    position: absolute;
    top: -12px; /* Posiciona para fora do card no topo */
    right: -12px; /* Posiciona para fora do card na direita */
    background-color: var(--danger);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%; /* Torna redondo */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 10; /* Garante que fique sobre a imagem */
}

.btn-remove:hover {
    background-color: #c82333;
    transform: scale(1.1);
}

/* =========================================
   6. RESPONSIVIDADE E RODAPÉ
   ========================================= */

/* Ajustes para Celulares (Até 576px) */
@media (max-width: 576px) {
    body { padding: 10px; }
    
    .content-header {
        flex-direction: column; /* Empilha o título e o botão 'Cadastrar' */
        gap: 15px;
        text-align: center;
    }
    
    .product-grid { gap: 15px; } /* Menos espaço entre cards no celular */
    
    /* Botões ocupam a largura total no celular */
    .btn-nav, .btn-submit, .btn-add-product { width: 100%; }
}

/* Rodapé Simples */
.main-footer, .content-footer {
    text-align: center;
    padding: 30px 0;
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-light);
}

body:has(#productForm) h1 {
    text-align: center;
    margin-bottom: 30px;
    margin-top: 20px;
    color: var(--text-main);
    font-weight: 800;
}

/* 2. Container Principal do Formulário */
#productForm {
    background-color: var(--bg-card); /* Fundo branco do card */
    padding: 30px;
    border-radius: var(--radius); /* Bordas arredondadas */
    box-shadow: var(--shadow); /* Sombra suave */
    max-width: 600px; /* Largura máxima controlada */
    margin: 0 auto 40px; /* Centraliza horizontalmente na tela */
    width: calc(100% - 20px); /* Garante margem em celulares */
}

/* 3. Estilo dos Grupos de Input */
.form-group {
    margin-bottom: 20px; /* Espaço entre cada campo */
}

/* 4. Estilo dos Rótulos (Labels) */
#productForm label {
    display: block;
    margin-bottom: 8px; /* Espaço entre rótulo e input */
    font-weight: 600; /* Rótulo mais forte */
    color: #555555;
    font-size: 0.95rem;
}

/* 5. Estilo dos Inputs (Texto e URL) */
#productForm input[type="text"],
#productForm input[type="url"] {
    width: 100%; /* Ocupa toda a largura do formulário */
    padding: 12px 15px; /* Espaço interno para texto não grudar nas bordas */
    border: 1px solid var(--border-color); /* Borda sutil */
    border-radius: 4px;
    font-size: 1rem;
    color: var(--text-main);
    transition: var(--transition);
}

/* 6. Efeito ao Clicar/Focar no Input */
#productForm input[type="text"]:focus,
#productForm input[type="url"]:focus {
    border-color: var(--primary-action); /* Borda fica laranja */
    outline: none; /* Remove a borda padrão do navegador */
    box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.1); /* Brilho laranja sutil */
}

/* 7. Estilo do Botão de Enviar (O pedido: Laranja, Branco, Empilhado) */
#productForm .btn-submit {
    background-color: var(--primary-action) !important; /* Laranja FORÇADO */
    color: white !important; /* Texto branco FORÇADO */
    border: none;
    padding: 15px 20px;
    border-radius: 4px;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: bold;
    width: 100%; /* Ocupa a largura total (empilhado) */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(255, 87, 34, 0.2); /* Sombra laranja */
    transition: var(--transition);
}

/* 8. Efeito do Botão ao Passar o Mouse */
#productForm .btn-submit:hover {
    opacity: 0.95;
    transform: translateY(-2px); /* Efeito de elevação */
}

/* ============================================================
   RESPONSIVIDADE DO FORMULÁRIO
   ============================================================ */

/* Ajustes para Celulares Pequenos (Até 480px) */
@media (max-width: 480px) {
    #productForm {
        padding: 20px; /* Reduz espaço interno em celulares */
    }

    #productForm .btn-submit {
        font-size: 1rem; /* Diminui fonte do botão */
        padding: 12px;
    }
}