/* --- Reset Básico e Configurações Globais --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 20px auto;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    text-align: center;
}

p {
    text-align: center;
    margin-bottom: 25px;
    color: #555;
}

/* --- Formulário --- */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.btn-calcular {
    width: 100%;
    padding: 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-calcular:hover {
    background-color: #0056b3;
}

/* --- Resultados (Calculadora) --- */
.results-container {
    margin-top: 30px;
}

.result-table {
    margin-bottom: 30px; /* Espaçamento entre tabelas no mobile e desktop */
}

.result-table h2 {
    color: #007bff;
    border-bottom: 2px solid #007bff;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

/* Estilo da Tabela (Calculadora e SEO) */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

table th, table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: right;
}

table th {
    background-color: #f9f9f9;
    font-weight: bold;
}

/* Wrapper para scroll em tabelas do artigo (se necessário) */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

/* Resumo da Calculadora */
#summary-results {
    margin-top: 20px;
}
#summary-results h2 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 10px;
}
#summary-results h3 {
    margin-top: 15px;
    color: #555;
}
#summary-results p {
    text-align: left;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.hidden {
    display: none;
}

/* ===============================================
   ESTILOS DE VALIDAÇÃO DE ERRO
===============================================
*/
.error-message {
    background-color: #fbebee; /* Fundo vermelho claro */
    border: 1px solid #e1b3b3;
    color: #c0392b; /* Texto vermelho escuro */
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.error-message ul {
    list-style-position: inside; /* Coloca os bullets para dentro */
    padding-left: 5px;
}

.error-message li {
    margin-bottom: 5px;
}

/* Classe para destacar o input inválido */
.input-error {
    border-color: #c0392b !important; /* !important sobrepõe outros estilos */
    background-color: #fbebee;
}

/* ===============================================
   ESTILOS DO ARTIGO DE SEO
===============================================
*/
.seo-content {
    margin-top: 30px;
    line-height: 1.7; /* Melhora a legibilidade */
    font-size: 1.1rem;
}

/* Ajusta os títulos dentro do artigo */
.seo-content h1 {
    font-size: 2.2rem;
    color: #333;
    margin-bottom: 20px;
}

.seo-content h2 {
    font-size: 1.8rem;
    color: #444;
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: none; /* Remove o sublinhado azul da calculadora */
}

.seo-content h3 {
    font-size: 1.4rem;
    color: #555;
    margin-top: 25px;
    margin-bottom: 10px;
}

.seo-content h4 {
    font-size: 1.1rem;
    font-style: italic;
    color: #666;
    margin-top: 20px;
    margin-bottom: 10px;
}

.seo-content p {
    text-align: left; /* Alinha o texto do artigo à esquerda */
    margin-bottom: 20px;
}

.seo-content ul, .seo-content ol {
    text-align: left;
    margin-left: 20px;
    margin-bottom: 20px;
    padding-left: 15px;
}

.seo-content li {
    margin-bottom: 10px;
}

/* Corrige a tabela de exemplo do artigo */
.seo-content table th, 
.seo-content table td {
    text-align: left; /* Alinha o texto da tabela do artigo */
    padding: 10px;
}

/* ===============================================
   CSS RESPONSIVO (OPÇÃO 1 - CARDS)
===============================================
*/
@media (max-width: 767px) {
    
    /* Faz o container usar a largura total */
    .container {
        margin: 0;
        padding: 15px;
        border-radius: 0;
        box-shadow: none;
    }

    /* Esconde o cabeçalho original da tabela */
    table thead {
        border: none;
        clip: rect(0 0 0 0);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        width: 1px;
    }

    /* Transforma a linha em um "card" */
    table tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 4px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }

    /* Transforma a célula em um item da lista */
    table td {
        display: block;
        padding: 10px;
        padding-left: 50%; /* Cria espaço à esquerda para o label */
        position: relative; /* Contexto para o ::before */
        text-align: right; /* Alinha o valor (R$) à direita */
        border: none;
        border-bottom: 1px dashed #eee; /* Linha separadora */
    }

    table td:last-child {
        border-bottom: none; /* Remove a linha da última célula */
    }

    /* O "Label" (Mês, Parcela, Juros...) */
    table td::before {
        content: attr(data-label); /* Puxa o texto do data-label */
        position: absolute;
        left: 10px;
        padding-right: 10px;
        width: calc(50% - 20px); /* Metade do espaço, menos padding */
        
        /* Estilo do Label */
        text-align: left;
        font-weight: bold;
        color: #333;
    }

    /* Garante que o alinhamento do artigo da tabela do SEO esteja correto */
    .seo-content table td {
        text-align: right; /* Mantém o padrão de card */
    }
    .seo-content table td::before {
        text-align: left; /* Mantém o padrão de card */
    }
}