/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Página de Login */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #2d3748;
    margin-bottom: 8px;
    font-size: 24px;
}

.login-header p {
    color: #718096;
    font-size: 14px;
}

.login-footer p {
    text-align: center;
}

.login-footer a {
    text-decoration: none;      /* Remove o sublinhado */
    color: #5a67d8;             /* Cor padrão do link (azul, por exemplo) */
}

.login-footer a:hover {
    color: #0056b3;             /* Cor quando o mouse está em cima */
    font-weight: bold;
}

/* Formulários */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2d3748;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Botões */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5a67d8;
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #2d3748;
}

.btn-secondary:hover {
    background-color: #cbd5e0;
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

/* Navegação - CORRIGIDA */
.navbar {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 15px 0;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-brand h1,
.nav-brand h2 {
    color: #2d3748;
    margin: 0;
    font-size: 24px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 25px;
    flex-wrap: wrap;
}

.nav-links a {
    color: #718096;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s;
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    color: #667eea;
    background-color: #f7fafc;
}

/* Container da navegação com flexbox */
.navbar .container,
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

/* Botão de tema */
#btnTema {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#btnTema:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-brand h2 {
    color: #2d3748;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-link {
    color: #718096;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-link:hover,
.nav-link.active {
    color: #667eea;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-user span {
    color: #2d3748;
    font-weight: 500;
}

/* Main Content */
.main-content {
    padding: 30px 0;
    min-height: calc(100vh - 70px);
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-left: 4px solid #e2e8f0;
}

.card-receitas {
    border-left-color: #48bb78;
}

.card-despesas {
    border-left-color: #f56565;
}

.card-saldo.card-positivo {
    border-left-color: #48bb78;
}

.card-saldo.card-negativo {
    border-left-color: #f56565;
}

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

.card-header h3 {
    color: #2d3748;
    font-size: 16px;
    font-weight: 600;
}

.card-icon {
    font-size: 24px;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 5px;
}

.card-subtitle {
    color: #718096;
    font-size: 14px;
}

/* Alertas */
.alertas-section {
    margin-bottom: 30px;
}

.alertas-section h3 {
    margin-bottom: 15px;
    color: #2d3748;
}

.alertas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.alerta-card {
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid;
}

.alerta-aviso {
    background-color: #fffbeb;
    border-left-color: #f59e0b;
    color: #92400e;
}

.alerta-critico {
    background-color: #fef2f2;
    border-left-color: #ef4444;
    color: #991b1b;
}

.alerta-valores {
    font-size: 14px;
    margin-top: 5px;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.chart-container h3 {
    margin-bottom: 20px;
    color: #2d3748;
    font-size: 18px;
}

/* Lançamentos */
.lancamentos-list {
    max-height: 400px;
    overflow-y: auto;
}

.lancamento-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #e2e8f0;
}

.lancamento-item:last-child {
    border-bottom: none;
}

.lancamento-info strong {
    display: block;
    color: #2d3748;
    margin-bottom: 3px;
}

.lancamento-info small {
    color: #718096;
    font-size: 12px;
}

.lancamento-valor {
    font-weight: 600;
    font-size: 16px;
}

.lancamento-valor.receita {
    color: #48bb78;
}

.lancamento-valor.despesa {
    color: #f56565;
}

.empty-state {
    text-align: center;
    color: #718096;
    padding: 40px 20px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    color: #2d3748;
    margin: 0;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #718096;
}

.close:hover {
    color: #2d3748;
}

.modal form {
    padding: 25px;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Páginas específicas */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.page-header h1 {
    color: #2d3748;
    font-size: 28px;
    margin: 0;
}

/* Categorias */
.categorias-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.categorias-section h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 18px;
}

.categorias-list {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.categoria-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #e2e8f0;
}

.categoria-item:last-child {
    border-bottom: none;
}

.categoria-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.categoria-cor {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.categoria-nome {
    font-weight: 500;
    color: #2d3748;
}

.categoria-limite {
    color: #718096;
    font-size: 12px;
    margin-left: 10px;
}

.categoria-actions {
    display: flex;
    gap: 8px;
}

.btn-danger {
    background-color: #f56565;
    color: white;
}

.btn-danger:hover {
    background-color: #e53e3e;
}

/* Relatórios */
.filtros-section {
    margin-bottom: 30px;
}

.filtros-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.filtros-card h3 {
    color: #2d3748;
    margin-bottom: 20px;
}

.filtros-form .form-row {
    margin-bottom: 15px;
}

.relatorio-section {
    animation: fade-in 0.3s ease-out;
}

.resumo-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.resumo-cards .card {
    text-align: center;
}

.resumo-cards .card h4 {
    color: #718096;
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 500;
}

.tabela-container {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-top: 30px;
}

.tabela-container h3 {
    color: #2d3748;
    margin-bottom: 20px;
}

.tabela-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
}

table td {
    color: #4a5568;
    font-size: 14px;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.badge.receita {
    background-color: #c6f6d5;
    color: #22543d;
}

.badge.despesa {
    background-color: #fed7d7;
    color: #742a2a;
}

.positivo {
    color: #48bb78 !important;
}

.negativo {
    color: #f56565 !important;
}

/* Tema escuro */
.tema-escuro {
    background-color: #1a202c;
    color: #e2e8f0;
}

.tema-escuro .navbar {
    background-color: #2d3748;
}

.tema-escuro .nav-links a {
    color: #a0aec0;
}

.tema-escuro .nav-links a:hover,
.tema-escuro .nav-links a.active {
    color: #667eea;
    background-color: #4a5568;
}

.tema-escuro #btnTema {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

.tema-escuro #btnTema:hover {
    background: #718096;
}

.tema-escuro .card,
.tema-escuro .chart-container,
.tema-escuro .categorias-list,
.tema-escuro .filtros-card,
.tema-escuro .tabela-container {
    background-color: #2d3748;
    color: #e2e8f0;
}

.tema-escuro .modal-content {
    background-color: #2d3748;
    color: #e2e8f0;
}

.tema-escuro input,
.tema-escuro select,
.tema-escuro textarea {
    background-color: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

.tema-escuro table th {
    background-color: #4a5568;
    color: #e2e8f0;
}

/* Animações */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsividade - MELHORADA */
@media (max-width: 768px) {
    .navbar {
        padding: 10px 0;
    }
    
    .navbar .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-links {
        justify-content: center;
        gap: 15px;
    }
    
    .nav-links a {
        padding: 6px 10px;
        font-size: 14px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .login-card {
        padding: 30px 20px;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .main-content {
        padding: 20px 0;
    }

    .card {
        padding: 20px;
    }

    .chart-container {
        padding: 20px;
    }

    .alertas-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-links {
        gap: 10px;
    }
    
    .nav-links a {
        padding: 4px 8px;
        font-size: 13px;
    }
}

/* Import admin styles */
@import url('admin.css');
