/* RESET E PADRÕES */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body { background-color: #f8f9fa; color: #1e293b; overflow-x: hidden; }

/* NAVBAR (Padrão) */
.navbar {
    background-color: #0F4D3A; height: 70px; width: 100%;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 40px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    position: sticky; top: 0; z-index: 1000;
}
.logo { height: 48px; filter: brightness(0) invert(1); }
.nav-links { display: flex; gap: 30px; list-style: none; }
.nav-links a { text-decoration: none; color: #cbd5e1; font-weight: 500; }
.nav-links a.active { color: white; }
.nav-right { display: flex; gap: 20px; align-items: center; }
.user-info { text-align: right; color: white; }
.user-name { display: block; font-weight: 600; font-size: 0.85rem; }
.user-email { font-size: 0.75rem; color: #cbd5e1; }
.btn-logout { background: none; border: 1px solid rgba(255,255,255,0.3); color: white; padding: 6px 14px; border-radius: 4px; cursor: pointer; }

/* LAYOUT GERAL */
.dashboard-container { max-width: 1280px; margin: 0 auto; padding: 40px; }
.page-header-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.section-title { font-size: 1.5rem; color: #0F4D3A; font-weight: 600; }

.btn-primary {
    background-color: #0F4D3A; color: white; border: none; padding: 10px 24px;
    border-radius: 8px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 8px;
    box-shadow: 0 4px 6px rgba(15, 77, 58, 0.2); transition: 0.2s;
}
.btn-primary:hover { background-color: #0a3528; }

/* CARDS KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 30px; }
.kpi-card { background: white; padding: 25px; border-radius: 12px; border: 1px solid #e2e8f0; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.kpi-label { font-size: 0.9rem; color: #64748b; margin-bottom: 5px; font-weight: 500; }
.kpi-value { font-size: 1.8rem; font-weight: 700; font-family: 'Roboto Mono', monospace; margin-bottom: 5px; }
.kpi-sub { font-size: 0.8rem; color: #94a3b8; display: flex; align-items: center; gap: 4px; }

.highlight-blue { color: #1e293b; }
.highlight-green { color: #166534; }
.highlight-red { color: #dc2626; }

/* BARRA DE FILTROS */
.filters-bar {
    background: white; padding: 15px; border-radius: 10px; border: 1px solid #e2e8f0;
    display: flex; gap: 15px; margin-bottom: 25px; align-items: center;
}
.search-wrapper { flex: 1; position: relative; }
.search-wrapper i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.search-wrapper input {
    width: 100%; padding: 10px 10px 10px 35px; border: 1px solid #cbd5e1; border-radius: 6px; outline: none;
}
.filter-group { display: flex; gap: 10px; }
.filter-group select {
    padding: 10px; border: 1px solid #cbd5e1; border-radius: 6px; background: white; color: #334155; outline: none; cursor: pointer;
}

/* TABELA FINANCEIRA */
.table-container { background: white; border-radius: 10px; border: 1px solid #e2e8f0; overflow: hidden; }
.finance-table { width: 100%; border-collapse: collapse; text-align: left; }
.finance-table thead { background-color: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.finance-table th { padding: 15px 20px; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; color: #64748b; }
.finance-table td { padding: 15px 20px; vertical-align: middle; font-size: 0.9rem; color: #334155; border-bottom: 1px solid #f1f5f9; }
.finance-table tr:hover { background-color: #fcfcfc; }

/* Colunas Específicas */
.type-icon {
    width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.type-icon.in { background: #dcfce7; color: #166534; } /* Receita */
.type-icon.out { background: #fee2e2; color: #dc2626; } /* Despesa */

.value-cell { font-family: 'Roboto Mono', monospace; font-weight: 600; }
.value-cell.positive { color: #166534; }
.value-cell.negative { color: #dc2626; }

.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.status-badge.paid { background: #dbeafe; color: #1e40af; }
.status-badge.pending { background: #f1f5f9; color: #64748b; }
.status-badge.overdue { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.action-btn { background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 1.2rem; }
.action-btn:hover { color: #0F4D3A; }

/* MODAL & SWITCHER */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 77, 58, 0.2); backdrop-filter: blur(4px);
    z-index: 2000; display: flex; justify-content: center; align-items: center;
}
.hidden { display: none; }

.modal-box {
    background: white; width: 100%; max-width: 500px; border-radius: 12px; padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1); border: 1px solid #dcfce7;
}

.modal-header { display: flex; justify-content: space-between; margin-bottom: 25px; }
.btn-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; }

/* Switcher de Receita/Despesa */
.type-switcher { display: flex; gap: 10px; margin-bottom: 20px; }
.switch-option { flex: 1; cursor: pointer; }
.switch-option input { display: none; }
.switch-box {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px; border-radius: 8px; border: 1px solid #e2e8f0;
    color: #64748b; font-weight: 500; transition: 0.2s;
}
.switch-option input:checked + .switch-box.box-receita {
    background: #dcfce7; border-color: #166534; color: #166534;
}
.switch-option input:checked + .switch-box.box-despesa {
    background: #fee2e2; border-color: #dc2626; color: #dc2626;
}

.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 0.85rem; color: #475569; margin-bottom: 5px; }
.form-group input, .form-group select {
    width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px; outline: none;
}
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.checkbox-group { display: flex; align-items: center; gap: 8px; }
.checkbox-group input { width: auto; }

/* Botão do Tema Dinâmico */
.btn-confirm {
    padding: 10px 20px; border: none; border-radius: 8px; color: white; cursor: pointer; font-weight: 500; transition: 0.3s;
}
/* Classes que o JS vai alternar */
.theme-red { background-color: #dc2626; }
.theme-red:hover { background-color: #b91c1c; }
.theme-green { background-color: #166534; }
.theme-green:hover { background-color: #14532d; }

.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.btn-cancel { background: white; border: 1px solid #cbd5e1; padding: 10px 20px; border-radius: 8px; cursor: pointer; }

/* Mobile */
@media(max-width: 900px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .filters-bar { flex-direction: column; }
    .nav-links, .nav-right .user-info { display: none; }
    .finance-table th:nth-child(3), .finance-table td:nth-child(3), /* Categoria */
    .finance-table th:nth-child(5), .finance-table td:nth-child(5) { display: none; } /* Status */
}
/* --- ÁREA DO USUÁRIO (DIREITA) --- */
.nav-right {
    display: flex;
    align-items: center; /* Centraliza verticalmente todos os itens */
    gap: 24px; /* Espaço entre o bloco do perfil e o botão sair */
    height: 100%; /* Garante que o container use a altura da navbar */
}

/* Container da foto e texto */
.user-profile {
    display: flex;
    align-items: center; /* Alinha foto e texto no centro vertical */
    gap: 12px; /* Espaço entre o texto e a foto */
    text-align: right; /* Alinha o texto para a direita (perto da foto) */
    
    /* Opcional: Linha vertical separando do botão sair */
    padding-right: 24px;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    height: 40px; /* Altura da linha divisória */
}

/* Container dos Textos (Nome e Email) */
.user-info {
    display: flex;
    flex-direction: column; /* Coloca um texto embaixo do outro */
    justify-content: center;
    line-height: 1.3; /* Espaçamento entre as linhas de texto */
}

.user-name {
    color: white;
    font-size: 0.9rem; /* 14px */
    font-weight: 600;
    white-space: nowrap; /* Evita que o nome quebre linha */
}

.user-email {
    color: #cbd5e1; /* Cinza claro */
    font-size: 0.75rem; /* 12px */
    font-weight: 400;
}

/* Foto do Usuário */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%; /* Círculo perfeito */
    object-fit: cover; /* Garante que a imagem não distorça */
    border: 2px solid rgba(255, 255, 255, 0.2); /* Borda sutil */
    flex-shrink: 0; /* Garante que a foto não amasse */
}

/* Botão Sair */
.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px; /* Espaço entre texto e ícone se houver */
    
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    height: 36px; /* Altura fixa para alinhar bem */
}

.btn-logout:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: white;
}

/* AJUSTE MOBILE (Esconde informações para não quebrar) */
@media (max-width: 768px) {
    .user-info {
        display: none; /* Esconde nome/email em telas pequenas */
    }
    
    .user-profile {
        padding-right: 0;
        border-right: none;
    }
}
/* Botão de Perfil (Destaque) */
.btn-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    
    /* Estilo Diferenciado (Cápsula Translúcida) */
    background-color: rgba(255, 255, 255, 0.15); 
    color: white;
    text-decoration: none;
    
    padding: 8px 16px;
    border-radius: 20px; /* Bordas bem redondas */
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent; /* Para evitar pulo no hover */
}

/* Efeito Hover: Fica branco com texto verde */
.btn-profile:hover {
    background-color: #ffffff;
    color: #0F4D3A; /* Verde da marca */
    transform: translateY(-1px); /* Leve subida */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Ajuste no botão de Sair para ficar harmônico ao lado */
.btn-logout {
    /* Se quiser, pode deixar o botão sair apenas como ícone para economizar espaço */
    padding: 8px 12px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
    display: flex; align-items: center; justify-content: center;
}

.btn-logout:hover {
    border-color: #fca5a5; /* Vermelho claro ao passar o mouse */
    color: #fca5a5;
    background: rgba(255, 0, 0, 0.05);
}

/* Responsividade: No mobile, esconde o texto 'Minha Conta' e deixa só o ícone */
@media (max-width: 900px) {
    .btn-profile {
        font-size: 0; /* Esconde o texto */
        padding: 10px; /* Ajusta padding para ficar quadrado/redondo */
        border-radius: 50%;
        width: 38px;
        height: 38px;
        justify-content: center;
    }
    
    .btn-profile i {
        font-size: 1.2rem; /* Aumenta o ícone */
    }
}
.small-modal { max-width: 400px !important; }

.input-file-custom {
    width: 100%;
    padding: 10px;
    border: 2px dashed #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
}

.btn-view-file {
    color: #2563eb;
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.btn-view-file:hover { transform: scale(1.2); }

.btn-quick-pay {
    background: #dcfce7;
    color: #16a34a;
    border: none;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-quick-pay:hover { background: #bbf7d0; }

/* Container das ações para manter alinhamento */
.actions-cell {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

/* Base comum para todos os botões de ação */
.btn-action, .btn-baixa, .btn-file-view {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #f1f5f9; /* Fundo neutro inicial */
    font-size: 1.2rem;
    position: relative;
}

/* --- ÍCONE DO COMPROVANTE (Visualização) --- */
.btn-file-view {
    color: #6366f1; /* Indigo */
    text-decoration: none;
}

.btn-file-view:hover {
    background-color: #e0e7ff;
    color: #4338ca;
    transform: scale(1.1);
}

/* --- BOTÃO DE BAIXA (Check) --- */
.btn-baixa {
    color: #10b981; /* Esmeralda/Verde */
}

.btn-baixa:hover {
    background-color: #d1fae5;
    color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}

/* --- BOTÃO EDITAR (Azul) --- */
.btn-edit {
    color: #3b82f6; /* Azul */
}

.btn-edit:hover {
    background-color: #dbeafe;
    color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
}

/* --- BOTÃO EXCLUIR (Vermelho) --- */
.btn-delete {
    color: #ef4444; /* Vermelho */
}

.btn-delete:hover {
    background-color: #fee2e2;
    color: #b91c1c;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.2);
}

/* Efeito de clique em todos */
.btn-action:active, .btn-baixa:active, .btn-file-view:active {
    transform: scale(0.9);
}

/* Estilo para quando não há comprovante (vazio) */
.no-doc {
    color: #cbd5e1;
    font-size: 0.9rem;
    font-style: italic;
}

/* Animação para o ícone de carregamento no botão confirmar */
.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
/* ============================================================
   NAVBAR & MENU RESPONSIVO (COMPLETO)
   ============================================================ */

/* --- Estilos Base (Desktop) --- */
.navbar {
    background-color: #0F4D3A; /* Verde Marca */
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Esconde o controle do menu e o ícone no Desktop */
#menu-check, .menu-hamburguer {
    display: none;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 25px;
}

.nav-links a {
    text-decoration: none;
    color: #cbd5e1;
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.3s;
}

.nav-links a:hover, .nav-links a.active {
    color: white;
}

/* --- Responsividade (Mobile: abaixo de 900px) --- */
@media (max-width: 900px) {
    .navbar {
        padding: 0 20px;
        justify-content: space-between;
    }

    /* Exibe o ícone de hambúrguer */
    .menu-hamburguer {
        display: block;
        color: white;
        font-size: 2rem;
        cursor: pointer;
        order: -1; /* Posiciona à esquerda do logo */
    }

    /* Menu Lateral (Drawer) */
    .nav-links {
        position: fixed;
        top: 70px;
        left: -100%; /* Escondido à esquerda */
        width: 280px;
        height: calc(100vh - 70px);
        background-color: #0F4D3A;
        flex-direction: column;
        gap: 5px; /* Espaçamento entre os blocos de link */
        padding-top: 30px;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        box-shadow: 10px 0 25px rgba(0,0,0,0.3);
    }

    /* Itens do Menu Mobile */
    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        display: flex;
        align-items: center;
        padding: 22px 35px; /* Espaço generoso para o clique */
        font-size: 1.1rem;
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.03);
        color: #cbd5e1;
    }

    /* Estado Ativo e Hover no Mobile */
    .nav-links a.active {
        background-color: rgba(255, 255, 255, 0.08);
        color: white;
        border-left: 6px solid #ffffff;
        padding-left: 29px; /* Ajuste para compensar a borda lateral */
    }

    .nav-links a:active {
        background-color: rgba(255, 255, 255, 0.15);
    }

    /* LOGICA DE ABERTURA: Quando o checkbox é marcado */
    #menu-check:checked ~ .nav-center .nav-links {
        left: 0; /* Desliza para dentro da tela */
    }

    /* Ajustes de interface mobile */
    .logo { height: 38px; }
    
    .nav-right {
        gap: 15px;
    }

    .btn-profile span, .user-info {
        display: none !important; /* Esconde textos para não quebrar a barra */
    }

    .btn-profile {
        padding: 10px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.1);
    }
}