/* Reset e configurações básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Variáveis CSS para melhor manutenção */
:root {
    --primary-color: #1a2a6c;
    --secondary-color: #4a90e2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --border-color: #eaeaea;
    --text-color: #333;
    --text-muted: #777;
    --shadow-light: 0 4px 8px rgba(0,0,0,0.05);
    --shadow-medium: 0 5px 15px rgba(0,0,0,0.1);
    --shadow-heavy: 0 8px 25px rgba(0,0,0,0.15);
    --border-radius: 12px;
    --border-radius-small: 8px;
    --transition: all 0.3s ease;
}

body {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-color);
    min-height: 100vh;
    padding: 15px;
    padding-bottom: 80px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 20px;
    color: white;
    padding: 15px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255,255,255,0.1), transparent);
    z-index: 0;
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}

header p {
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #1a2a6c, #4a90e2);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Saldo Container */
.saldo-container {
    text-align: center;
    position: relative;
}

.saldo-titulo {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 10px;
    font-weight: 600;
}

.saldo-valor {
    font-size: 1.8rem;
    font-weight: bold;
    color: #1a2a6c;
    margin: 15px 0;
    transition: color 0.3s;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    word-break: break-all;
}

.saldo-positivo {
    color: #28a745;
}

.saldo-negativo {
    color: #dc3545;
}

.mes-atual {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #4a90e2;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Resumo */
.resumo {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    gap: 15px;
    flex-wrap: wrap;
}

.receita, .despesa {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.3s;
    position: relative;
    overflow: hidden;
    min-width: 140px;
}

.receita:hover, .despesa:hover {
    transform: scale(1.03);
}

.receita {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.despesa {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.resumo-titulo {
    font-size: 0.9rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.resumo-valor {
    font-weight: bold;
    font-size: 1.1rem;
}

/* Formulário */
.form-titulo {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #1a2a6c;
    text-align: center;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.form-group {
    margin-bottom: 15px;
    position: relative;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #444;
    display: flex;
    align-items: center;
    gap: 8px;
}

label i {
    font-size: 1rem;
    color: #1a2a6c;
    width: 24px;
    text-align: center;
}

input, select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    background: #f9f9f9;
    transition: all 0.3s;
}

input:focus, select:focus {
    border-color: #1a2a6c;
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26, 42, 108, 0.1);
}

input::placeholder {
    color: #aaa;
    font-size: 0.95rem;
}

/* Radio Group */
.radio-group {
    display: flex;
    margin-top: 5px;
    gap: 10px;
    flex-wrap: wrap;
}

.radio-option {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    background: #f9f9f9;
    min-width: 120px;
}

.radio-option i {
    font-size: 1.2rem;
    margin-bottom: 6px;
}

.radio-option.active {
    background: #1a2a6c;
    color: white;
    border-color: #1a2a6c;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(26, 42, 108, 0.3);
}

/* Botões */
.btn-adicionar {
    background: #1a2a6c;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-adicionar:hover {
    background: #0d1a4d;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

.btn-adicionar:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-limpar {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 15px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.btn-limpar:hover {
    background: #bd2130;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-fechar-mes {
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    margin-top: 15px;
    width: 100%;
    justify-content: center;
}

.btn-fechar-mes:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Histórico */
.historico-titulo {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #1a2a6c;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    font-weight: 600;
}

.lista-transacoes {
    max-height: 300px;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid #eee;
    padding: 8px;
}

.transacao {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid #eee;
    transition: background 0.3s;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    position: relative;
}

.transacao:hover {
    background: #f9f9f9;
    border-radius: 8px;
}

.transacao:last-child {
    border-bottom: none;
}

.transacao-info {
    flex: 1;
    min-width: 150px;
}

.transacao-descricao {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 1rem;
}

.transacao-data {
    font-size: 0.85rem;
    color: #777;
}

.transacao-valor {
    font-weight: bold;
    font-size: 1.1rem;
    min-width: 100px;
    text-align: right;
}

.entrada .transacao-valor {
    color: #28a745;
}

.saida .transacao-valor {
    color: #dc3545;
}

.transacao-acoes {
    display: flex;
    align-items: center;
}

.btn-excluir {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px;
    transition: transform 0.2s;
}

.btn-excluir:hover {
    transform: scale(1.2);
}

.vazio {
    text-align: center;
    padding: 25px 15px;
    color: #777;
    font-style: italic;
    font-size: 1rem;
}

/* Análise Mensal */
.analise-mensal {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-top: 10px;
    border: 1px solid #eee;
}

.analise-titulo {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: #1a2a6c;
    text-align: center;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.analise-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.95rem;
    flex-wrap: wrap;
    align-items: center;
}

.analise-label {
    color: #555;
    min-width: 140px;
    font-weight: 500;
    font-size: 0.95rem;
}

.analise-valor {
    font-weight: bold;
    color: #1a2a6c;
    text-align: right;
    min-width: 120px;
    font-size: 1rem;
}

.previsao {
    color: #28a745;
}

/* Status Info */
.status-info {
    text-align: center;
    padding: 8px;
    margin-top: 8px;
    border-radius: 8px;
    background: #e9f7ef;
    color: #28a745;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Decendiais */
.decendial-container {
    margin-top: 20px;
}

.decendial-titulo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.decendial-titulo h3 {
    color: #1a2a6c;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filtro-mes {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filtro-mes label {
    color: #555;
    font-weight: 500;
    margin-bottom: 0;
    font-size: 0.95rem;
}

#filtroMes {
    padding: 10px 12px;
    font-size: 0.95rem;
}

.decendial-periodos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.periodo-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 18px;
    border: 1px solid #eaeaea;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.periodo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.periodo-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.periodo-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1a2a6c;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.periodo-title {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.periodo-dias {
    color: #777;
    font-size: 0.85rem;
}

.periodo-valor {
    font-size: 1.6rem;
    font-weight: bold;
    text-align: center;
    margin: 8px 0;
    transition: color 0.3s;
}

.periodo-positivo {
    color: #28a745;
}

.periodo-negativo {
    color: #dc3545;
}

.periodo-info {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 0.85rem;
    color: #666;
}

/* Gráfico */
.grafico-container {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-top: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.grafico-titulo {
    text-align: center;
    color: #1a2a6c;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Meses Histórico */
.meses-historico {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.mes-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 18px;
    border: 1px solid #eaeaea;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.mes-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.mes-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.mes-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1a2a6c;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.mes-title {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.mes-info {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.9rem;
    color: #555;
    flex-wrap: wrap;
    gap: 5px;
}

.mes-info span {
    flex: 1;
    min-width: 120px;
}

.mes-saldo {
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    margin: 10px 0;
    transition: color 0.3s;
}

.mes-positivo {
    color: #28a745;
}

.mes-negativo {
    color: #dc3545;
}

.mes-acoes {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-editar-mes, .btn-excluir-mes {
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.btn-editar-mes {
    background: #4a90e2;
    color: white;
    border: none;
}

.btn-editar-mes:hover {
    background: #3a7bc8;
}

.btn-excluir-mes {
    background: #dc3545;
    color: white;
    border: none;
}

.btn-excluir-mes:hover {
    background: #bd2130;
}

/* Footer */
footer {
    text-align: center;
    color: white;
    margin-top: 25px;
    font-size: 0.9rem;
    padding: 12px;
    border-radius: 10px;
    background: rgba(0,0,0,0.2);
}

/* Responsividade - Telas Pequenas */
@media (max-width: 768px) {
    body {
        padding: 10px;
        padding-bottom: 70px;
    }
    
    header h1 {
        font-size: 1.3rem;
    }
    
    .card {
        padding: 18px 15px;
    }
    
    .saldo-valor {
        font-size: 1.6rem;
        margin: 12px 0;
    }
    
    .mes-atual {
        position: static;
        margin: 0 auto 10px;
        width: fit-content;
    }
    
    .resumo {
        flex-direction: column;
    }
    
    .receita, .despesa {
        width: 100%;
    }
    
    .form-titulo {
        font-size: 1.1rem;
    }
    
    .radio-group {
        flex-direction: column;
    }
    
    .radio-option {
        width: 100%;
    }
    
    .historico-titulo {
        font-size: 1.1rem;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .btn-limpar {
        width: 100%;
        justify-content: center;
    }
    
    .lista-transacoes {
        max-height: 250px;
    }
    
    .transacao {
        padding: 10px;
    }
    
    .transacao-valor {
        min-width: auto;
        flex: 0 0 100px;
    }
    
    .analise-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .analise-valor {
        text-align: left;
        min-width: 100%;
    }
    
    .decendial-titulo {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filtro-mes {
        width: 100%;
        justify-content: space-between;
    }
    
    #filtroMes {
        flex: 1;
        max-width: 200px;
    }
    
    .decendial-periodos {
        grid-template-columns: 1fr;
    }
    
    .meses-historico {
        grid-template-columns: 1fr;
    }
}

/* Telas muito pequenas (smartphones) */
@media (max-width: 480px) {
    .container {
        padding: 0 5px;
    }
    
    header {
        padding: 12px 10px;
    }
    
    header h1 {
        font-size: 1.2rem;
    }
    
    header p {
        font-size: 0.8rem;
    }
    
    .saldo-valor {
        font-size: 1.4rem;
    }
    
    .resumo-valor {
        font-size: 1rem;
    }
    
    .form-titulo {
        font-size: 1rem;
    }
    
    input, select {
        padding: 10px 12px;
        font-size: 0.95rem;
    }
    
    .btn-adicionar {
        padding: 12px;
        font-size: 1rem;
    }
    
    .transacao-descricao {
        font-size: 0.95rem;
    }
    
    .transacao-valor {
        font-size: 1rem;
    }
    
    .btn-excluir {
        font-size: 1rem;
    }
    
    .periodo-valor {
        font-size: 1.4rem;
    }
    
    .mes-saldo {
        font-size: 1.2rem;
    }
}

