/* =============================================================
   Egina Finanças — Frontend Design Tokens (v2, Issue #240)
   Shared with hub/src/index.css. Keep palette and scale in sync.
   ============================================================= */
:root {
    /* Typography — modular scale 1.25 */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-md: 1.125rem;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 1.875rem;
    --font-size-3xl: 2.25rem;
    --font-size-4xl: 3rem;

    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Palette — Primary */
    --color-primary: #2c3e50;
    --color-primary-light: #3d5368;
    --color-primary-dark: #1d2a38;

    /* Palette — Accent */
    --color-accent: #27ae60;
    --color-accent-hover: #219150;
    --color-accent-light: #d4efdf;
    --color-accent-dark: #1e8449;

    /* Palette — Secondary (blue) */
    --color-secondary: #3b82f6;
    --color-secondary-light: #dbeafe;
    --color-secondary-dark: #1d4ed8;

    /* Palette — Status */
    --color-success: #22c55e;
    --color-success-light: #dcfce7;
    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    --color-info: #0ea5e9;
    --color-info-light: #e0f2fe;
    --color-danger: #ef4444;
    --color-danger-light: #fee2e2;
    --color-error: #c0392b;

    /* Neutrals */
    --color-neutral-50: #f9fafb;
    --color-neutral-100: #f3f4f6;
    --color-neutral-200: #e5e7eb;
    --color-neutral-300: #d1d5db;
    --color-neutral-400: #9ca3af;
    --color-neutral-500: #6b7280;
    --color-neutral-600: #4b5563;
    --color-neutral-700: #374151;
    --color-neutral-800: #1f2937;
    --color-neutral-900: #111827;

    /* Semantic */
    --color-bg: #f4f7f6;
    --color-card: #ffffff;
    --color-text: #333333;
    --color-text-muted: #6b6b6b;
    --color-border: #e0e0e0;
    --color-border-light: #eeeeee;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.05);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    font-size: var(--font-size-base);
}

.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: var(--color-primary);
    margin-bottom: 10px;
    text-align: center;
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.02em;
}

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

/* Long-form article copy: justified for readability, never centered */
.seo-article p,
.seo-content p {
    text-align: justify;
}

/* --- 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 var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-light);
}

/* Helper text under form inputs — consistent block spacing across all calculators */
.form-group small {
    display: block;
    margin-top: 4px;
    color: #777;
    line-height: 1.5;
}

.btn-calcular {
    width: 100%;
    padding: 16px 32px;
    background-color: var(--color-accent);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    letter-spacing: 0.01em;
}

.btn-calcular:hover {
    background-color: var(--color-accent-hover);
}

.btn-calcular:active {
    transform: translateY(1px);
}

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

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

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

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

table th, table td {
    border-bottom: 1px solid var(--color-border);
    padding: 10px 12px;
    text-align: right;
}

table th {
    background-color: var(--color-neutral-50);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-neutral-700);
}

table tbody tr:nth-child(even) {
    background-color: var(--color-neutral-50);
}

table tbody tr:hover {
    background-color: var(--color-neutral-100);
}

/* 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,
.seo-article ul, .seo-article ol {
    text-align: left;
    margin-left: 20px;
    margin-bottom: 20px;
    padding-left: 15px;
}

.seo-content li,
.seo-article 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 */
    }
}

/* ===============================================
   ESTILOS DE PÁGINAS LEGAIS (Termos, Privacidade)
===============================================
*/
.legal-content {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 40px;
    border: 1px solid #eee;
}

.legal-content h1 {
    color: #2c3e50;
    font-size: 2.2rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 10px;
    text-align: left;
}

.legal-content h2 {
    color: #2c3e50;
    font-size: 1.4em;
    margin-top: 35px;
    margin-bottom: 15px;
    text-align: left;
    border-bottom: none;
}

.legal-content h3 {
    color: #555;
    font-size: 1.15em;
    margin-top: 20px;
    margin-bottom: 10px;
    text-align: left;
}

.legal-content p {
    line-height: 1.8;
    color: #555;
    margin-bottom: 15px;
    text-align: justify;
}

.legal-content ul {
    margin-bottom: 20px;
    padding-left: 20px;
    text-align: left;
}

.legal-content li {
    margin-bottom: 10px;
    color: #555;
    line-height: 1.7;
}

.legal-content .last-updated {
    font-style: italic;
    color: #777;
    font-size: 0.9em;
    margin-bottom: 30px;
    text-align: left;
}

/* ===============================================
   FOOTER LEGAL (Links de Termos/Privacidade)
===============================================
*/
.site-footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px;
    color: #6b7280;
    font-size: 0.9em;
    border-top: 1px solid #eee;
}

.site-footer p {
    text-align: center;
    margin-bottom: 10px;
}

.footer-legal {
    text-align: center;
    margin-top: 8px;
    font-size: 0.95em;
}

.footer-legal a {
    color: #555;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-legal a:hover {
    color: #27ae60;
    text-decoration: underline;
}

.footer-social {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
}

.footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #ecf0f1;
    color: #555;
    transition: background-color 0.2s, color 0.2s;
}

.footer-social a:hover {
    background-color: #27ae60;
    color: #fff;
}

.footer-social svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

@media (max-width: 480px) {
    .legal-content {
        padding: 20px 15px;
    }

    .legal-content h1 {
        font-size: 1.7rem;
    }

    .legal-content h2 {
        font-size: 1.2em;
    }

    .footer-legal {
        font-size: 0.85em;
    }

    .footer-social {
        gap: 12px;
    }

    .footer-social a {
        width: 30px;
        height: 30px;
    }

    .footer-social svg {
        width: 14px;
        height: 14px;
    }
}

/* --- Cookie Consent Banner --- */
.cookie-banner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2c3e50;
    color: #fff;
    padding: 16px 24px;
    z-index: 10000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    font-size: 14px;
    line-height: 1.5;
}

.cookie-banner.active {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.cookie-banner p {
    margin: 0;
    flex: 1;
    min-width: 250px;
    color: #ffffff;
}

.cookie-banner a {
    color: #27ae60;
    text-decoration: underline;
}

.cookie-banner-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.cookie-banner-actions button {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: opacity 0.2s;
}

.cookie-banner-actions button:hover {
    opacity: 0.85;
}

.cookie-btn-accept {
    background: #27ae60;
    color: #fff;
}

.cookie-btn-reject {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4) !important;
}

.cookie-manage-link {
    cursor: pointer;
}

@media (max-width: 480px) {
    .cookie-banner {
        padding: 14px 16px;
        font-size: 13px;
    }

    .cookie-banner p {
        min-width: 100%;
    }

    .cookie-banner-actions {
        width: 100%;
        justify-content: stretch;
    }

    .cookie-banner-actions button {
        flex: 1;
    }
}

/* --- Material Icons --- */
.material-icons-outlined {
    vertical-align: middle;
    font-size: inherit;
}

.material-icons-outlined.icon-sm {
    font-size: 18px;
}

.material-icons-outlined.icon-md {
    font-size: 24px;
}

.material-icons-outlined.icon-lg {
    font-size: 36px;
}

/* --- a11y #277: skip-link + global focus-visible --- */
.skip-link {
    position: absolute;
    top: -48px;
    left: 8px;
    z-index: 10001;
    background: #2c3e50;
    color: #fff;
    padding: 10px 16px;
    border-radius: 0 0 6px 6px;
    text-decoration: none;
    font-weight: 600;
    transition: top 0.15s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
    top: 0;
    outline: 2px solid #27ae60;
    outline-offset: 2px;
}

/* Global focus indicator (WCAG 2.4.7) — only when keyboard-navigated.
   Inputs continue using their own box-shadow ring style. */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
summary:focus-visible {
    outline: 2px solid #27ae60;
    outline-offset: 2px;
    border-radius: 3px;
}

/* ── Utilities (#305 — single-property classes; mirror calculator.css) ── */
.fs-sm  { font-size: 0.9em; }
.fs-xs  { font-size: 0.8em; }
.fs-16  { font-size: 16px; }
.fs-18  { font-size: 18px; }
.fs-22  { font-size: 22px; }
.text-accent  { color: #27ae60; }
.text-555     { color: #555; }
.text-666     { color: #666; }
.text-777     { color: #777; }
.text-2c3e50  { color: #2c3e50; }
.disclaimer-fineprint { font-size: 0.8em; color: #666; margin-top: 10px; }
.divider-dot { color: #ddd; margin: 0 6px; }