/* "style.css" */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Century Gothic', 'Poppins', Arial, sans-serif;
}

body {
    background-color: #f4f4f4;
    color: #333;
}

header {
    background-color: #800020;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

header h1 {
    font-size: 24px;
}

nav a {
    color: white;
    text-decoration: none;
    margin-left: 20px;
    font-weight: bold;
}

nav a:hover {
    color: #f4c2c2;
}

main {
    padding: 30px;
}

/* ===== FORMULÁRIOS ===== */
form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

label {
    display: block;
    font-weight: bold;
    margin-top: 10px;
}

input, select {
    display: block;
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

button {
    background-color: #800020;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
}

button:hover {
    background-color: #5c0017;
}

/* ===== TABELAS ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
}

th, td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

th {
    background-color: #800020;
    color: white;
}

hr {
    margin: 30px 0;
    border: none;
    border-top: 2px solid #ddd;
}

/* ===== GRÁFICOS ===== */
.grafico-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 700px;
    margin-bottom: 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* ===== DISTRIBUIÇÃO POR CLASSE (gráfico + lista lado a lado) ===== */
.distribuicao-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.grafico-metade {
    max-width: 350px;
    margin-bottom: 0;
}

.lista-distribuicao {
    flex: 1;
    min-width: 250px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 20px;
}

.lista-distribuicao table {
    margin-top: 0;
}

/* ===== META DE INVESTIMENTO ===== */
.meta-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 500px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.progresso-container {
    background: #e0e0e0;
    border-radius: 20px;
    overflow: hidden;
    margin-top: 15px;
    height: 30px;
}

.progresso-barra {
    background: linear-gradient(90deg, #800020, #a00030);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    transition: width 0.5s ease;
    min-width: 30px;
}

/* ===== CARDS DE RESUMO ===== */
.cards-resumo {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.card-resumo {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex: 1;
    min-width: 150px;
    text-align: center;
}

.card-resumo h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.card-resumo p {
    font-size: 22px;
    font-weight: bold;
    color: #333;
}

.card-total {
    background: #800020;
}

.card-total h3, .card-total p {
    color: white;
}

/* ===== DASHBOARD ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.dash-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

#dash-transacoes {
    display: flex;
    flex-direction: column;
}

.quick-access-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
    flex: 1;
}

.btn-quick {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    font-size: 20px;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-quick:hover {
    opacity: 0.9;
    transform: scale(1.01);
}

.btn-receita {
    background: #27ae60;
}

.btn-despesa {
    background: #c0392b;
}

.dash-destaque {
    font-size: 28px;
    font-weight: bold;
    color: #800020;
    margin: 10px 0;
}

.grafico-dash {
    max-width: 100%;
    height: 320px;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== LISTA RETRATIL (MEUS INVESTIMENTOS) ===== */
.titulo-retratil {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    user-select: none;
    max-width: 700px;
}

.titulo-retratil:hover {
    background: #f4e9ec;
}

#icone-toggle-lista {
    transition: transform 0.3s ease;
    font-size: 16px;
}

.conteudo-retratil {
    overflow: hidden;
    max-height: 3000px;
    transition: max-height 0.4s ease;
    margin-top: 10px;
}

.conteudo-retratil.fechado {
    max-height: 0;
    margin-top: 0;
}

.icone-rotacionado {
    transform: rotate(-90deg);
}

/* ===== FILTROS DA LISTA (CLASSE + BUSCA) ===== */
.filtros-lista {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.filtro-item {
    flex: 1;
    min-width: 200px;
}

.filtro-item label {
    margin-top: 0;
}

/* ===== LAYOUT LADO A LADO: TRANSACOES ===== */
.layout-transacoes {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.coluna-formulario {
    flex: 0 0 500px;
    max-width: 500px;
}

.coluna-historico {
    flex: 1;
    min-width: 300px;
}

.tabela-scroll {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.tabela-scroll table {
    margin-top: 0;
    box-shadow: none;
}

/* ===== TABELA COMPACTA (colunas menores) ===== */
.tabela-compacta th,
.tabela-compacta td {
    padding: 6px 8px;
    font-size: 12px;
    white-space: nowrap;
}

/* ===== RESPONSIVO: EMPILHA EM TELAS PEQUENAS ===== */
@media (max-width: 900px) {
    .layout-transacoes {
        flex-direction: column;
    }

    .coluna-formulario {
        max-width: 100%;
        flex: 1 1 auto;
    }

    .coluna-historico {
        width: 100%;
    }
}
/* ===== LISTA RETRATIL NATIVA (details/summary) - usada no Historico de Proventos ===== */
.detalhes-retratil {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.resumo-retratil {
    cursor: pointer;
    padding: 15px 20px;
    font-weight: bold;
    font-size: 18px;
    color: #333;
    list-style: none;
    user-select: none;
    position: relative;
}

.resumo-retratil::-webkit-details-marker {
    display: none;
}

.resumo-retratil::after {
    content: '▼';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    transition: transform 0.3s ease;
}

.detalhes-retratil[open] .resumo-retratil::after {
    transform: translateY(-50%) rotate(180deg);
}

.resumo-retratil:hover {
    background: #f4e9ec;
}

.conteudo-detalhes {
    padding: 0 20px 20px 20px;
}

.conteudo-detalhes table {
    margin-top: 0;
    box-shadow: none;
}
/* ===== LINHA DE TRANSFERENCIA NA TABELA UNIFICADA DE TRANSACOES ===== */
.linha-transferencia {
    background: #eef6ff;
}

.badge-transferencia {
    display: inline-block;
    background: #0068FF;
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
}

/* ===== BOTTOM NAV (MOBILE) ===== */
.bottom-nav {
    display: none;
}

@media (max-width: 640px) {

    header nav { display: none; }
    header { justify-content: center; padding: 16px; }
    header h1 { font-size: 20px; }

    body { padding-bottom: 64px; }

    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #800020;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
        z-index: 999;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .bottom-nav a {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 8px 2px 6px;
        color: rgba(255,255,255,0.7);
        text-decoration: none;
        font-size: 10px;
        font-weight: bold;
    }

    .icone-nav { font-size: 20px; }

    .bottom-nav a.ativo {
        color: #fff;
    }
}

/* ===== AJUSTES GERAIS MOBILE ===== */
@media (max-width: 640px) {

    main { padding: 15px; }

    h2 { font-size: 18px; margin-bottom: 10px; }
    h3 { font-size: 15px; }

    form, .meta-container {
        max-width: 100%;
    }

    input, select, button {
        font-size: 16px;
    }

    .cards-resumo {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .card-resumo { min-width: 0; }
    .card-resumo p { font-size: 18px; }

    .grafico-container, .grafico-metade {
        max-width: 100%;
    }

    .distribuicao-container {
        flex-direction: column;
    }

    .filtros-lista {
        flex-direction: column;
        gap: 10px;
    }

    .titulo-retratil {
        max-width: 100%;
    }

    .btn-quick { min-height: 56px; }
}

/* ===== TABELAS RESPONSIVAS (viram "cards" no mobile) ===== */
@media (max-width: 640px) {
    table.tabela-responsiva thead {
        display: none;
    }

    table.tabela-responsiva,
    table.tabela-responsiva tbody,
    table.tabela-responsiva tr,
    table.tabela-responsiva td {
        display: block;
        width: 100%;
    }

    table.tabela-responsiva {
        box-shadow: none;
        background: transparent;
    }

    table.tabela-responsiva tr {
        background: white;
        margin-bottom: 12px;
        border-radius: 8px;
        padding: 10px 12px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }

    table.tabela-responsiva td {
        border: none;
        border-bottom: 1px solid #f0f0f0;
        padding: 6px 0;
        text-align: right;
        white-space: normal;
        position: relative;
        padding-left: 45%;
        min-height: 24px;
    }

    table.tabela-responsiva td:last-child {
        border-bottom: none;
        text-align: right;
    }

    table.tabela-responsiva td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 42%;
        text-align: left;
        font-weight: bold;
        color: #800020;
        font-size: 12px;
    }
}
/* ===== BACKUP (EXPORTAR / IMPORTAR) - SOMENTE NO DASHBOARD ===== */
.backup-card {
    border: 2px dashed #800020;
    margin-bottom: 20px;
}

.backup-descricao {
    font-size: 13px;
    color: #666;
    margin: 8px 0 15px;
    line-height: 1.5;
}

.backup-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.backup-actions button {
    flex: 1;
    min-width: 160px;
    margin-top: 0;
}

.backup-info {
    font-size: 12px;
    color: #888;
    margin-top: 10px;
}

@media (max-width: 640px) {
    .backup-actions {
        flex-direction: column;
    }

    .backup-actions button {
        min-width: 0;
    }
}