/* =========================================
   1. IMPORTAÇÕES E VARIÁVEIS GERAIS
   ========================================= */

/* Fonte Inter (Moderna, usada por bancos) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

:root {
    /* --- TEMA CLARO (PADRÃO) --- */
    --primary: #27ae60;       /* Verde Nubank Principal */
    --primary-dark: #219150;  /* Verde mais escuro para hover */
    --bg-color: #f5f6fa;      /* Fundo geral (Cinza gelo) */
    --card-bg: #ffffff;       /* Fundo dos cartões (Branco) */
    --text-main: #2d3436;     /* Texto principal (Cinza chumbo) */
    --text-sec: #636e72;      /* Texto secundário (Cinza médio) */
    --border: #dfe6e9;        /* Bordas sutis */
    --shadow: 0 8px 30px rgba(0,0,0,0.08); /* Sombra suave */
    --input-bg: #f5f6fa;      /* Fundo dos campos de texto */
    --red: #c0392b;           /* Vermelho para despesas */
    --purple: #9b59b6;        /* Roxo Nubank para parcelados */
}

/* --- TEMA ESCURO (DARK MODE) --- */
[data-theme="dark"] {
    --primary: #2ecc71;       /* Verde Neon (Brilha mais no escuro) */
    --primary-dark: #27ae60;
    --bg-color: #1e1e1e;      /* Preto Suave (Fundo) */
    --card-bg: #2d2d2d;       /* Cinza Grafite (Cartões) */
    --text-main: #f5f6fa;     /* Texto Branco */
    --text-sec: #b2bec3;      /* Texto Cinza Claro */
    --border: #444;           /* Bordas mais escuras */
    --shadow: 0 8px 30px rgba(0,0,0,0.4); /* Sombra mais forte */
    --input-bg: #3d3d3d;      /* Inputs escuros */
}

/* =========================================
   2. RESET E ESTRUTURA (EFEITO NUBANK)
   ========================================= */

* {
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s;
}

html {
    /* SEGREDINHO: Pinta o fundo do navegador de verde.
       Assim, ao puxar a tela (overscroll) no celular, aparece verde e não branco. */
    background-color: var(--primary);
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    margin: 0;
    -webkit-font-smoothing: antialiased; /* Deixa a fonte mais nítida */
    min-height: 100vh;
}

/* =========================================
   3. MODO PRIVACIDADE (NOVO)
   ========================================= */

/* Quando o BODY tem a classe .blur-active, borra tudo que tem .blur-sensitive */
body.blur-active .blur-sensitive {
    filter: blur(8px);       /* O Borrão em si */
    user-select: none;       /* Impede selecionar o texto escondido */
    cursor: default;         /* Tira o cursor de texto */
    transition: filter 0.3s ease;
}

/* =========================================
   4. TELA DE LOGIN
   ========================================= */

.tela-login {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background-color: var(--bg-color);
    overflow: hidden; /* Trava a rolagem */
    height: 100vh;    /* Garante altura fixa */
}

.login-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 380px;
    text-align: center;
    border: 1px solid var(--border);
}

/* =========================================
   5. CABEÇALHO DO APP (HEADER)
   ========================================= */

.app-header {
    background-color: var(--primary);
    color: white;
    /* Padding bottom grande (90px) para o cartão de saldo subir por cima */
    padding: 25px 25px 90px 25px; 
    border-radius: 0 0 35px 35px; /* Arredonda só embaixo */
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* Botões do Topo (Lua, Sair, Olho, Gráfico) */
.theme-btn {
    background: rgba(255,255,255,0.2);
    width: 40px; 
    height: 40px;
    border-radius: 50%;
    display: flex; 
    justify-content: center; 
    align-items: center;
    margin: 0 !important; 
    padding: 0 !important;
    box-shadow: none;
    font-size: 18px;
    border: none;
    cursor: pointer;
    color: white;
    transition: transform 0.2s;
}

.theme-btn:active {
    transform: scale(0.9); /* Efeito de clique */
}

/* =========================================
   6. CARTÃO DE SALDO (FLUTUANTE)
   ========================================= */

.saldo-card {
    background: var(--card-bg);
    width: 88%;
    max-width: 420px;
    /* Margem negativa puxa ele pra cima do header */
    margin: -70px auto 30px auto;
    padding: 30px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    text-align: center;
    position: relative;
    border: 1px solid var(--border);
}

.saldo-valor {
    font-size: 42px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -1.5px;
    margin: 10px 0;
}

/* =========================================
   7. LISTA DE TRANSAÇÕES E FILTROS
   ========================================= */

.lista-transacoes {
    padding: 0 20px 100px 20px; /* Padding bottom 100px pro botão FAB não cobrir o final */
    max-width: 600px; 
    margin: 0 auto; 
}

.card-resumo {
    /* Estilo usado na Dashboard */
    background: var(--card-bg);
    flex: 1;
    padding: 15px;
    border-radius: 16px;
    border: 1px solid var(--border);
    text-align: center;
}

/* Item Individual da Lista */
.transacao-item {
    background: var(--card-bg);
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    border: 1px solid var(--border);
    cursor: pointer; /* Mãozinha indicando que dá pra clicar/editar */
}

.transacao-item:active {
    transform: scale(0.98);
    background-color: rgba(0,0,0,0.02);
}

/* Pasta de Custos Fixos (Acordeão) */
details.pasta-fixos {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 25px;
    padding: 15px;
}

details.pasta-fixos summary { 
    color: var(--text-sec); 
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex; 
    align-items: center;
}

/* Setinha que gira */
details.pasta-fixos summary::after {
    content: '›'; 
    font-size: 20px; 
    margin-left: auto; 
    transition: 0.2s; 
    transform: rotate(90deg);
}

details.pasta-fixos[open] summary::after { 
    transform: rotate(-90deg); 
}

/* =========================================
   8. COMPONENTES (INPUTS, SELECTS, BOTÕES)
   ========================================= */

input, select {
    width: 100%;
    padding: 16px;
    margin: 8px 0;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    outline: none;
}

input:focus, select:focus {
    border-color: var(--primary);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.1);
}

button {
    width: 100%;
    padding: 16px;
    margin-top: 15px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

button:active {
    transform: scale(0.98);
}

button.outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: none;
}

/* =========================================
   9. BOTÃO FLUTUANTE (FAB)
   ========================================= */

/* Botão Flutuante (FAB) Alinhado */
.fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 35px;
    box-shadow: var(--shadow);
    cursor: pointer;
    z-index: 1000;
    /* O SEGREDO DO ALINHAMENTO 👇 */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0; /* Remove padding padrão que empurra o ícone */
    padding-bottom: 4px; /* Ajuste fino ótico se precisar */
}

/* =========================================
   10. MODAL (JANELA FLUTUANTE)
   ========================================= */

.modal-overlay {
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px); /* Desfoque bonito estilo iOS */
    display: none;
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    justify-content: center; 
    align-items: center; 
    z-index: 1000;
}

.modal-overlay.open { 
    display: flex; 
}

.modal-card {
    background: var(--card-bg);
    padding: 30px 30px 40px 30px;
    border-radius: 30px;
    width: 90%; 
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    text-align: center;
    border: 1px solid var(--border);
    max-height: 90vh; /* Se a tela for pequena, cria rolagem interna */
    overflow-y: auto;
}

/* Utilitário para esconder coisas */
.hidden {
    display: none !important;
}

/* ... (MANTENHA TUDO O QUE JÁ EXISTE NO ARQUIVO, COLE ISSO NO FINAL) ... */

/* =========================================
   11. MENU DE PERFIL (DROPDOWN)
   ========================================= */

.profile-container {
    position: relative;
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    top: 60px;
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    width: 200px;
    display: none; /* Escondido por padrão */
    flex-direction: column;
    overflow: hidden;
    z-index: 2000;
}

.dropdown-menu.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.dropdown-item {
    padding: 15px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    background: none;
    text-align: left;
    margin: 0;
    width: 100%;
    border-radius: 0;
    box-shadow: none;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: var(--bg-color);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   12. ZONA DE PERIGO (CONFIGURAÇÕES)
   ========================================= */

.danger-zone {
    border: 1px solid #ff7675;
    background-color: rgba(255, 118, 117, 0.1);
    border-radius: 12px;
    padding: 15px;
    margin-top: 20px;
}

.btn-danger {
    background-color: #c0392b;
    color: white;
    margin-top: 10px;
}
.btn-danger:hover {
    background-color: #a93226;
}

/* =========================================
   13. TELA DE INTRODUÇÃO (ONBOARDING)
   ========================================= */

.intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Fundo gradiente usando as cores do seu tema */
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    z-index: 9999; /* Garante que fique em cima de tudo */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

/* Classe para mostrar a tela */
.intro-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.intro-card {
    background: var(--card-bg);
    padding: 40px 30px;
    border-radius: 30px;
    text-align: center;
    max-width: 350px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    /* Animação de entrada (Pop) */
    transform: scale(0.8);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.intro-overlay.visible .intro-card {
    transform: scale(1);
}

.intro-icon {
    font-size: 60px;
    margin-bottom: 20px;
    display: block;
}

.intro-card h2 {
    color: var(--primary);
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 800;
}

.intro-card p {
    color: var(--text-sec);
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 25px;
    min-height: 70px; /* Altura fixa para o texto não pular */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Bolinhas de Navegação */
.intro-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.dot {
    width: 10px;
    height: 10px;
    background-color: #ddd;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.dot.active {
    background-color: var(--primary);
    width: 25px; /* Estica a bolinha ativa */
    border-radius: 10px;
}

/* =========================================
   14. ESTILIZAÇÃO AVANÇADA DO MODAL (RECORRÊNCIA)
   ========================================= */

.opcoes-recorrencia {
    background: var(--bg-color); /* Fundo cinza suave */
    padding: 20px;
    border-radius: 16px;
    text-align: left;
    margin-top: 20px;
    border: 1px solid var(--border);
}

.opcoes-recorrencia label {
    font-size: 12px;
    color: var(--text-sec);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: block;
}

/* Força os inputs dentro da caixa cinza a serem brancos */
.opcoes-recorrencia select,
.opcoes-recorrencia input[type="number"] {
    background: var(--card-bg) !important;
    border: 1px solid var(--border) !important;
    margin: 0 0 15px 0; /* Espaço embaixo */
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

/* Área das Parcelas (Flexbox para alinhar lado a lado) */
.area-parcelas-grid {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 5px;
}

/* Checkbox Personalizado (Estilo Botão) */
.checkbox-custom {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    background: var(--card-bg);
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    flex: 1; /* Ocupa metade do espaço */
    justify-content: center;
    font-size: 13px;
    color: var(--text-main);
    transition: 0.2s;
}

/* Quando marcado, fica verde */
.checkbox-custom input:checked + span {
    color: var(--primary);
    font-weight: bold;
}

.checkbox-custom:active {
    transform: scale(0.98);
}

/* =========================================
   15. ESCONDER BARRA DE ROLAGEM (SCROLL INVISÍVEL)
   ========================================= */

/* Para Chrome, Safari e Opera */
.modal-card::-webkit-scrollbar {
    display: none;
}

/* Para Firefox, IE e Edge */
.modal-card {
    -ms-overflow-style: none;  /* IE e Edge */
    scrollbar-width: none;  /* Firefox */
}

/* =========================================
   16. BOTÕES DE SELEÇÃO MODERNOS (SÓLIDOS)
   ========================================= */

/* --- Container dos Radios (Ganhei/Gastei) --- */
.radio-group-modern {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

/* O estilo base do botão (desmarcado) */
.radio-btn-label, .checkbox-btn-label {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    background: var(--bg-color); /* Fundo cinza claro */
    color: var(--text-sec);
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 14px;
}

/* Esconde o input original do navegador */
.radio-btn-label input, .checkbox-btn-label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0; width: 0;
}

/* --- ESTADOS MARCADOS (:checked) --- */

/* Quando RECEITA (Ganhei) está marcado */
.radio-btn-label:has(input[value="receita"]:checked) {
    background-color: var(--primary); /* Verde */
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

/* Quando DESPESA (Gastei) está marcado */
.radio-btn-label:has(input[value="despesa"]:checked) {
    background-color: var(--red); /* Vermelho */
    color: white;
    border-color: var(--red);
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.3);
}

/* Quando o CHECKBOX (Pular mês) está marcado */
.checkbox-btn-label:has(input:checked) {
    background-color: var(--primary); /* Verde */
    color: white;
    border-color: var(--primary);
}

/* Efeito de clique */
.radio-btn-label:active, .checkbox-btn-label:active {
    transform: scale(0.97);
}

/* =========================================
   17. ANIMAÇÃO DE ENTRADA DO MODAL
   ========================================= */

/* A Animação do Fundo Escuro */
@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* A Animação do Cartão (Sobe e Cresce) */
@keyframes modalPopIn {
    from { 
        opacity: 0; 
        transform: translateY(20px) scale(0.95); /* Começa mais baixo e menor */
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); /* Termina no lugar certo */
    }
}

/* Aplica ao Fundo quando abre */
.modal-overlay.open {
    display: flex; /* Mantém o display flex */
    animation: overlayFadeIn 0.3s ease forwards;
}

/* Aplica ao Cartão quando abre */
.modal-overlay.open .modal-card {
    /* O cubic-bezier dá aquele efeito "elástico" suave no final */
    animation: modalPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* =========================================
   18. PASTAS COM CABEÇALHO SÓLIDO (EFEITO BOTÃO)
   ========================================= */

details.pasta-fixos {
    padding: 0; /* Remove padding para o título encostar nas bordas */
    overflow: hidden; /* Garante que o fundo não vaze */
    border: 1px solid transparent; /* A cor será definida abaixo */
    background: var(--card-bg);
}

/* O Cabeçalho (Título) */
details.pasta-fixos summary {
    padding: 18px 20px;
    font-weight: 700;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    transition: background 0.3s;
}

/* Ajuste da setinha para ficar branca */
details.pasta-fixos summary::after {
    color: white; /* Setinha branca */
    font-weight: bold;
}

/* O Conteúdo (A lista dentro) */
details.pasta-fixos > div {
    padding: 20px; /* Devolve o espaço para os itens dentro */
    background: var(--card-bg);
}

/* --- CORES ESPECÍFICAS --- */

/* 1. Receitas (Verde) */
details.pasta-receita { border-color: var(--primary); }
details.pasta-receita summary { background: var(--primary); color: white; }

/* 2. Custos (Vermelho) */
details.pasta-despesa { border-color: var(--red); }
details.pasta-despesa summary { background: var(--red); color: white; }

/* 3. Parcelados (Roxo) */
details.pasta-parcelado { border-color: var(--purple); }
details.pasta-parcelado summary { background: var(--purple); color: white; }

