/* ===================================
   CALCULADORA DE JUROS COMPOSTOS - CSS COMPLETO COM ABAS
   Área: FINANCEIRA | Cores: Verde/Dourado + SISTEMA DE ABAS
   ================================== */

:root {
    --primary: #2d7d32;        /* Verde escuro financeiro */
    --secondary: #4caf50;      /* Verde médio */
    --accent: #fdd835;         /* Dourado/amarelo */
    --success: #27ae60;        /* Verde sucesso */
    --warning: #f39c12;        /* Laranja aviso */
    --danger: #e74c3c;         /* Vermelho */
    --light: #e8f5e8;          /* Verde claro */
    --gradient: linear-gradient(135deg, #2d7d32 0%, #4caf50 50%, #fdd835 100%);
    
    /* Cores para cenários */
    --conservador: #81c784;    /* Verde claro */
    --moderado: #4caf50;       /* Verde médio */
    --arrojado: #2e7d32;       /* Verde escuro */
    --table-border: #ddd;      /* Bordas das tabelas */
}

/* ===================================
   SEÇÃO PRINCIPAL DA CALCULADORA
   ================================== */
.juros-compostos-calculator-section {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    /* CORREÇÃO: Prevenir overflow horizontal */
    overflow-x: hidden;
    box-sizing: border-box;
}

.juros-compostos-header {
    text-align: center;
    margin-bottom: 3rem;
    background: var(--gradient);
    padding: 3rem 2rem;
    border-radius: 20px;
    color: white;
    box-shadow: 0 8px 25px rgba(45, 125, 50, 0.3);
}

.juros-compostos-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.juros-compostos-header p {
    font-size: 1.2rem;
    opacity: 0.95;
    font-weight: 500;
}

/* ===================================
   CONTAINER PRINCIPAL - CORRIGIDO OVERFLOW
   ================================== */
.juros-compostos-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--light);
    /* CORREÇÃO: Evitar scroll horizontal */
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* CORREÇÃO: Classe para evitar scroll horizontal (igual calculadora pressão arterial) */
.container-scroll-fix {
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* ===================================
   SISTEMA DE ABAS
   ================================== */
.calculadora-tabs {
    display: flex;
    margin-bottom: 2rem;
    border-bottom: 3px solid var(--light);
    flex-wrap: wrap; /* CORREÇÃO: Permite quebra em telas menores */
    /* CORREÇÃO: Prevenir overflow */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-button {
    background: transparent;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    color: #666;
    flex: 1; /* CORREÇÃO: Distribui igualmente */
    min-width: 150px; /* CORREÇÃO: Largura mínima */
    text-align: center; /* CORREÇÃO: Centraliza texto */
    white-space: nowrap; /* CORREÇÃO: Evita quebra do texto */
}

.tab-button:hover {
    color: var(--secondary);
    background: rgba(76, 175, 80, 0.1);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(45, 125, 50, 0.1);
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: block;
}

.aba-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light);
}

.aba-header h3 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.aba-header p {
    color: #666;
    font-size: 1rem;
}

/* ===================================
   INPUTS E FORMULÁRIO
   ================================== */
.juros-compostos-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.juros-compostos-input-group {
    display: flex;
    flex-direction: column;
}

.juros-compostos-input-group label {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.juros-compostos-input-group input,
.juros-compostos-input-group select {
    padding: 1rem;
    border: 2px solid var(--light);
    border-radius: 10px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    font-family: inherit;
    /* CORREÇÃO: Box-sizing consistente */
    box-sizing: border-box;
}

.juros-compostos-input-group input:focus,
.juros-compostos-input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45, 125, 50, 0.1);
    background: white;
}

.juros-compostos-input-group input::placeholder {
    color: #95a5a6;
    font-style: italic;
}

/* ===================================
   INPUT COM SELECT (NOVO) - PROPORÇÃO 50/50
   ================================== */
.input-with-select {
    display: flex;
    gap: 0.5rem;
}

.input-with-select input {
    /* CORREÇÃO: 50% do espaço para o input */
    flex: 1;
    max-width: 50%;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    min-width: 0;
}

.input-with-select select {
    /* CORREÇÃO: 50% do espaço para o select */
    flex: 1;
    max-width: 50%;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: 1px solid var(--light);
    background: rgba(45, 125, 50, 0.05);
    font-weight: 500;
    min-width: 0;
}

/* ===================================
   BOTÕES
   ================================== */
.juros-compostos-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap; /* CORREÇÃO: Permite quebra em telas menores */
}

.btn-primary {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(45, 125, 50, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(45, 125, 50, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6 0%, #bdc3c7 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.4);
}

.btn-meta {
    background: linear-gradient(135deg, var(--accent) 0%, #f9a825 100%);
    color: #333;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 1rem;
}

.btn-meta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(253, 216, 53, 0.4);
}

/* ===================================
   EXEMPLOS RÁPIDOS
   ================================== */
.juros-compostos-examples {
    text-align: center;
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--light);
    border-radius: 12px;
}

.juros-compostos-examples h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.btn-example {
    background: rgba(45, 125, 50, 0.1);
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.8rem 1.5rem;
    margin: 0.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-example:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* ===================================
   META REVERSA
   ================================== */
.resultado-meta-reversa {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
    border: 2px solid var(--accent);
    animation: slideIn 0.6s ease;
    box-shadow: 0 5px 20px rgba(253, 216, 53, 0.2);
}

/* ===================================
   CONFIGURAÇÕES AVANÇADAS
   ================================== */
.info-avancado {
    background: var(--light);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
    border: 2px solid rgba(45, 125, 50, 0.2);
}

.info-avancado h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-avancado p {
    color: #4a5568;
    margin-bottom: 0.8rem;
    line-height: 1.5;
}

.info-avancado p:last-child {
    margin-bottom: 0;
}

/* ===================================
   RESULTADO PRINCIPAL - CORRIGIDO CONTRASTE
   ================================== */
.juros-compostos-resultado {
    background: var(--gradient);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 2rem;
    color: white;
    box-shadow: 0 8px 25px rgba(45, 125, 50, 0.3);
    animation: slideIn 0.6s ease;
}


.resultado-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap; /* CORREÇÃO: Permite quebra */
    gap: 1rem;
}

.resultado-header h3 {
    font-size: 1.8rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    color: #5a6c7d ;
}

.performance-badge {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.9rem;
}

.performance-badge.excelente {
    background: rgba(39, 174, 96, 0.3);
    color: #2ecc71;
}

.performance-badge.bom {
    background: rgba(241, 196, 15, 0.3);
    color: #f1c40f;
}

.performance-badge.regular {
    background: rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

.resultado-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.resultado-item {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.resultado-label {
    display: block;
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.resultado-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.valor-final .resultado-value {
    color: #fdd835;
    font-size: 1.8rem;
}

.contador-animado {
    transition: all 0.3s ease;
}

/* ===================================
   INDICADORES EXTRAS
   ================================== */
.indicadores-extras {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.indicador-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    /* CORREÇÃO: Responsivo */
    flex-wrap: wrap;
    gap: 0.5rem;
}

.indicador-item:last-child {
    border-bottom: none;
}

.indicador-label {
    font-weight: 500;
    opacity: 0.9;
}

.indicador-value {
    font-weight: 700;
    /* CORREÇÃO: Texto branco mais legível em vez de amarelo */
    color: white !important;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ===================================
   PROGRESS BAR DA META
   ================================== */
.progress-meta {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-weight: 600;
    /* CORREÇÃO: Responsivo */
    flex-wrap: wrap;
    gap: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #27ae60);
    border-radius: 6px;
    transition: width 1s ease-in-out;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ===================================
   SUGESTÕES INTELIGENTES - CORRIGIDO PROBLEMA DE LEGIBILIDADE
   ================================== */
.sugestoes-inteligentes {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.sugestoes-inteligentes h4 {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sugestao-item {
    /* CORREÇÃO: Fundo mais claro e texto escuro para melhor legibilidade */
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--accent);
    /* CORREÇÃO: Texto escuro em vez de branco */
    color: #2c3e50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sugestao-item:last-child {
    margin-bottom: 0;
}

.sugestao-destaque {
    font-weight: 700;
    /* CORREÇÃO: Cor que contrasta bem com fundo claro */
    color: var(--primary);
}

/* ===================================
   TABELA DE EVOLUÇÃO
   ================================== */
.tabela-evolucao-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    border: 2px solid var(--light);
}

.tabela-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 3px solid var(--light);
    padding-bottom: 1rem;
    /* CORREÇÃO: Responsivo */
    flex-wrap: wrap;
    gap: 1rem;
}

.tabela-header h3 {
    color: var(--primary);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-toggle-tabela {
    background: var(--secondary);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-toggle-tabela:hover {
    background: var(--primary);
    transform: translateY(-2px);
}

.tabela-evolucao-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.tabela-evolucao-content.show {
    max-height: 600px;
}

.tabela-wrapper {
    max-height: 500px;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
    /* CORREÇÃO: Evitar overflow horizontal */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tabela-evolucao {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: white;
    /* CORREÇÃO: Tabela responsiva */
    min-width: 600px; /* Largura mínima para manter colunas legíveis */
}

.tabela-evolucao th {
    background: var(--gradient);
    color: white;
    padding: 1rem 0.8rem;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    /* CORREÇÃO: Células da tabela não quebram */
    white-space: nowrap;
    font-size: 0.85rem; /* Fonte menor nos headers */
}

.tabela-evolucao td {
    padding: 0.8rem;
    border-bottom: 1px solid var(--table-border);
    color: #4a5568;
    /* CORREÇÃO: Conteúdo não quebra */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem; /* Fonte menor */
}

.tabela-evolucao tr:nth-child(even) {
    background: rgba(232, 245, 232, 0.3);
}

.tabela-evolucao tr:hover {
    background: rgba(45, 125, 50, 0.1);
}

.tabela-resumo {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--light);
    flex-wrap: wrap; /* CORREÇÃO: Permite quebra */
}

.btn-export {
    background: rgba(45, 125, 50, 0.1);
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-export:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* ===================================
   CARDS ESPECÍFICOS PARA ADS - MELHORADOS
   ================================== */
.calc-explanation,
.explanation {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--secondary);
    border-radius: 12px;
    padding: 2.5rem;
    margin: 4rem 0; /* CORREÇÃO: Aumentado espaçamento superior de 3rem para 4rem */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.8s ease;
    /* CORREÇÃO: Evitar overflow */
    overflow-x: hidden;
    word-wrap: break-word;
}

/* CORREÇÃO: Título mais atraente para o card do gráfico */
.calc-chart h3,
.chart-explanation h3 {
    color: var(--primary);
    margin: 2rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 3px solid var(--light);
    padding-bottom: 0.8rem;
    font-size: 1.6rem; /* CORREÇÃO: Fonte maior */
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none; /* Remove shadow para gradient text */
    position: relative;
}

/* CORREÇÃO: Efeito especial no título do gráfico */
.calc-chart h3::after,
.chart-explanation h3::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient);
    border-radius: 2px;
}

.calc-explanation h3,
.explanation h3 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 3px solid var(--light);
    padding-bottom: 0.8rem;
    font-size: 1.5rem;
}

.calc-explanation h4,
.explanation h4 {
    color: var(--secondary);
    margin: 2rem 0 1rem 0;
    font-size: 1.2rem;
    border-left: 4px solid var(--secondary);
    padding-left: 1rem;
}

.calc-explanation p,
.explanation p {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 1rem;
}

/* CORREÇÃO: Estilos melhorados para as seções de análise */
.composition-analysis,
.performance-analysis,
.comparative-analysis {
    background: rgba(45, 125, 50, 0.03);
    border: 1px solid rgba(45, 125, 50, 0.1);
    border-radius: 12px;
    padding: 0.5rem;
    margin: 2rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.composition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.composition-item {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid var(--light);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.composition-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(45, 125, 50, 0.1);
    border-color: var(--secondary);
}

.composition-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.composition-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.composition-percent {
    font-size: 0.85rem;
    color: #777;
    font-weight: 500;
}

.performance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.performance-metric {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    border: 2px solid var(--light);
    transition: all 0.3s ease;
}

.performance-metric:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.metric-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.metric-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 0.3rem;
}

.metric-desc {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
}

.comparative-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.comparative-item {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    border: 2px solid var(--light);
}

.comparative-item.current {
    border-color: var(--primary);
    background: rgba(45, 125, 50, 0.05);
}

.comparative-item.poupanca {
    border-color: #f39c12;
    background: rgba(243, 156, 18, 0.05);
}

.comparative-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comparative-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.comparative-item.current .comparative-value {
    color: var(--primary);
}

.comparative-item.poupanca .comparative-value {
    color: #f39c12;
}

.comparative-growth,
.comparative-diff {
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
}

.calc-legal,
.legal-explanation {
    background: linear-gradient(135deg, rgba(45, 125, 50, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
    border: 2px solid rgba(45, 125, 50, 0.3);
    border-radius: 12px;
    padding: 2.5rem;
    margin: 2rem 0;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    /* CORREÇÃO: Evitar overflow */
    overflow-x: hidden;
    word-wrap: break-word;
}

.calc-legal h3,
.legal-explanation h3 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 3px solid rgba(45, 125, 50, 0.2);
    padding-bottom: 0.8rem;
    font-size: 1.5rem;
}

.calc-legal h4,
.legal-explanation h4 {
    color: var(--primary);
    margin: 2rem 0 1rem 0;
    font-size: 1.2rem;
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
}

.calc-legal p,
.legal-explanation p {
    color: #2d5016;
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 1rem;
}

/* CORREÇÃO: Estilos melhorados para fundamentação */
.fundamentacao-intro {
    background: rgba(76, 175, 80, 0.05);
    border-left: 4px solid var(--secondary);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

.metodologia-container,
.indicadores-container,
.aplicabilidade-container {
    margin: 2rem 0;
}

.metodologia-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.metodologia-item {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid var(--light);
    border-radius: 10px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.metodologia-item:hover {
    transform: translateY(-2px);
    border-color: var(--secondary);
    box-shadow: 0 4px 15px rgba(45, 125, 50, 0.1);
}

.metodologia-titulo {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.8rem;
    font-size: 1rem;
    border-bottom: 2px solid var(--light);
    padding-bottom: 0.5rem;
}

.metodologia-desc {
    color: #4a5568;
    font-size: 0.9rem;
    line-height: 1.5;
}

.indicadores-formulas {
    background: rgba(253, 216, 53, 0.05);
    border: 1px solid rgba(253, 216, 53, 0.3);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.formula-item {
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(253, 216, 53, 0.2);
    color: #4a5568;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.formula-item:last-child {
    border-bottom: none;
}

.aviso-legal-container {
    margin: 2.5rem 0;
    padding: 2rem;
    background: rgba(45, 125, 50, 0.05);
    border: 3px solid rgba(45, 125, 50, 0.2);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(45, 125, 50, 0.1);
}

.aviso-legal-content {
    background: rgba(255, 255, 255, 0.8);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid rgba(45, 125, 50, 0.1);
}

.aviso-legal-content p {
    color: #2d5016;
    margin: 0.8rem 0;
    font-weight: 500;
    line-height: 1.7;
}

/* ===================================
   DADOS FORNECIDOS
   ================================== */
.dados-fornecidos {
    background: linear-gradient(135deg, var(--light), rgba(45, 125, 50, 0.08));
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border: 1px solid rgba(45, 125, 50, 0.2);
}

.dados-fornecidos p {
    margin: 0.5rem 0;
    color: var(--primary);
    font-weight: 600;
}

.dados-fornecidos p strong {
    color: var(--secondary);
}

/* ===================================
   DESTAQUE DE FÓRMULAS
   ================================== */
.formula-highlight {
    background: linear-gradient(135deg, rgba(253, 216, 53, 0.1), rgba(76, 175, 80, 0.1));
    border: 2px solid var(--accent);
    border-radius: 10px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    text-align: center;
}

.formula-main {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
    background: rgba(253, 216, 53, 0.2);
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--accent);
    /* CORREÇÃO: Fórmula quebra em telas menores */
    word-break: break-all;
    overflow-wrap: break-word;
}

.formula-highlight p {
    color: var(--secondary);
    font-weight: 600;
    margin: 0.5rem 0;
}

/* ===================================
   CONTEÚDO EDUCACIONAL
   ================================== */
.educational-content {
    max-width: 1000px;
    margin: 4rem auto 0;
    padding: 0 2rem;
    /* CORREÇÃO: Evitar overflow */
    overflow-x: hidden;
    box-sizing: border-box;
}

.education-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    border: 2px solid var(--light);
    transition: all 0.3s ease;
}

.education-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-color: var(--secondary);
}

.education-card h2 {
    color: var(--primary);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 3px solid var(--light);
    padding-bottom: 1rem;
}

.education-card p {
    color: #4a5568;
    line-height: 1.7;
    margin-bottom: 1.2rem;
    font-size: 1rem;
}

/* ===================================
   GRIDS DE FUNCIONALIDADES
   ================================== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.feature-item {
    background: var(--light);
    border-radius: 10px;
    padding: 1.5rem;
    border: 2px solid rgba(45, 125, 50, 0.2);
    transition: all 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(45, 125, 50, 0.2);
    border-color: var(--secondary);
}

.feature-item h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feature-item p {
    color: #4a5568;
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.5;
}

/* ===================================
   EXPLICAÇÃO DOS INDICADORES
   ================================== */
.indicadores-explicacao {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.indicador-explicacao {
    background: var(--light);
    border-radius: 12px;
    padding: 2rem;
    border: 2px solid rgba(45, 125, 50, 0.2);
    transition: all 0.3s ease;
}

.indicador-explicacao:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(45, 125, 50, 0.2);
    border-color: var(--secondary);
}

.indicador-explicacao h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 2px solid rgba(45, 125, 50, 0.2);
    padding-bottom: 0.5rem;
}

.indicador-explicacao p {
    color: #4a5568;
    line-height: 1.6;
    margin: 0;
    font-size: 1rem;
}

/* ===================================
   LISTAS E STEPS
   ================================== */
.steps-list {
    counter-reset: step-counter;
    padding-left: 0;
    list-style: none;
}

.steps-list li {
    counter-increment: step-counter;
    margin-bottom: 1.5rem;
    padding-left: 3rem;
    position: relative;
    color: #4a5568;
    line-height: 1.6;
}

.steps-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: var(--gradient);
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.tips-list {
    list-style: none;
    padding: 0;
}

.tips-list li {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--light);
    border-radius: 8px;
    color: #4a5568;
    line-height: 1.6;
    border-left: 4px solid var(--primary);
}

/* ===================================
   GRIDS DE EXEMPLOS E APLICAÇÕES
   ================================== */
.examples-grid,
.applications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.example-item,
.application-item {
    background: var(--light);
    border-radius: 10px;
    padding: 1.5rem;
    border: 2px solid rgba(45, 125, 50, 0.2);
    transition: all 0.3s ease;
}

.example-item:hover,
.application-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(45, 125, 50, 0.2);
    border-color: var(--secondary);
}

.example-item h4,
.application-item h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.example-item p,
.application-item p {
    color: #4a5568;
    font-size: 0.95rem;
    margin: 0.3rem 0;
    line-height: 1.5;
}

/* ===================================
   REFERÊNCIAS
   ================================== */
.references {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--light);
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.references:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-color: var(--secondary);
}

.references h2 {
    color: var(--primary);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 3px solid var(--light);
    padding-bottom: 1rem;
}

.references ul {
    list-style: none;
    padding: 0;
}

.references li {
    padding: 1rem;
    margin-bottom: 0.8rem;
    background: var(--light);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    color: #4a5568;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.references li:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(45, 125, 50, 0.15);
    background: rgba(45, 125, 50, 0.08);
    color: #2d5016;
}

.references li:last-child {
    margin-bottom: 0;
}

/* ===================================
   ANIMAÇÕES
   ================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===================================
   RESPONSIVIDADE COMPLETA - CORRIGIDA
   ================================== */
@media (max-width: 768px) {
    /* CORREÇÃO: Prevenir overflow horizontal global */
    body {
        overflow-x: hidden;
    }
    
    .main-container {
        overflow-x: hidden;
    }
    
    .container-scroll-fix {
        max-width: 100vw;
        padding: 1rem;
    }
    
    .juros-compostos-calculator-section {
        padding: 1rem;
    }
    
    .calculadora-tabs {
        flex-direction: column;
        gap: 0;
        overflow-x: visible;
    }
    
    .tab-button {
        padding: 0.8rem 1rem;
        font-size: 1rem;
        border-bottom: 2px solid var(--light);
        flex: none; /* CORREÇÃO: Remove flex em mobile */
        min-width: auto; /* CORREÇÃO: Remove largura mínima */
        white-space: normal; /* Permite quebra do texto em mobile */
    }
    
    .tab-button.active {
        border-bottom-color: var(--primary);
    }
    
    .juros-compostos-input-row {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .input-with-select {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .input-with-select input {
        border-radius: 10px;
        border: 2px solid var(--light);
    }
    
    .input-with-select select {
        width: 100%;
        border-radius: 10px;
        border: 2px solid var(--light);
    }
    
    .resultado-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .juros-compostos-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        max-width: 300px;
    }
    
    .juros-compostos-header h1 {
        font-size: 2rem;
    }
    
    .formula-main {
        font-size: 1.2rem;
        word-break: break-all;
    }
    
    .examples-grid,
    .applications-grid,
    .features-grid,
    .indicadores-explicacao {
        grid-template-columns: 1fr;
    }
    
    .tabela-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .tabela-resumo {
        flex-direction: column;
        align-items: center;
    }
    
    .tabela-evolucao {
        font-size: 0.8rem;
    }
    
    .tabela-evolucao th,
    .tabela-evolucao td {
        padding: 0.6rem 0.4rem;
    }
    
    .juros-compostos-container {
        padding: 1.5rem;
    }
    
    .indicador-item {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .progress-header {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    /* CORREÇÃO: Cards responsivos */
    .calc-explanation,
    .explanation,
    .calc-legal,
    .legal-explanation {
        padding: 1.5rem;
        margin: 2rem 0;
    }
    
    .composition-grid,
    .performance-grid {
        grid-template-columns: 1fr;
    }
    
    .comparative-content {
        grid-template-columns: 1fr;
    }
    
    .metodologia-grid {
        grid-template-columns: 1fr;
    }
    
    /* CORREÇÃO: Título do gráfico em mobile */
    .calc-chart h3,
    .chart-explanation h3 {
        font-size: 1.3rem;
        text-align: center;
    }
}

/* ===================================
   MEDIA QUERY PARA TABLETS
   ================================== */
@media (max-width: 1024px) and (min-width: 769px) {
    .calculadora-tabs {
        gap: 0.5rem;
    }
    
    .tab-button {
        padding: 0.9rem 1.5rem;
        font-size: 1rem;
    }
    
    .composition-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .metodologia-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}