
/* ========================================
   CONFIGURAÇÕES GERAIS
======================================== */

:root {
    --primaria: #2563eb;
    --primaria-hover: #1d4ed8;
    --fundo: #f1f5f9;
    --branco: #ffffff;
    --texto: #1e293b;
    --texto-secundario: #64748b;
    --borda: #e2e8f0;
    --verde: #16a34a;
    --vermelho: #dc2626;
    --sombra: 0 4px 16px rgba(15, 23, 42, 0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: var(--fundo);
    color: var(--texto);
    line-height: 1.6;
}

[hidden] {
    display: none !important;
}

/* ========================================
   LOGIN E CADASTRO
======================================== */

#autenticacao {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px;
    background: linear-gradient(135deg, #0f172a, #1e40af);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 35px;
    background-color: var(--branco);
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.18);
}

.auth-container > h1 {
    text-align: center;
    color: var(--primaria);
    font-size: 1.9rem;
    margin-bottom: 8px;
}

.auth-container > p {
    text-align: center;
    color: var(--texto-secundario);
    margin-bottom: 25px;
}

.auth-container h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    text-align: center;
}

.auth-container form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-container form button {
    margin-top: 10px;
    width: 100%;
}

#area-login > p,
#area-cadastro > p {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
}

.botao-link {
    background: transparent;
    color: var(--primaria);
    border: none;
    padding: 5px;
    font-size: 0.9rem;
    font-weight: 600;
}

.botao-link:hover {
    background: transparent;
    color: var(--primaria-hover);
    text-decoration: underline;
}

#mensagem-auth {
    margin-top: 15px;
    font-size: 0.9rem;
    text-align: center;
    overflow-wrap: anywhere;
}

/* ========================================
   CABEÇALHO
======================================== */

header {
    background: linear-gradient(135deg, #0f172a, #1e40af);
    color: var(--branco);
    text-align: center;
    padding: 40px 20px;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

header p {
    color: #cbd5e1;
}

.usuario-logado {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
}

#usuario-email {
    color: #e2e8f0;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

#botao-sair {
    background-color: var(--vermelho);
}

#botao-sair:hover {
    background-color: #b91c1c;
}

/* ========================================
   CONTEÚDO PRINCIPAL
======================================== */

main {
    width: 92%;
    max-width: 1100px;
    margin: 35px auto;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

main section {
    background-color: var(--branco);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--sombra);
}

main section h2 {
    font-size: 1.3rem;
    margin-bottom: 18px;
    color: var(--texto);
}

/* ========================================
   FORMULÁRIOS
======================================== */

form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

label {
    font-size: 0.95rem;
    font-weight: 600;
}

input,
select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--borda);
    border-radius: 8px;
    background-color: var(--branco);
    color: var(--texto);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
    border-color: var(--primaria);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input:disabled,
select:disabled {
    background-color: #f1f5f9;
    cursor: not-allowed;
}

button {
    padding: 12px 18px;
    background-color: var(--primaria);
    color: var(--branco);
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

button:hover {
    background-color: var(--primaria-hover);
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========================================
   SALDO INICIAL
======================================== */

#saldo-inicial {
    border-left: 5px solid var(--primaria);
}

#saldo-inicial > p {
    color: var(--texto-secundario);
    margin-bottom: 18px;
}

#form-saldo-inicial {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 12px;
}

#form-saldo-inicial label {
    grid-column: 1 / -1;
}

#form-saldo-inicial input {
    min-width: 0;
}

#form-saldo-inicial button {
    white-space: nowrap;
}

#saldo-inicial > p:last-child {
    margin-top: 20px;
    margin-bottom: 0;
    padding: 15px;
    background-color: #eff6ff;
    border-radius: 8px;
    color: var(--texto);
}

#saldo-inicial-atual {
    color: var(--primaria);
    font-size: 1.15rem;
}

/* ========================================
   FILTROS
======================================== */

#filtro {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
}

#filtro h2 {
    grid-column: 1 / -1;
    margin-bottom: 5px;
}

#filtro label {
    align-self: end;
}

#filtro select,
#filtro input {
    grid-row: 3;
}

/* ========================================
   RESUMO FINANCEIRO
======================================== */

#resumo {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

#resumo h2 {
    grid-column: 1 / -1;
    margin-bottom: 0;
}

#resumo article {
    background-color: #f8fafc;
    padding: 22px;
    border: 1px solid var(--borda);
    border-radius: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

#resumo article:hover {
    transform: translateY(-3px);
    box-shadow: var(--sombra);
}

#resumo article h3 {
    font-size: 0.95rem;
    color: var(--texto-secundario);
    font-weight: 500;
    margin-bottom: 10px;
}

#resumo article p {
    font-size: 1.65rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

#resumo article:nth-of-type(1) {
    border-top: 4px solid var(--primaria);
}

#resumo article:nth-of-type(2) {
    border-top: 4px solid var(--verde);
}

#resumo article:nth-of-type(3) {
    border-top: 4px solid var(--vermelho);
}

#receitas {
    color: var(--verde);
}

#despesas {
    color: var(--vermelho);
}

/* ========================================
   GRÁFICO DE DESPESAS
======================================== */

#grafico-despesas {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.grafico-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.grafico-info {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.9rem;
}

.grafico-info span:last-child {
    font-weight: 600;
}

.barra-fundo {
    width: 100%;
    height: 14px;
    background-color: #e2e8f0;
    border-radius: 20px;
    overflow: hidden;
}

.barra-progresso {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    border-radius: 20px;
    transition: width 0.3s ease;
}

/* ========================================
   CADASTRO DE MOVIMENTAÇÕES
======================================== */

#cadastro form {
    max-width: 650px;
}

#cadastro button {
    margin-top: 10px;
}

/* ========================================
   HISTÓRICO
======================================== */

#historico {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 650px;
}

thead {
    background-color: #f1f5f9;
}

th,
td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--borda);
    font-size: 0.9rem;
}

th {
    color: #475569;
    font-weight: 700;
}

tbody tr:hover {
    background-color: #f8fafc;
}

.btn-excluir {
    background-color: var(--vermelho);
    padding: 8px 12px;
    font-size: 0.85rem;
}

.btn-excluir:hover {
    background-color: #b91c1c;
}

/* ========================================
   RODAPÉ
======================================== */

footer {
    text-align: center;
    padding: 25px 15px;
    color: var(--texto-secundario);
    font-size: 0.9rem;
}

/* ========================================
   RESPONSIVIDADE - TABLETS
======================================== */

@media (max-width: 768px) {
    main {
        width: 95%;
        margin: 20px auto;
        gap: 18px;
    }

    main section {
        padding: 20px;
    }

    #resumo {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    #resumo h2 {
        grid-column: 1;
    }

    #resumo article p {
        font-size: 1.5rem;
    }

    #filtro {
        grid-template-columns: 1fr;
    }

    #filtro h2 {
        grid-column: 1;
    }

    #filtro select,
    #filtro input {
        grid-row: auto;
    }
}

/* ========================================
   RESPONSIVIDADE - CELULARES
======================================== */

@media (max-width: 480px) {
    header {
        padding: 30px 15px;
    }

    header h1 {
        font-size: 1.7rem;
    }

    .auth-container {
        padding: 25px 20px;
    }

    .auth-container > h1 {
        font-size: 1.6rem;
    }

    #form-saldo-inicial {
        grid-template-columns: 1fr;
    }

    #form-saldo-inicial label {
        grid-column: 1;
    }

    #form-saldo-inicial button {
        width: 100%;
    }

    .grafico-info {
        flex-direction: column;
        gap: 2px;
    }

    .usuario-logado {
        flex-direction: column;
    }
}
