/* Reset and Base Styles */
* { box-sizing: border-box; }
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 0; 
    padding: 10px; 
    background-color: #f4f4f4; 
    line-height: 1.6;
}

.container { 
    max-width: 1000px; 
    margin: auto; 
    background: white; 
    padding: 15px; 
    border-radius: 8px; 
    box-shadow: 0 0 10px rgba(0,0,0,0.1); 
}

h1, h2 { color: #333; font-size: 1.5rem; }

/* Navigation */
.nav { 
    margin-bottom: 20px; 
    padding-bottom: 10px; 
    border-bottom: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.nav span { font-weight: bold; width: 100%; margin-bottom: 5px; }
.nav a { 
    text-decoration: none; 
    color: #007bff; 
    font-size: 0.9rem;
    padding: 5px 8px;
    background: #e9ecef;
    border-radius: 4px;
}
.nav a:hover { background: #dee2e6; }

/* Dashboard Cards */
.forecast { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px; 
    margin-bottom: 20px; 
}

.forecast-item { 
    padding: 15px; 
    border-radius: 5px; 
    color: white; 
    text-align: center;
}
.forecast-item h3 { margin-top: 0; font-size: 1rem; }
.forecast-item p { margin-bottom: 0; font-size: 1.2rem; font-weight: bold; }

.planned-income { background-color: #28a745; }
.planned-expense { background-color: #dc3545; }
.actual-income { background-color: #218838; }
.actual-expense { background-color: #c82333; }

/* Filters */
.filters {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-group {
    flex: 1 1 150px;
}

.btn-filter {
    width: 100%;
    padding: 10px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Tables - Responsive Strategy */
table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 20px; 
}

th, td { 
    padding: 10px; 
    border: 1px solid #ddd; 
    text-align: left; 
}

th { background-color: #f8f9fa; }

/* Forms */
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 5px; font-weight: bold; }
input, select { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #ccc; 
    border-radius: 4px; 
    font-size: 1rem;
}

button { 
    width: 100%;
    padding: 12px; 
    background-color: #007bff; 
    color: white; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
    font-size: 1rem;
    font-weight: bold;
}
button:hover { background-color: #0056b3; }

.btn-toggle { 
    display: block;
    padding: 8px;
    background-color: #007bff;
    color: white !important;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.8rem;
    text-align: center;
    margin-top: 5px;
}

.btn-edit { 
    display: block;
    padding: 8px;
    background-color: #ffc107;
    color: #212529 !important;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.8rem;
    text-align: center;
    margin-top: 5px;
}
.btn-edit:hover {
    background-color: #e0a800;
}

.card { padding: 15px; border: 1px solid #ddd; border-radius: 5px; margin-bottom: 15px; }
.error { color: red; margin-bottom: 15px; font-weight: bold; }

/* Responsive Adjustments */
@media (max-width: 600px) {
    .container { padding: 10px; border-radius: 0; }
    
    /* Table to Card layout */
    table, thead, tbody, th, td, tr { 
        display: block; 
    }
    
    thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    tr { border: 1px solid #ccc; margin-bottom: 10px; }
    
    td { 
        border: none;
        border-bottom: 1px solid #eee; 
        position: relative;
        padding-left: 45%; 
    }
    
    td:before { 
        position: absolute;
        top: 10px;
        left: 10px;
        width: 40%; 
        padding-right: 10px; 
        white-space: nowrap;
        font-weight: bold;
    }
    
    /* Specific labels for Dashboard Table */
    .dashboard-table td:nth-of-type(1):before { content: "Data"; }
    .dashboard-table td:nth-of-type(2):before { content: "Descrição"; }
    .dashboard-table td:nth-of-type(3):before { content: "Categoria"; }
    .dashboard-table td:nth-of-type(4):before { content: "Valor"; }
    .dashboard-table td:nth-of-type(5):before { content: "Tipo"; }
    .dashboard-table td:nth-of-type(6):before { content: "Status"; }
    .dashboard-table td:nth-of-type(7):before { content: "Ações"; }

    .category-lists {
        flex-direction: column;
    }
}

/* Print Styles */
@media print {
    .no-print, .nav, .filters, .btn-filter, button { 
        display: none !important; 
    }
    body { background: white; padding: 0; }
    .container { box-shadow: none; max-width: 100%; width: 100%; margin: 0; padding: 0; }
    .card { border: 1px solid #eee; break-inside: avoid; }
}
