/* --- VARIABLES Y GLOBAL --- */
:root {
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --primary: #1a73e8;
    --income: #2ecc71;
    --expense: #e74c3c;
    --text-main: #1c1e21;
    --text-muted: #606770;
    --border-color: #e9ecef;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    color: var(--text-main);
}

.container {
    width: 95%;
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* --- NAVBAR --- */
.navbar {
    background: var(--card-bg);
    padding: 0.8rem 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.nav-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand { font-weight: 700; text-decoration: none; color: var(--primary); font-size: 1.2rem; }

.nav-actions { display: flex; align-items: center; gap: 15px; }

.user-tag { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); }

.logout-btn {
    background: #fdf2f2;
    border: 1px solid #f8d7da;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--expense);
    font-size: 0.85rem;
    transition: 0.2s;
}

.logout-btn:hover { background: var(--expense); color: white; }

/* --- CARDS Y DASHBOARD --- */
.dashboard-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin: 20px 0; }

.stat-box { padding: 15px; border-radius: 12px; color: white; text-align: center; }
.stat-box.income { background: var(--income); }
.stat-box.expense { background: var(--expense); }

/* --- HISTORIAL --- */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.history-info { display: flex; flex-direction: column; }
.history-desc { font-weight: 600; }
.history-date { font-size: 0.8rem; color: var(--text-muted); }

.amount-ingreso { color: var(--income); font-weight: 700; }
.amount-egreso { color: var(--expense); font-weight: 700; }

.delete-link {
    color: #ccc;
    text-decoration: none;
    font-size: 1.2rem;
    margin-left: 10px;
}
.delete-link:hover { color: var(--expense); }

/* --- FORMULARIOS --- */
.login-wrapper {
    display: flex; justify-content: center; align-items: center;
    min-height: calc(100vh - 150px);
}

.form-group { margin-bottom: 1.2rem; display: flex; flex-direction: column; }
.form-group label { font-weight: 600; margin-bottom: 8px; font-size: 0.9rem; }

.btn {
    display: block; 
    /* width: 100%;  */
    padding: 14px;
    background: var(--primary); color: white;
    text-align: center; border-radius: 10px;
    text-decoration: none; font-weight: 600; border: none; cursor: pointer;
}

/* --- RADIO TOGGLES (Botones de Ingreso/Egreso) --- */
.radio-buttons-container {
    display: flex;
    gap: 15px;
    margin-top: 5px;
}

.radio-buttons-container input[type="radio"] {
    display: none; /* Escondemos el circulito nativo */
}

.radio-label {
    flex: 1;
    padding: 12px;
    text-align: center;
    background: #f8f9fa;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    color: var(--text-muted);
}

/* Estado seleccionado: Ingreso */
input[value="ingreso"]:checked + .radio-label {
    background: var(--income);
    border-color: var(--income);
    color: white;
}

/* Estado seleccionado: Egreso */
input[value="egreso"]:checked + .radio-label {
    background: var(--expense);
    border-color: var(--expense);
    color: white;
}

input[type="number"], input[type="text"], input[type="password"] {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
}

input[type="date"] {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    background-color: white;
}

input[type="date"]:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

/* Grilla de gráficos en Dashboard */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
    margin-bottom: 30px;
}

.chart-box {
    background: #fff;
    padding: 10px;
}

/* Filtros de gráfico */
.filter-group {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .charts-grid { grid-template-columns: 1fr; }
}

.link-ver-todos {
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}