/*
 * ARQUIVO: style.css
 * DESCRIÇÃO: Estilos CSS para o sistema de Gestão de Gastos.
 * OBJETIVO: Tornar a interface mais agradável e moderna.
 * COMENTÁRIOS: Todos os estilos foram revisados e comentados em Português.
 */

/* ==========================================================================
   ESTILOS GERAIS E RESET BÁSICO
   ========================================================================== */
body {
    /* Fonte principal para todo o corpo do documento */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0; /* Remove margem padrão do body */
    padding: 0; /* Remove padding padrão do body */
    /* Cor de fundo suave para a aplicação */
    background-color: #f0f2f5;
    color: #333; /* Cor de texto padrão */
    line-height: 1.6; /* Espaçamento de linha para melhor leitura */
}

a {
    color: #007bff; /* Cor primária para links */
    text-decoration: none; /* Remove sublinhado padrão */
    transition: color 0.3s; /* Transição suave para o hover */
}

a:hover {
    color: #0056b3; /* Cor mais escura no hover */
    text-decoration: underline; /* Adiciona sublinhado no hover */
}

/* ==========================================================================
   ESTILOS DE AUTENTICAÇÃO (LOGIN/CADASTRO)
   ========================================================================== */
.auth-container {
    max-width: 400px; /* Largura máxima do formulário */
    margin: 80px auto; /* Centraliza vertical e horizontalmente */
    padding: 30px;
    background-color: #fff;
    border-radius: 12px; /* Cantos mais arredondados */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); /* Sombra mais suave e proeminente */
    text-align: center;
}

.auth-container h2 {
    margin-bottom: 25px;
    color: #1e3a8a; /* Cor mais escura e profissional para o título */
    font-size: 1.8em;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600; /* Fonte um pouco mais grossa */
    color: #4b5563;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px; /* Input mais arredondado */
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus {
    border-color: #3b82f6; /* Borda azul no foco */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); /* Sombra suave no foco */
    outline: none; /* Remove o outline padrão */
}

.error-message {
    color: #ef4444; /* Vermelho mais vibrante para erros */
    font-size: 0.9em;
    margin-top: 5px;
    display: block;
    font-weight: 500;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background-color: #3b82f6; /* Azul primário */
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    margin-top: 15px;
    transition: background-color 0.3s, transform 0.1s;
}

.btn-primary:hover {
    background-color: #2563eb; /* Azul mais escuro no hover */
}

.btn-primary:active {
    transform: scale(0.99); /* Efeito de clique */
}

/* ==========================================================================
   ESTILOS DO DASHBOARD E LAYOUT PRINCIPAL
   ========================================================================== */
.dashboard-container {
    display: flex;
    min-height: 100vh; /* Ocupa a altura total da viewport */
}

/* Barra Lateral (Sidebar) */
.sidebar {
    width: 260px; /* Largura um pouco maior */
    background-color: #1e3a8a; /* Azul escuro, cor primária */
    color: white;
    padding: 20px 0; /* Padding vertical */
    box-shadow: 3px 0 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0; /* Impede que a sidebar encolha */
}

.sidebar h3 {
    text-align: center;
    margin-bottom: 40px;
    color: #fff;
    font-size: 1.5em;
    padding: 0 20px;
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
}

.sidebar nav ul li a {
    display: flex; /* Para alinhar ícones se houver */
    align-items: center;
    color: #e5e7eb; /* Cor do texto mais clara */
    padding: 12px 20px;
    margin-bottom: 5px;
    border-left: 4px solid transparent; /* Borda para indicar ativo */
    transition: background-color 0.3s, border-left-color 0.3s;
}

.sidebar nav ul li a:hover {
    background-color: #254b9b; /* Cor de fundo mais clara no hover */
    border-left-color: #3b82f6; /* Borda azul no hover */
    text-decoration: none;
}

.sidebar nav ul li a.active {
    background-color: #254b9b;
    border-left-color: #3b82f6; /* Borda azul para o item ativo */
    color: white;
    font-weight: bold;
}

/* Conteúdo Principal */
.main-content {
    flex-grow: 1;
    padding: 30px;
    background-color: #f9fafb; /* Fundo do conteúdo principal */
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 15px;
}

.header h1 {
    margin: 0;
    color: #1f2937;
    font-size: 2em;
}

.user-info {
    font-weight: 600;
    color: #4b5563;
}

/* Cards de Resumo */
.cards-container {
    display: grid;
    /* Layout responsivo com 4 colunas ou o mínimo de 250px */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.card {
    background-color: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-left: 6px solid; /* Borda mais grossa para destaque */
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px); /* Efeito de leve levantamento no hover */
}

.card.total { border-left-color: #3b82f6; } /* Azul */
.card.income { border-left-color: #10b981; } /* Verde */
.card.expense { border-left-color: #ef4444; } /* Vermelho */
.card.balance { border-left-color: #f59e0b; } /* Amarelo/Laranja */

.card h4 {
    margin-top: 0;
    color: #6b7280;
    font-size: 1em;
    font-weight: 500;
}

.card p {
    font-size: 2em;
    font-weight: bold;
    margin: 5px 0 0;
    color: #1f2937;
}

/* ==========================================================================
   ESTILOS PARA CRUDs (Tabelas e Seções)
   ========================================================================== */
.crud-section {
    background-color: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.crud-section h2 {
    color: #1f2937;
    font-size: 1.5em;
    margin-top: 0;
}

.crud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-add {
    padding: 10px 20px;
    background-color: #10b981; /* Verde para adicionar */
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background-color 0.3s;
}

.btn-add:hover {
    background-color: #059669;
}

.data-table {
    width: 100%;
    border-collapse: separate; /* Permite border-radius */
    border-spacing: 0;
    margin-top: 15px;
    font-size: 0.95em;
}

.data-table th, .data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #f3f4f6; /* Linha divisória mais clara */
}

.data-table th {
    background-color: #f9fafb; /* Fundo do cabeçalho */
    color: #4b5563;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9em;
}

/* Arredondamento das bordas da tabela */
.data-table thead tr:first-child th:first-child {
    border-top-left-radius: 8px;
}
.data-table thead tr:first-child th:last-child {
    border-top-right-radius: 8px;
}

.data-table tbody tr:last-child td {
    border-bottom: none; /* Remove a borda da última linha */
}

.data-table tbody tr:hover {
    background-color: #fefefe; /* Efeito de hover suave */
}

.actions button {
    padding: 8px 12px;
    margin-right: 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: opacity 0.3s;
}

.actions button:hover {
    opacity: 0.8;
}

.btn-edit {
    background-color: #f59e0b; /* Amarelo para editar */
    color: white;
}

.btn-delete {
    background-color: #ef4444; /* Vermelho para deletar */
    color: white;
}

/* ==========================================================================
   ESTILOS PARA MODAL (Formulário de CRUD)
   ========================================================================== */
.modal {
    display: none; /* Escondido por padrão */
    position: fixed;
    z-index: 1000; /* Garante que fique acima de tudo */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5); /* Fundo escuro semi-transparente */
    backdrop-filter: blur(3px); /* Efeito de desfoque no fundo */
}

.modal-content {
    background-color: #fff;
    margin: 10% auto; /* Centraliza um pouco mais alto */
    padding: 30px;
    border: none;
    width: 90%;
    max-width: 550px; /* Largura máxima um pouco maior */
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: fadeIn 0.3s ease-out; /* Animação de entrada */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.close-btn {
    color: #9ca3af;
    float: right;
    font-size: 32px;
    font-weight: normal;
    line-height: 1;
    transition: color 0.3s;
}

.close-btn:hover,
.close-btn:focus {
    color: #333;
    text-decoration: none;
    cursor: pointer;
}

.modal-content h3 {
    margin-top: 0;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 15px;
    margin-bottom: 25px;
    color: #1f2937;
    font-size: 1.6em;
}

.modal-content .form-group input[type="text"],
.modal-content .form-group input[type="number"],
.modal-content .form-group input[type="date"],
.modal-content .form-group select {
    /* Reutiliza os estilos de input, mas adiciona o de data */
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1em;
}

.modal-actions {
    text-align: right;
    margin-top: 30px;
}

.modal-actions button {
    padding: 10px 20px;
    margin-left: 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background-color 0.3s;
}

.btn-save {
    background-color: #3b82f6; /* Azul para salvar */
    color: white;
}

.btn-cancel {
    background-color: #6b7280; /* Cinza para cancelar */
    color: white;
}

.btn-save:hover {
    background-color: #2563eb;
}

.btn-cancel:hover {
    background-color: #4b5563;
}
