/* Estilos Generales */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.afp-dashboard-container {
    background-color: #f0f2f5;
    padding: 1em;
    max-width: 700px;
    margin: 2em auto;
}

/* --- Tarjetas del Dashboard --- */
.afp-card {
    background-color: #fff;
    padding: 1.5em;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 1em;
}

.afp-card h2 {
    margin-top: 0;
    font-size: 1.1em;
    color: #666;
}

.afp-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.afp-card li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1em 0;
    border-bottom: 1px solid #f0f2f5;
}
.afp-card li:last-child { border-bottom: none; }
.afp-card .item-name { font-weight: 500; }
.afp-card .item-balance { font-weight: bold; }

/* Tarjetas Clickables */
.afp-card-clickable {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.afp-card-clickable:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.afp-card-action {
    font-size: 0.9em;
    font-weight: bold;
    color: #0073aa;
}

/* Grid para el Resumen */
.afp-summary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1em;
}

/* Tarjetas específicas */
.afp-available-balance-card, .afp-net-worth-card {
    text-align: center;
    color: white;
    padding: 2em 1.5em;
}
.afp-available-balance-card {
    background: linear-gradient(45deg, #2ecc71, #28b485);
}
.afp-net-worth-card {
    background: linear-gradient(45deg, #3498db, #2980b9);
}
.afp-available-balance-card h3, .afp-net-worth-card h3 {
    margin: 0;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}
.afp-available-balance-card .amount, .afp-net-worth-card .amount {
    font-size: 2.5em;
    font-weight: 700;
    margin: 0.2em 0;
}

/* Flujo de Caja y Totales */
.afp-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #eee;
    margin-bottom: 1em;
}
.amount-display {
    font-size: 1.8em;
    font-weight: 600;
    text-align: center;
    margin-top: 0.5em;
    color: #333;
}

/* Botones dentro de las tarjetas */
.afp-card-buttons {
    display: flex;
    justify-content: center;
    margin-top: 1em;
}

.afp-card-buttons .button {
    padding: 0.8em 1.2em;
    font-size: 0.9em;
    border-radius: 8px;
}

/* Formulario de Gasto Diario */
.afp-add-transaction {
    margin-top: 1em;
}
.afp-add-transaction-form {
    display: grid;
    gap: 0.8em;
}
.afp-add-transaction-form input, .afp-add-transaction-form select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
}
.afp-add-transaction-form button {
    padding: 12px;
    border-radius: 8px;
    font-size: 1em;
}

/* --- Vista de Detalle --- */
.afp-detail-view-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5em;
    padding-bottom: 1em;
    border-bottom: 1px solid #eee;
}
.afp-detail-view-header button {
    align-self: flex-start;
    margin-bottom: 1em;
    padding: 0;
    color: #0073aa;
    border: none;
    background: none;
    font-size: 1em;
    font-weight: 500;
}
.afp-detail-view-header h2 { margin: 0; }

/* Formulario de Edición en Vista de Detalle */
.afp-edit-list .afp-form-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.5em;
    align-items: center;
    margin-bottom: 0.5em;
}
.afp-edit-list input { padding: 8px; }
.afp-edit-list .afp-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5em;
    gap: 1em; /* Added gap for multiple buttons */
}

.afp-list-display ul {
    list-style: none;
    padding: 0;
}

.afp-list-display li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.afp-list-display li:last-child {
    border-bottom: none;
}

.afp-list-display .item-details {
    display: flex;
    flex-direction: column;
}

.afp-list-display .item-name {
    font-weight: bold;
}

.afp-list-display .item-date {
    font-size: 0.8em;
    color: #777;
}

/* Filtros de fecha */
.afp-filter-controls {
    display: flex;
    gap: 1em;
    margin-bottom: 1.5em;
}

.afp-filter-controls input[type="date"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Botones de acción en el resumen (antiguo, ahora se usan afp-card-buttons) */
.afp-form-buttons {
    display: none; /* Ocultar los botones globales, ahora están dentro de las tarjetas */
}

/* --- Media Queries para Escritorio --- */
@media (min-width: 600px) {
    .afp-dashboard-container { padding: 2em; }
    .afp-summary-grid {
        grid-template-columns: 1fr 1fr;
    }
    .afp-add-transaction-form {
        grid-template-columns: 1fr 1fr auto auto auto;
        gap: 1em;
        align-items: center;
    }
}
